diff --git a/.fantomasignore b/.fantomasignore index a4802164d9b..20249273f54 100644 --- a/.fantomasignore +++ b/.fantomasignore @@ -117,6 +117,9 @@ src/Compiler/Facilities/AsyncMemoize.fsi src/Compiler/Facilities/AsyncMemoize.fs src/Compiler/AbstractIL/il.fs +src/Compiler/Driver/GraphChecking/Graph.fsi +src/Compiler/Driver/GraphChecking/Graph.fs + # Fantomas limitations on implementation files (to investigate) src/Compiler/AbstractIL/ilwrite.fs diff --git a/Directory.Build.targets b/Directory.Build.targets index c43425cc369..c6603ea43be 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -10,16 +10,10 @@ $(ArtifactsDir)/bin/fsyacc/$(Configuration)/$(FSharpNetCoreProductDefaultTargetFramework)/$(NETCoreSdkPortableRuntimeIdentifier)/fsyacc.dll - - - - - - - + 9 0 - 100 + 200 0 @@ -43,7 +43,7 @@ $(FSCorePackageVersionValue)-$(PreReleaseVersionLabel).* - 12 + 13 9 $(FSBuildVersion) $(FSRevisionVersion) @@ -53,7 +53,7 @@ 17 - 12 + 13 $(VSMajorVersion).0 $(VSMajorVersion).$(VSMinorVersion).0 $(VSAssemblyVersionPrefix).0 @@ -186,15 +186,12 @@ 5.0.0-preview.7.20364.11 17.4.0 13.0.3 - 3.13.2 - 4.1.0 - 3.11.0 - 2.1.80 1.0.0-beta2-dev3 2.18.48 2.10.69 2.9.0 2.8.2 + 3.1.17 5.10.3 2.2.0 diff --git a/eng/build.sh b/eng/build.sh index 8ac4d0a9fa1..c4abb23f6f1 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -214,7 +214,7 @@ function Test() { projectname=$(basename -- "$testproject") projectname="${projectname%.*}" testlogpath="$artifacts_dir/TestResults/$configuration/${projectname}_$targetframework.xml" - args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"nunit;LogFilePath=$testlogpath\" --blame --results-directory $artifacts_dir/TestResults/$configuration -p:vstestusemsbuildoutput=false" + args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"xunit;LogFilePath=$testlogpath\" --blame --results-directory $artifacts_dir/TestResults/$configuration -p:vstestusemsbuildoutput=false" "$DOTNET_INSTALL_DIR/dotnet" $args || exit $? } diff --git a/src/Compiler/AbstractIL/il.fs b/src/Compiler/AbstractIL/il.fs index 2aadea335e1..82faea51c5e 100644 --- a/src/Compiler/AbstractIL/il.fs +++ b/src/Compiler/AbstractIL/il.fs @@ -1909,6 +1909,23 @@ let inline conditionalAdd condition flagToAdd source = let NoMetadataIdx = -1 +type InterfaceImpl = + { Idx: int; Type: ILType; mutable CustomAttrsStored: ILAttributesStored } + + member x.CustomAttrs = + match x.CustomAttrsStored with + | ILAttributesStored.Reader f -> + let res = ILAttributes(f x.Idx) + x.CustomAttrsStored <- ILAttributesStored.Given res + res + | ILAttributesStored.Given attrs -> attrs + + static member Create(ilType: ILType, customAttrsStored: ILAttributesStored) = + { Idx = NoMetadataIdx; Type = ilType; CustomAttrsStored = customAttrsStored } + + static member Create(ilType: ILType) = InterfaceImpl.Create(ilType, emptyILCustomAttrsStored) + + [] type ILMethodDef ( @@ -2635,8 +2652,7 @@ type ILTypeDef name: string, attributes: TypeAttributes, layout: ILTypeDefLayout, - implements: ILTypes, - implementsCustomAttrs: (ILAttributesStored * int) list option, + implements: InterruptibleLazy, genericParams: ILGenericParameterDefs, extends: ILType option, methods: ILMethodDefs, @@ -2659,7 +2675,6 @@ type ILTypeDef attributes, layout, implements, - implementsCustomAttrs, genericParams, extends, methods, @@ -2676,7 +2691,6 @@ type ILTypeDef attributes, layout, implements, - implementsCustomAttrs, genericParams, extends, methods, @@ -2703,8 +2717,6 @@ type ILTypeDef member _.Implements = implements - member _.ImplementsCustomAttrs = implementsCustomAttrs - member _.Extends = extends member _.Methods = methods @@ -2744,8 +2756,7 @@ type ILTypeDef ?properties, ?newAdditionalFlags, ?customAttrs, - ?securityDecls, - ?implementsCustomAttrs + ?securityDecls ) = ILTypeDef( name = defaultArg name x.Name, @@ -2754,7 +2765,6 @@ type ILTypeDef genericParams = defaultArg genericParams x.GenericParams, nestedTypes = defaultArg nestedTypes x.NestedTypes, implements = defaultArg implements x.Implements, - implementsCustomAttrs = defaultArg implementsCustomAttrs x.ImplementsCustomAttrs, extends = defaultArg extends x.Extends, methods = defaultArg methods x.Methods, securityDecls = defaultArg securityDecls x.SecurityDecls, @@ -2903,35 +2913,17 @@ and [] ILPreTypeDef = /// This is a memory-critical class. Very many of these objects get allocated and held to represent the contents of .NET assemblies. and [] ILPreTypeDefImpl(nameSpace: string list, name: string, metadataIndex: int32, storage: ILTypeDefStored) = - let mutable store: ILTypeDef = Unchecked.defaultof<_> - let mutable storage = storage + let stored = + lazy + match storage with + | ILTypeDefStored.Given td -> td + | ILTypeDefStored.Computed f -> f () + | ILTypeDefStored.Reader f -> f metadataIndex interface ILPreTypeDef with member _.Namespace = nameSpace member _.Name = name - - member x.GetTypeDef() = - match box store with - | null -> - let syncObj = storage - Monitor.Enter(syncObj) - - try - match box store with - | null -> - let value = - match storage with - | ILTypeDefStored.Given td -> td - | ILTypeDefStored.Computed f -> f () - | ILTypeDefStored.Reader f -> f metadataIndex - - store <- value - storage <- Unchecked.defaultof<_> - value - | _ -> store - finally - Monitor.Exit(syncObj) - | _ -> store + member x.GetTypeDef() = stored.Value and ILTypeDefStored = | Given of ILTypeDef @@ -3333,6 +3325,8 @@ let mkILTypeDefs l = mkILTypeDefsFromArray (Array.ofList l) let mkILTypeDefsComputed f = ILTypeDefs f let emptyILTypeDefs = mkILTypeDefsFromArray [||] +let emptyILInterfaceImpls = InterruptibleLazy.FromValue([]) + // -------------------------------------------------------------------- // Operations on method tables. // -------------------------------------------------------------------- @@ -4240,7 +4234,7 @@ let mkILSimpleStorageCtor (baseTySpec, ty, extraParams, flds, access, tag, impor let mkILStorageCtor (preblock, ty, flds, access, tag, imports) = mkILStorageCtorWithParamNames (preblock, ty, [], addParamNames flds, access, tag, imports) -let mkILGenericClass (nm, access, genparams, extends, impl, methods, fields, nestedTypes, props, events, attrs, init) = +let mkILGenericClass (nm, access, genparams, extends, impls, methods, fields, nestedTypes, props, events, attrs, init) = let attributes = convertTypeAccessFlags access ||| TypeAttributes.AutoLayout @@ -4254,8 +4248,7 @@ let mkILGenericClass (nm, access, genparams, extends, impl, methods, fields, nes name = nm, attributes = attributes, genericParams = genparams, - implements = impl, - implementsCustomAttrs = None, + implements = InterruptibleLazy.FromValue(impls), layout = ILTypeDefLayout.Auto, extends = Some extends, methods = methods, @@ -4279,8 +4272,7 @@ let mkRawDataValueTypeDef (iltyp_ValueType: ILType) (nm, size, pack) = ||| TypeAttributes.ExplicitLayout ||| TypeAttributes.BeforeFieldInit ||| TypeAttributes.AnsiClass), - implements = [], - implementsCustomAttrs = None, + implements = emptyILInterfaceImpls, extends = Some iltyp_ValueType, layout = ILTypeDefLayout.Explicit { Size = Some size; Pack = Some pack }, methods = emptyILMethods, @@ -5586,7 +5578,7 @@ and refsOfILMethodImpl s m = and refsOfILTypeDef s (td: ILTypeDef) = refsOfILTypeDefs s td.NestedTypes refsOfILGenericParams s td.GenericParams - refsOfILTypes s td.Implements + refsOfILTypes s (td.Implements.Value |> List.map _.Type) Option.iter (refsOfILType s) td.Extends refsOfILMethodDefs s td.Methods refsOfILFieldDefs s (td.Fields.AsList()) diff --git a/src/Compiler/AbstractIL/il.fsi b/src/Compiler/AbstractIL/il.fsi index e3ec95a40d7..1487830e8f0 100644 --- a/src/Compiler/AbstractIL/il.fsi +++ b/src/Compiler/AbstractIL/il.fsi @@ -327,6 +327,15 @@ type ILCallingSignature = ArgTypes: ILTypes ReturnType: ILType } +type InterfaceImpl = + { Idx: int + Type: ILType + mutable CustomAttrsStored: ILAttributesStored } + + member CustomAttrs: ILAttributes + static member Create: ilType: ILType * customAttrsStored: ILAttributesStored -> InterfaceImpl + static member Create: ilType: ILType -> InterfaceImpl + /// Actual generic parameters are always types. type ILGenericArgs = ILType list @@ -1518,8 +1527,7 @@ type ILTypeDef = name: string * attributes: TypeAttributes * layout: ILTypeDefLayout * - implements: ILTypes * - implementsCustomAttrs: (ILAttributesStored * int) list option * + implements: InterruptibleLazy * genericParams: ILGenericParameterDefs * extends: ILType option * methods: ILMethodDefs * @@ -1539,8 +1547,7 @@ type ILTypeDef = name: string * attributes: TypeAttributes * layout: ILTypeDefLayout * - implements: ILTypes * - implementsCustomAttrs: (ILAttributesStored * int) list option * + implements: InterruptibleLazy * genericParams: ILGenericParameterDefs * extends: ILType option * methods: ILMethodDefs * @@ -1559,8 +1566,7 @@ type ILTypeDef = member GenericParams: ILGenericParameterDefs member Layout: ILTypeDefLayout member NestedTypes: ILTypeDefs - member Implements: ILTypes - member ImplementsCustomAttrs: (ILAttributesStored * int) list option + member Implements: InterruptibleLazy member Extends: ILType option member Methods: ILMethodDefs member SecurityDecls: ILSecurityDecls @@ -1609,7 +1615,7 @@ type ILTypeDef = ?name: string * ?attributes: TypeAttributes * ?layout: ILTypeDefLayout * - ?implements: ILTypes * + ?implements: InterruptibleLazy * ?genericParams: ILGenericParameterDefs * ?extends: ILType option * ?methods: ILMethodDefs * @@ -1620,8 +1626,7 @@ type ILTypeDef = ?properties: ILPropertyDefs * ?newAdditionalFlags: ILTypeDefAdditionalFlags * ?customAttrs: ILAttributesStored * - ?securityDecls: ILSecurityDecls * - ?implementsCustomAttrs: (ILAttributesStored * int) list option -> + ?securityDecls: ILSecurityDecls -> ILTypeDef /// Represents a prefix of information for ILTypeDef. @@ -2161,7 +2166,7 @@ val internal mkILGenericClass: ILTypeDefAccess * ILGenericParameterDefs * ILType * - ILType list * + InterfaceImpl list * ILMethodDefs * ILFieldDefs * ILTypeDefs * @@ -2245,6 +2250,8 @@ val internal mkCtorMethSpecForDelegate: ILGlobals -> ILType * bool -> ILMethodSp /// The toplevel "class" for a module or assembly. val internal mkILTypeForGlobalFunctions: ILScopeRef -> ILType +val emptyILInterfaceImpls: InterruptibleLazy + /// Making tables of custom attributes, etc. val mkILCustomAttrs: ILAttribute list -> ILAttributes val mkILCustomAttrsFromArray: ILAttribute[] -> ILAttributes diff --git a/src/Compiler/AbstractIL/ilmorph.fs b/src/Compiler/AbstractIL/ilmorph.fs index 334ed93d212..9f2f3d0582f 100644 --- a/src/Compiler/AbstractIL/ilmorph.fs +++ b/src/Compiler/AbstractIL/ilmorph.fs @@ -368,8 +368,13 @@ let rec tdef_ty2ty_ilmbody2ilmbody_mdefs2mdefs isInKnownSet enc fs (tdef: ILType let mdefsR = fMethodDefs (enc, tdef) tdef.Methods let fdefsR = fdefs_ty2ty fTyInCtxtR tdef.Fields + let implements = + tdef.Implements.Value + |> List.map (fun x -> { x with Type = fTyInCtxtR x.Type }) + |> InterruptibleLazy.FromValue + tdef.With( - implements = List.map fTyInCtxtR tdef.Implements, + implements = implements, genericParams = gparams_ty2ty fTyInCtxtR tdef.GenericParams, extends = Option.map fTyInCtxtR tdef.Extends, methods = mdefsR, diff --git a/src/Compiler/AbstractIL/ilpars.fsy b/src/Compiler/AbstractIL/ilpars.fsy index b8380364f6b..ca06f6570be 100644 --- a/src/Compiler/AbstractIL/ilpars.fsy +++ b/src/Compiler/AbstractIL/ilpars.fsy @@ -2,7 +2,6 @@ %{ -#nowarn "64" // turn off warnings that type variables used in production annotations are instantiated to concrete type #nowarn "1182" // the generated code often has unused variable "parseState" #nowarn "3261" // the generated code would need to properly annotate nulls, e.g. changing System.Object to `obj|null` diff --git a/src/Compiler/AbstractIL/ilprint.fs b/src/Compiler/AbstractIL/ilprint.fs index 9d278dbe317..6ed8aec9286 100644 --- a/src/Compiler/AbstractIL/ilprint.fs +++ b/src/Compiler/AbstractIL/ilprint.fs @@ -752,8 +752,9 @@ let goutput_superclass env os = output_string os "extends " (goutput_typ_with_shortened_class_syntax env) os typ -let goutput_implements env os (imp: ILTypes) = +let goutput_implements env os (imp: InterfaceImpl list) = if not (List.isEmpty imp) then + let imp = imp |> Seq.map _.Type output_string os "implements " output_seq ", " (goutput_typ_with_shortened_class_syntax env) os imp @@ -836,7 +837,7 @@ let rec goutput_tdef enc env contents os (cd: ILTypeDef) = output_string os "\n\t" goutput_superclass env os cd.Extends output_string os "\n\t" - goutput_implements env os cd.Implements + goutput_implements env os cd.Implements.Value output_string os "\n{\n " if contents then diff --git a/src/Compiler/AbstractIL/ilread.fs b/src/Compiler/AbstractIL/ilread.fs index 02696c53f0e..5bedfe05752 100644 --- a/src/Compiler/AbstractIL/ilread.fs +++ b/src/Compiler/AbstractIL/ilread.fs @@ -2144,11 +2144,6 @@ and typeDefReader ctxtH : ILTypeDefStored = else let mutable attrIdx = attrsStartIdx - let looksLikeSystemAssembly = - ctxt.fileName.EndsWith("System.Runtime.dll") - || ctxt.fileName.EndsWith("mscorlib.dll") - || ctxt.fileName.EndsWith("netstandard.dll") - while attrIdx <= attrsEndIdx && not containsExtensionMethods do let mutable addr = ctxt.rowAddr TableNames.CustomAttribute attrIdx // skip parentIndex to read typeIndex @@ -2159,12 +2154,9 @@ and typeDefReader ctxtH : ILTypeDefStored = let name = if attrTypeIndex.tag = cat_MethodDef then // the ExtensionAttribute constructor can be cat_MethodDef if the metadata is read from the assembly - // in which the corresponding attribute is defined -- from the system library - if not looksLikeSystemAssembly then - "" - else - let _, (_, nameIdx, namespaceIdx, _, _, _) = seekMethodDefParent ctxt attrCtorIdx - readBlobHeapAsTypeName ctxt (nameIdx, namespaceIdx) + // in which the corresponding attribute is defined + let _, (_, nameIdx, namespaceIdx, _, _, _) = seekMethodDefParent ctxt attrCtorIdx + readBlobHeapAsTypeName ctxt (nameIdx, namespaceIdx) else let mutable addr = ctxt.rowAddr TableNames.MemberRef attrCtorIdx let mrpTag = seekReadMemberRefParentIdx ctxt mdv &addr @@ -2192,8 +2184,7 @@ and typeDefReader ctxtH : ILTypeDefStored = let fdefs = seekReadFields ctxt (numTypars, hasLayout) fieldsIdx endFieldsIdx let nested = seekReadNestedTypeDefs ctxt idx - let impls, intImplsAttrs = - seekReadInterfaceImpls ctxt mdv numTypars idx |> List.unzip + let impls = seekReadInterfaceImpls ctxt mdv numTypars idx let mimpls = seekReadMethodImpls ctxt numTypars idx let props = seekReadProperties ctxt numTypars idx @@ -2206,7 +2197,6 @@ and typeDefReader ctxtH : ILTypeDefStored = layout = layout, nestedTypes = nested, implements = impls, - implementsCustomAttrs = Some intImplsAttrs, extends = super, methods = mdefs, securityDeclsStored = ctxt.securityDeclsReader_TypeDef, @@ -2240,19 +2230,26 @@ and seekReadNestedTypeDefs (ctxt: ILMetadataReader) tidx = |]) and seekReadInterfaceImpls (ctxt: ILMetadataReader) mdv numTypars tidx = - seekReadIndexedRows ( - ctxt.getNumRows TableNames.InterfaceImpl, - id, - id, - (fun idx -> - let mutable addr = ctxt.rowAddr TableNames.InterfaceImpl idx - let _tidx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr - simpleIndexCompare tidx _tidx), - isSorted ctxt TableNames.InterfaceImpl, - (fun idx -> - let intfIdx = seekReadInterfaceIdx ctxt mdv idx - seekReadTypeDefOrRef ctxt numTypars AsObject [] intfIdx, (ctxt.customAttrsReader_InterfaceImpl, idx)) - ) + InterruptibleLazy(fun () -> + seekReadIndexedRows ( + ctxt.getNumRows TableNames.InterfaceImpl, + id, + id, + (fun idx -> + let mutable addr = ctxt.rowAddr TableNames.InterfaceImpl idx + let _tidx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr + simpleIndexCompare tidx _tidx), + isSorted ctxt TableNames.InterfaceImpl, + (fun idx -> + let intfIdx = seekReadInterfaceIdx ctxt mdv idx + let ilType = seekReadTypeDefOrRef ctxt numTypars AsObject [] intfIdx + + { + Idx = idx + Type = ilType + CustomAttrsStored = ctxt.customAttrsReader_InterfaceImpl + }) + )) and seekReadGenericParams ctxt numTypars (a, b) : ILGenericParameterDefs = ctxt.seekReadGenericParams (GenericParamsIdx(numTypars, a, b)) diff --git a/src/Compiler/AbstractIL/ilreflect.fs b/src/Compiler/AbstractIL/ilreflect.fs index 9b0b7eddb9e..5a52ddc017a 100644 --- a/src/Compiler/AbstractIL/ilreflect.fs +++ b/src/Compiler/AbstractIL/ilreflect.fs @@ -277,7 +277,7 @@ type TypeBuilder with match m with | null -> raise (MissingMethodException nm) - | m -> m.Invoke(null, args) + | m -> m.Invoke(null, (args: obj array)) member typB.SetCustomAttributeAndLog(cinfo, bytes) = if logRefEmitCalls then @@ -2178,7 +2178,8 @@ let rec buildTypeDefPass2 cenv nesting emEnv (tdef: ILTypeDef) = let typB = envGetTypB emEnv tref let emEnv = envPushTyvars emEnv (getGenericArgumentsOfType typB) // add interface impls - tdef.Implements + tdef.Implements.Value + |> List.map _.Type |> convTypes cenv emEnv |> List.iter (fun implT -> typB.AddInterfaceImplementationAndLog implT) // add methods, properties @@ -2339,7 +2340,8 @@ let createTypeRef (visited: Dictionary<_, _>, created: Dictionary<_, _>) emEnv t if verbose2 then dprintf "buildTypeDefPass4: Creating Interface Chain of %s\n" tdef.Name - tdef.Implements |> List.iter (traverseType CollectTypes.All) + tdef.Implements.Value + |> List.iter (fun x -> traverseType CollectTypes.All x.Type) if verbose2 then dprintf "buildTypeDefPass4: Do value types in fields of %s\n" tdef.Name diff --git a/src/Compiler/AbstractIL/ilwrite.fs b/src/Compiler/AbstractIL/ilwrite.fs index 832aa1c2810..3cbdd3c752b 100644 --- a/src/Compiler/AbstractIL/ilwrite.fs +++ b/src/Compiler/AbstractIL/ilwrite.fs @@ -1323,7 +1323,7 @@ and GenTypeDefPass2 pidx enc cenv (tdef: ILTypeDef) = // Now generate or assign index numbers for tables referenced by the maps. // Don't yet generate contents of these tables - leave that to pass3, as // code may need to embed these entries. - cenv.implementsIdxs[tidx] <- tdef.Implements |> List.map (GenImplementsPass2 cenv env tidx) + cenv.implementsIdxs[tidx] <- tdef.Implements.Value |> List.map (fun x -> GenImplementsPass2 cenv env tidx x.Type) tdef.Fields.AsList() |> List.iter (GenFieldDefPass2 tdef cenv tidx) tdef.Methods |> Seq.iter (GenMethodDefPass2 tdef cenv tidx) @@ -2875,12 +2875,9 @@ let rec GenTypeDefPass3 enc cenv (tdef: ILTypeDef) = let env = envForTypeDef tdef let tidx = GetIdxForTypeDef cenv (TdKey(enc, tdef.Name)) - match tdef.ImplementsCustomAttrs with - | None -> () - | Some attrList -> - attrList - |> List.zip cenv.implementsIdxs[tidx] - |> List.iter (fun (impIdx,(attrs,metadataIdx)) -> GenCustomAttrsPass3Or4 cenv (hca_InterfaceImpl,impIdx) (attrs.GetCustomAttrs metadataIdx)) + tdef.Implements.Value + |> List.zip cenv.implementsIdxs[tidx] + |> List.iter (fun (impIdx, impl) -> GenCustomAttrsPass3Or4 cenv (hca_InterfaceImpl,impIdx) impl.CustomAttrs) tdef.Properties.AsList() |> List.iter (GenPropertyPass3 cenv env) tdef.Events.AsList() |> List.iter (GenEventPass3 cenv env) diff --git a/src/Compiler/Checking/AttributeChecking.fs b/src/Compiler/Checking/AttributeChecking.fs index a91ace98d4a..8ef659ac20e 100644 --- a/src/Compiler/Checking/AttributeChecking.fs +++ b/src/Compiler/Checking/AttributeChecking.fs @@ -466,9 +466,9 @@ let MethInfoIsUnseen g (m: range) (ty: TType) minfo = let isUnseenByHidingAttribute () = #if !NO_TYPEPROVIDERS - not (isObjTy g ty) && + not (isObjTyAnyNullness g ty) && isAppTy g ty && - isObjTy g minfo.ApparentEnclosingType && + isObjTyAnyNullness g minfo.ApparentEnclosingType && let tcref = tcrefOfAppTy g ty match tcref.TypeReprInfo with | TProvidedTypeRepr info -> diff --git a/src/Compiler/Checking/ConstraintSolver.fs b/src/Compiler/Checking/ConstraintSolver.fs index f9ed37fe9ca..6c79c33be97 100644 --- a/src/Compiler/Checking/ConstraintSolver.fs +++ b/src/Compiler/Checking/ConstraintSolver.fs @@ -1225,164 +1225,165 @@ and SolveTypeEqualsType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTr TransactMemberConstraintSolution traitInfo trace traitSln | _ -> () - if ty1 === ty2 then CompleteD else + if ty1 === ty2 then + CompleteD + else + let canShortcut = not trace.HasTrace + let sty1 = stripTyEqnsA csenv.g canShortcut ty1 + let sty2 = stripTyEqnsA csenv.g canShortcut ty2 + + let csenv = + match ty1 with + | TType.TType_var(r,_) when r.typar_flags.IsSupportsNullFlex -> + { csenv with IsSupportsNullFlex = true} + | _ -> csenv + + match sty1, sty2 with + // type vars inside forall-types may be alpha-equivalent + | TType_var (tp1, nullness1), TType_var (tp2, nullness2) when typarEq tp1 tp2 || (match aenv.EquivTypars.TryFind tp1 with | Some tpTy1 when typeEquiv g tpTy1 ty2 -> true | _ -> false) -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullness2 + + | TType_var (tp1, nullness1), TType_var (tp2, nullness2) when PreferUnifyTypar tp1 tp2 -> + match nullness1.TryEvaluate(), nullness2.TryEvaluate() with + // Unifying 'T1? and 'T2? + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> + SolveTyparEqualsType csenv ndeep m2 trace sty1 (TType_var (tp2, g.knownWithoutNull)) + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithoutNull -> + let tpNew = NewCompGenTypar(TyparKind.Type, TyparRigidity.Flexible, TyparStaticReq.None, TyparDynamicReq.No, false) + trackErrors { + do! SolveTypeEqualsType csenv ndeep m2 trace cxsln sty2 (TType_var(tpNew, g.knownWithNull)) + do! SolveTypeEqualsType csenv ndeep m2 trace cxsln (TType_var(tpNew, g.knownWithoutNull)) sty1 + } + //// Unifying 'T1 % and 'T2 % + //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> + // SolveTyparEqualsType csenv ndeep m2 trace sty1 (TType_var (tp2, g.knownWithoutNull)) + | _ -> + trackErrors { + do! SolveTyparEqualsType csenv ndeep m2 trace sty1 ty2 + let nullnessAfterSolution1 = combineNullness (nullnessOfTy g sty1) nullness1 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 nullnessAfterSolution1 nullness2 + } - let canShortcut = not trace.HasTrace - let sty1 = stripTyEqnsA csenv.g canShortcut ty1 - let sty2 = stripTyEqnsA csenv.g canShortcut ty2 - let csenv = - match ty1 with - | TType.TType_var(r,_) when r.typar_flags.IsSupportsNullFlex -> - { csenv with IsSupportsNullFlex = true} - | _ -> csenv - - match sty1, sty2 with - // type vars inside forall-types may be alpha-equivalent - | TType_var (tp1, nullness1), TType_var (tp2, nullness2) when typarEq tp1 tp2 || (match aenv.EquivTypars.TryFind tp1 with | Some tpTy1 when typeEquiv g tpTy1 ty2 -> true | _ -> false) -> - SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullness2 - - | TType_var (tp1, nullness1), TType_var (tp2, nullness2) when PreferUnifyTypar tp1 tp2 -> - match nullness1.TryEvaluate(), nullness2.TryEvaluate() with - // Unifying 'T1? and 'T2? - | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> - SolveTyparEqualsType csenv ndeep m2 trace sty1 (TType_var (tp2, g.knownWithoutNull)) - | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithoutNull -> - let tpNew = NewCompGenTypar(TyparKind.Type, TyparRigidity.Flexible, TyparStaticReq.None, TyparDynamicReq.No, false) - trackErrors { - do! SolveTypeEqualsType csenv ndeep m2 trace cxsln sty2 (TType_var(tpNew, g.knownWithNull)) - do! SolveTypeEqualsType csenv ndeep m2 trace cxsln (TType_var(tpNew, g.knownWithoutNull)) sty1 - } - //// Unifying 'T1 % and 'T2 % - //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> - // SolveTyparEqualsType csenv ndeep m2 trace sty1 (TType_var (tp2, g.knownWithoutNull)) - | _ -> - trackErrors { - do! SolveTyparEqualsType csenv ndeep m2 trace sty1 ty2 - let nullnessAfterSolution1 = combineNullness (nullnessOfTy g sty1) nullness1 - do! SolveNullnessEquiv csenv m2 trace ty1 ty2 nullnessAfterSolution1 nullness2 - } + | TType_var (tp1, nullness1), TType_var (tp2, nullness2) when not csenv.MatchingOnly && PreferUnifyTypar tp2 tp1 -> + match nullness1.TryEvaluate(), nullness2.TryEvaluate() with + // Unifying 'T1? and 'T2? + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> + SolveTyparEqualsType csenv ndeep m2 trace sty2 (TType_var (tp1, g.knownWithoutNull)) + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithoutNull -> + let tpNew = NewCompGenTypar(TyparKind.Type, TyparRigidity.Flexible, TyparStaticReq.None, TyparDynamicReq.No, false) + trackErrors { + do! SolveTypeEqualsType csenv ndeep m2 trace cxsln sty2 (TType_var(tpNew, g.knownWithNull)) + do! SolveTypeEqualsType csenv ndeep m2 trace cxsln (TType_var(tpNew, g.knownWithoutNull)) sty1 + } + //// Unifying 'T1 % and 'T2 % + //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> + // SolveTyparEqualsType csenv ndeep m2 trace sty2 (TType_var (tp1, g.knownWithoutNull)) + | _ -> + // Unifying 'T1 ? and 'T2 % + // Unifying 'T1 % and 'T2 ? + trackErrors { + do! SolveTyparEqualsType csenv ndeep m2 trace sty2 ty1 + let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullnessAfterSolution2 + } + | TType_var (tp1, nullness1), _ when not (IsRigid csenv tp1) -> + match nullness1.TryEvaluate(), (nullnessOfTy g sty2).TryEvaluate() with + // Unifying 'T1? and 'T2? + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> + SolveTyparEqualsType csenv ndeep m2 trace sty1 (replaceNullnessOfTy g.knownWithoutNull sty2) + | ValueSome NullnessInfo.WithoutNull, ValueSome NullnessInfo.WithoutNull when + csenv.IsSupportsNullFlex && + isAppTy g sty2 && + tp1.Constraints |> List.exists (function TyparConstraint.SupportsNull _ -> true | _ -> false) -> + let tpNew = NewCompGenTypar(TyparKind.Type, TyparRigidity.Flexible, TyparStaticReq.None, TyparDynamicReq.No, false) + trackErrors { + do! SolveTypeEqualsType csenv ndeep m2 trace cxsln (TType_var(tpNew, g.knownWithoutNull)) sty2 + do! SolveTypeEqualsType csenv ndeep m2 trace cxsln ty1 (TType_var(tpNew, g.knownWithNull)) + } + // Unifying 'T1 % and 'T2 % + //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> + // SolveTyparEqualsType csenv ndeep m2 trace sty1 (replaceNullnessOfTy g.knownWithoutNull sty2) + | _ -> + trackErrors { + do! SolveTyparEqualsType csenv ndeep m2 trace sty1 ty2 + let nullnessAfterSolution1 = combineNullness (nullnessOfTy g sty1) nullness1 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 nullnessAfterSolution1 (nullnessOfTy g sty2) + } - | TType_var (tp1, nullness1), TType_var (tp2, nullness2) when not csenv.MatchingOnly && PreferUnifyTypar tp2 tp1 -> - match nullness1.TryEvaluate(), nullness2.TryEvaluate() with - // Unifying 'T1? and 'T2? - | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> - SolveTyparEqualsType csenv ndeep m2 trace sty2 (TType_var (tp1, g.knownWithoutNull)) - | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithoutNull -> - let tpNew = NewCompGenTypar(TyparKind.Type, TyparRigidity.Flexible, TyparStaticReq.None, TyparDynamicReq.No, false) - trackErrors { - do! SolveTypeEqualsType csenv ndeep m2 trace cxsln sty2 (TType_var(tpNew, g.knownWithNull)) - do! SolveTypeEqualsType csenv ndeep m2 trace cxsln (TType_var(tpNew, g.knownWithoutNull)) sty1 - } - //// Unifying 'T1 % and 'T2 % - //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> - // SolveTyparEqualsType csenv ndeep m2 trace sty2 (TType_var (tp1, g.knownWithoutNull)) - | _ -> - // Unifying 'T1 ? and 'T2 % - // Unifying 'T1 % and 'T2 ? + | _, TType_var (tp2, nullness2) when not csenv.MatchingOnly && not (IsRigid csenv tp2) -> + match (nullnessOfTy g sty1).TryEvaluate(), nullness2.TryEvaluate() with + // Unifying 'T1? and 'T2? + | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> + SolveTyparEqualsType csenv ndeep m2 trace sty2 (replaceNullnessOfTy g.knownWithoutNull sty1) + // Unifying 'T1 % and 'T2 % + //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> + // SolveTyparEqualsType csenv ndeep m2 trace sty2 (replaceNullnessOfTy g.knownWithoutNull sty1) + | _ -> + trackErrors { + do! SolveTyparEqualsType csenv ndeep m2 trace sty2 ty1 + let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) nullnessAfterSolution2 + } + + // Catch float<_>=float<1>, float32<_>=float32<1> and decimal<_>=decimal<1> + | (_, TType_app (tc2, [ms2], _)) when (tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty1 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms2])) -> trackErrors { - do! SolveTyparEqualsType csenv ndeep m2 trace sty2 ty1 - let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 - do! SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullnessAfterSolution2 + do! SolveTypeEqualsType csenv ndeep m2 trace None (TType_measure Measure.One) ms2 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) } - | TType_var (tp1, nullness1), _ when not (IsRigid csenv tp1) -> - match nullness1.TryEvaluate(), (nullnessOfTy g sty2).TryEvaluate() with - // Unifying 'T1? and 'T2? - | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> - SolveTyparEqualsType csenv ndeep m2 trace sty1 (replaceNullnessOfTy g.knownWithoutNull sty2) - | ValueSome NullnessInfo.WithoutNull, ValueSome NullnessInfo.WithoutNull when - csenv.IsSupportsNullFlex && - isAppTy g sty2 && - tp1.Constraints |> List.exists (function TyparConstraint.SupportsNull _ -> true | _ -> false) -> - let tpNew = NewCompGenTypar(TyparKind.Type, TyparRigidity.Flexible, TyparStaticReq.None, TyparDynamicReq.No, false) - trackErrors { - do! SolveTypeEqualsType csenv ndeep m2 trace cxsln (TType_var(tpNew, g.knownWithoutNull)) sty2 - do! SolveTypeEqualsType csenv ndeep m2 trace cxsln ty1 (TType_var(tpNew, g.knownWithNull)) - } - // Unifying 'T1 % and 'T2 % - //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> - // SolveTyparEqualsType csenv ndeep m2 trace sty1 (replaceNullnessOfTy g.knownWithoutNull sty2) - | _ -> + | (TType_app (tc1, [ms1], _), _) when (tc1.IsMeasureableReprTycon && typeEquiv csenv.g sty2 (reduceTyconRefMeasureableOrProvided csenv.g tc1 [ms1])) -> trackErrors { - do! SolveTyparEqualsType csenv ndeep m2 trace sty1 ty2 - let nullnessAfterSolution1 = combineNullness (nullnessOfTy g sty1) nullness1 - do! SolveNullnessEquiv csenv m2 trace ty1 ty2 nullnessAfterSolution1 (nullnessOfTy g sty2) + do! SolveTypeEqualsType csenv ndeep m2 trace None ms1 (TType_measure Measure.One) + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) } - | _, TType_var (tp2, nullness2) when not csenv.MatchingOnly && not (IsRigid csenv tp2) -> - match (nullnessOfTy g sty1).TryEvaluate(), nullness2.TryEvaluate() with - // Unifying 'T1? and 'T2? - | ValueSome NullnessInfo.WithNull, ValueSome NullnessInfo.WithNull -> - SolveTyparEqualsType csenv ndeep m2 trace sty2 (replaceNullnessOfTy g.knownWithoutNull sty1) - // Unifying 'T1 % and 'T2 % - //| ValueSome NullnessInfo.AmbivalentToNull, ValueSome NullnessInfo.AmbivalentToNull -> - // SolveTyparEqualsType csenv ndeep m2 trace sty2 (replaceNullnessOfTy g.knownWithoutNull sty1) - | _ -> + | TType_app (tc1, l1, _), TType_app (tc2, l2, _) when tyconRefEq g tc1 tc2 -> trackErrors { - do! SolveTyparEqualsType csenv ndeep m2 trace sty2 ty1 - let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 - do! SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) nullnessAfterSolution2 + do! SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) } + | TType_app _, TType_app _ -> + localAbortD - // Catch float<_>=float<1>, float32<_>=float32<1> and decimal<_>=decimal<1> - | (_, TType_app (tc2, [ms2], _)) when (tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty1 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms2])) -> - trackErrors { - do! SolveTypeEqualsType csenv ndeep m2 trace None (TType_measure Measure.One) ms2 - do! SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) - } - - | (TType_app (tc1, [ms1], _), _) when (tc1.IsMeasureableReprTycon && typeEquiv csenv.g sty2 (reduceTyconRefMeasureableOrProvided csenv.g tc1 [ms1])) -> - trackErrors { - do! SolveTypeEqualsType csenv ndeep m2 trace None ms1 (TType_measure Measure.One) - do! SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) - } - - | TType_app (tc1, l1, _), TType_app (tc2, l2, _) when tyconRefEq g tc1 tc2 -> - trackErrors { - do! SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 - do! SolveNullnessEquiv csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) - } - | TType_app _, TType_app _ -> - localAbortD - - | TType_tuple (tupInfo1, l1), TType_tuple (tupInfo2, l2) -> - if evalTupInfoIsStruct tupInfo1 <> evalTupInfoIsStruct tupInfo2 then - ErrorD (ConstraintSolverError(FSComp.SR.tcTupleStructMismatch(), csenv.m, m2)) - else - SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 + | TType_tuple (tupInfo1, l1), TType_tuple (tupInfo2, l2) -> + if evalTupInfoIsStruct tupInfo1 <> evalTupInfoIsStruct tupInfo2 then + ErrorD (ConstraintSolverError(FSComp.SR.tcTupleStructMismatch(), csenv.m, m2)) + else + SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 - | TType_anon (anonInfo1, l1),TType_anon (anonInfo2, l2) -> - trackErrors { - do! SolveAnonInfoEqualsAnonInfo csenv m2 anonInfo1 anonInfo2 - do! SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 - } + | TType_anon (anonInfo1, l1),TType_anon (anonInfo2, l2) -> + trackErrors { + do! SolveAnonInfoEqualsAnonInfo csenv m2 anonInfo1 anonInfo2 + do! SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 + } - | TType_fun (domainTy1, rangeTy1, nullness1), TType_fun (domainTy2, rangeTy2, nullness2) -> - trackErrors { - do! SolveFunTypeEqn csenv ndeep m2 trace None domainTy1 domainTy2 rangeTy1 rangeTy2 - do! SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullness2 - } + | TType_fun (domainTy1, rangeTy1, nullness1), TType_fun (domainTy2, rangeTy2, nullness2) -> + trackErrors { + do! SolveFunTypeEqn csenv ndeep m2 trace None domainTy1 domainTy2 rangeTy1 rangeTy2 + do! SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullness2 + } - | TType_measure ms1, TType_measure ms2 -> - UnifyMeasures csenv trace ms1 ms2 + | TType_measure ms1, TType_measure ms2 -> + UnifyMeasures csenv trace ms1 ms2 - | TType_forall(tps1, bodyTy1), TType_forall(tps2, bodyTy2) -> - if tps1.Length <> tps2.Length then - localAbortD - else - let aenv = aenv.BindEquivTypars tps1 tps2 - let csenv = {csenv with EquivEnv = aenv } - if not (typarsAEquiv g aenv tps1 tps2) then + | TType_forall(tps1, bodyTy1), TType_forall(tps2, bodyTy2) -> + if tps1.Length <> tps2.Length then localAbortD else - SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace bodyTy1 bodyTy2 + let aenv = aenv.BindEquivTypars tps1 tps2 + let csenv = {csenv with EquivEnv = aenv } + if not (typarsAEquiv g aenv tps1 tps2) then + localAbortD + else + SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace bodyTy1 bodyTy2 - | TType_ucase (uc1, l1), TType_ucase (uc2, l2) when g.unionCaseRefEq uc1 uc2 -> - SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 + | TType_ucase (uc1, l1), TType_ucase (uc2, l2) when g.unionCaseRefEq uc1 uc2 -> + SolveTypeEqualsTypeEqns csenv ndeep m2 trace None l1 l2 - | _ -> localAbortD + | _ -> localAbortD and SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace ty1 ty2 = SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace None ty1 ty2 @@ -1455,132 +1456,136 @@ and SolveFunTypeEqn csenv ndeep m2 trace cxsln domainTy1 domainTy2 rangeTy1 rang // // "ty2 casts to ty1" // "a value of type ty2 can be used where a value of type ty1 is expected" -and SolveTypeSubsumesType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) cxsln ty1 ty2 = - // 'a :> obj ---> +and SolveTypeSubsumesType (csenv: ConstraintSolverEnv) ndeep m2 (trace: OptionalTrace) cxsln ty1 ty2 = let ndeep = ndeep + 1 let g = csenv.g - if isObjTy g ty1 then CompleteD else let canShortcut = not trace.HasTrace - let sty1 = stripTyEqnsA csenv.g canShortcut ty1 - let sty2 = stripTyEqnsA csenv.g canShortcut ty2 - let amap = csenv.amap - let aenv = csenv.EquivEnv - let denv = csenv.DisplayEnv + // 'a :> objnull ---> + if isObjNullTy g ty1 then + CompleteD + elif isObjTyAnyNullness g ty1 && not csenv.MatchingOnly && not(isTyparTy g ty2) then + let nullness t = t |> stripTyEqnsA g canShortcut |> nullnessOfTy g + SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullness ty1) (nullness ty2) + else + let sty1 = stripTyEqnsA csenv.g canShortcut ty1 + let sty2 = stripTyEqnsA csenv.g canShortcut ty2 + let amap = csenv.amap + let aenv = csenv.EquivEnv + let denv = csenv.DisplayEnv - match sty1, sty2 with - | TType_var (tp1, nullness1) , _ -> - match aenv.EquivTypars.TryFind tp1 with - | Some tpTy1 -> SolveTypeSubsumesType csenv ndeep m2 trace cxsln tpTy1 ty2 - | _ -> - match sty2 with - | TType_var (r2, nullness2) when typarEq tp1 r2 -> - SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullness2 - | TType_var (r2, nullness2) when not csenv.MatchingOnly -> + match sty1, sty2 with + | TType_var (tp1, nullness1) , _ -> + match aenv.EquivTypars.TryFind tp1 with + | Some tpTy1 -> SolveTypeSubsumesType csenv ndeep m2 trace cxsln tpTy1 ty2 + | _ -> + match sty2 with + | TType_var (r2, nullness2) when typarEq tp1 r2 -> + SolveNullnessEquiv csenv m2 trace ty1 ty2 nullness1 nullness2 + | TType_var (r2, nullness2) when not csenv.MatchingOnly -> + trackErrors { + do! SolveTyparSubtypeOfType csenv ndeep m2 trace r2 ty1 + let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 + do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nullness1 nullnessAfterSolution2 + } + | _ -> SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ty1 ty2 + + | _, TType_var (r2, nullness2) when not csenv.MatchingOnly -> trackErrors { do! SolveTyparSubtypeOfType csenv ndeep m2 trace r2 ty1 let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 - do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nullness1 nullnessAfterSolution2 + do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) nullnessAfterSolution2 } - | _ -> SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ty1 ty2 - - | _, TType_var (r2, nullness2) when not csenv.MatchingOnly -> - trackErrors { - do! SolveTyparSubtypeOfType csenv ndeep m2 trace r2 ty1 - let nullnessAfterSolution2 = combineNullness (nullnessOfTy g sty2) nullness2 - do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) nullnessAfterSolution2 - } - - | TType_tuple (tupInfo1, l1), TType_tuple (tupInfo2, l2) -> - if evalTupInfoIsStruct tupInfo1 <> evalTupInfoIsStruct tupInfo2 then - ErrorD (ConstraintSolverError(FSComp.SR.tcTupleStructMismatch(), csenv.m, m2)) - else - SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 (* nb. can unify since no variance *) - | TType_fun (domainTy1, rangeTy1, nullness1), TType_fun (domainTy2, rangeTy2, nullness2) -> - // nb. can unify since no variance - trackErrors { - do! SolveFunTypeEqn csenv ndeep m2 trace cxsln domainTy1 domainTy2 rangeTy1 rangeTy2 - do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nullness1 nullness2 - } - | TType_anon (anonInfo1, l1), TType_anon (anonInfo2, l2) -> - trackErrors { - do! SolveAnonInfoEqualsAnonInfo csenv m2 anonInfo1 anonInfo2 - do! SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 - } - | TType_measure ms1, TType_measure ms2 -> - UnifyMeasures csenv trace ms1 ms2 - // Enforce the identities float=float<1>, float32=float32<1> and decimal=decimal<1> - | _, TType_app (tc2, [ms2], _) when tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty1 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms2]) -> - trackErrors { - do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ms2 (TType_measure Measure.One) - do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) - } - - | TType_app (tc1, [ms1], _), _ when tc1.IsMeasureableReprTycon && typeEquiv csenv.g sty2 (reduceTyconRefMeasureableOrProvided csenv.g tc1 [ms1]) -> - trackErrors { - do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ms1 (TType_measure Measure.One) - do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) - } + | TType_tuple (tupInfo1, l1), TType_tuple (tupInfo2, l2) -> + if evalTupInfoIsStruct tupInfo1 <> evalTupInfoIsStruct tupInfo2 then + ErrorD (ConstraintSolverError(FSComp.SR.tcTupleStructMismatch(), csenv.m, m2)) + else + SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 (* nb. can unify since no variance *) + | TType_fun (domainTy1, rangeTy1, nullness1), TType_fun (domainTy2, rangeTy2, nullness2) -> + // nb. can unify since no variance + trackErrors { + do! SolveFunTypeEqn csenv ndeep m2 trace cxsln domainTy1 domainTy2 rangeTy1 rangeTy2 + do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 nullness1 nullness2 + } + | TType_anon (anonInfo1, l1), TType_anon (anonInfo2, l2) -> + trackErrors { + do! SolveAnonInfoEqualsAnonInfo csenv m2 anonInfo1 anonInfo2 + do! SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 + } + | TType_measure ms1, TType_measure ms2 -> + UnifyMeasures csenv trace ms1 ms2 - // Special subsumption rule for byref tags - | TType_app (tc1, l1, _) , TType_app (tc2, l2, _) when tyconRefEq g tc1 tc2 && g.byref2_tcr.CanDeref && tyconRefEq g g.byref2_tcr tc1 -> - match l1, l2 with - | [ h1; tag1 ], [ h2; tag2 ] -> trackErrors { - do! SolveTypeEqualsType csenv ndeep m2 trace None h1 h2 - match stripTyEqnsA csenv.g canShortcut tag1, stripTyEqnsA csenv.g canShortcut tag2 with - | TType_app(tagc1, [], _), TType_app(tagc2, [], _) - when (tyconRefEq g tagc2 g.byrefkind_InOut_tcr && - (tyconRefEq g tagc1 g.byrefkind_In_tcr || tyconRefEq g tagc1 g.byrefkind_Out_tcr) ) -> () - | _ -> return! SolveTypeEqualsType csenv ndeep m2 trace cxsln tag1 tag2 - } - | _ -> SolveTypeEqualsTypeWithContravarianceEqns csenv ndeep m2 trace cxsln l1 l2 tc1.TyparsNoRange - - | TType_app (tc1, l1, _) , TType_app (tc2, l2, _) when tyconRefEq g tc1 tc2 -> - trackErrors { - do! SolveTypeEqualsTypeWithContravarianceEqns csenv ndeep m2 trace cxsln l1 l2 tc1.TyparsNoRange - do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) - } + // Enforce the identities float=float<1>, float32=float32<1> and decimal=decimal<1> + | _, TType_app (tc2, [ms2], _) when tc2.IsMeasureableReprTycon && typeEquiv csenv.g sty1 (reduceTyconRefMeasureableOrProvided csenv.g tc2 [ms2]) -> + trackErrors { + do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ms2 (TType_measure Measure.One) + do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) + } - | TType_ucase (uc1, l1), TType_ucase (uc2, l2) when g.unionCaseRefEq uc1 uc2 -> - SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 + | TType_app (tc1, [ms1], _), _ when tc1.IsMeasureableReprTycon && typeEquiv csenv.g sty2 (reduceTyconRefMeasureableOrProvided csenv.g tc1 [ms1]) -> + trackErrors { + do! SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln ms1 (TType_measure Measure.One) + do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) + } - | _ -> - // By now we know the type is not a variable type + // Special subsumption rule for byref tags + | TType_app (tc1, l1, _) , TType_app (tc2, l2, _) when tyconRefEq g tc1 tc2 && g.byref2_tcr.CanDeref && tyconRefEq g g.byref2_tcr tc1 -> + match l1, l2 with + | [ h1; tag1 ], [ h2; tag2 ] -> trackErrors { + do! SolveTypeEqualsType csenv ndeep m2 trace None h1 h2 + match stripTyEqnsA csenv.g canShortcut tag1, stripTyEqnsA csenv.g canShortcut tag2 with + | TType_app(tagc1, [], _), TType_app(tagc2, [], _) + when (tyconRefEq g tagc2 g.byrefkind_InOut_tcr && + (tyconRefEq g tagc1 g.byrefkind_In_tcr || tyconRefEq g tagc1 g.byrefkind_Out_tcr) ) -> () + | _ -> return! SolveTypeEqualsType csenv ndeep m2 trace cxsln tag1 tag2 + } + | _ -> SolveTypeEqualsTypeWithContravarianceEqns csenv ndeep m2 trace cxsln l1 l2 tc1.TyparsNoRange - // C :> obj ---> - if isObjTy g ty1 then CompleteD else - - let m = csenv.m + | TType_app (tc1, l1, _) , TType_app (tc2, l2, _) when tyconRefEq g tc1 tc2 -> + trackErrors { + do! SolveTypeEqualsTypeWithContravarianceEqns csenv ndeep m2 trace cxsln l1 l2 tc1.TyparsNoRange + do! SolveNullnessSubsumesNullness csenv m2 trace ty1 ty2 (nullnessOfTy g sty1) (nullnessOfTy g sty2) + } - // 'a[] :> IList<'b> ---> 'a = 'b - // 'a[] :> ICollection<'b> ---> 'a = 'b - // 'a[] :> IEnumerable<'b> ---> 'a = 'b - // 'a[] :> IReadOnlyList<'b> ---> 'a = 'b - // 'a[] :> IReadOnlyCollection<'b> ---> 'a = 'b - // Note we don't support co-variance on array types nor - // the special .NET conversions for these types - match ty1 with - | AppTy g (tcref1, tinst1) when - isArray1DTy g ty2 && - (tyconRefEq g tcref1 g.tcref_System_Collections_Generic_IList || - tyconRefEq g tcref1 g.tcref_System_Collections_Generic_ICollection || - tyconRefEq g tcref1 g.tcref_System_Collections_Generic_IReadOnlyList || - tyconRefEq g tcref1 g.tcref_System_Collections_Generic_IReadOnlyCollection || - tyconRefEq g tcref1 g.tcref_System_Collections_Generic_IEnumerable) -> - match tinst1 with - | [elemTy1] -> - let elemTy2 = destArrayTy g ty2 - SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln elemTy1 elemTy2 - | _ -> error(InternalError("destArrayTy", m)) + | TType_ucase (uc1, l1), TType_ucase (uc2, l2) when g.unionCaseRefEq uc1 uc2 -> + SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln l1 l2 | _ -> - // D :> Head<_> --> C :> Head<_> for the - // first interface or super-class C supported by D which - // may feasibly convert to Head. - match FindUniqueFeasibleSupertype g amap m ty1 ty2 with - | None -> ErrorD(ConstraintSolverTypesNotInSubsumptionRelation(denv, ty1, ty2, m, m2)) - | Some t -> SolveTypeSubsumesType csenv ndeep m2 trace cxsln ty1 t + // By now we know the type is not a variable type + // C :> obj ---> + if isObjNullTy g ty1 then + CompleteD + else + let m = csenv.m + // 'a[] :> IList<'b> ---> 'a = 'b + // 'a[] :> ICollection<'b> ---> 'a = 'b + // 'a[] :> IEnumerable<'b> ---> 'a = 'b + // 'a[] :> IReadOnlyList<'b> ---> 'a = 'b + // 'a[] :> IReadOnlyCollection<'b> ---> 'a = 'b + // Note we don't support co-variance on array types nor + // the special .NET conversions for these types + match ty1 with + | AppTy g (tcref1, tinst1) when + isArray1DTy g ty2 && + (tyconRefEq g tcref1 g.tcref_System_Collections_Generic_IList || + tyconRefEq g tcref1 g.tcref_System_Collections_Generic_ICollection || + tyconRefEq g tcref1 g.tcref_System_Collections_Generic_IReadOnlyList || + tyconRefEq g tcref1 g.tcref_System_Collections_Generic_IReadOnlyCollection || + tyconRefEq g tcref1 g.tcref_System_Collections_Generic_IEnumerable) -> + match tinst1 with + | [elemTy1] -> + let elemTy2 = destArrayTy g ty2 + SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln elemTy1 elemTy2 + | _ -> error(InternalError("destArrayTy", m)) + + | _ -> + // D :> Head<_> --> C :> Head<_> for the + // first interface or super-class C supported by D which + // may feasibly convert to Head. + match FindUniqueFeasibleSupertype g amap m ty1 ty2 with + | None -> ErrorD(ConstraintSolverTypesNotInSubsumptionRelation(denv, ty1, ty2, m, m2)) + | Some t -> SolveTypeSubsumesType csenv ndeep m2 trace cxsln ty1 t and SolveTypeSubsumesTypeKeepAbbrevs csenv ndeep m2 trace cxsln ty1 ty2 = let denv = csenv.DisplayEnv @@ -1595,15 +1600,22 @@ and SolveTypeSubsumesTypeKeepAbbrevs csenv ndeep m2 trace cxsln ty1 ty2 = and SolveTyparSubtypeOfType (csenv: ConstraintSolverEnv) ndeep m2 trace tp ty1 = let g = csenv.g - if isObjTy g ty1 then CompleteD - elif typeEquiv g ty1 (mkTyparTy tp) then CompleteD + if isObjNullTy g ty1 then + CompleteD + elif isObjTyAnyNullness g ty1 then + AddConstraint csenv ndeep m2 trace tp (TyparConstraint.NotSupportsNull csenv.m) + elif typeEquiv g ty1 (mkTyparTy tp) then + CompleteD elif isSealedTy g ty1 then SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace (mkTyparTy tp) ty1 else AddConstraint csenv ndeep m2 trace tp (TyparConstraint.CoercesTo(ty1, csenv.m)) and DepthCheck ndeep m = - if ndeep > 300 then error(Error(FSComp.SR.csTypeInferenceMaxDepth(), m)) else CompleteD + if ndeep > 300 then + error(Error(FSComp.SR.csTypeInferenceMaxDepth(), m)) + else + CompleteD // If this is a type that's parameterized on a unit-of-measure (expected to be numeric), unify its measure with 1 and SolveDimensionlessNumericType (csenv: ConstraintSolverEnv) ndeep m2 trace ty = @@ -1625,434 +1637,435 @@ and SolveMemberConstraint (csenv: ConstraintSolverEnv) ignoreUnresolvedOverload trackErrors { let (TTrait(supportTys, nm, memFlags, traitObjAndArgTys, retTy, source, sln)) = traitInfo // Do not re-solve if already solved - if sln.Value.IsSome then return true else - - let g = csenv.g - let m = csenv.m - let amap = csenv.amap - let aenv = csenv.EquivEnv - let denv = csenv.DisplayEnv + if sln.Value.IsSome then + return true + else + let g = csenv.g + let m = csenv.m + let amap = csenv.amap + let aenv = csenv.EquivEnv + let denv = csenv.DisplayEnv - let ndeep = ndeep + 1 - do! DepthCheck ndeep m + let ndeep = ndeep + 1 + do! DepthCheck ndeep m - // Remove duplicates from the set of types in the support - let supportTys = ListSet.setify (typeAEquiv g aenv) supportTys + // Remove duplicates from the set of types in the support + let supportTys = ListSet.setify (typeAEquiv g aenv) supportTys - // Rebuild the trait info after removing duplicates - let traitInfo = traitInfo.WithSupportTypes supportTys - let retTy = GetFSharpViewOfReturnType g retTy + // Rebuild the trait info after removing duplicates + let traitInfo = traitInfo.WithSupportTypes supportTys + let retTy = GetFSharpViewOfReturnType g retTy - // Assert the object type if the constraint is for an instance member - if memFlags.IsInstance then - match supportTys, traitObjAndArgTys with - | [ty], h :: _ -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace h ty - | _ -> do! ErrorD (ConstraintSolverError(FSComp.SR.csExpectedArguments(), m, m2)) + // Assert the object type if the constraint is for an instance member + if memFlags.IsInstance then + match supportTys, traitObjAndArgTys with + | [ty], h :: _ -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace h ty + | _ -> do! ErrorD (ConstraintSolverError(FSComp.SR.csExpectedArguments(), m, m2)) + + // Trait calls are only supported on pseudo type (variables) + if not (g.langVersion.SupportsFeature LanguageFeature.InterfacesWithAbstractStaticMembers) then + for e in supportTys do + do! SolveTypStaticReq csenv trace TyparStaticReq.HeadType e + + // SRTP constraints on rigid type parameters do not need to be solved + let isRigid = + supportTys |> List.forall (fun ty -> + match tryDestTyparTy g ty with + | ValueSome tp -> + match tp.Rigidity with + | TyparRigidity.Rigid + | TyparRigidity.WillBeRigid -> true + | _ -> false + | ValueNone -> false) + + let argTys = if memFlags.IsInstance then List.tail traitObjAndArgTys else traitObjAndArgTys + + let minfos = GetRelevantMethodsForTrait csenv permitWeakResolution nm traitInfo + + let! res = + trackErrors { + match minfos, supportTys, memFlags.IsInstance, nm, argTys with + | _, _, false, ("op_Division" | "op_Multiply"), [argTy1;argTy2] + when + // This simulates the existence of + // float * float -> float + // float32 * float32 -> float32 + // float<'u> * float<'v> -> float<'u 'v> + // float32<'u> * float32<'v> -> float32<'u 'v> + // decimal<'u> * decimal<'v> -> decimal<'u 'v> + // decimal<'u> * decimal -> decimal<'u> + // float32<'u> * float32<'v> -> float32<'u 'v> + // int * int -> int + // int64 * int64 -> int64 + // + // The rule is triggered by these sorts of inputs when permitWeakResolution=false + // float * float + // float * float32 // will give error + // decimal * decimal + // decimal * decimal <-- Note this one triggers even though "decimal" has some possibly-relevant methods + // float * Matrix // the rule doesn't trigger for this one since Matrix has overloads we can use and we prefer those instead + // float * Matrix // the rule doesn't trigger for this one since Matrix has overloads we can use and we prefer those instead + // + // The rule is triggered by these sorts of inputs when permitWeakResolution=true + // float * 'a + // 'a * float + // decimal<'u> * 'a + (let checkRuleAppliesInPreferenceToMethods argTy1 argTy2 = + // Check that at least one of the argument types is numeric + IsNumericOrIntegralEnumType g argTy1 && + // Check the other type is nominal, unless using weak resolution + IsBinaryOpOtherArgType g permitWeakResolution argTy2 && + // This next condition checks that either + // - Neither type contributes any methods OR + // - We have the special case "decimal<_> * decimal". In this case we have some + // possibly-relevant methods from "decimal" but we ignore them in this case. + (isNil minfos || (Option.isSome (getMeasureOfType g argTy1) && isDecimalTy g argTy2)) in + + checkRuleAppliesInPreferenceToMethods argTy1 argTy2 || + checkRuleAppliesInPreferenceToMethods argTy2 argTy1) -> + + match getMeasureOfType g argTy1 with + | Some (tcref, ms1) -> + let ms2 = freshMeasure () + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 (mkWoNullAppTy tcref [TType_measure ms2]) + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkWoNullAppTy tcref [TType_measure (Measure.Prod(ms1, if nm = "op_Multiply" then ms2 else Measure.Inv ms2))]) + return TTraitBuiltIn - // Trait calls are only supported on pseudo type (variables) - if not (g.langVersion.SupportsFeature LanguageFeature.InterfacesWithAbstractStaticMembers) then - for e in supportTys do - do! SolveTypStaticReq csenv trace TyparStaticReq.HeadType e + | _ -> - // SRTP constraints on rigid type parameters do not need to be solved - let isRigid = - supportTys |> List.forall (fun ty -> - match tryDestTyparTy g ty with - | ValueSome tp -> - match tp.Rigidity with - | TyparRigidity.Rigid - | TyparRigidity.WillBeRigid -> true - | _ -> false - | ValueNone -> false) + match getMeasureOfType g argTy2 with + | Some (tcref, ms2) -> + let ms1 = freshMeasure () + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy1 (mkWoNullAppTy tcref [TType_measure ms1]) + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkWoNullAppTy tcref [TType_measure (Measure.Prod(ms1, if nm = "op_Multiply" then ms2 else Measure.Inv ms2))]) + return TTraitBuiltIn + + | _ -> + + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + return TTraitBuiltIn + + | _, _, false, ("op_Addition" | "op_Subtraction" | "op_Modulus"), [argTy1;argTy2] + when // Ignore any explicit +/- overloads from any basic integral types + (minfos |> List.forall (fun (_, minfo) -> isIntegerTy g minfo.ApparentEnclosingType ) && + ( IsAddSubModType nm g argTy1 && IsBinaryOpOtherArgType g permitWeakResolution argTy2 + || IsAddSubModType nm g argTy2 && IsBinaryOpOtherArgType g permitWeakResolution argTy1)) -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + return TTraitBuiltIn - let argTys = if memFlags.IsInstance then List.tail traitObjAndArgTys else traitObjAndArgTys + | _, _, false, ("op_LessThan" | "op_LessThanOrEqual" | "op_GreaterThan" | "op_GreaterThanOrEqual" | "op_Equality" | "op_Inequality" ), [argTy1;argTy2] + when // Ignore any explicit overloads from any basic integral types + (minfos |> List.forall (fun (_, minfo) -> isIntegerTy g minfo.ApparentEnclosingType ) && + ( IsRelationalType g argTy1 && IsBinaryOpOtherArgType g permitWeakResolution argTy2 + || IsRelationalType g argTy2 && IsBinaryOpOtherArgType g permitWeakResolution argTy1)) -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy g.bool_ty + return TTraitBuiltIn - let minfos = GetRelevantMethodsForTrait csenv permitWeakResolution nm traitInfo + // We pretend for uniformity that the numeric types have a static property called Zero and One + // As with constants, only zero is polymorphic in its units + | [], [ty], false, "get_Zero", [] + when isNumericType g ty || isCharTy g ty -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ty + return TTraitBuiltIn - let! res = - trackErrors { - match minfos, supportTys, memFlags.IsInstance, nm, argTys with - | _, _, false, ("op_Division" | "op_Multiply"), [argTy1;argTy2] - when - // This simulates the existence of - // float * float -> float - // float32 * float32 -> float32 - // float<'u> * float<'v> -> float<'u 'v> - // float32<'u> * float32<'v> -> float32<'u 'v> - // decimal<'u> * decimal<'v> -> decimal<'u 'v> - // decimal<'u> * decimal -> decimal<'u> - // float32<'u> * float32<'v> -> float32<'u 'v> - // int * int -> int - // int64 * int64 -> int64 - // - // The rule is triggered by these sorts of inputs when permitWeakResolution=false - // float * float - // float * float32 // will give error - // decimal * decimal - // decimal * decimal <-- Note this one triggers even though "decimal" has some possibly-relevant methods - // float * Matrix // the rule doesn't trigger for this one since Matrix has overloads we can use and we prefer those instead - // float * Matrix // the rule doesn't trigger for this one since Matrix has overloads we can use and we prefer those instead - // - // The rule is triggered by these sorts of inputs when permitWeakResolution=true - // float * 'a - // 'a * float - // decimal<'u> * 'a - (let checkRuleAppliesInPreferenceToMethods argTy1 argTy2 = - // Check that at least one of the argument types is numeric - IsNumericOrIntegralEnumType g argTy1 && - // Check the other type is nominal, unless using weak resolution - IsBinaryOpOtherArgType g permitWeakResolution argTy2 && - // This next condition checks that either - // - Neither type contributes any methods OR - // - We have the special case "decimal<_> * decimal". In this case we have some - // possibly-relevant methods from "decimal" but we ignore them in this case. - (isNil minfos || (Option.isSome (getMeasureOfType g argTy1) && isDecimalTy g argTy2)) in - - checkRuleAppliesInPreferenceToMethods argTy1 argTy2 || - checkRuleAppliesInPreferenceToMethods argTy2 argTy1) -> - - match getMeasureOfType g argTy1 with - | Some (tcref, ms1) -> - let ms2 = freshMeasure () - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 (mkWoNullAppTy tcref [TType_measure ms2]) - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkWoNullAppTy tcref [TType_measure (Measure.Prod(ms1, if nm = "op_Multiply" then ms2 else Measure.Inv ms2))]) + | [], [ty], false, "get_One", [] + when isNumericType g ty || isCharTy g ty -> + do! SolveDimensionlessNumericType csenv ndeep m2 trace ty + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ty return TTraitBuiltIn - | _ -> + | [], _, false, "DivideByInt", [argTy1;argTy2] + when isFpTy g argTy1 || isDecimalTy g argTy1 -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 g.int_ty + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + return TTraitBuiltIn - match getMeasureOfType g argTy2 with - | Some (tcref, ms2) -> - let ms1 = freshMeasure () - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy1 (mkWoNullAppTy tcref [TType_measure ms1]) - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkWoNullAppTy tcref [TType_measure (Measure.Prod(ms1, if nm = "op_Multiply" then ms2 else Measure.Inv ms2))]) - return TTraitBuiltIn + // We pretend for uniformity that the 'string' and 'array' types have an indexer property called 'Item' + | [], [ty], true, "get_Item", [argTy1] + when isStringTy g ty -> - | _ -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy1 g.int_ty + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy g.char_ty + return TTraitBuiltIn - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - return TTraitBuiltIn + | [], [ty], true, "get_Item", argTys + when isArrayTy g ty -> + + if rankOfArrayTy g ty <> argTys.Length then + do! ErrorD(ConstraintSolverError(FSComp.SR.csIndexArgumentMismatch((rankOfArrayTy g ty), argTys.Length), m, m2)) + + for argTy in argTys do + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy g.int_ty - | _, _, false, ("op_Addition" | "op_Subtraction" | "op_Modulus"), [argTy1;argTy2] - when // Ignore any explicit +/- overloads from any basic integral types - (minfos |> List.forall (fun (_, minfo) -> isIntegerTy g minfo.ApparentEnclosingType ) && - ( IsAddSubModType nm g argTy1 && IsBinaryOpOtherArgType g permitWeakResolution argTy2 - || IsAddSubModType nm g argTy2 && IsBinaryOpOtherArgType g permitWeakResolution argTy1)) -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - return TTraitBuiltIn - - | _, _, false, ("op_LessThan" | "op_LessThanOrEqual" | "op_GreaterThan" | "op_GreaterThanOrEqual" | "op_Equality" | "op_Inequality" ), [argTy1;argTy2] - when // Ignore any explicit overloads from any basic integral types - (minfos |> List.forall (fun (_, minfo) -> isIntegerTy g minfo.ApparentEnclosingType ) && - ( IsRelationalType g argTy1 && IsBinaryOpOtherArgType g permitWeakResolution argTy2 - || IsRelationalType g argTy2 && IsBinaryOpOtherArgType g permitWeakResolution argTy1)) -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy g.bool_ty - return TTraitBuiltIn - - // We pretend for uniformity that the numeric types have a static property called Zero and One - // As with constants, only zero is polymorphic in its units - | [], [ty], false, "get_Zero", [] - when isNumericType g ty || isCharTy g ty -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ty - return TTraitBuiltIn - - | [], [ty], false, "get_One", [] - when isNumericType g ty || isCharTy g ty -> - do! SolveDimensionlessNumericType csenv ndeep m2 trace ty - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ty - return TTraitBuiltIn - - | [], _, false, "DivideByInt", [argTy1;argTy2] - when isFpTy g argTy1 || isDecimalTy g argTy1 -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 g.int_ty - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - return TTraitBuiltIn - - // We pretend for uniformity that the 'string' and 'array' types have an indexer property called 'Item' - | [], [ty], true, "get_Item", [argTy1] - when isStringTy g ty -> - - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy1 g.int_ty - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy g.char_ty - return TTraitBuiltIn - - | [], [ty], true, "get_Item", argTys - when isArrayTy g ty -> - - if rankOfArrayTy g ty <> argTys.Length then - do! ErrorD(ConstraintSolverError(FSComp.SR.csIndexArgumentMismatch((rankOfArrayTy g ty), argTys.Length), m, m2)) - - for argTy in argTys do - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy g.int_ty - - let ety = destArrayTy g ty - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ety - return TTraitBuiltIn - - | [], [ty], true, "set_Item", argTys - when isArrayTy g ty -> + let ety = destArrayTy g ty + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy ety + return TTraitBuiltIn + + | [], [ty], true, "set_Item", argTys + when isArrayTy g ty -> - if rankOfArrayTy g ty <> argTys.Length - 1 then - do! ErrorD(ConstraintSolverError(FSComp.SR.csIndexArgumentMismatch((rankOfArrayTy g ty), (argTys.Length - 1)), m, m2)) - let argTys, lastTy = List.frontAndBack argTys + if rankOfArrayTy g ty <> argTys.Length - 1 then + do! ErrorD(ConstraintSolverError(FSComp.SR.csIndexArgumentMismatch((rankOfArrayTy g ty), (argTys.Length - 1)), m, m2)) + let argTys, lastTy = List.frontAndBack argTys + + for argTy in argTys do + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy g.int_ty + + let elemTy = destArrayTy g ty + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace lastTy elemTy + return TTraitBuiltIn - for argTy in argTys do - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy g.int_ty + | [], _, false, ("op_BitwiseAnd" | "op_BitwiseOr" | "op_ExclusiveOr"), [argTy1;argTy2] + when IsBitwiseOpType g argTy1 && IsBinaryOpOtherArgType g permitWeakResolution argTy2 + || IsBitwiseOpType g argTy2 && IsBinaryOpOtherArgType g permitWeakResolution argTy1 -> - let elemTy = destArrayTy g ty - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace lastTy elemTy - return TTraitBuiltIn + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy1 + return TTraitBuiltIn - | [], _, false, ("op_BitwiseAnd" | "op_BitwiseOr" | "op_ExclusiveOr"), [argTy1;argTy2] - when IsBitwiseOpType g argTy1 && IsBinaryOpOtherArgType g permitWeakResolution argTy2 - || IsBitwiseOpType g argTy2 && IsBinaryOpOtherArgType g permitWeakResolution argTy1 -> + | [], _, false, ("op_LeftShift" | "op_RightShift"), [argTy1;argTy2] + when IsIntegerOrIntegerEnumTy g argTy1 -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy1 - return TTraitBuiltIn + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 g.int_ty + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy1 + return TTraitBuiltIn - | [], _, false, ("op_LeftShift" | "op_RightShift"), [argTy1;argTy2] - when IsIntegerOrIntegerEnumTy g argTy1 -> + | _, _, false, "op_UnaryPlus", [argTy] + when IsNumericOrIntegralEnumType g argTy -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 g.int_ty - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy1 - return TTraitBuiltIn + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy + return TTraitBuiltIn - | _, _, false, "op_UnaryPlus", [argTy] - when IsNumericOrIntegralEnumType g argTy -> + | _, _, false, "op_UnaryNegation", [argTy] + when isSignedIntegerTy g argTy || isFpTy g argTy || isDecimalTy g argTy -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy - return TTraitBuiltIn + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy + return TTraitBuiltIn - | _, _, false, "op_UnaryNegation", [argTy] - when isSignedIntegerTy g argTy || isFpTy g argTy || isDecimalTy g argTy -> + | _, _, true, "get_Sign", [] + when IsSignType g supportTys.Head -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy - return TTraitBuiltIn + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy g.int32_ty + return TTraitBuiltIn - | _, _, true, "get_Sign", [] - when IsSignType g supportTys.Head -> + | _, _, false, ("op_LogicalNot" | "op_OnesComplement"), [argTy] + when IsIntegerOrIntegerEnumTy g argTy -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy g.int32_ty - return TTraitBuiltIn + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy + do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy + return TTraitBuiltIn - | _, _, false, ("op_LogicalNot" | "op_OnesComplement"), [argTy] - when IsIntegerOrIntegerEnumTy g argTy -> + | _, _, false, "Abs", [argTy] + when isSignedIntegerTy g argTy || isFpTy g argTy || isDecimalTy g argTy -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy - do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy - return TTraitBuiltIn + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy + return TTraitBuiltIn - | _, _, false, "Abs", [argTy] - when isSignedIntegerTy g argTy || isFpTy g argTy || isDecimalTy g argTy -> + | _, _, false, "Sqrt", [argTy1] + when isFpTy g argTy1 -> + match getMeasureOfType g argTy1 with + | Some (tcref, _) -> + let ms1 = freshMeasure () + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy1 (mkWoNullAppTy tcref [TType_measure (Measure.Prod (ms1, ms1))]) + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkWoNullAppTy tcref [TType_measure ms1]) + return TTraitBuiltIn + | None -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + return TTraitBuiltIn + + | _, _, false, ("Sin" | "Cos" | "Tan" | "Sinh" | "Cosh" | "Tanh" | "Atan" | "Acos" | "Asin" | "Exp" | "Ceiling" | "Floor" | "Round" | "Truncate" | "Log10" | "Log" | "Sqrt"), [argTy] + when isFpTy g argTy -> + + do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy + return TTraitBuiltIn - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy - return TTraitBuiltIn + // Conversions from non-decimal numbers / strings / chars to non-decimal numbers / chars are built-in + | _, _, false, "op_Explicit", [argTy] + when (// The input type. + (IsNonDecimalNumericOrIntegralEnumType g argTy || isStringTy g argTy || isCharTy g argTy) && + // The output type + (IsNonDecimalNumericOrIntegralEnumType g retTy || isCharTy g retTy)) -> - | _, _, false, "Sqrt", [argTy1] - when isFpTy g argTy1 -> - match getMeasureOfType g argTy1 with - | Some (tcref, _) -> - let ms1 = freshMeasure () - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy1 (mkWoNullAppTy tcref [TType_measure (Measure.Prod (ms1, ms1))]) - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkWoNullAppTy tcref [TType_measure ms1]) - return TTraitBuiltIn - | None -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - return TTraitBuiltIn + return TTraitBuiltIn + + // Conversions from (including decimal) numbers / strings / chars to decimals are built-in + | _, _, false, "op_Explicit", [argTy] + when (// The input type. + (IsNumericOrIntegralEnumType g argTy || isStringTy g argTy || isCharTy g argTy) && + // The output type + (isDecimalTy g retTy)) -> + return TTraitBuiltIn + + // Conversions from decimal numbers to native integers are built-in + // The rest of decimal conversions are handled via op_Explicit lookup on System.Decimal (which also looks for op_Implicit) + | _, _, false, "op_Explicit", [argTy] + when (// The input type. + (isDecimalTy g argTy) && + // The output type + (isNativeIntegerTy g retTy)) -> + return TTraitBuiltIn - | _, _, false, ("Sin" | "Cos" | "Tan" | "Sinh" | "Cosh" | "Tanh" | "Atan" | "Acos" | "Asin" | "Exp" | "Ceiling" | "Floor" | "Round" | "Truncate" | "Log10" | "Log" | "Sqrt"), [argTy] - when isFpTy g argTy -> - - do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy - return TTraitBuiltIn - - // Conversions from non-decimal numbers / strings / chars to non-decimal numbers / chars are built-in - | _, _, false, "op_Explicit", [argTy] - when (// The input type. - (IsNonDecimalNumericOrIntegralEnumType g argTy || isStringTy g argTy || isCharTy g argTy) && - // The output type - (IsNonDecimalNumericOrIntegralEnumType g retTy || isCharTy g retTy)) -> - - return TTraitBuiltIn - - // Conversions from (including decimal) numbers / strings / chars to decimals are built-in - | _, _, false, "op_Explicit", [argTy] - when (// The input type. - (IsNumericOrIntegralEnumType g argTy || isStringTy g argTy || isCharTy g argTy) && - // The output type - (isDecimalTy g retTy)) -> - return TTraitBuiltIn - - // Conversions from decimal numbers to native integers are built-in - // The rest of decimal conversions are handled via op_Explicit lookup on System.Decimal (which also looks for op_Implicit) - | _, _, false, "op_Explicit", [argTy] - when (// The input type. - (isDecimalTy g argTy) && - // The output type - (isNativeIntegerTy g retTy)) -> - return TTraitBuiltIn - - | [], _, false, "Pow", [argTy1; argTy2] - when isFpTy g argTy1 -> + | [], _, false, "Pow", [argTy1; argTy2] + when isFpTy g argTy1 -> - do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy1 - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - return TTraitBuiltIn - - | _, _, false, "Atan2", [argTy1; argTy2] - when isFpTy g argTy1 -> - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 - match getMeasureOfType g argTy1 with - | None -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 - | Some (tcref, _) -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkWoNullAppTy tcref [TType_measure Measure.One]) - return TTraitBuiltIn + do! SolveDimensionlessNumericType csenv ndeep m2 trace argTy1 + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + return TTraitBuiltIn - | _ -> - // OK, this is not solved by a built-in constraint. - // Now look for real solutions - - // First look for a solution by a record property - let recdPropSearch = - let isGetProp = nm.StartsWithOrdinal("get_") - let isSetProp = nm.StartsWithOrdinal("set_") - if not isRigid && ((argTys.IsEmpty && isGetProp) || isSetProp) then - let propName = nm[4..] - let props = - supportTys |> List.choose (fun ty -> - match TryFindIntrinsicNamedItemOfType csenv.InfoReader (propName, AccessibleFromEverywhere, false) FindMemberFlag.IgnoreOverrides m ty with - | Some (RecdFieldItem rfinfo) - when (isGetProp || rfinfo.RecdField.IsMutable) && - (rfinfo.IsStatic = not memFlags.IsInstance) && - IsRecdFieldAccessible amap m AccessibleFromEverywhere rfinfo.RecdFieldRef && - not rfinfo.LiteralValue.IsSome && - not rfinfo.RecdField.IsCompilerGenerated -> - Some (rfinfo, isSetProp) - | _ -> None) - match props with - | [ prop ] -> Some prop - | _ -> None - else - None - - let anonRecdPropSearch = - let isGetProp = nm.StartsWithOrdinal("get_") - if not isRigid && isGetProp && memFlags.IsInstance then - let propName = nm[4..] - let props = - supportTys |> List.choose (fun ty -> - match TryFindAnonRecdFieldOfType g ty propName with - | Some (Item.AnonRecdField(anonInfo, tinst, i, _)) -> Some (anonInfo, tinst, i) - | _ -> None) - match props with - | [ prop ] -> Some prop - | _ -> None - else - None - - // Now check if there are no feasible solutions at all - match minfos, recdPropSearch, anonRecdPropSearch with - | [], None, None when MemberConstraintIsReadyForStrongResolution csenv traitInfo -> - if supportTys |> List.exists (isFunTy g) then - return! ErrorD (ConstraintSolverError(FSComp.SR.csExpectTypeWithOperatorButGivenFunction(ConvertValLogicalNameToDisplayNameCore nm), m, m2)) - elif supportTys |> List.exists (isAnyTupleTy g) then - return! ErrorD (ConstraintSolverError(FSComp.SR.csExpectTypeWithOperatorButGivenTuple(ConvertValLogicalNameToDisplayNameCore nm), m, m2)) - else - match nm, argTys with - | "op_Explicit", [argTy] -> - let argTyString = NicePrint.prettyStringOfTy denv argTy - let rtyString = NicePrint.prettyStringOfTy denv retTy - return! ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotSupportConversion(argTyString, rtyString), m, m2)) - | _ -> - let tyString = - match supportTys with - | [ty] -> NicePrint.minimalStringOfType denv ty - | _ -> supportTys |> List.map (NicePrint.minimalStringOfType denv) |> String.concat ", " - let opName = ConvertValLogicalNameToDisplayNameCore nm - let err = - match opName with - | "?>=" | "?>" | "?<=" | "?<" | "?=" | "?<>" - | ">=?" | ">?" | "<=?" | "?" - | "?>=?" | "?>?" | "?<=?" | "??" -> - if List.isSingleton supportTys then FSComp.SR.csTypeDoesNotSupportOperatorNullable(tyString, opName) - else FSComp.SR.csTypesDoNotSupportOperatorNullable(tyString, opName) - | _ -> - match supportTys, source.Value with - | [_], Some s when s.StartsWith("Operators.") -> - let opSource = s[10..] - if opSource = nm then FSComp.SR.csTypeDoesNotSupportOperator(tyString, opName) - else FSComp.SR.csTypeDoesNotSupportOperator(tyString, opSource) - | [_], Some s -> - FSComp.SR.csFunctionDoesNotSupportType(s, tyString, nm) - | [_], _ - -> FSComp.SR.csTypeDoesNotSupportOperator(tyString, opName) - | _, _ - -> FSComp.SR.csTypesDoNotSupportOperator(tyString, opName) - return! ErrorD(ConstraintSolverError(err, m, m2)) + | _, _, false, "Atan2", [argTy1; argTy2] + when isFpTy g argTy1 -> + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace argTy2 argTy1 + match getMeasureOfType g argTy1 with + | None -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy argTy1 + | Some (tcref, _) -> do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy (mkWoNullAppTy tcref [TType_measure Measure.One]) + return TTraitBuiltIn | _ -> - let dummyExpr = mkUnit g m - let calledMethGroup = - minfos - // curried members may not be used to satisfy constraints - |> List.choose (fun (staticTy, minfo) -> - if minfo.IsCurried then - None - else - let callerArgs = - { - Unnamed = [ (argTys |> List.map (fun argTy -> CallerArg(argTy, m, false, dummyExpr))) ] - Named = [ [ ] ] - } - let minst = FreshenMethInfo m minfo - let objtys = minfo.GetObjArgTypes(amap, m, minst) - Some(CalledMeth(csenv.InfoReader, None, false, FreshenMethInfo, m, AccessibleFromEverywhere, minfo, minst, minst, None, objtys, callerArgs, false, false, None, Some staticTy))) - - let methOverloadResult, errors = - trace.CollectThenUndoOrCommit - (fun (a, _) -> Option.isSome a) - (fun trace -> ResolveOverloading csenv (WithTrace trace) nm ndeep (Some traitInfo) CallerArgs.Empty AccessibleFromEverywhere calledMethGroup false (Some (MustEqual retTy))) - - match anonRecdPropSearch, recdPropSearch, methOverloadResult with - | Some (anonInfo, tinst, i), None, None -> - // OK, the constraint is solved by a record property. Assert that the return types match. - let rty2 = List.item i tinst - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy rty2 - return TTraitSolvedAnonRecdProp(anonInfo, tinst, i) - - | None, Some (rfinfo, isSetProp), None -> - // OK, the constraint is solved by a record property. Assert that the return types match. - let rty2 = if isSetProp then g.unit_ty else rfinfo.FieldType - do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy rty2 - return TTraitSolvedRecdProp(rfinfo, isSetProp) - - | None, None, Some (calledMeth: CalledMeth<_>) -> - // OK, the constraint is solved. - let minfo = calledMeth.Method - - do! errors - let isInstance = minfo.IsInstance - if isInstance <> memFlags.IsInstance then - return! - if isInstance then - ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsNotStatic((NicePrint.minimalStringOfType denv minfo.ApparentEnclosingType), (ConvertValLogicalNameToDisplayNameCore nm), nm), m, m2 )) - else - ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsStatic((NicePrint.minimalStringOfType denv minfo.ApparentEnclosingType), (ConvertValLogicalNameToDisplayNameCore nm), nm), m, m2 )) - else - do! CheckMethInfoAttributes g m None minfo - return TTraitSolved (minfo, calledMeth.CalledTyArgs, calledMeth.OptionalStaticType) + // OK, this is not solved by a built-in constraint. + // Now look for real solutions + + // First look for a solution by a record property + let recdPropSearch = + let isGetProp = nm.StartsWithOrdinal("get_") + let isSetProp = nm.StartsWithOrdinal("set_") + if not isRigid && ((argTys.IsEmpty && isGetProp) || isSetProp) then + let propName = nm[4..] + let props = + supportTys |> List.choose (fun ty -> + match TryFindIntrinsicNamedItemOfType csenv.InfoReader (propName, AccessibleFromEverywhere, false) FindMemberFlag.IgnoreOverrides m ty with + | Some (RecdFieldItem rfinfo) + when (isGetProp || rfinfo.RecdField.IsMutable) && + (rfinfo.IsStatic = not memFlags.IsInstance) && + IsRecdFieldAccessible amap m AccessibleFromEverywhere rfinfo.RecdFieldRef && + not rfinfo.LiteralValue.IsSome && + not rfinfo.RecdField.IsCompilerGenerated -> + Some (rfinfo, isSetProp) + | _ -> None) + match props with + | [ prop ] -> Some prop + | _ -> None + else + None + + let anonRecdPropSearch = + let isGetProp = nm.StartsWithOrdinal("get_") + if not isRigid && isGetProp && memFlags.IsInstance then + let propName = nm[4..] + let props = + supportTys |> List.choose (fun ty -> + match TryFindAnonRecdFieldOfType g ty propName with + | Some (Item.AnonRecdField(anonInfo, tinst, i, _)) -> Some (anonInfo, tinst, i) + | _ -> None) + match props with + | [ prop ] -> Some prop + | _ -> None + else + None + + // Now check if there are no feasible solutions at all + match minfos, recdPropSearch, anonRecdPropSearch with + | [], None, None when MemberConstraintIsReadyForStrongResolution csenv traitInfo -> + if supportTys |> List.exists (isFunTy g) then + return! ErrorD (ConstraintSolverError(FSComp.SR.csExpectTypeWithOperatorButGivenFunction(ConvertValLogicalNameToDisplayNameCore nm), m, m2)) + elif supportTys |> List.exists (isAnyTupleTy g) then + return! ErrorD (ConstraintSolverError(FSComp.SR.csExpectTypeWithOperatorButGivenTuple(ConvertValLogicalNameToDisplayNameCore nm), m, m2)) + else + match nm, argTys with + | "op_Explicit", [argTy] -> + let argTyString = NicePrint.prettyStringOfTy denv argTy + let rtyString = NicePrint.prettyStringOfTy denv retTy + return! ErrorD (ConstraintSolverError(FSComp.SR.csTypeDoesNotSupportConversion(argTyString, rtyString), m, m2)) + | _ -> + let tyString = + match supportTys with + | [ty] -> NicePrint.minimalStringOfType denv ty + | _ -> supportTys |> List.map (NicePrint.minimalStringOfType denv) |> String.concat ", " + let opName = ConvertValLogicalNameToDisplayNameCore nm + let err = + match opName with + | "?>=" | "?>" | "?<=" | "?<" | "?=" | "?<>" + | ">=?" | ">?" | "<=?" | "?" + | "?>=?" | "?>?" | "?<=?" | "??" -> + if List.isSingleton supportTys then FSComp.SR.csTypeDoesNotSupportOperatorNullable(tyString, opName) + else FSComp.SR.csTypesDoNotSupportOperatorNullable(tyString, opName) + | _ -> + match supportTys, source.Value with + | [_], Some s when s.StartsWith("Operators.") -> + let opSource = s[10..] + if opSource = nm then FSComp.SR.csTypeDoesNotSupportOperator(tyString, opName) + else FSComp.SR.csTypeDoesNotSupportOperator(tyString, opSource) + | [_], Some s -> + FSComp.SR.csFunctionDoesNotSupportType(s, tyString, nm) + | [_], _ + -> FSComp.SR.csTypeDoesNotSupportOperator(tyString, opName) + | _, _ + -> FSComp.SR.csTypesDoNotSupportOperator(tyString, opName) + return! ErrorD(ConstraintSolverError(err, m, m2)) | _ -> - do! AddUnsolvedMemberConstraint csenv ndeep m2 trace permitWeakResolution ignoreUnresolvedOverload traitInfo errors - return TTraitUnsolved - } - return! RecordMemberConstraintSolution csenv.SolverState m trace traitInfo res + let dummyExpr = mkUnit g m + let calledMethGroup = + minfos + // curried members may not be used to satisfy constraints + |> List.choose (fun (staticTy, minfo) -> + if minfo.IsCurried then + None + else + let callerArgs = + { + Unnamed = [ (argTys |> List.map (fun argTy -> CallerArg(argTy, m, false, dummyExpr))) ] + Named = [ [ ] ] + } + let minst = FreshenMethInfo m minfo + let objtys = minfo.GetObjArgTypes(amap, m, minst) + Some(CalledMeth(csenv.InfoReader, None, false, FreshenMethInfo, m, AccessibleFromEverywhere, minfo, minst, minst, None, objtys, callerArgs, false, false, None, Some staticTy))) + + let methOverloadResult, errors = + trace.CollectThenUndoOrCommit + (fun (a, _) -> Option.isSome a) + (fun trace -> ResolveOverloading csenv (WithTrace trace) nm ndeep (Some traitInfo) CallerArgs.Empty AccessibleFromEverywhere calledMethGroup false (Some (MustEqual retTy))) + + match anonRecdPropSearch, recdPropSearch, methOverloadResult with + | Some (anonInfo, tinst, i), None, None -> + // OK, the constraint is solved by a record property. Assert that the return types match. + let rty2 = List.item i tinst + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy rty2 + return TTraitSolvedAnonRecdProp(anonInfo, tinst, i) + + | None, Some (rfinfo, isSetProp), None -> + // OK, the constraint is solved by a record property. Assert that the return types match. + let rty2 = if isSetProp then g.unit_ty else rfinfo.FieldType + do! SolveTypeEqualsTypeKeepAbbrevs csenv ndeep m2 trace retTy rty2 + return TTraitSolvedRecdProp(rfinfo, isSetProp) + + | None, None, Some (calledMeth: CalledMeth<_>) -> + // OK, the constraint is solved. + let minfo = calledMeth.Method + + do! errors + let isInstance = minfo.IsInstance + if isInstance <> memFlags.IsInstance then + return! + if isInstance then + ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsNotStatic((NicePrint.minimalStringOfType denv minfo.ApparentEnclosingType), (ConvertValLogicalNameToDisplayNameCore nm), nm), m, m2 )) + else + ErrorD(ConstraintSolverError(FSComp.SR.csMethodFoundButIsStatic((NicePrint.minimalStringOfType denv minfo.ApparentEnclosingType), (ConvertValLogicalNameToDisplayNameCore nm), nm), m, m2 )) + else + do! CheckMethInfoAttributes g m None minfo + return TTraitSolved (minfo, calledMeth.CalledTyArgs, calledMeth.OptionalStaticType) + + | _ -> + do! AddUnsolvedMemberConstraint csenv ndeep m2 trace permitWeakResolution ignoreUnresolvedOverload traitInfo errors + return TTraitUnsolved + } + return! RecordMemberConstraintSolution csenv.SolverState m trace traitInfo res } and AddUnsolvedMemberConstraint csenv ndeep m2 trace permitWeakResolution ignoreUnresolvedOverload traitInfo errors = diff --git a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs index 3a3682fbf53..c1aa4dafc5d 100644 --- a/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckComputationExpressions.fs @@ -1545,7 +1545,9 @@ let rec TryTranslateComputationExpression let dataCompPrior = translatedCtxt ( - TranslateComputationExpressionNoQueryOps ceenv (SynExpr.YieldOrReturn((true, false), varSpaceExpr, mClause)) + TranslateComputationExpressionNoQueryOps + ceenv + (SynExpr.YieldOrReturn((true, false), varSpaceExpr, mClause, SynExprYieldOrReturnTrivia.Zero)) ) // Rebind using for ... @@ -1576,7 +1578,9 @@ let rec TryTranslateComputationExpression let isYield = not (customOperationMaintainsVarSpaceUsingBind ceenv nm) translatedCtxt ( - TranslateComputationExpressionNoQueryOps ceenv (SynExpr.YieldOrReturn((isYield, false), varSpaceExpr, mClause)) + TranslateComputationExpressionNoQueryOps + ceenv + (SynExpr.YieldOrReturn((isYield, false), varSpaceExpr, mClause, SynExprYieldOrReturnTrivia.Zero)) ) // Now run the consumeCustomOpClauses @@ -1589,10 +1593,10 @@ let rec TryTranslateComputationExpression Some(TranslateComputationExpression ceenv CompExprTranslationPass.Initial q varSpace innerComp2 translatedCtxt) else - if ceenv.isQuery && not (innerComp1.IsArbExprAndThusAlreadyReportedError) then match innerComp1 with - | SynExpr.JoinIn _ -> () // an error will be reported later when we process innerComp1 as a sequential + | SynExpr.JoinIn _ -> () + | SynExpr.DoBang(trivia = { DoBangKeyword = m }) -> errorR (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), m)) | _ -> errorR (Error(FSComp.SR.tcUnrecognizedQueryOperator (), innerComp1.RangeOfFirstPortion)) match @@ -1657,7 +1661,7 @@ let rec TryTranslateComputationExpression | None -> // "do! expr; cexpr" is treated as { let! () = expr in cexpr } match innerComp1 with - | SynExpr.DoBang(rhsExpr, m) -> + | SynExpr.DoBang(expr = rhsExpr; range = m) -> let sp = match sp with | DebugPointAtSequential.SuppressExpr -> DebugPointAtBinding.NoneAtDo @@ -1854,12 +1858,14 @@ let rec TryTranslateComputationExpression // or // --> build.BindReturn(e1, (fun _argN -> match _argN with pat -> expr-without-return)) | SynExpr.LetOrUseBang( - bindDebugPoint = spBind; isUse = false; isFromSource = isFromSource; pat = pat; rhs = rhsExpr; andBangs = []; body = innerComp) -> - - let mBind = - match spBind with - | DebugPointAtBinding.Yes m -> m - | _ -> rhsExpr.Range + bindDebugPoint = spBind + isUse = false + isFromSource = isFromSource + pat = pat + rhs = rhsExpr + andBangs = [] + body = innerComp + trivia = { LetOrUseBangKeyword = mBind }) -> if ceenv.isQuery then error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), mBind)) @@ -1900,7 +1906,8 @@ let rec TryTranslateComputationExpression pat = SynPat.Named(ident = SynIdent(id, _); isThisVal = false) as pat rhs = rhsExpr andBangs = [] - body = innerComp) + body = innerComp + trivia = { LetOrUseBangKeyword = mBind }) | SynExpr.LetOrUseBang( bindDebugPoint = spBind isUse = true @@ -1908,12 +1915,8 @@ let rec TryTranslateComputationExpression pat = SynPat.LongIdent(longDotId = SynLongIdent(id = [ id ])) as pat rhs = rhsExpr andBangs = [] - body = innerComp) -> - - let mBind = - match spBind with - | DebugPointAtBinding.Yes m -> m - | _ -> rhsExpr.Range + body = innerComp + trivia = { LetOrUseBangKeyword = mBind }) -> if ceenv.isQuery then error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), mBind)) @@ -1988,9 +1991,9 @@ let rec TryTranslateComputationExpression Some(translatedCtxt bindExpr) // 'use! pat = e1 ... in e2' where 'pat' is not a simple name -> error - | SynExpr.LetOrUseBang(isUse = true; pat = pat; andBangs = andBangs) -> + | SynExpr.LetOrUseBang(isUse = true; andBangs = andBangs; trivia = { LetOrUseBangKeyword = mBind }) -> if isNil andBangs then - error (Error(FSComp.SR.tcInvalidUseBangBinding (), pat.Range)) + error (Error(FSComp.SR.tcInvalidUseBangBinding (), mBind)) else let m = match andBangs with @@ -2013,17 +2016,17 @@ let rec TryTranslateComputationExpression rhs = letRhsExpr andBangs = andBangBindings body = innerComp - range = letBindRange) -> + trivia = { LetOrUseBangKeyword = mBind }) -> if not (cenv.g.langVersion.SupportsFeature LanguageFeature.AndBang) then - error (Error(FSComp.SR.tcAndBangNotSupported (), comp.Range)) + let andBangRange = + match andBangBindings with + | [] -> comp.Range + | h :: _ -> h.Trivia.AndBangKeyword - if ceenv.isQuery then - error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), letBindRange)) + error (Error(FSComp.SR.tcAndBangNotSupported (), andBangRange)) - let mBind = - match spBind with - | DebugPointAtBinding.Yes m -> m - | _ -> letRhsExpr.Range + if ceenv.isQuery then + error (Error(FSComp.SR.tcBindMayNotBeUsedInQueries (), mBind)) let sources = (letRhsExpr @@ -2375,7 +2378,7 @@ let rec TryTranslateComputationExpression Some(translatedCtxt callExpr) - | SynExpr.YieldOrReturnFrom((true, _), synYieldExpr, m) -> + | SynExpr.YieldOrReturnFrom((true, _), synYieldExpr, _, { YieldOrReturnFromKeyword = m }) -> let yieldFromExpr = mkSourceExpr synYieldExpr ceenv.sourceMethInfo ceenv.builderValName @@ -2393,7 +2396,8 @@ let rec TryTranslateComputationExpression then error (Error(FSComp.SR.tcRequireBuilderMethod ("YieldFrom"), m)) - let yieldFromCall = mkSynCall "YieldFrom" m [ yieldFromExpr ] ceenv.builderValName + let yieldFromCall = + mkSynCall "YieldFrom" synYieldExpr.Range [ yieldFromExpr ] ceenv.builderValName let yieldFromCall = if IsControlFlowExpression synYieldExpr then @@ -2403,7 +2407,7 @@ let rec TryTranslateComputationExpression Some(translatedCtxt yieldFromCall) - | SynExpr.YieldOrReturnFrom((false, _), synReturnExpr, m) -> + | SynExpr.YieldOrReturnFrom((false, _), synReturnExpr, _, { YieldOrReturnFromKeyword = m }) -> let returnFromExpr = mkSourceExpr synReturnExpr ceenv.sourceMethInfo ceenv.builderValName @@ -2425,7 +2429,7 @@ let rec TryTranslateComputationExpression error (Error(FSComp.SR.tcRequireBuilderMethod ("ReturnFrom"), m)) let returnFromCall = - mkSynCall "ReturnFrom" m [ returnFromExpr ] ceenv.builderValName + mkSynCall "ReturnFrom" synReturnExpr.Range [ returnFromExpr ] ceenv.builderValName let returnFromCall = if IsControlFlowExpression synReturnExpr then @@ -2435,7 +2439,7 @@ let rec TryTranslateComputationExpression Some(translatedCtxt returnFromCall) - | SynExpr.YieldOrReturn((isYield, _), synYieldOrReturnExpr, m) -> + | SynExpr.YieldOrReturn((isYield, _), synYieldOrReturnExpr, _, { YieldOrReturnKeyword = m }) -> let methName = (if isYield then "Yield" else "Return") if ceenv.isQuery && not isYield then @@ -2453,10 +2457,10 @@ let rec TryTranslateComputationExpression ceenv.builderTy ) then - error (Error(FSComp.SR.tcRequireBuilderMethod (methName), m)) + error (Error(FSComp.SR.tcRequireBuilderMethod methName, m)) let yieldOrReturnCall = - mkSynCall methName m [ synYieldOrReturnExpr ] ceenv.builderValName + mkSynCall methName synYieldOrReturnExpr.Range [ synYieldOrReturnExpr ] ceenv.builderValName let yieldOrReturnCall = if IsControlFlowExpression synYieldOrReturnExpr then @@ -2760,7 +2764,7 @@ and TranslateComputationExpressionBind /// The inner option indicates if a custom operation is involved inside and convertSimpleReturnToExpr (ceenv: ComputationExpressionContext<'a>) comp varSpace innerComp = match innerComp with - | SynExpr.YieldOrReturn((false, _), returnExpr, m) -> + | SynExpr.YieldOrReturn((false, _), returnExpr, m, _) -> let returnExpr = SynExpr.DebugPoint(DebugPointAtLeafExpr.Yes m, false, returnExpr) Some(returnExpr, None) @@ -2868,7 +2872,7 @@ and TranslateComputationExpression (ceenv: ComputationExpressionContext<'a>) fir // This only occurs in final position in a sequence match comp with // "do! expr;" in final position is treated as { let! () = expr in return () } when Return is provided (and no Zero with Default attribute is available) or as { let! () = expr in zero } otherwise - | SynExpr.DoBang(rhsExpr, m) -> + | SynExpr.DoBang(expr = rhsExpr; trivia = { DoBangKeyword = m }) -> let mUnit = rhsExpr.Range let rhsExpr = mkSourceExpr rhsExpr ceenv.sourceMethInfo ceenv.builderValName @@ -2902,7 +2906,7 @@ and TranslateComputationExpression (ceenv: ComputationExpressionContext<'a>) fir with | minfo :: _ when MethInfoHasAttribute ceenv.cenv.g m ceenv.cenv.g.attrib_DefaultValueAttribute minfo -> SynExpr.ImplicitZero m - | _ -> SynExpr.YieldOrReturn((false, true), SynExpr.Const(SynConst.Unit, m), m) + | _ -> SynExpr.YieldOrReturn((false, true), SynExpr.Const(SynConst.Unit, m), m, SynExprYieldOrReturnTrivia.Zero) let letBangBind = SynExpr.LetOrUseBang( diff --git a/src/Compiler/Checking/Expressions/CheckExpressions.fs b/src/Compiler/Checking/Expressions/CheckExpressions.fs index b5cc414e721..4325d503206 100644 --- a/src/Compiler/Checking/Expressions/CheckExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckExpressions.fs @@ -3283,7 +3283,7 @@ let AnalyzeArbitraryExprAsEnumerable (cenv: cenv) (env: TcEnv) localAlloc m expr let enumElemTy = - if isObjTy g enumElemTy then + if isObjTyAnyNullness g enumElemTy then // Look for an 'Item' property, or a set of these with consistent return types let allEquivReturnTypes (minfo: MethInfo) (others: MethInfo list) = let returnTy = minfo.GetFSharpReturnType(cenv.amap, m, []) @@ -5991,23 +5991,23 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE CallExprHasTypeSink cenv.tcSink (m, env.NameEnv, overallTy.Commit, env.AccessRights) TcQuotationExpr cenv overallTy env tpenv (oper, raw, ast, isFromQueryExpression, m) - | SynExpr.YieldOrReturn ((isTrueYield, _), _, m) - | SynExpr.YieldOrReturnFrom ((isTrueYield, _), _, m) when isTrueYield -> + | SynExpr.YieldOrReturn ((isTrueYield, _), _, _m, { YieldOrReturnKeyword = m }) + | SynExpr.YieldOrReturnFrom ((isTrueYield, _), _, _m, { YieldOrReturnFromKeyword = m }) when isTrueYield -> error(Error(FSComp.SR.tcConstructRequiresListArrayOrSequence(), m)) - | SynExpr.YieldOrReturn ((_, isTrueReturn), _, m) - | SynExpr.YieldOrReturnFrom ((_, isTrueReturn), _, m) when isTrueReturn -> + | SynExpr.YieldOrReturn ((_, isTrueReturn), _, _m, { YieldOrReturnKeyword = m }) + | SynExpr.YieldOrReturnFrom ((_, isTrueReturn), _, _m, { YieldOrReturnFromKeyword = m }) when isTrueReturn -> error(Error(FSComp.SR.tcConstructRequiresComputationExpressions(), m)) - | SynExpr.YieldOrReturn (_, _, m) - | SynExpr.YieldOrReturnFrom (_, _, m) + | SynExpr.YieldOrReturn (trivia = { YieldOrReturnKeyword = m }) + | SynExpr.YieldOrReturnFrom (trivia = { YieldOrReturnFromKeyword = m }) | SynExpr.ImplicitZero m -> error(Error(FSComp.SR.tcConstructRequiresSequenceOrComputations(), m)) - | SynExpr.DoBang (_, m) - | SynExpr.MatchBang (range = m) + | SynExpr.DoBang (trivia = { DoBangKeyword = m }) + | SynExpr.MatchBang (trivia = { MatchBangKeyword = m }) | SynExpr.WhileBang (range = m) - | SynExpr.LetOrUseBang (range = m) -> + | SynExpr.LetOrUseBang (trivia = { LetOrUseBangKeyword = m }) -> error(Error(FSComp.SR.tcConstructRequiresComputationExpression(), m)) | SynExpr.IndexFromEnd (rightExpr, m) -> @@ -6195,7 +6195,7 @@ and TcExprObjectExpr (cenv: cenv) overallTy env tpenv (synObjTy, argopt, binds, errorR(Error(FSComp.SR.tcCannotInheritFromErasedType(), m)) (m, intfTy, overrides), tpenv) - let realObjTy = if isObjTy g objTy && not (isNil extraImpls) then (p23 (List.head extraImpls)) else objTy + let realObjTy = if isObjTyAnyNullness g objTy && not (isNil extraImpls) then (p23 (List.head extraImpls)) else objTy TcPropagatingExprLeafThenConvert cenv overallTy realObjTy env (* canAdhoc *) m (fun () -> TcObjectExpr cenv env tpenv (objTy, realObjTy, argopt, binds, extraImpls, mObjTy, mNewExpr, m) @@ -7320,7 +7320,7 @@ and TcFormatStringExpr cenv (overallTy: OverallTy) env m tpenv (fmtString: strin let formatTy = mkPrintfFormatTy g aty bty cty dty ety // This might qualify as a format string - check via a type directed rule - let ok = not (isObjTy g overallTy.Commit) && AddCxTypeMustSubsumeTypeUndoIfFailed env.DisplayEnv cenv.css m overallTy.Commit formatTy + let ok = not (isObjTyAnyNullness g overallTy.Commit) && AddCxTypeMustSubsumeTypeUndoIfFailed env.DisplayEnv cenv.css m overallTy.Commit formatTy if ok then // Parse the format string to work out the phantom types @@ -7399,7 +7399,7 @@ and TcInterpolatedStringExpr cenv (overallTy: OverallTy) env m tpenv (parts: Syn Choice1Of2 (true, newFormatMethod) // ... or if that fails then may be a FormattableString by a type-directed rule.... - elif (not (isObjTy g overallTy.Commit) && + elif (not (isObjTyAnyNullness g overallTy.Commit) && ((g.system_FormattableString_tcref.CanDeref && AddCxTypeMustSubsumeTypeUndoIfFailed env.DisplayEnv cenv.css m overallTy.Commit g.system_FormattableString_ty) || (g.system_IFormattable_tcref.CanDeref && AddCxTypeMustSubsumeTypeUndoIfFailed env.DisplayEnv cenv.css m overallTy.Commit g.system_IFormattable_ty))) then @@ -7420,7 +7420,7 @@ and TcInterpolatedStringExpr cenv (overallTy: OverallTy) env m tpenv (parts: Syn | None -> languageFeatureNotSupportedInLibraryError LanguageFeature.StringInterpolation m // ... or if that fails then may be a PrintfFormat by a type-directed rule.... - elif not (isObjTy g overallTy.Commit) && AddCxTypeMustSubsumeTypeUndoIfFailed env.DisplayEnv cenv.css m overallTy.Commit formatTy then + elif not (isObjTyAnyNullness g overallTy.Commit) && AddCxTypeMustSubsumeTypeUndoIfFailed env.DisplayEnv cenv.css m overallTy.Commit formatTy then // And if that succeeds, the printerTy and printerResultTy must be the same (there are no curried arguments) UnifyTypes cenv env m printerTy printerResultTy diff --git a/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs b/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs index 31be49131ab..781060c8af4 100644 --- a/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs +++ b/src/Compiler/Checking/Expressions/CheckSequenceExpressions.fs @@ -168,7 +168,7 @@ let TcSequenceExpression (cenv: TcFileState) env tpenv comp (overallTy: OverallT | SynExpr.ImplicitZero m -> Some(mkSeqEmpty cenv env m genOuterTy, tpenv) - | SynExpr.DoBang(_rhsExpr, m) -> error (Error(FSComp.SR.tcDoBangIllegalInSequenceExpression (), m)) + | SynExpr.DoBang(trivia = { DoBangKeyword = m }) -> error (Error(FSComp.SR.tcDoBangIllegalInSequenceExpression (), m)) | SynExpr.Sequential(sp, true, innerComp1, innerComp2, m, _) -> let env1 = @@ -353,43 +353,44 @@ let TcSequenceExpression (cenv: TcFileState) env tpenv comp (overallTy: OverallT Some(combinatorExpr, tpenv) - | SynExpr.YieldOrReturnFrom((isYield, _), synYieldExpr, m) -> + | SynExpr.YieldOrReturnFrom(flags = (isYield, _); expr = synYieldExpr; trivia = { YieldOrReturnFromKeyword = m }) -> let env = { env with eIsControlFlow = false } let resultExpr, genExprTy, tpenv = TcExprOfUnknownType cenv env tpenv synYieldExpr if not isYield then errorR (Error(FSComp.SR.tcUseYieldBangForMultipleResults (), m)) - AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css m NoTrace genOuterTy genExprTy + AddCxTypeMustSubsumeType ContextInfo.NoContext env.DisplayEnv cenv.css synYieldExpr.Range NoTrace genOuterTy genExprTy - let resultExpr = mkCoerceExpr (resultExpr, genOuterTy, m, genExprTy) + let resultExpr = + mkCoerceExpr (resultExpr, genOuterTy, synYieldExpr.Range, genExprTy) let resultExpr = if IsControlFlowExpression synYieldExpr then resultExpr else - mkDebugPoint m resultExpr + mkDebugPoint resultExpr.Range resultExpr Some(resultExpr, tpenv) - | SynExpr.YieldOrReturn((isYield, _), synYieldExpr, m) -> + | SynExpr.YieldOrReturn(flags = (isYield, _); expr = synYieldExpr; trivia = { YieldOrReturnKeyword = m }) -> let env = { env with eIsControlFlow = false } let genResultTy = NewInferenceType g if not isYield then errorR (Error(FSComp.SR.tcSeqResultsUseYield (), m)) - UnifyTypes cenv env m genOuterTy (mkSeqTy cenv.g genResultTy) + UnifyTypes cenv env synYieldExpr.Range genOuterTy (mkSeqTy cenv.g genResultTy) let resultExpr, tpenv = TcExprFlex cenv flex true genResultTy env tpenv synYieldExpr - let resultExpr = mkCallSeqSingleton cenv.g m genResultTy resultExpr + let resultExpr = mkCallSeqSingleton cenv.g synYieldExpr.Range genResultTy resultExpr let resultExpr = if IsControlFlowExpression synYieldExpr then resultExpr else - mkDebugPoint m resultExpr + mkDebugPoint synYieldExpr.Range resultExpr Some(resultExpr, tpenv) diff --git a/src/Compiler/Checking/InfoReader.fs b/src/Compiler/Checking/InfoReader.fs index f4a9f033c64..24a2d5bbf6e 100644 --- a/src/Compiler/Checking/InfoReader.fs +++ b/src/Compiler/Checking/InfoReader.fs @@ -1082,7 +1082,7 @@ let TryDestStandardDelegateType (infoReader: InfoReader) m ad delTy = let g = infoReader.g let (SigOfFunctionForDelegate(_, delArgTys, delRetTy, _)) = GetSigOfFunctionForDelegate infoReader delTy m ad match delArgTys with - | senderTy :: argTys when (isObjTy g senderTy) && not (List.exists (isByrefTy g) argTys) -> Some(mkRefTupledTy g argTys, delRetTy) + | senderTy :: argTys when (isObjTyAnyNullness g senderTy) && not (List.exists (isByrefTy g) argTys) -> Some(mkRefTupledTy g argTys, delRetTy) | _ -> None diff --git a/src/Compiler/Checking/MethodCalls.fs b/src/Compiler/Checking/MethodCalls.fs index 72363943549..ac4d92141d8 100644 --- a/src/Compiler/Checking/MethodCalls.fs +++ b/src/Compiler/Checking/MethodCalls.fs @@ -1319,7 +1319,7 @@ let BuildNewDelegateExpr (eventInfoOpt: EventInfo option, g, amap, delegateTy, d | Some einfo -> match delArgVals with | [] -> error(nonStandardEventError einfo.EventName m) - | h :: _ when not (isObjTy g h.Type) -> error(nonStandardEventError einfo.EventName m) + | h :: _ when not (isObjTyAnyNullness g h.Type) -> error(nonStandardEventError einfo.EventName m) | h :: t -> [exprForVal m h; mkRefTupledVars g m t] | None -> if isNil delArgTys then [mkUnit g m] else List.map (exprForVal m) delArgVals diff --git a/src/Compiler/Checking/NameResolution.fs b/src/Compiler/Checking/NameResolution.fs index 2eb5b14fa02..010e9e0cd8d 100644 --- a/src/Compiler/Checking/NameResolution.fs +++ b/src/Compiler/Checking/NameResolution.fs @@ -4422,14 +4422,14 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso // // Don't show GetHashCode or Equals for F# types that admit equality as an abnormal operation let isUnseenDueToBasicObjRules = - not (isObjTy g ty) && + not (isObjTyAnyNullness g ty) && not minfo.IsExtensionMember && match minfo.LogicalName with | "GetType" -> false - | "GetHashCode" -> isObjTy g minfo.ApparentEnclosingType && not (AugmentTypeDefinitions.TypeDefinitelyHasEquality g ty) + | "GetHashCode" -> isObjTyAnyNullness g minfo.ApparentEnclosingType && not (AugmentTypeDefinitions.TypeDefinitelyHasEquality g ty) | "ToString" -> false | "Equals" -> - if not (isObjTy g minfo.ApparentEnclosingType) then + if not (isObjTyAnyNullness g minfo.ApparentEnclosingType) then // declaring type is not System.Object - show it false elif minfo.IsInstance then @@ -4440,7 +4440,7 @@ let ResolveCompletionsInType (ncenv: NameResolver) nenv (completionTargets: Reso true | _ -> // filter out self methods of obj type - isObjTy g minfo.ApparentEnclosingType + isObjTyAnyNullness g minfo.ApparentEnclosingType let result = not isUnseenDueToBasicObjRules && @@ -5121,14 +5121,14 @@ let ResolveCompletionsInTypeForItem (ncenv: NameResolver) nenv m ad statics ty ( // // Don't show GetHashCode or Equals for F# types that admit equality as an abnormal operation let isUnseenDueToBasicObjRules = - not (isObjTy g ty) && + not (isObjTyAnyNullness g ty) && not minfo.IsExtensionMember && match minfo.LogicalName with | "GetType" -> false - | "GetHashCode" -> isObjTy g minfo.ApparentEnclosingType && not (AugmentTypeDefinitions.TypeDefinitelyHasEquality g ty) + | "GetHashCode" -> isObjTyAnyNullness g minfo.ApparentEnclosingType && not (AugmentTypeDefinitions.TypeDefinitelyHasEquality g ty) | "ToString" -> false | "Equals" -> - if not (isObjTy g minfo.ApparentEnclosingType) then + if not (isObjTyAnyNullness g minfo.ApparentEnclosingType) then // declaring type is not System.Object - show it false elif minfo.IsInstance then @@ -5139,7 +5139,7 @@ let ResolveCompletionsInTypeForItem (ncenv: NameResolver) nenv m ad statics ty ( true | _ -> // filter out self methods of obj type - isObjTy g minfo.ApparentEnclosingType + isObjTyAnyNullness g minfo.ApparentEnclosingType let result = not isUnseenDueToBasicObjRules && not minfo.IsInstance = statics && diff --git a/src/Compiler/Checking/NicePrint.fs b/src/Compiler/Checking/NicePrint.fs index 812837a3edd..09e8708b894 100644 --- a/src/Compiler/Checking/NicePrint.fs +++ b/src/Compiler/Checking/NicePrint.fs @@ -2191,7 +2191,7 @@ module TastDefinitionPrinting = let inherits = [ if not (suppressInheritanceAndInterfacesForTyInSimplifiedDisplays g amap m ty) then match GetSuperTypeOfType g amap m ty with - | Some superTy when not (isObjTy g superTy) && not (isValueTypeTy g superTy) -> + | Some superTy when not (isObjTyAnyNullness g superTy) && not (isValueTypeTy g superTy) -> superTy | _ -> () ] diff --git a/src/Compiler/Checking/PostInferenceChecks.fs b/src/Compiler/Checking/PostInferenceChecks.fs index e9860a76efa..645f43fe3cb 100644 --- a/src/Compiler/Checking/PostInferenceChecks.fs +++ b/src/Compiler/Checking/PostInferenceChecks.fs @@ -1958,7 +1958,8 @@ and CheckAttribArgExpr cenv env expr = | Const.Single _ | Const.Char _ | Const.Zero - | Const.String _ -> () + | Const.String _ + | Const.Decimal _ -> () | _ -> if cenv.reportErrors then errorR (Error (FSComp.SR.tastNotAConstantExpression(), m)) diff --git a/src/Compiler/Checking/TypeHierarchy.fs b/src/Compiler/Checking/TypeHierarchy.fs index 1ccde31b75e..9bf7c2ec892 100644 --- a/src/Compiler/Checking/TypeHierarchy.fs +++ b/src/Compiler/Checking/TypeHierarchy.fs @@ -67,7 +67,7 @@ let GetSuperTypeOfType g amap m ty = Some (instType (mkInstForAppTy g ty) (superOfTycon g tcref.Deref)) elif isArrayTy g ty then Some g.system_Array_ty - elif isRefTy g ty && not (isObjTy g ty) then + elif isRefTy g ty && not (isObjTyAnyNullness g ty) then Some g.obj_ty_noNulls elif isStructTupleTy g ty then Some g.system_Value_ty @@ -117,17 +117,16 @@ let GetImmediateInterfacesOfMetadataType g amap m skipUnref ty (tcref: TyconRef) // succeeded with more reported. There are pathological corner cases where this // doesn't apply: e.g. for mscorlib interfaces like IComparable, but we can always // assume those are present. - match tdef.ImplementsCustomAttrs with - | Some attrsList when g.langFeatureNullness && g.checkNullness -> - for (attrs,attrsIdx),intfTy in tdef.Implements |> List.zip attrsList do - if skipUnref = SkipUnrefInterfaces.No || CanRescopeAndImportILType scoref amap m intfTy then + let checkNullness = g.langFeatureNullness && g.checkNullness + for {Idx = attrsIdx; Type = intfTy; CustomAttrsStored = attrs} in tdef.Implements.Value do + if skipUnref = SkipUnrefInterfaces.No || CanRescopeAndImportILType scoref amap m intfTy then + if checkNullness then let typeAttrs = AttributesFromIL(attrsIdx,attrs) let nullness = {DirectAttributes = typeAttrs; Fallback = FromClass typeAttrs} RescopeAndImportILType scoref amap m tinst nullness intfTy - | _ -> - for intfTy in tdef.Implements do - if skipUnref = SkipUnrefInterfaces.No || CanRescopeAndImportILType scoref amap m intfTy then + else RescopeAndImportILTypeSkipNullness scoref amap m tinst intfTy + | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata -> for intfTy in tcref.ImmediateInterfaceTypesOfFSharpTycon do instType (mkInstForAppTy g ty) intfTy ] diff --git a/src/Compiler/Checking/TypeRelations.fs b/src/Compiler/Checking/TypeRelations.fs index b52a1da1574..498fd3e3bb8 100644 --- a/src/Compiler/Checking/TypeRelations.fs +++ b/src/Compiler/Checking/TypeRelations.fs @@ -117,7 +117,7 @@ let rec TypeFeasiblySubsumesType ndeep g amap m ty1 canCoerce ty2 = | _ -> // F# reference types are subtypes of type 'obj' - (isObjTy g ty1 && (canCoerce = CanCoerce || isRefTy g ty2)) + (isObjTyAnyNullness g ty1 && (canCoerce = CanCoerce || isRefTy g ty2)) || (isAppTy g ty2 && (canCoerce = CanCoerce || isRefTy g ty2) && diff --git a/src/Compiler/Checking/infos.fs b/src/Compiler/Checking/infos.fs index 23afa7bece5..18add6588d0 100644 --- a/src/Compiler/Checking/infos.fs +++ b/src/Compiler/Checking/infos.fs @@ -207,7 +207,7 @@ type OptionalArgInfo = if isByrefTy g ty then let ty = destByrefTy g ty PassByRef (ty, analyze ty) - elif isObjTy g ty then + elif isObjTyAnyNullness g ty then match ilParam.Marshal with | Some(ILNativeType.IUnknown | ILNativeType.IDispatch | ILNativeType.Interface) -> Constant ILFieldInit.Null | _ -> @@ -296,7 +296,7 @@ let CrackParamAttribsInfo g (ty: TType, argInfo: ArgReprInfo) = | None -> // Do a type-directed analysis of the type to determine the default value to pass. // Similar rules as OptionalArgInfo.FromILParameter are applied here, except for the COM and byref-related stuff. - CallerSide (if isObjTy g ty then MissingValue else DefaultValue) + CallerSide (if isObjTyAnyNullness g ty then MissingValue else DefaultValue) | Some attr -> let defaultValue = OptionalArgInfo.ValueOfDefaultParameterValueAttrib attr match defaultValue with @@ -364,7 +364,9 @@ type ILFieldInit with | :? uint32 as i -> ILFieldInit.UInt32 i | :? int64 as i -> ILFieldInit.Int64 i | :? uint64 as i -> ILFieldInit.UInt64 i - | _ -> error(Error(FSComp.SR.infosInvalidProvidedLiteralValue(try !!v.ToString() with _ -> "?"), m)) + | _ -> + let txt = match v with | null -> "?" | v -> try !!v.ToString() with _ -> "?" + error(Error(FSComp.SR.infosInvalidProvidedLiteralValue(txt), m)) /// Compute the OptionalArgInfo for a provided parameter. @@ -382,7 +384,7 @@ let OptionalArgInfoOfProvidedParameter (amap: ImportMap) m (provParam : Tainted< if isByrefTy g ty then let ty = destByrefTy g ty PassByRef (ty, analyze ty) - elif isObjTy g ty then MissingValue + elif isObjTyAnyNullness g ty then MissingValue else DefaultValue let paramTy = ImportProvidedType amap m (provParam.PApply((fun p -> p.ParameterType), m)) diff --git a/src/Compiler/CodeGen/EraseClosures.fs b/src/Compiler/CodeGen/EraseClosures.fs index ed32d83b369..df2604717ed 100644 --- a/src/Compiler/CodeGen/EraseClosures.fs +++ b/src/Compiler/CodeGen/EraseClosures.fs @@ -572,8 +572,7 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = name = td.Name, genericParams = td.GenericParams, attributes = td.Attributes, - implements = [], - implementsCustomAttrs = None, + implements = emptyILInterfaceImpls, nestedTypes = emptyILTypeDefs, layout = ILTypeDefLayout.Auto, extends = Some cenv.mkILTyFuncTy, @@ -707,8 +706,7 @@ let rec convIlxClosureDef cenv encl (td: ILTypeDef) clo = name = td.Name, genericParams = td.GenericParams, attributes = td.Attributes, - implements = [], - implementsCustomAttrs = None, + implements = emptyILInterfaceImpls, layout = ILTypeDefLayout.Auto, nestedTypes = emptyILTypeDefs, extends = Some nowEnvParentClass, diff --git a/src/Compiler/CodeGen/EraseUnions.fs b/src/Compiler/CodeGen/EraseUnions.fs index 88336c057b2..79788107475 100644 --- a/src/Compiler/CodeGen/EraseUnions.fs +++ b/src/Compiler/CodeGen/EraseUnions.fs @@ -1571,8 +1571,7 @@ let mkClassUnionDef genericParams = td.GenericParams, attributes = enum 0, layout = ILTypeDefLayout.Auto, - implements = [], - implementsCustomAttrs = None, + implements = emptyILInterfaceImpls, extends = Some g.ilg.typ_Object, methods = emptyILMethods, securityDecls = emptyILSecurityDecls, diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 6758b6dcd94..2a1c876b8f5 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -2227,7 +2227,8 @@ type AnonTypeGenerationTable() = let ilInterfaceTys = [ - for intfTy, _, _ in tcaug.tcaug_interfaces -> GenType cenv m (TypeReprEnv.Empty.ForTypars tps) intfTy + for intfTy, _, _ in tcaug.tcaug_interfaces -> + GenType cenv m (TypeReprEnv.Empty.ForTypars tps) intfTy |> InterfaceImpl.Create ] let ilTypeDef = @@ -3781,11 +3782,11 @@ and GenCoerce cenv cgbuf eenv (e, tgtTy, m, srcTy) sequel = else GenExpr cenv cgbuf eenv e Continue - if not (isObjTy g srcTy) then + if not (isObjTyAnyNullness g srcTy) then let ilFromTy = GenType cenv m eenv.tyenv srcTy CG.EmitInstr cgbuf (pop 1) (Push [ g.ilg.typ_Object ]) (I_box ilFromTy) - if not (isObjTy g tgtTy) then + if not (isObjTyAnyNullness g tgtTy) then let ilToTy = GenType cenv m eenv.tyenv tgtTy CG.EmitInstr cgbuf (pop 1) (Push [ ilToTy ]) (I_unbox_any ilToTy) @@ -6023,7 +6024,8 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel let interfaceTys = GetImmediateInterfacesOfType SkipUnrefInterfaces.Yes g cenv.amap m templateStructTy - let ilInterfaceTys = List.map (GenType cenv m eenvinner.tyenv) interfaceTys + let ilInterfaceTys = + List.map (GenType cenv m eenvinner.tyenv >> InterfaceImpl.Create) interfaceTys let super = g.iltyp_ValueType @@ -6254,8 +6256,7 @@ and GenStructStateMachine cenv cgbuf eenvouter (res: LoweredStateMachine) sequel methods = mkILMethods mdefs, methodImpls = mkILMethodImpls mimpls, nestedTypes = emptyILTypeDefs, - implements = ilInterfaceTys, - implementsCustomAttrs = None, + implements = InterruptibleLazy.FromValue(ilInterfaceTys), extends = Some super, additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls @@ -6381,7 +6382,8 @@ and GenObjectExpr cenv cgbuf eenvouter objExpr (baseType, baseValOpt, basecall, let mimpls = mimpls |> List.choose id // choose the ones that actually have method impls let interfaceTys = - interfaceImpls |> List.map (fst >> GenType cenv m eenvinner.tyenv) + interfaceImpls + |> List.map (fst >> GenType cenv m eenvinner.tyenv >> InterfaceImpl.Create) let super = (if isInterfaceTy g baseType then @@ -6390,7 +6392,11 @@ and GenObjectExpr cenv cgbuf eenvouter objExpr (baseType, baseValOpt, basecall, ilCloRetTy) let interfaceTys = - interfaceTys @ (if isInterfaceTy g baseType then [ ilCloRetTy ] else []) + interfaceTys + @ (if isInterfaceTy g baseType then + [ InterfaceImpl.Create(ilCloRetTy) ] + else + []) let cloTypeDefs = GenClosureTypeDefs @@ -6688,8 +6694,7 @@ and GenClosureTypeDefs methods = mkILMethods mdefs, methodImpls = mkILMethodImpls mimpls, nestedTypes = emptyILTypeDefs, - implements = ilIntfTys, - implementsCustomAttrs = None, + implements = InterruptibleLazy.FromValue(ilIntfTys), extends = Some ext, additionalFlags = ILTypeDefAdditionalFlags.None, securityDecls = emptyILSecurityDecls @@ -8558,10 +8563,15 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = let ilFieldDef = mkILStaticField (fspec.Name, fty, None, None, access) + let isDecimalConstant = + match vref.LiteralValue with + | Some(Const.Decimal _) -> true + | _ -> false + let ilFieldDef = match vref.LiteralValue with - | Some konst -> ilFieldDef.WithLiteralDefaultValue(Some(GenFieldInit m konst)) - | None -> ilFieldDef + | Some konst when not isDecimalConstant -> ilFieldDef.WithLiteralDefaultValue(Some(GenFieldInit m konst)) + | _ -> ilFieldDef let ilFieldDef = let isClassInitializer = (cgbuf.MethodName = ".cctor") @@ -8573,6 +8583,7 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = || not isClassInitializer || hasLiteralAttr ) + || isDecimalConstant ) let ilAttribs = @@ -8585,6 +8596,64 @@ and GenBindingAfterDebugPoint cenv cgbuf eenv bind isStateVar startMarkOpt = let ilAttribs = GenAdditionalAttributesForTy g vspec.Type @ ilAttribs + let ilAttribs = + if isDecimalConstant then + match vref.LiteralValue with + | Some(Const.Decimal d) -> + match System.Decimal.GetBits d with + | [| lo; med; hi; signExp |] -> + let scale = (min (((signExp &&& 0xFF0000) >>> 16) &&& 0xFF) 28) |> byte + let sign = if (signExp &&& 0x80000000) <> 0 then 1uy else 0uy + + let attrib = + mkILCustomAttribute ( + g.attrib_DecimalConstantAttribute.TypeRef, + [ + g.ilg.typ_Byte + g.ilg.typ_Byte + g.ilg.typ_Int32 + g.ilg.typ_Int32 + g.ilg.typ_Int32 + ], + [ + ILAttribElem.Byte scale + ILAttribElem.Byte sign + ILAttribElem.UInt32(uint32 hi) + ILAttribElem.UInt32(uint32 med) + ILAttribElem.UInt32(uint32 lo) + ], + [] + ) + + let ilInstrs = + [ + mkLdcInt32 lo + mkLdcInt32 med + mkLdcInt32 hi + mkLdcInt32 (int32 sign) + mkLdcInt32 (int32 scale) + mkNormalNewobj ( + mkILCtorMethSpecForTy ( + fspec.ActualType, + [ + g.ilg.typ_Int32 + g.ilg.typ_Int32 + g.ilg.typ_Int32 + g.ilg.typ_Bool + g.ilg.typ_Byte + ] + ) + ) + mkNormalStsfld fspec + ] + + CG.EmitInstrs cgbuf (pop 0) (Push0) ilInstrs + [ attrib ] + | _ -> failwith "unreachable" + | _ -> failwith "unreachable" + else + ilAttribs + let ilFieldDef = ilFieldDef.With(customAttrs = mkILCustomAttrs (ilAttribs @ [ g.DebuggerBrowsableNeverAttribute ])) @@ -10770,23 +10839,20 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option let ilThisTy = GenType cenv m eenvinner.tyenv thisTy let tref = ilThisTy.TypeRef let ilGenParams = GenGenericParams cenv eenvinner tycon.TyparsNoRange + let checkNullness = g.langFeatureNullness && g.checkNullness let ilIntfTys = tycon.ImmediateInterfaceTypesOfFSharpTycon - |> List.map (GenType cenv m eenvinner.tyenv) - - let ilIntCustomAttrs = - if g.langFeatureNullness && g.checkNullness && not (isNil ilIntfTys) then - tycon.ImmediateInterfaceTypesOfFSharpTycon - |> List.map ( - GenAdditionalAttributesForTy g - >> mkILCustomAttrs - >> ILAttributesStored.Given - >> (fun x -> x, 0) - ) - |> Some - else - None + |> List.map (fun x -> + let ilType = GenType cenv m eenvinner.tyenv x + + let customAttrs = + if checkNullness then + GenAdditionalAttributesForTy g x |> mkILCustomAttrs |> ILAttributesStored.Given + else + emptyILCustomAttrsStored + + InterfaceImpl.Create(ilType, customAttrs)) let ilTypeName = tref.Name @@ -11447,11 +11513,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option .WithSerializable(isSerializable) .WithAbstract(isAbstract) .WithImport(isComInteropTy g thisTy) - .With( - methodImpls = mkILMethodImpls methodImpls, - newAdditionalFlags = additionalFlags, - implementsCustomAttrs = ilIntCustomAttrs - ) + .With(methodImpls = mkILMethodImpls methodImpls, newAdditionalFlags = additionalFlags) let tdLayout, tdEncoding = match TryFindFSharpAttribute g g.attrib_StructLayoutAttribute tycon.Attribs with @@ -11613,8 +11675,7 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) : ILTypeRef option methods = mkILMethods ilMethods, methodImpls = mkILMethodImpls methodImpls, nestedTypes = emptyILTypeDefs, - implements = ilIntfTys, - implementsCustomAttrs = None, + implements = InterruptibleLazy.FromValue(ilIntfTys), extends = Some( if tycon.IsStructOrEnumTycon then @@ -11837,7 +11898,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) : ILTypeRef option = let interfaces = exnc.ImmediateInterfaceTypesOfFSharpTycon - |> List.map (GenType cenv m eenv.tyenv) + |> List.map (GenType cenv m eenv.tyenv >> InterfaceImpl.Create) let tdef = mkILGenericClass ( @@ -12121,7 +12182,7 @@ let LookupGeneratedValue (cenv: cenv) (ctxt: ExecutionContext) eenv (v: Val) = None // Invoke the set_Foo method for a declaration with a value. Used to create variables with values programmatically in fsi.exe. -let SetGeneratedValue (ctxt: ExecutionContext) eenv isForced (v: Val) (value: obj) = +let SetGeneratedValue (ctxt: ExecutionContext) eenv isForced (v: Val) (value: objnull) = try match StorageForVal v.Range v eenv with | StaticPropertyWithField(fspec, _, hasLiteralAttr, _, _, _, _f, ilSetterMethRef, _) -> diff --git a/src/Compiler/CodeGen/IlxGenSupport.fs b/src/Compiler/CodeGen/IlxGenSupport.fs index 073b4473ea9..0e163db4069 100644 --- a/src/Compiler/CodeGen/IlxGenSupport.fs +++ b/src/Compiler/CodeGen/IlxGenSupport.fs @@ -46,7 +46,7 @@ let mkLocalPrivateAttributeWithDefaultConstructor (g: TcGlobals, name: string) = ILTypeDefAccess.Private, ILGenericParameterDefs.Empty, g.ilg.typ_Attribute, - ILTypes.Empty, + [], ilMethods, emptyILFields, emptyILTypeDefs, @@ -140,7 +140,7 @@ let mkLocalPrivateAttributeWithPropertyConstructors ILTypeDefAccess.Private, ILGenericParameterDefs.Empty, g.ilg.typ_Attribute, - ILTypes.Empty, + [], mkILMethods ( ilCtorDef :: (ilElements |> List.fold (fun acc (_, getter, _, _) -> getter @ acc) []) @@ -205,7 +205,7 @@ let mkLocalPrivateAttributeWithByteAndByteArrayConstructors (g: TcGlobals, name: ILTypeDefAccess.Private, ILGenericParameterDefs.Empty, g.ilg.typ_Attribute, - ILTypes.Empty, + [], mkILMethods ([ ilScalarCtorDef; ilArrayCtorDef ]), mkILFields [ fieldDef ], emptyILTypeDefs, @@ -233,7 +233,7 @@ let mkLocalPrivateInt32Enum (g: TcGlobals, tref: ILTypeRef, values: (string * in ILTypeDefAccess.Private, ILGenericParameterDefs.Empty, g.ilg.typ_Enum, - ILTypes.Empty, + [], mkILMethods [], mkILFields enumFields, emptyILTypeDefs, diff --git a/src/Compiler/DependencyManager/DependencyProvider.fs b/src/Compiler/DependencyManager/DependencyProvider.fs index 709899e9a05..a241880e620 100644 --- a/src/Compiler/DependencyManager/DependencyProvider.fs +++ b/src/Compiler/DependencyManager/DependencyProvider.fs @@ -160,19 +160,19 @@ type ReflectionDependencyManagerProvider let instance = if not (isNull (theType.GetConstructor([| typeof; typeof |]))) then - Activator.CreateInstance(theType, [| outputDir :> obj; useResultsCache :> obj |]) + Activator.CreateInstance(theType, [| outputDir :> objnull; useResultsCache :> objnull |]) else - Activator.CreateInstance(theType, [| outputDir :> obj |]) + Activator.CreateInstance(theType, [| outputDir :> objnull |]) - let nameProperty = nameProperty.GetValue >> string - let keyProperty = keyProperty.GetValue >> string + let nameProperty (x: objnull) = x |> nameProperty.GetValue |> string + let keyProperty (x: objnull) = x |> keyProperty.GetValue |> string - let helpMessagesProperty = - let toStringArray (o: obj) = o :?> string[] + let helpMessagesProperty (x: objnull) = + let toStringArray (o: objnull) = o :?> string[] match helpMessagesProperty with - | Some helpMessagesProperty -> helpMessagesProperty.GetValue >> toStringArray - | None -> fun _ -> [||] + | Some helpMessagesProperty -> x |> helpMessagesProperty.GetValue |> toStringArray + | None -> [||] static member InstanceMaker(theType: Type, outputDir: string option, useResultsCache: bool) = match @@ -453,14 +453,18 @@ type ReflectionDependencyManagerProvider None, [||] match method with + | None -> ReflectionDependencyManagerProvider.MakeResultFromFields(false, [||], [||], Seq.empty, Seq.empty, Seq.empty) | Some m -> - let result = m.Invoke(instance, arguments) + match m.Invoke(instance, arguments) with + | null -> ReflectionDependencyManagerProvider.MakeResultFromFields(false, [||], [||], Seq.empty, Seq.empty, Seq.empty) // Verify the number of arguments returned in the tuple returned by resolvedependencies, it can be: // 1 - object with properties // 3 - (bool * string list * string list) // Support legacy api return shape (bool, seq, seq) --- original paket packagemanager - if FSharpType.IsTuple(result.GetType()) then + | result when FSharpType.IsTuple(result.GetType()) |> not -> + ReflectionDependencyManagerProvider.MakeResultFromObject(result) + | result -> // Verify the number of arguments returned in the tuple returned by resolvedependencies, it can be: // 3 - (bool * string list * string list) let success, sourceFiles, packageRoots = @@ -474,10 +478,6 @@ type ReflectionDependencyManagerProvider | _ -> false, seqEmpty, seqEmpty ReflectionDependencyManagerProvider.MakeResultFromFields(success, [||], [||], Seq.empty, sourceFiles, packageRoots) - else - ReflectionDependencyManagerProvider.MakeResultFromObject(result) - - | None -> ReflectionDependencyManagerProvider.MakeResultFromFields(false, [||], [||], Seq.empty, Seq.empty, Seq.empty) /// Provides DependencyManagement functions. /// Class is IDisposable diff --git a/src/Compiler/Driver/CompilerDiagnostics.fs b/src/Compiler/Driver/CompilerDiagnostics.fs index c73b8e5d197..1c50ca26781 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fs +++ b/src/Compiler/Driver/CompilerDiagnostics.fs @@ -24,7 +24,6 @@ open FSharp.Compiler.ConstraintSolver open FSharp.Compiler.DiagnosticMessage open FSharp.Compiler.Diagnostics open FSharp.Compiler.DiagnosticsLogger -open FSharp.Compiler.Features open FSharp.Compiler.Infos open FSharp.Compiler.IO open FSharp.Compiler.Lexhelp @@ -2300,13 +2299,17 @@ type PhasedDiagnostic with // Scoped #nowarn pragmas /// Build an DiagnosticsLogger that delegates to another DiagnosticsLogger but filters warnings turned off by the given pragma declarations +// +// NOTE: we allow a flag to turn of strict file checking. This is because file names sometimes don't match due to use of +// #line directives, e.g. for pars.fs/pars.fsy. In this case we just test by line number - in most cases this is sufficient +// because we install a filtering error handler on a file-by-file basis for parsing and type-checking. +// However this is indicative of a more systematic problem where source-line +// sensitive operations (lexfilter and warning filtering) do not always +// interact well with #line directives. type DiagnosticsLoggerFilteringByScopedPragmas - (langVersion: LanguageVersion, scopedPragmas, diagnosticOptions: FSharpDiagnosticOptions, diagnosticsLogger: DiagnosticsLogger) = + (checkFile, scopedPragmas, diagnosticOptions: FSharpDiagnosticOptions, diagnosticsLogger: DiagnosticsLogger) = inherit DiagnosticsLogger("DiagnosticsLoggerFilteringByScopedPragmas") - let needCompatibilityWithEarlierInconsistentInteraction = - not (langVersion.SupportsFeature LanguageFeature.ConsistentNowarnLineDirectiveInteraction) - let mutable realErrorPresent = false override _.DiagnosticSink(diagnostic: PhasedDiagnostic, severity) = @@ -2320,10 +2323,12 @@ type DiagnosticsLoggerFilteringByScopedPragmas match diagnostic.Range with | Some m -> scopedPragmas - |> List.exists (fun (ScopedPragma.WarningOff(pragmaRange, warningNumFromPragma)) -> + |> List.exists (fun pragma -> + let (ScopedPragma.WarningOff(pragmaRange, warningNumFromPragma)) = pragma + warningNum = warningNumFromPragma - && (needCompatibilityWithEarlierInconsistentInteraction - || m.FileIndex = pragmaRange.FileIndex && posGeq m.Start pragmaRange.Start)) + && (not checkFile || m.FileIndex = pragmaRange.FileIndex) + && posGeq m.Start pragmaRange.Start) |> not | None -> true @@ -2339,5 +2344,5 @@ type DiagnosticsLoggerFilteringByScopedPragmas override _.CheckForRealErrorsIgnoringWarnings = realErrorPresent -let GetDiagnosticsLoggerFilteringByScopedPragmas (langVersion, scopedPragmas, diagnosticOptions, diagnosticsLogger) = - DiagnosticsLoggerFilteringByScopedPragmas(langVersion, scopedPragmas, diagnosticOptions, diagnosticsLogger) :> DiagnosticsLogger +let GetDiagnosticsLoggerFilteringByScopedPragmas (checkFile, scopedPragmas, diagnosticOptions, diagnosticsLogger) = + DiagnosticsLoggerFilteringByScopedPragmas(checkFile, scopedPragmas, diagnosticOptions, diagnosticsLogger) :> DiagnosticsLogger diff --git a/src/Compiler/Driver/CompilerDiagnostics.fsi b/src/Compiler/Driver/CompilerDiagnostics.fsi index 7c5acef17d4..6139da434cf 100644 --- a/src/Compiler/Driver/CompilerDiagnostics.fsi +++ b/src/Compiler/Driver/CompilerDiagnostics.fsi @@ -7,7 +7,6 @@ open System.Text open FSharp.Compiler.CompilerConfig open FSharp.Compiler.Diagnostics open FSharp.Compiler.DiagnosticsLogger -open FSharp.Compiler.Features open FSharp.Compiler.Syntax open FSharp.Compiler.Text @@ -85,7 +84,7 @@ type PhasedDiagnostic with /// Get a diagnostics logger that filters the reporting of warnings based on scoped pragma information val GetDiagnosticsLoggerFilteringByScopedPragmas: - langVersion: LanguageVersion * + checkFile: bool * scopedPragmas: ScopedPragma list * diagnosticOptions: FSharpDiagnosticOptions * diagnosticsLogger: DiagnosticsLogger -> diff --git a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs index c1f6ce8ddb4..5fd190b1995 100644 --- a/src/Compiler/Driver/GraphChecking/FileContentMapping.fs +++ b/src/Compiler/Driver/GraphChecking/FileContentMapping.fs @@ -523,7 +523,7 @@ let visitSynExpr (e: SynExpr) : FileContentEntry list = visit expr (fun exprNodes -> [ yield! exprNodes; yield! List.collect visitSynMatchClause clauses ] |> continuation) - | SynExpr.DoBang(expr, _) -> visit expr continuation + | SynExpr.DoBang(expr = expr) -> visit expr continuation | SynExpr.WhileBang(whileExpr = whileExpr; doExpr = doExpr) -> visit whileExpr (fun whileNodes -> visit doExpr (fun doNodes -> whileNodes @ doNodes |> continuation)) | SynExpr.LibraryOnlyILAssembly(typeArgs = typeArgs; args = args; retTy = retTy) -> diff --git a/src/Compiler/Driver/GraphChecking/Graph.fs b/src/Compiler/Driver/GraphChecking/Graph.fs index 210ca927c7f..6bfb1199181 100644 --- a/src/Compiler/Driver/GraphChecking/Graph.fs +++ b/src/Compiler/Driver/GraphChecking/Graph.fs @@ -83,7 +83,7 @@ module internal Graph = graph |> Seq.iter (fun (KeyValue(file, deps)) -> printfn $"{file} -> {deps |> Array.map nodePrinter |> join}") - let print (graph: Graph<'Node>) : unit = + let print (graph: Graph<'Node> when 'Node: not null) : unit = printCustom graph (fun node -> node.ToString() |> string) let serialiseToMermaid (graph: Graph) = diff --git a/src/Compiler/Driver/GraphChecking/Graph.fsi b/src/Compiler/Driver/GraphChecking/Graph.fsi index a93e429d2fe..2caf421dc54 100644 --- a/src/Compiler/Driver/GraphChecking/Graph.fsi +++ b/src/Compiler/Driver/GraphChecking/Graph.fsi @@ -20,7 +20,7 @@ module internal Graph = /// Create a reverse of the graph. val reverse<'Node when 'Node: equality> : originalGraph: Graph<'Node> -> Graph<'Node> /// Print the contents of the graph to the standard output. - val print: graph: Graph<'Node> -> unit + val print: graph: Graph<'Node> -> unit when 'Node: not null /// Create a simple Mermaid graph val serialiseToMermaid: graph: Graph -> string /// Create a simple Mermaid graph and save it under the path specified. diff --git a/src/Compiler/Driver/ParseAndCheckInputs.fs b/src/Compiler/Driver/ParseAndCheckInputs.fs index d5d18d79651..a6804bfe746 100644 --- a/src/Compiler/Driver/ParseAndCheckInputs.fs +++ b/src/Compiler/Driver/ParseAndCheckInputs.fs @@ -511,7 +511,7 @@ let ParseInput finally // OK, now commit the errors, since the ScopedPragmas will (hopefully) have been scraped let filteringDiagnosticsLogger = - GetDiagnosticsLoggerFilteringByScopedPragmas(lexbuf.LanguageVersion, scopedPragmas, diagnosticOptions, diagnosticsLogger) + GetDiagnosticsLoggerFilteringByScopedPragmas(false, scopedPragmas, diagnosticOptions, diagnosticsLogger) delayLogger.CommitDelayedDiagnostics filteringDiagnosticsLogger @@ -1429,7 +1429,7 @@ let CheckOneInput // Within a file, equip loggers to locally filter w.r.t. scope pragmas in each input let DiagnosticsLoggerForInput (tcConfig: TcConfig, input: ParsedInput, oldLogger) = - GetDiagnosticsLoggerFilteringByScopedPragmas(tcConfig.langVersion, input.ScopedPragmas, tcConfig.diagnosticsOptions, oldLogger) + GetDiagnosticsLoggerFilteringByScopedPragmas(false, input.ScopedPragmas, tcConfig.diagnosticsOptions, oldLogger) /// Typecheck a single file (or interactive entry into F# Interactive) let CheckOneInputEntry (ctok, checkForErrors, tcConfig: TcConfig, tcImports, tcGlobals, prefixPathOpt) tcState input = diff --git a/src/Compiler/Driver/fsc.fs b/src/Compiler/Driver/fsc.fs index 9dccdec826d..ac4ee179538 100644 --- a/src/Compiler/Driver/fsc.fs +++ b/src/Compiler/Driver/fsc.fs @@ -745,7 +745,7 @@ let main2 yield! pragmas ] - GetDiagnosticsLoggerFilteringByScopedPragmas(tcConfig.langVersion, scopedPragmas, tcConfig.diagnosticsOptions, oldLogger) + GetDiagnosticsLoggerFilteringByScopedPragmas(true, scopedPragmas, tcConfig.diagnosticsOptions, oldLogger) SetThreadDiagnosticsLoggerNoUnwind diagnosticsLogger diff --git a/src/Compiler/FSComp.txt b/src/Compiler/FSComp.txt index 2e391fa5515..b5a50afc7c0 100644 --- a/src/Compiler/FSComp.txt +++ b/src/Compiler/FSComp.txt @@ -1783,5 +1783,4 @@ featureEmptyBodiedComputationExpressions,"Support for computation expressions wi featureAllowAccessModifiersToAutoPropertiesGettersAndSetters,"Allow access modifiers to auto properties getters and setters" 3871,tcAccessModifiersNotAllowedInSRTPConstraint,"Access modifiers cannot be applied to an SRTP constraint." featureAllowObjectExpressionWithoutOverrides,"Allow object expressions without overrides" -3872,tcPartialActivePattern,"Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern." -featureConsistentNowarnLineDirectiveInteraction,"The interaction between #nowarn and #line is now consistent." +3872,tcPartialActivePattern,"Multi-case partial active patterns are not supported. Consider using a single-case partial active pattern or a full active pattern." \ No newline at end of file diff --git a/src/Compiler/Facilities/LanguageFeatures.fs b/src/Compiler/Facilities/LanguageFeatures.fs index 5f16aead30a..5c311237594 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fs +++ b/src/Compiler/Facilities/LanguageFeatures.fs @@ -94,7 +94,6 @@ type LanguageFeature = | ParsedHashDirectiveArgumentNonQuotes | EmptyBodiedComputationExpressions | AllowObjectExpressionWithoutOverrides - | ConsistentNowarnLineDirectiveInteraction /// LanguageVersion management type LanguageVersion(versionText) = @@ -213,10 +212,9 @@ type LanguageVersion(versionText) = LanguageFeature.LowerSimpleMappingsInComprehensionsToFastLoops, languageVersion90 LanguageFeature.ParsedHashDirectiveArgumentNonQuotes, languageVersion90 LanguageFeature.EmptyBodiedComputationExpressions, languageVersion90 - LanguageFeature.ConsistentNowarnLineDirectiveInteraction, languageVersion90 + LanguageFeature.EnforceAttributeTargets, languageVersion90 // F# preview - LanguageFeature.EnforceAttributeTargets, previewVersion // waiting for fix of https://github.com/dotnet/fsharp/issues/17731 LanguageFeature.UnmanagedConstraintCsharpInterop, previewVersion // not enabled because: https://github.com/dotnet/fsharp/issues/17509 LanguageFeature.FromEndSlicing, previewVersion // Unfinished features --- needs work LanguageFeature.AllowAccessModifiersToAutoPropertiesGettersAndSetters, previewVersion @@ -377,7 +375,6 @@ type LanguageVersion(versionText) = | LanguageFeature.ParsedHashDirectiveArgumentNonQuotes -> FSComp.SR.featureParsedHashDirectiveArgumentNonString () | LanguageFeature.EmptyBodiedComputationExpressions -> FSComp.SR.featureEmptyBodiedComputationExpressions () | LanguageFeature.AllowObjectExpressionWithoutOverrides -> FSComp.SR.featureAllowObjectExpressionWithoutOverrides () - | LanguageFeature.ConsistentNowarnLineDirectiveInteraction -> FSComp.SR.featureConsistentNowarnLineDirectiveInteraction () /// Get a version string associated with the given feature. static member GetFeatureVersionString feature = diff --git a/src/Compiler/Facilities/LanguageFeatures.fsi b/src/Compiler/Facilities/LanguageFeatures.fsi index 4ae722c7f60..7408300b943 100644 --- a/src/Compiler/Facilities/LanguageFeatures.fsi +++ b/src/Compiler/Facilities/LanguageFeatures.fsi @@ -85,7 +85,6 @@ type LanguageFeature = | ParsedHashDirectiveArgumentNonQuotes | EmptyBodiedComputationExpressions | AllowObjectExpressionWithoutOverrides - | ConsistentNowarnLineDirectiveInteraction /// LanguageVersion management type LanguageVersion = diff --git a/src/Compiler/Facilities/prim-parsing.fs b/src/Compiler/Facilities/prim-parsing.fs index 3088a5579ed..7fb0d7fca41 100644 --- a/src/Compiler/Facilities/prim-parsing.fs +++ b/src/Compiler/Facilities/prim-parsing.fs @@ -14,7 +14,7 @@ exception Accept of obj [] type internal IParseState - (ruleStartPoss: Position[], ruleEndPoss: Position[], lhsPos: Position[], ruleValues: obj[], lexbuf: LexBuffer) = + (ruleStartPoss: Position[], ruleEndPoss: Position[], lhsPos: Position[], ruleValues: objnull[], lexbuf: LexBuffer) = member _.LexBuffer = lexbuf member _.InputRange index = @@ -125,7 +125,7 @@ type Stack<'a>(n) = member buf.PrintStack() = for i = 0 to (count - 1) do - Console.Write("{0}{1}", contents[i], (if i = count - 1 then ":" else "-")) + Console.Write("{0}{1}", contents[i] :> objnull, (if i = count - 1 then ":" else "-")) module Flags = #if DEBUG @@ -151,7 +151,10 @@ module internal Implementation = //------------------------------------------------------------------------- // Read the tables written by FSYACC. - type AssocTable(elemTab: uint16[], offsetTab: uint16[], cache: int[], cacheSize: int) = + type AssocTable(elemTab: uint16[], offsetTab: uint16[], cache: int[]) = + + do Array.fill cache 0 cache.Length -1 + let cacheSize = cache.Length / 2 member t.ReadAssoc(minElemNum, maxElemNum, defaultValueOfAssoc, keyToFind) = // do a binary chop on the table @@ -231,7 +234,7 @@ module internal Implementation = [] [] type ValueInfo = - val value: obj + val value: objnull val startPos: Position val endPos: Position @@ -269,17 +272,12 @@ module internal Implementation = // 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 ruleValues = (Array.zeroCreate 100: objnull[]) let lhsPos = (Array.zeroCreate 2: Position[]) let reductions = tables.reductions let cacheSize = 7919 // the 1000'th prime - // Use a simpler hash table with faster lookup, but only one - // hash bucket per key. let actionTableCache = ArrayPool.Shared.Rent(cacheSize * 2) let gotoTableCache = ArrayPool.Shared.Rent(cacheSize * 2) - // Clear the arrays since ArrayPool does not - Array.Clear(actionTableCache, 0, actionTableCache.Length) - Array.Clear(gotoTableCache, 0, gotoTableCache.Length) use _cacheDisposal = { new IDisposable with @@ -289,10 +287,10 @@ module internal Implementation = } let actionTable = - AssocTable(tables.actionTableElements, tables.actionTableRowOffsets, actionTableCache, cacheSize) + AssocTable(tables.actionTableElements, tables.actionTableRowOffsets, actionTableCache) let gotoTable = - AssocTable(tables.gotos, tables.sparseGotoTableRowOffsets, gotoTableCache, cacheSize) + AssocTable(tables.gotos, tables.sparseGotoTableRowOffsets, gotoTableCache) let stateToProdIdxsTable = IdxToIdxListTable(tables.stateToProdIdxsTableElements, tables.stateToProdIdxsTableRowOffsets) diff --git a/src/Compiler/Interactive/fsi.fs b/src/Compiler/Interactive/fsi.fs index 832327656d9..74fcc37340c 100644 --- a/src/Compiler/Interactive/fsi.fs +++ b/src/Compiler/Interactive/fsi.fs @@ -1675,34 +1675,6 @@ let internal mkBoundValueTypedImpl tcGlobals m moduleName name ty = let qname = QualifiedNameOfFile.QualifiedNameOfFile(Ident(moduleName, m)) entity, v, CheckedImplFile.CheckedImplFile(qname, [], mty, contents, false, false, StampMap.Empty, Map.empty) -let scriptingSymbolsPath = - let createDirectory (path: string) = - lazy - try - if not (Directory.Exists(path)) then - Directory.CreateDirectory(path) |> ignore - - path - with _ -> - path - - createDirectory (Path.Combine(Path.GetTempPath(), $"{DateTime.Now:s}-{Guid.NewGuid():n}".Replace(':', '-'))) - -let deleteScriptingSymbols () = - try -#if !DEBUG - if scriptingSymbolsPath.IsValueCreated then - if Directory.Exists(scriptingSymbolsPath.Value) then - Directory.Delete(scriptingSymbolsPath.Value, true) -#else - () -#endif - with _ -> - () - -AppDomain.CurrentDomain.ProcessExit -|> Event.add (fun _ -> deleteScriptingSymbols ()) - let dynamicCcuName = "FSI-ASSEMBLY" /// Encapsulates the coordination of the typechecking, optimization and code generation @@ -1764,6 +1736,33 @@ type internal FsiDynamicCompiler let reportedAssemblies = Dictionary() + let scriptingSymbolsPath = + let createDirectory (path: string) = + try + if not (Directory.Exists(path)) then + Directory.CreateDirectory(path) |> ignore + + path + with _ -> + path + + createDirectory (Path.Combine(Path.GetTempPath(), $"{DateTime.Now:s}-{Guid.NewGuid():n}".Replace(':', '-'))) + + let deleteScriptingSymbols () = + try +#if !DEBUG + if Directory.Exists(scriptingSymbolsPath) then + Directory.Delete(scriptingSymbolsPath, true) +#else + () +#endif + with _ -> + () + + do + AppDomain.CurrentDomain.ProcessExit + |> Event.add (fun _ -> deleteScriptingSymbols ()) + /// Add attributes let CreateModuleFragment (tcConfigB: TcConfigBuilder, dynamicCcuName, codegenResults) = if progress then @@ -1841,7 +1840,7 @@ type internal FsiDynamicCompiler { ilg = tcGlobals.ilg outfile = $"{multiAssemblyName}-{dynamicAssemblyId}.dll" - pdbfile = Some(Path.Combine(scriptingSymbolsPath.Value, $"{multiAssemblyName}-{dynamicAssemblyId}.pdb")) + pdbfile = Some(Path.Combine(scriptingSymbolsPath, $"{multiAssemblyName}-{dynamicAssemblyId}.pdb")) emitTailcalls = tcConfig.emitTailcalls deterministic = tcConfig.deterministic portablePDB = true @@ -4694,7 +4693,7 @@ type FsiEvaluationSession let lexResourceManager = LexResourceManager() /// The lock stops the type checker running at the same time as the server intellisense implementation. - let tcLockObject = box 7 // any new object will do + let tcLockObject = box 7 |> Unchecked.nonNull // any new object will do let resolveAssemblyRef (aref: ILAssemblyRef) = // Explanation: This callback is invoked during compilation to resolve assembly references diff --git a/src/Compiler/Service/BackgroundCompiler.fs b/src/Compiler/Service/BackgroundCompiler.fs index a2f5457b1b6..1089f5774e8 100644 --- a/src/Compiler/Service/BackgroundCompiler.fs +++ b/src/Compiler/Service/BackgroundCompiler.fs @@ -266,8 +266,7 @@ type internal BackgroundCompiler parallelReferenceResolution, captureIdentifiersWhenParsing, getSource: (string -> Async) option, - useChangeNotifications, - useSyntaxTreeCache + useChangeNotifications ) as self = let beforeFileChecked = Event() @@ -403,8 +402,7 @@ type internal BackgroundCompiler parallelReferenceResolution, captureIdentifiersWhenParsing, getSource, - useChangeNotifications, - useSyntaxTreeCache + useChangeNotifications ) match builderOpt with diff --git a/src/Compiler/Service/BackgroundCompiler.fsi b/src/Compiler/Service/BackgroundCompiler.fsi index 9ca174a5686..d93ece6217b 100644 --- a/src/Compiler/Service/BackgroundCompiler.fsi +++ b/src/Compiler/Service/BackgroundCompiler.fsi @@ -235,8 +235,7 @@ type internal BackgroundCompiler = parallelReferenceResolution: ParallelReferenceResolution * captureIdentifiersWhenParsing: bool * getSource: (string -> Async) option * - useChangeNotifications: bool * - useSyntaxTreeCache: bool -> + useChangeNotifications: bool -> BackgroundCompiler static member ActualCheckFileCount: int diff --git a/src/Compiler/Service/FSharpParseFileResults.fs b/src/Compiler/Service/FSharpParseFileResults.fs index 34958588b79..2623cbde347 100644 --- a/src/Compiler/Service/FSharpParseFileResults.fs +++ b/src/Compiler/Service/FSharpParseFileResults.fs @@ -573,12 +573,12 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput, yield! checkRange m yield! walkExpr isControlFlow innerExpr - | SynExpr.YieldOrReturn(_, e, m) -> + | SynExpr.YieldOrReturn(_, e, m, _) -> yield! checkRange m yield! walkExpr false e - | SynExpr.YieldOrReturnFrom(_, e, _) - | SynExpr.DoBang(e, _) -> + | SynExpr.YieldOrReturnFrom(_, e, _, _) + | SynExpr.DoBang(expr = e) -> yield! checkRange e.Range yield! walkExpr false e diff --git a/src/Compiler/Service/IncrementalBuild.fs b/src/Compiler/Service/IncrementalBuild.fs index 7951f3c9328..29059b4873b 100644 --- a/src/Compiler/Service/IncrementalBuild.fs +++ b/src/Compiler/Service/IncrementalBuild.fs @@ -259,7 +259,7 @@ type BoundModel private ( IncrementalBuilderEventTesting.MRU.Add(IncrementalBuilderEventTesting.IBETypechecked fileName) let capturingDiagnosticsLogger = CapturingDiagnosticsLogger("TypeCheck") - let diagnosticsLogger = GetDiagnosticsLoggerFilteringByScopedPragmas(tcConfig.langVersion, input.ScopedPragmas, tcConfig.diagnosticsOptions, capturingDiagnosticsLogger) + let diagnosticsLogger = GetDiagnosticsLoggerFilteringByScopedPragmas(false, input.ScopedPragmas, tcConfig.diagnosticsOptions, capturingDiagnosticsLogger) use _ = new CompilationGlobalsScope(diagnosticsLogger, BuildPhase.TypeCheck) beforeFileChecked.Trigger fileName @@ -507,10 +507,12 @@ type FrameworkImportsCache(size) = let frameworkTcImportsCache = AgedLookup>(size, areSimilar=(fun (x, y) -> x = y)) /// Reduce the size of the cache in low-memory scenarios - member _.Downsize() = frameworkTcImportsCache.Resize(AnyCallerThread, newKeepStrongly=0) + member _.Downsize() = lock gate <| fun () -> + frameworkTcImportsCache.Resize(AnyCallerThread, newKeepStrongly=0) /// Clear the cache - member _.Clear() = frameworkTcImportsCache.Clear AnyCallerThread + member _.Clear() = lock gate <| fun () -> + frameworkTcImportsCache.Clear AnyCallerThread /// This function strips the "System" assemblies from the tcConfig and returns a age-cached TcImports for them. member _.GetNode(tcConfig: TcConfig, frameworkDLLs: AssemblyResolution list, nonFrameworkResolutions: AssemblyResolution list) = @@ -886,7 +888,6 @@ type IncrementalBuilderInitialState = defaultTimeStamp: DateTime mutable isImportsInvalidated: bool useChangeNotifications: bool - useSyntaxTreeCache: bool } static member Create @@ -908,8 +909,7 @@ type IncrementalBuilderInitialState = #endif allDependencies, defaultTimeStamp: DateTime, - useChangeNotifications: bool, - useSyntaxTreeCache + useChangeNotifications: bool ) = let initialState = @@ -935,7 +935,6 @@ type IncrementalBuilderInitialState = defaultTimeStamp = defaultTimeStamp isImportsInvalidated = false useChangeNotifications = useChangeNotifications - useSyntaxTreeCache = useSyntaxTreeCache } #if !NO_TYPEPROVIDERS importsInvalidatedByTypeProvider.Publish.Add(fun () -> initialState.isImportsInvalidated <- true) @@ -1407,8 +1406,7 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc parallelReferenceResolution, captureIdentifiersWhenParsing, getSource, - useChangeNotifications, - useSyntaxTreeCache + useChangeNotifications ) = let useSimpleResolutionSwitch = "--simpleresolution" @@ -1650,8 +1648,7 @@ type IncrementalBuilder(initialState: IncrementalBuilderInitialState, state: Inc #endif allDependencies, defaultTimeStamp, - useChangeNotifications, - useSyntaxTreeCache + useChangeNotifications ) let builder = IncrementalBuilder(initialState, IncrementalBuilderState.Create(initialState)) diff --git a/src/Compiler/Service/IncrementalBuild.fsi b/src/Compiler/Service/IncrementalBuild.fsi index 21b2fb23404..0f8ed5582da 100644 --- a/src/Compiler/Service/IncrementalBuild.fsi +++ b/src/Compiler/Service/IncrementalBuild.fsi @@ -296,8 +296,7 @@ type internal IncrementalBuilder = parallelReferenceResolution: ParallelReferenceResolution * captureIdentifiersWhenParsing: bool * getSource: (string -> Async) option * - useChangeNotifications: bool * - useSyntaxTreeCache: bool -> + useChangeNotifications: bool -> Async /// Generalized Incremental Builder. This is exposed only for unit testing purposes. diff --git a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs index d691e002c0a..f0ddc777b14 100644 --- a/src/Compiler/Service/ServiceInterfaceStubGenerator.fs +++ b/src/Compiler/Service/ServiceInterfaceStubGenerator.fs @@ -952,9 +952,9 @@ module InterfaceStubGenerator = | SynExpr.Null _range | SynExpr.ImplicitZero _range -> None - | SynExpr.YieldOrReturn(_, synExpr, _range) - | SynExpr.YieldOrReturnFrom(_, synExpr, _range) - | SynExpr.DoBang(synExpr, _range) -> walkExpr synExpr + | SynExpr.YieldOrReturn(expr = synExpr) + | SynExpr.YieldOrReturnFrom(expr = synExpr) + | SynExpr.DoBang(expr = synExpr) -> walkExpr synExpr | SynExpr.LetOrUseBang(rhs = synExpr1; andBangs = synExprAndBangs; body = synExpr2) -> [ diff --git a/src/Compiler/Service/ServiceStructure.fs b/src/Compiler/Service/ServiceStructure.fs index 1d0f7c7f8ec..5fab5ef9eb5 100644 --- a/src/Compiler/Service/ServiceStructure.fs +++ b/src/Compiler/Service/ServiceStructure.fs @@ -246,15 +246,15 @@ module Structure = rcheck Scope.New Collapse.Below r e.Range parseExpr e - | SynExpr.YieldOrReturn(_, e, r) -> + | SynExpr.YieldOrReturn(_, e, r, _) -> rcheck Scope.YieldOrReturn Collapse.Below r r parseExpr e - | SynExpr.YieldOrReturnFrom(_, e, r) -> + | SynExpr.YieldOrReturnFrom(_, e, r, _) -> rcheck Scope.YieldOrReturnBang Collapse.Below r r parseExpr e - | SynExpr.DoBang(e, r) -> + | SynExpr.DoBang(expr = e; range = r) -> rcheck Scope.Do Collapse.Below r <| Range.modStart 3 r parseExpr e diff --git a/src/Compiler/Service/TransparentCompiler.fs b/src/Compiler/Service/TransparentCompiler.fs index 735a6b241f1..5158ac7f25c 100644 --- a/src/Compiler/Service/TransparentCompiler.fs +++ b/src/Compiler/Service/TransparentCompiler.fs @@ -326,8 +326,7 @@ type internal TransparentCompiler parallelReferenceResolution, captureIdentifiersWhenParsing, getSource: (string -> Async) option, - useChangeNotifications, - useSyntaxTreeCache + useChangeNotifications ) as self = let documentSource = @@ -374,8 +373,7 @@ type internal TransparentCompiler parallelReferenceResolution, captureIdentifiersWhenParsing, getSource, - useChangeNotifications, - useSyntaxTreeCache + useChangeNotifications ) :> IBackgroundCompiler @@ -1303,12 +1301,7 @@ type internal TransparentCompiler let diagnosticsLogger = errHandler.DiagnosticsLogger let diagnosticsLogger = - GetDiagnosticsLoggerFilteringByScopedPragmas( - tcConfig.langVersion, - input.ScopedPragmas, - tcConfig.diagnosticsOptions, - diagnosticsLogger - ) + GetDiagnosticsLoggerFilteringByScopedPragmas(false, input.ScopedPragmas, tcConfig.diagnosticsOptions, diagnosticsLogger) use _ = new CompilationGlobalsScope(diagnosticsLogger, BuildPhase.TypeCheck) diff --git a/src/Compiler/Service/TransparentCompiler.fsi b/src/Compiler/Service/TransparentCompiler.fsi index be1f5ab64fa..7746445c0af 100644 --- a/src/Compiler/Service/TransparentCompiler.fsi +++ b/src/Compiler/Service/TransparentCompiler.fsi @@ -155,8 +155,7 @@ type internal TransparentCompiler = parallelReferenceResolution: ParallelReferenceResolution * captureIdentifiersWhenParsing: bool * getSource: (string -> Async) option * - useChangeNotifications: bool * - useSyntaxTreeCache: bool -> + useChangeNotifications: bool -> TransparentCompiler member FindReferencesInFile: diff --git a/src/Compiler/Service/service.fs b/src/Compiler/Service/service.fs index 2c915870f84..525faf3be3d 100644 --- a/src/Compiler/Service/service.fs +++ b/src/Compiler/Service/service.fs @@ -125,7 +125,6 @@ type FSharpChecker captureIdentifiersWhenParsing, getSource, useChangeNotifications, - useSyntaxTreeCache, useTransparentCompiler ) = @@ -144,8 +143,7 @@ type FSharpChecker parallelReferenceResolution, captureIdentifiersWhenParsing, getSource, - useChangeNotifications, - useSyntaxTreeCache + useChangeNotifications ) :> IBackgroundCompiler else @@ -162,8 +160,7 @@ type FSharpChecker parallelReferenceResolution, captureIdentifiersWhenParsing, getSource, - useChangeNotifications, - useSyntaxTreeCache + useChangeNotifications ) :> IBackgroundCompiler @@ -209,7 +206,6 @@ type FSharpChecker ?parallelReferenceResolution: bool, ?captureIdentifiersWhenParsing: bool, ?documentSource: DocumentSource, - ?useSyntaxTreeCache: bool, ?useTransparentCompiler: bool ) = @@ -238,8 +234,6 @@ type FSharpChecker | Some(DocumentSource.Custom _) -> true | _ -> false - let useSyntaxTreeCache = defaultArg useSyntaxTreeCache true - if keepAssemblyContents && enablePartialTypeChecking then invalidArg "enablePartialTypeChecking" "'keepAssemblyContents' and 'enablePartialTypeChecking' cannot be both enabled." @@ -261,7 +255,6 @@ type FSharpChecker | Some(DocumentSource.Custom f) -> Some f | _ -> None), useChangeNotifications, - useSyntaxTreeCache, useTransparentCompiler ) diff --git a/src/Compiler/Service/service.fsi b/src/Compiler/Service/service.fsi index 0a6c601344c..0e48a0d6360 100644 --- a/src/Compiler/Service/service.fsi +++ b/src/Compiler/Service/service.fsi @@ -38,7 +38,6 @@ type public FSharpChecker = /// Indicates whether to resolve references in parallel. /// When set to true we create a set of all identifiers for each parsed file which can be used to speed up finding references. /// Default: FileSystem. You can use Custom source to provide a function that will return the source for a given file path instead of reading it from the file system. Note that with this option the FSharpChecker will also not monitor the file system for file changes. It will expect to be notified of changes via the NotifyFileChanged method. - /// Default: true. Indicates whether to keep parsing results in a cache. /// Default: false. Indicates whether we use a new experimental background compiler. This does not yet support all features static member Create: ?projectCacheSize: int * @@ -54,8 +53,6 @@ type public FSharpChecker = ?captureIdentifiersWhenParsing: bool * [] ?documentSource: DocumentSource * - [] ?useSyntaxTreeCache: - bool * [] ?useTransparentCompiler: bool -> FSharpChecker diff --git a/src/Compiler/Symbols/Exprs.fs b/src/Compiler/Symbols/Exprs.fs index 15b1bb2a3f6..91480597cc2 100644 --- a/src/Compiler/Symbols/Exprs.fs +++ b/src/Compiler/Symbols/Exprs.fs @@ -121,7 +121,7 @@ type E = | ValueSet of FSharpMemberOrFunctionOrValue * FSharpExpr | Unused | DefaultValue of FSharpType - | Const of obj * FSharpType + | Const of objnull * FSharpType | AddressOf of FSharpExpr | Sequential of FSharpExpr * FSharpExpr | IntegerForLoop of FSharpExpr * FSharpExpr * FSharpExpr * bool * DebugPointAtFor * DebugPointAtInOrTo diff --git a/src/Compiler/SyntaxTree/ParseHelpers.fs b/src/Compiler/SyntaxTree/ParseHelpers.fs index 22c27eeb9b0..8d62a724972 100644 --- a/src/Compiler/SyntaxTree/ParseHelpers.fs +++ b/src/Compiler/SyntaxTree/ParseHelpers.fs @@ -108,7 +108,7 @@ module LexbufLocalXmlDocStore = |> unbox let ClearXmlDoc (lexbuf: Lexbuf) = - lexbuf.BufferLocalStore[xmlDocKey] <- box (XmlDocCollector()) + lexbuf.BufferLocalStore[xmlDocKey] <- box (XmlDocCollector()) |> Unchecked.nonNull /// Called from the lexer to save a single line of XML doc comment. let SaveXmlDocLine (lexbuf: Lexbuf, lineText, range: range) = diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fs b/src/Compiler/SyntaxTree/SyntaxTree.fs index 962188c2f21..fc0c811e55d 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fs +++ b/src/Compiler/SyntaxTree/SyntaxTree.fs @@ -704,9 +704,9 @@ type SynExpr = | SequentialOrImplicitYield of debugPoint: DebugPointAtSequential * expr1: SynExpr * expr2: SynExpr * ifNotStmt: SynExpr * range: range - | YieldOrReturn of flags: (bool * bool) * expr: SynExpr * range: range + | YieldOrReturn of flags: (bool * bool) * expr: SynExpr * range: range * trivia: SynExprYieldOrReturnTrivia - | YieldOrReturnFrom of flags: (bool * bool) * expr: SynExpr * range: range + | YieldOrReturnFrom of flags: (bool * bool) * expr: SynExpr * range: range * trivia: SynExprYieldOrReturnFromTrivia | LetOrUseBang of bindDebugPoint: DebugPointAtBinding * @@ -726,7 +726,7 @@ type SynExpr = range: range * trivia: SynExprMatchBangTrivia - | DoBang of expr: SynExpr * range: range + | DoBang of expr: SynExpr * range: range * trivia: SynExprDoBangTrivia | WhileBang of whileDebugPoint: DebugPointAtWhile * whileExpr: SynExpr * doExpr: SynExpr * range: range diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi index f2c75d8dfac..45b03ad3b75 100644 --- a/src/Compiler/SyntaxTree/SyntaxTree.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi @@ -877,12 +877,12 @@ type SynExpr = /// F# syntax: yield expr /// F# syntax: return expr /// Computation expressions only - | YieldOrReturn of flags: (bool * bool) * expr: SynExpr * range: range + | YieldOrReturn of flags: (bool * bool) * expr: SynExpr * range: range * trivia: SynExprYieldOrReturnTrivia /// F# syntax: yield! expr /// F# syntax: return! expr /// Computation expressions only - | YieldOrReturnFrom of flags: (bool * bool) * expr: SynExpr * range: range + | YieldOrReturnFrom of flags: (bool * bool) * expr: SynExpr * range: range * trivia: SynExprYieldOrReturnFromTrivia /// F# syntax: let! pat = expr in expr /// F# syntax: use! pat = expr in expr @@ -909,7 +909,7 @@ type SynExpr = /// F# syntax: do! expr /// Computation expressions only - | DoBang of expr: SynExpr * range: range + | DoBang of expr: SynExpr * range: range * trivia: SynExprDoBangTrivia /// F# syntax: 'while! ... do ...' | WhileBang of whileDebugPoint: DebugPointAtWhile * whileExpr: SynExpr * doExpr: SynExpr * range: range diff --git a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs index dc08afd6368..8dc46313341 100644 --- a/src/Compiler/SyntaxTree/SyntaxTreeOps.fs +++ b/src/Compiler/SyntaxTree/SyntaxTreeOps.fs @@ -883,9 +883,9 @@ let rec synExprContainsError inpExpr = | SynExpr.InferredDowncast(e, _) | SynExpr.Lazy(e, _) | SynExpr.TraitCall(_, _, e, _) - | SynExpr.YieldOrReturn(_, e, _) - | SynExpr.YieldOrReturnFrom(_, e, _) - | SynExpr.DoBang(e, _) + | SynExpr.YieldOrReturn(_, e, _, _) + | SynExpr.YieldOrReturnFrom(_, e, _, _) + | SynExpr.DoBang(e, _, _) | SynExpr.Fixed(e, _) | SynExpr.DebugPoint(_, _, e) | SynExpr.Paren(e, _, _, _) -> walkExpr e diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fs b/src/Compiler/SyntaxTree/SyntaxTrivia.fs index 0932befd7c1..10aee262292 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fs +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fs @@ -93,10 +93,15 @@ type SynExprLetOrUseTrivia = [] type SynExprLetOrUseBangTrivia = { + LetOrUseBangKeyword: range EqualsRange: range option } - static member Zero: SynExprLetOrUseBangTrivia = { EqualsRange = None } + static member Zero: SynExprLetOrUseBangTrivia = + { + LetOrUseBangKeyword = Range.Zero + EqualsRange = None + } [] type SynExprMatchTrivia = @@ -112,6 +117,28 @@ type SynExprMatchBangTrivia = WithKeyword: range } +[] +type SynExprYieldOrReturnTrivia = + { + YieldOrReturnKeyword: range + } + + static member Zero: SynExprYieldOrReturnTrivia = { YieldOrReturnKeyword = Range.Zero } + +[] +type SynExprYieldOrReturnFromTrivia = + { + YieldOrReturnFromKeyword: range + } + + static member Zero: SynExprYieldOrReturnFromTrivia = + { + YieldOrReturnFromKeyword = Range.Zero + } + +[] +type SynExprDoBangTrivia = { DoBangKeyword: range } + [] type SynExprAnonRecdTrivia = { OpeningBraceRange: range } diff --git a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi index 24bfc1b7a52..fff834beb41 100644 --- a/src/Compiler/SyntaxTree/SyntaxTrivia.fsi +++ b/src/Compiler/SyntaxTree/SyntaxTrivia.fsi @@ -139,6 +139,8 @@ type SynExprLetOrUseTrivia = [] type SynExprLetOrUseBangTrivia = { + /// The syntax range of the `let!` or `use!` keyword. + LetOrUseBangKeyword: range /// The syntax range of the `=` token. EqualsRange: range option } @@ -167,6 +169,32 @@ type SynExprMatchBangTrivia = WithKeyword: range } +/// Represents additional information for SynExpr.DoBang +[] +type SynExprDoBangTrivia = + { + /// The syntax range of the `do!` keyword + DoBangKeyword: range + } + +/// Represents additional information for SynExpr.YieldOrReturn +[] +type SynExprYieldOrReturnTrivia = + { + /// The syntax range of the `yield` or `return` keyword. + YieldOrReturnKeyword: range + } + + static member Zero: SynExprYieldOrReturnTrivia + +/// Represents additional information for SynExpr.YieldOrReturnFrom +[] +type SynExprYieldOrReturnFromTrivia = + { + /// The syntax range of the `yield!` or `return!` keyword. + YieldOrReturnFromKeyword: range + } + /// Represents additional information for SynExpr.AnonRecd [] type SynExprAnonRecdTrivia = diff --git a/src/Compiler/TypedTree/TcGlobals.fs b/src/Compiler/TypedTree/TcGlobals.fs index 2c065437f2b..531ef79d264 100644 --- a/src/Compiler/TypedTree/TcGlobals.fs +++ b/src/Compiler/TypedTree/TcGlobals.fs @@ -1490,6 +1490,7 @@ type TcGlobals( member val attrib_CallerFilePathAttribute = findSysAttrib "System.Runtime.CompilerServices.CallerFilePathAttribute" member val attrib_CallerMemberNameAttribute = findSysAttrib "System.Runtime.CompilerServices.CallerMemberNameAttribute" member val attrib_SkipLocalsInitAttribute = findSysAttrib "System.Runtime.CompilerServices.SkipLocalsInitAttribute" + member val attrib_DecimalConstantAttribute = findSysAttrib "System.Runtime.CompilerServices.DecimalConstantAttribute" member val attribs_Unsupported = v_attribs_Unsupported member val attrib_ProjectionParameterAttribute = mk_MFCore_attrib "ProjectionParameterAttribute" diff --git a/src/Compiler/TypedTree/TcGlobals.fsi b/src/Compiler/TypedTree/TcGlobals.fsi index 950d5217500..b7d5a892d06 100644 --- a/src/Compiler/TypedTree/TcGlobals.fsi +++ b/src/Compiler/TypedTree/TcGlobals.fsi @@ -474,6 +474,8 @@ type internal TcGlobals = member attrib_SkipLocalsInitAttribute: BuiltinAttribInfo + member attrib_DecimalConstantAttribute: BuiltinAttribInfo + member attrib_StructAttribute: BuiltinAttribInfo member attrib_StructLayoutAttribute: BuiltinAttribInfo diff --git a/src/Compiler/TypedTree/TypeProviders.fs b/src/Compiler/TypedTree/TypeProviders.fs index 78baba4ee9d..5c81312e135 100644 --- a/src/Compiler/TypedTree/TypeProviders.fs +++ b/src/Compiler/TypedTree/TypeProviders.fs @@ -979,7 +979,7 @@ type ProvidedExprType = | ProvidedTryFinallyExpr of ProvidedExpr * ProvidedExpr | ProvidedLambdaExpr of ProvidedVar * ProvidedExpr | ProvidedCallExpr of ProvidedExpr option * ProvidedMethodInfo * ProvidedExpr[] - | ProvidedConstantExpr of obj * ProvidedType + | ProvidedConstantExpr of objnull * ProvidedType | ProvidedDefaultExpr of ProvidedType | ProvidedNewTupleExpr of ProvidedExpr[] | ProvidedTupleGetExpr of ProvidedExpr * int diff --git a/src/Compiler/TypedTree/TypedTreeOps.fs b/src/Compiler/TypedTree/TypedTreeOps.fs index e7c4576b24e..71f26dbf95b 100644 --- a/src/Compiler/TypedTree/TypedTreeOps.fs +++ b/src/Compiler/TypedTree/TypedTreeOps.fs @@ -1853,7 +1853,20 @@ let isArray1DTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) - let isUnitTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tyconRefEq g g.unit_tcr_canon tcref | _ -> false) -let isObjTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tyconRefEq g g.system_Object_tcref tcref | _ -> false) +let isObjTyAnyNullness g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tyconRefEq g g.system_Object_tcref tcref | _ -> false) + +let isObjNullTy g ty = + ty + |> stripTyEqns g + |> (function TType_app(tcref, _, n) when (not g.checkNullness) || (n.TryEvaluate() <> ValueSome(NullnessInfo.WithoutNull)) + -> tyconRefEq g g.system_Object_tcref tcref | _ -> false) + +let isObjTyWithoutNull (g:TcGlobals) ty = + g.checkNullness && + ty + |> stripTyEqns g + |> (function TType_app(tcref, _, n) when (n.TryEvaluate() = ValueSome(NullnessInfo.WithoutNull)) + -> tyconRefEq g g.system_Object_tcref tcref | _ -> false) let isValueTypeTy g ty = ty |> stripTyEqns g |> (function TType_app(tcref, _, _) -> tyconRefEq g g.system_Value_tcref tcref | _ -> false) @@ -10020,7 +10033,7 @@ let EvalArithUnOp (opInt8, opInt16, opInt32, opInt64, opUInt8, opUInt16, opUInt3 | _ -> error (Error ( FSComp.SR.tastNotAConstantExpression(), m)) with :? System.OverflowException -> error (Error ( FSComp.SR.tastConstantExpressionOverflow(), m)) -let EvalArithBinOp (opInt8, opInt16, opInt32, opInt64, opUInt8, opUInt16, opUInt32, opUInt64, opSingle, opDouble) (arg1: Expr) (arg2: Expr) = +let EvalArithBinOp (opInt8, opInt16, opInt32, opInt64, opUInt8, opUInt16, opUInt32, opUInt64, opSingle, opDouble, opDecimal) (arg1: Expr) (arg2: Expr) = // At compile-time we check arithmetic let m = unionRanges arg1.Range arg2.Range try @@ -10035,6 +10048,7 @@ let EvalArithBinOp (opInt8, opInt16, opInt32, opInt64, opUInt8, opUInt16, opUInt | Expr.Const (Const.UInt64 x1, _, ty), Expr.Const (Const.UInt64 x2, _, _) -> Expr.Const (Const.UInt64 (opUInt64 x1 x2), m, ty) | Expr.Const (Const.Single x1, _, ty), Expr.Const (Const.Single x2, _, _) -> Expr.Const (Const.Single (opSingle x1 x2), m, ty) | Expr.Const (Const.Double x1, _, ty), Expr.Const (Const.Double x2, _, _) -> Expr.Const (Const.Double (opDouble x1 x2), m, ty) + | Expr.Const (Const.Decimal x1, _, ty), Expr.Const (Const.Decimal x2, _, _) -> Expr.Const (Const.Decimal (opDecimal x1 x2), m, ty) | _ -> error (Error ( FSComp.SR.tastNotAConstantExpression(), m)) with :? System.OverflowException -> error (Error ( FSComp.SR.tastConstantExpressionOverflow(), m)) @@ -10066,9 +10080,10 @@ let rec EvalAttribArgExpr suppressLangFeatureCheck (g: TcGlobals) (x: Expr) = | Const.Single _ | Const.Char _ | Const.Zero - | Const.String _ -> + | Const.String _ + | Const.Decimal _ -> x - | Const.Decimal _ | Const.IntPtr _ | Const.UIntPtr _ | Const.Unit -> + | Const.IntPtr _ | Const.UIntPtr _ | Const.Unit -> errorR (Error ( FSComp.SR.tastNotAConstantExpression(), m)) x @@ -10084,7 +10099,7 @@ let rec EvalAttribArgExpr suppressLangFeatureCheck (g: TcGlobals) (x: Expr) = match v1 with | IntegerConstExpr -> - EvalArithBinOp ((|||), (|||), (|||), (|||), (|||), (|||), (|||), (|||), ignore2, ignore2) v1 (EvalAttribArgExpr suppressLangFeatureCheck g arg2) + EvalArithBinOp ((|||), (|||), (|||), (|||), (|||), (|||), (|||), (|||), ignore2, ignore2, ignore2) v1 (EvalAttribArgExpr suppressLangFeatureCheck g arg2) | _ -> errorR (Error ( FSComp.SR.tastNotAConstantExpression(), x.Range)) x @@ -10099,7 +10114,7 @@ let rec EvalAttribArgExpr suppressLangFeatureCheck (g: TcGlobals) (x: Expr) = Expr.Const (Const.Char (x1 + x2), m, ty) | _ -> checkFeature() - EvalArithBinOp (Checked.(+), Checked.(+), Checked.(+), Checked.(+), Checked.(+), Checked.(+), Checked.(+), Checked.(+), Checked.(+), Checked.(+)) v1 v2 + EvalArithBinOp (Checked.(+), Checked.(+), Checked.(+), Checked.(+), Checked.(+), Checked.(+), Checked.(+), Checked.(+), Checked.(+), Checked.(+), Checked.(+)) v1 v2 | SpecificBinopExpr g g.unchecked_subtraction_vref (arg1, arg2) -> checkFeature() let v1, v2 = EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg1, EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2 @@ -10108,16 +10123,16 @@ let rec EvalAttribArgExpr suppressLangFeatureCheck (g: TcGlobals) (x: Expr) = | Expr.Const (Const.Char x1, m, ty), Expr.Const (Const.Char x2, _, _) -> Expr.Const (Const.Char (x1 - x2), m, ty) | _ -> - EvalArithBinOp (Checked.(-), Checked.(-), Checked.(-), Checked.(-), Checked.(-), Checked.(-), Checked.(-), Checked.(-), Checked.(-), Checked.(-)) v1 v2 + EvalArithBinOp (Checked.(-), Checked.(-), Checked.(-), Checked.(-), Checked.(-), Checked.(-), Checked.(-), Checked.(-), Checked.(-), Checked.(-), Checked.(-)) v1 v2 | SpecificBinopExpr g g.unchecked_multiply_vref (arg1, arg2) -> checkFeature() - EvalArithBinOp (Checked.(*), Checked.(*), Checked.(*), Checked.(*), Checked.(*), Checked.(*), Checked.(*), Checked.(*), Checked.(*), Checked.(*)) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg1) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2) + EvalArithBinOp (Checked.(*), Checked.(*), Checked.(*), Checked.(*), Checked.(*), Checked.(*), Checked.(*), Checked.(*), Checked.(*), Checked.(*), Checked.(*)) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg1) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2) | SpecificBinopExpr g g.unchecked_division_vref (arg1, arg2) -> checkFeature() - EvalArithBinOp ((/), (/), (/), (/), (/), (/), (/), (/), (/), (/)) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg1) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2) + EvalArithBinOp ((/), (/), (/), (/), (/), (/), (/), (/), (/), (/), (/)) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg1) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2) | SpecificBinopExpr g g.unchecked_modulus_vref (arg1, arg2) -> checkFeature() - EvalArithBinOp ((%), (%), (%), (%), (%), (%), (%), (%), (%), (%)) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg1) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2) + EvalArithBinOp ((%), (%), (%), (%), (%), (%), (%), (%), (%), (%), (%)) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg1) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2) | SpecificBinopExpr g g.bitwise_shift_left_vref (arg1, arg2) -> checkFeature() EvalArithShiftOp ((<<<), (<<<), (<<<), (<<<), (<<<), (<<<), (<<<), (<<<)) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg1) (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2) @@ -10130,7 +10145,7 @@ let rec EvalAttribArgExpr suppressLangFeatureCheck (g: TcGlobals) (x: Expr) = match v1 with | IntegerConstExpr -> - EvalArithBinOp ((&&&), (&&&), (&&&), (&&&), (&&&), (&&&), (&&&), (&&&), ignore2, ignore2) v1 (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2) + EvalArithBinOp ((&&&), (&&&), (&&&), (&&&), (&&&), (&&&), (&&&), (&&&), ignore2, ignore2, ignore2) v1 (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2) | _ -> errorR (Error ( FSComp.SR.tastNotAConstantExpression(), x.Range)) x @@ -10140,7 +10155,7 @@ let rec EvalAttribArgExpr suppressLangFeatureCheck (g: TcGlobals) (x: Expr) = match v1 with | IntegerConstExpr -> - EvalArithBinOp ((^^^), (^^^), (^^^), (^^^), (^^^), (^^^), (^^^), (^^^), ignore2, ignore2) v1 (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2) + EvalArithBinOp ((^^^), (^^^), (^^^), (^^^), (^^^), (^^^), (^^^), (^^^), ignore2, ignore2, ignore2) v1 (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2) | _ -> errorR (Error (FSComp.SR.tastNotAConstantExpression(), x.Range)) x @@ -10150,7 +10165,7 @@ let rec EvalAttribArgExpr suppressLangFeatureCheck (g: TcGlobals) (x: Expr) = match v1 with | FloatConstExpr -> - EvalArithBinOp (ignore2, ignore2, ignore2, ignore2, ignore2, ignore2, ignore2, ignore2, ( ** ), ( ** )) v1 (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2) + EvalArithBinOp (ignore2, ignore2, ignore2, ignore2, ignore2, ignore2, ignore2, ignore2, ( ** ), ( ** ), ignore2) v1 (EvalAttribArgExpr SuppressLanguageFeatureCheck.Yes g arg2) | _ -> errorR (Error (FSComp.SR.tastNotAConstantExpression(), x.Range)) x diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi index 8c17d530762..85c2adaab91 100755 --- a/src/Compiler/TypedTree/TypedTreeOps.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.fsi @@ -1666,8 +1666,14 @@ val rankOfArrayTyconRef: TcGlobals -> TyconRef -> int /// Determine if a type is the F# unit type val isUnitTy: TcGlobals -> TType -> bool -/// Determine if a type is the System.Object type -val isObjTy: TcGlobals -> TType -> bool +/// Determine if a type is the System.Object type with any nullness qualifier +val isObjTyAnyNullness: TcGlobals -> TType -> bool + +/// Determine if a type is the (System.Object | null) type. Allows either nullness if null checking is disabled. +val isObjNullTy: TcGlobals -> TType -> bool + +/// Determine if a type is a strictly non-nullable System.Object type. If nullness checking is disabled, this returns false. +val isObjTyWithoutNull: TcGlobals -> TType -> bool /// Determine if a type is the System.ValueType type val isValueTypeTy: TcGlobals -> TType -> bool diff --git a/src/Compiler/Utilities/FileSystem.fs b/src/Compiler/Utilities/FileSystem.fs index cb8c1cdbea8..a541234199e 100644 --- a/src/Compiler/Utilities/FileSystem.fs +++ b/src/Compiler/Utilities/FileSystem.fs @@ -157,7 +157,7 @@ type ByteArrayMemory(bytes: byte[], offset, length) = type SafeUnmanagedMemoryStream = inherit UnmanagedMemoryStream - val mutable private holder: obj + val mutable private holder: objnull val mutable private isDisposed: bool new(addr, length, holder) = diff --git a/src/Compiler/Utilities/illib.fs b/src/Compiler/Utilities/illib.fs index 6c5a52a2fd8..e09c650e39b 100644 --- a/src/Compiler/Utilities/illib.fs +++ b/src/Compiler/Utilities/illib.fs @@ -1139,7 +1139,7 @@ module IPartialEqualityComparer = member _.GetHashCode(Wrap x) = per.GetHashCode x } // Wrap a Wrap _ around all keys in case the key type is itself a type using null as a representation - let dict = Dictionary, obj>(wper) + let dict = Dictionary, _>(wper) seq |> List.filter (fun v -> diff --git a/src/Compiler/Utilities/sformat.fs b/src/Compiler/Utilities/sformat.fs index 9279bf093d0..f6fc27b1e51 100644 --- a/src/Compiler/Utilities/sformat.fs +++ b/src/Compiler/Utilities/sformat.fs @@ -1012,7 +1012,7 @@ module Display = // Recursive descent let rec nestedObjL depthLim prec (x: obj, ty: Type) = objL ShowAll depthLim prec (x, ty) - and objL showMode depthLim prec (x: obj, ty: Type) = + and objL showMode depthLim prec (x: objnull, ty: Type) = let info = Value.GetValueInfo bindingFlags (x, ty) try if depthLim <= 0 || exceededPrintSize () then @@ -1337,9 +1337,6 @@ module Display = if word = "map" - && (match v with - | null -> false - | _ -> true) && tyv.IsGenericType && tyv.GetGenericTypeDefinition() = typedefof> then diff --git a/src/Compiler/Utilities/sr.fs b/src/Compiler/Utilities/sr.fs index 9473cc8d78e..10a615846e3 100644 --- a/src/Compiler/Utilities/sr.fs +++ b/src/Compiler/Utilities/sr.fs @@ -27,7 +27,7 @@ module internal DiagnosticMessage = open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators - let mkFunctionValue (tys: System.Type[]) (impl: obj -> obj) = + let mkFunctionValue (tys: System.Type[]) (impl: objnull -> objnull) = FSharpValue.MakeFunction(FSharpType.MakeFunctionType(tys[0], tys[1]), impl) let funTyC = typeof obj>.GetGenericTypeDefinition() diff --git a/src/Compiler/pars.fsy b/src/Compiler/pars.fsy index 54d47b7c4fb..185bd1ed842 100644 --- a/src/Compiler/pars.fsy +++ b/src/Compiler/pars.fsy @@ -2,7 +2,6 @@ %{ -#nowarn "64" // turn off warnings that type variables used in production annotations are instantiated to concrete type #nowarn "1182" // generated code has lots of unused "parseState" #nowarn "3261" // the generated code would need to properly annotate nulls, e.g. changing System.Object to `obj|null` @@ -4403,24 +4402,28 @@ declExpr: exprFromParseError (SynExpr.ForEach(spFor, spIn, SeqExprOnly false, true, $2, arbExpr ("forLoopCollection", mFor), arbExpr ("forLoopBody3", mForLoopBodyArb), mForLoopAll)) } | YIELD declExpr - { SynExpr.YieldOrReturn(($1, not $1), $2, unionRanges (rhs parseState 1) $2.Range) } + { let trivia: SynExprYieldOrReturnTrivia = { YieldOrReturnKeyword = rhs parseState 1 } + SynExpr.YieldOrReturn(($1, not $1), $2, (unionRanges (rhs parseState 1) $2.Range), trivia) } | YIELD_BANG declExpr - { SynExpr.YieldOrReturnFrom(($1, not $1), $2, unionRanges (rhs parseState 1) $2.Range) } + { let trivia: SynExprYieldOrReturnFromTrivia = { YieldOrReturnFromKeyword = rhs parseState 1 } + SynExpr.YieldOrReturnFrom(($1, not $1), $2, (unionRanges (rhs parseState 1) $2.Range), trivia) } | YIELD recover { let mYieldAll = rhs parseState 1 - SynExpr.YieldOrReturn(($1, not $1), arbExpr ("yield", mYieldAll), mYieldAll) } + let trivia: SynExprYieldOrReturnTrivia = { YieldOrReturnKeyword = rhs parseState 1 } + SynExpr.YieldOrReturn(($1, not $1), arbExpr ("yield", mYieldAll), mYieldAll, trivia) } | YIELD_BANG recover { let mYieldAll = rhs parseState 1 - SynExpr.YieldOrReturnFrom(($1, not $1), arbExpr ("yield!", mYieldAll), mYieldAll) } + let trivia: SynExprYieldOrReturnFromTrivia = { YieldOrReturnFromKeyword = rhs parseState 1 } + SynExpr.YieldOrReturnFrom(($1, not $1), arbExpr ("yield!", mYieldAll), mYieldAll, trivia) } | BINDER headBindingPattern EQUALS typedSequentialExprBlock IN opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let { let spBind = DebugPointAtBinding.Yes(rhs2 parseState 1 5) let mEquals = rhs parseState 3 let m = unionRanges (rhs parseState 1) $8.Range - let trivia: SynExprLetOrUseBangTrivia = { EqualsRange = Some mEquals } + let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, $2, $4, $7, $8, m, trivia) } | OBINDER headBindingPattern EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP moreBinders typedSequentialExprBlock %prec expr_let @@ -4429,7 +4432,7 @@ declExpr: let spBind = DebugPointAtBinding.Yes(unionRanges (rhs parseState 1) $4.Range) let mEquals = rhs parseState 3 let m = unionRanges (rhs parseState 1) $8.Range - let trivia: SynExprLetOrUseBangTrivia = { EqualsRange = Some mEquals } + let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, $2, $4, $7, $8, m, trivia) } | OBINDER headBindingPattern EQUALS typedSequentialExprBlock hardwhiteDefnBindingsTerminator opt_OBLOCKSEP error %prec expr_let @@ -4438,16 +4441,19 @@ declExpr: let mEquals = rhs parseState 3 let mAll = unionRanges (rhs parseState 1) (rhs parseState 7) let m = $4.Range.EndRange // zero-width range - let trivia: SynExprLetOrUseBangTrivia = { EqualsRange = Some mEquals } + let trivia: SynExprLetOrUseBangTrivia = { LetOrUseBangKeyword = rhs parseState 1 ; EqualsRange = Some mEquals } SynExpr.LetOrUseBang(spBind, ($1 = "use"), true, $2, $4, [], SynExpr.ImplicitZero m, mAll, trivia) } | DO_BANG typedSequentialExpr IN opt_OBLOCKSEP typedSequentialExprBlock %prec expr_let { let spBind = DebugPointAtBinding.NoneAtDo - let trivia: SynExprLetOrUseBangTrivia = { EqualsRange = None } - SynExpr.LetOrUseBang(spBind, false, true, SynPat.Const(SynConst.Unit, $2.Range), $2, [], $5, unionRanges (rhs parseState 1) $5.Range, trivia) } + let trivia: SynExprDoBangTrivia = { DoBangKeyword = rhs parseState 1 } + let m = unionRanges (rhs parseState 1) $5.Range + SynExpr.DoBang($2, m, trivia) } | ODO_BANG typedSequentialExprBlock hardwhiteDefnBindingsTerminator %prec expr_let - { SynExpr.DoBang($2, unionRanges (rhs parseState 1) $2.Range) } + { let trivia: SynExprDoBangTrivia = { DoBangKeyword = rhs parseState 1 } + let m = unionRanges (rhs parseState 1) $2.Range + SynExpr.DoBang($2, m, trivia) } | FIXED declExpr { SynExpr.Fixed($2, (unionRanges (rhs parseState 1) $2.Range)) } @@ -4456,7 +4462,8 @@ declExpr: { errorR(Error(FSComp.SR.parsArrowUseIsLimited(), lhs parseState)) let mArrow = rhs parseState 1 let expr = $2 mArrow - SynExpr.YieldOrReturn((true, true), expr, (unionRanges mArrow expr.Range)) } + let trivia: SynExprYieldOrReturnTrivia = { YieldOrReturnKeyword = rhs parseState 1 } + SynExpr.YieldOrReturn((true, true), expr, (unionRanges mArrow expr.Range), trivia) } | declExpr COLON_QMARK typ { SynExpr.TypeTest($1, $3, unionRanges $1.Range $3.Range) } @@ -5454,7 +5461,8 @@ arrowThenExprR: | RARROW typedSequentialExprBlockR { let mArrow = rhs parseState 1 let expr = $2 mArrow - SynExpr.YieldOrReturn((true, false), expr, unionRanges mArrow expr.Range) } + let trivia: SynExprYieldOrReturnTrivia = { YieldOrReturnKeyword = mArrow } + SynExpr.YieldOrReturn((true, false), expr, (unionRanges mArrow expr.Range), trivia) } forLoopBinder: | parenPattern IN declExpr diff --git a/src/Compiler/pppars.fsy b/src/Compiler/pppars.fsy index 41cb41ff38a..cd27722a254 100644 --- a/src/Compiler/pppars.fsy +++ b/src/Compiler/pppars.fsy @@ -3,7 +3,6 @@ %{ open FSharp.Compiler.DiagnosticsLogger -#nowarn "64" // turn off warnings that type variables used in production annotations are instantiated to concrete type #nowarn "3261" // the generated code would need to properly annotate nulls, e.g. changing System.Object to `obj|null` let dummy = IfdefId("DUMMY") diff --git a/src/Compiler/xlf/FSComp.txt.cs.xlf b/src/Compiler/xlf/FSComp.txt.cs.xlf index e384127d444..958a1357ac9 100644 --- a/src/Compiler/xlf/FSComp.txt.cs.xlf +++ b/src/Compiler/xlf/FSComp.txt.cs.xlf @@ -307,11 +307,6 @@ Vyvolá upozornění, pokud je atribut TailCall použit u nerekurzivních funkcí. - - The interaction between #nowarn and #line is now consistent. - The interaction between #nowarn and #line is now consistent. - - Constraint intersection on flexible types Průnik omezení u flexibilních typů diff --git a/src/Compiler/xlf/FSComp.txt.de.xlf b/src/Compiler/xlf/FSComp.txt.de.xlf index 2cd51bff66a..d7233a5d2fc 100644 --- a/src/Compiler/xlf/FSComp.txt.de.xlf +++ b/src/Compiler/xlf/FSComp.txt.de.xlf @@ -307,11 +307,6 @@ Löst Warnungen aus, wenn das Attribut "TailCall" für nicht rekursive Funktionen verwendet wird. - - The interaction between #nowarn and #line is now consistent. - The interaction between #nowarn and #line is now consistent. - - Constraint intersection on flexible types Einschränkungsüberschneidung für flexible Typen diff --git a/src/Compiler/xlf/FSComp.txt.es.xlf b/src/Compiler/xlf/FSComp.txt.es.xlf index 47c41d9d5a3..1b3205ffa53 100644 --- a/src/Compiler/xlf/FSComp.txt.es.xlf +++ b/src/Compiler/xlf/FSComp.txt.es.xlf @@ -307,11 +307,6 @@ Genera advertencias si el atributo 'TailCall' se usa en funciones no recursivas. - - The interaction between #nowarn and #line is now consistent. - The interaction between #nowarn and #line is now consistent. - - Constraint intersection on flexible types Intersección de restricciones en tipos flexibles diff --git a/src/Compiler/xlf/FSComp.txt.fr.xlf b/src/Compiler/xlf/FSComp.txt.fr.xlf index 2509d30cd3c..018180a8fb6 100644 --- a/src/Compiler/xlf/FSComp.txt.fr.xlf +++ b/src/Compiler/xlf/FSComp.txt.fr.xlf @@ -307,11 +307,6 @@ Émet des avertissements si l’attribut « TailCall » est utilisé sur des fonctions non récursives. - - The interaction between #nowarn and #line is now consistent. - The interaction between #nowarn and #line is now consistent. - - Constraint intersection on flexible types Intersection de contraintes sur les types flexibles diff --git a/src/Compiler/xlf/FSComp.txt.it.xlf b/src/Compiler/xlf/FSComp.txt.it.xlf index 932620230c2..7cc3f46259b 100644 --- a/src/Compiler/xlf/FSComp.txt.it.xlf +++ b/src/Compiler/xlf/FSComp.txt.it.xlf @@ -307,11 +307,6 @@ Genera avvisi se l'attributo 'TailCall' viene utilizzato in funzioni non ricorsive. - - The interaction between #nowarn and #line is now consistent. - The interaction between #nowarn and #line is now consistent. - - Constraint intersection on flexible types Intersezione di vincoli su tipi flessibili diff --git a/src/Compiler/xlf/FSComp.txt.ja.xlf b/src/Compiler/xlf/FSComp.txt.ja.xlf index 0d7aee793bf..10c5f06f4ff 100644 --- a/src/Compiler/xlf/FSComp.txt.ja.xlf +++ b/src/Compiler/xlf/FSComp.txt.ja.xlf @@ -307,11 +307,6 @@ 'TailCall' 属性が再帰関数以外で使用されている場合、警告が発せられます。 - - The interaction between #nowarn and #line is now consistent. - The interaction between #nowarn and #line is now consistent. - - Constraint intersection on flexible types フレキシブル型の制約積集合 diff --git a/src/Compiler/xlf/FSComp.txt.ko.xlf b/src/Compiler/xlf/FSComp.txt.ko.xlf index aaf528ddf61..94cd344f052 100644 --- a/src/Compiler/xlf/FSComp.txt.ko.xlf +++ b/src/Compiler/xlf/FSComp.txt.ko.xlf @@ -307,11 +307,6 @@ 'TailCall' 특성이 비 재귀 함수에 사용되는 경우 경고를 발생합니다. - - The interaction between #nowarn and #line is now consistent. - The interaction between #nowarn and #line is now consistent. - - Constraint intersection on flexible types 유연한 형식의 제약 조건 교집합 diff --git a/src/Compiler/xlf/FSComp.txt.pl.xlf b/src/Compiler/xlf/FSComp.txt.pl.xlf index 5727c48f9ef..01f2ff1d5e3 100644 --- a/src/Compiler/xlf/FSComp.txt.pl.xlf +++ b/src/Compiler/xlf/FSComp.txt.pl.xlf @@ -307,11 +307,6 @@ Zgłasza ostrzeżenia, jeśli atrybut „TailCall” jest używany w funkcjach niekursywnych. - - The interaction between #nowarn and #line is now consistent. - The interaction between #nowarn and #line is now consistent. - - Constraint intersection on flexible types Przecięcie ograniczenia dla typów elastycznych diff --git a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf index 481824624bd..63da6a667b1 100644 --- a/src/Compiler/xlf/FSComp.txt.pt-BR.xlf +++ b/src/Compiler/xlf/FSComp.txt.pt-BR.xlf @@ -307,11 +307,6 @@ Gera avisos se o atributo "TailCall" for usado em funções não recursivas. - - The interaction between #nowarn and #line is now consistent. - The interaction between #nowarn and #line is now consistent. - - Constraint intersection on flexible types Interseção de restrição em tipos flexíveis diff --git a/src/Compiler/xlf/FSComp.txt.ru.xlf b/src/Compiler/xlf/FSComp.txt.ru.xlf index 597b46ad265..231bc83103b 100644 --- a/src/Compiler/xlf/FSComp.txt.ru.xlf +++ b/src/Compiler/xlf/FSComp.txt.ru.xlf @@ -307,11 +307,6 @@ Выдает предупреждения, если атрибут TailCall используется в нерекурсивных функциях. - - The interaction between #nowarn and #line is now consistent. - The interaction between #nowarn and #line is now consistent. - - Constraint intersection on flexible types Пересечение ограничений на гибких типах diff --git a/src/Compiler/xlf/FSComp.txt.tr.xlf b/src/Compiler/xlf/FSComp.txt.tr.xlf index 9896d5fec9b..a3bab7e5a92 100644 --- a/src/Compiler/xlf/FSComp.txt.tr.xlf +++ b/src/Compiler/xlf/FSComp.txt.tr.xlf @@ -307,11 +307,6 @@ 'TailCall' özniteliği özyinelemeli olmayan işlevlerde kullanılıyorsa uyarılar oluşturur. - - The interaction between #nowarn and #line is now consistent. - The interaction between #nowarn and #line is now consistent. - - Constraint intersection on flexible types Esnek türlerde kısıtlama kesişimi diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf index 41a056b3bd7..579ac9b79c3 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hans.xlf @@ -307,11 +307,6 @@ 如果在非递归函数上使用“TailCall”属性,则引发警告。 - - The interaction between #nowarn and #line is now consistent. - The interaction between #nowarn and #line is now consistent. - - Constraint intersection on flexible types 灵活类型的约束交集 diff --git a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf index 74c4b57ae60..09818a7487b 100644 --- a/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/Compiler/xlf/FSComp.txt.zh-Hant.xlf @@ -307,11 +307,6 @@ 如果 'TailCall' 屬性用於非遞迴函數,則引發警告。 - - The interaction between #nowarn and #line is now consistent. - The interaction between #nowarn and #line is now consistent. - - Constraint intersection on flexible types 彈性類型上的條件約束交集 diff --git a/src/FSharp.Build/FSharpEmbedResourceText.fs b/src/FSharp.Build/FSharpEmbedResourceText.fs index ac0adf8329d..061715184de 100644 --- a/src/FSharp.Build/FSharpEmbedResourceText.fs +++ b/src/FSharp.Build/FSharpEmbedResourceText.fs @@ -295,7 +295,7 @@ open Printf #endif - static let mkFunctionValue (tys: System.Type[]) (impl:obj->obj) = + static let mkFunctionValue (tys: System.Type[]) (impl:objnull->objnull) = FSharpValue.MakeFunction(FSharpType.MakeFunctionType(tys.[0],tys.[1]), impl) static let funTyC = typeof<(obj -> obj)>.GetGenericTypeDefinition() diff --git a/src/FSharp.Build/Fsc.fs b/src/FSharp.Build/Fsc.fs index c18b42a3989..25cdbd34195 100644 --- a/src/FSharp.Build/Fsc.fs +++ b/src/FSharp.Build/Fsc.fs @@ -786,10 +786,10 @@ type public Fsc() as this = let builder = generateCommandLineBuilder () builder.GetCapturedArguments() |> String.concat Environment.NewLine - // expose this to internal components (for nunit testing) + // expose this to internal components (for unit testing) member internal fsc.InternalGenerateCommandLineCommands() = fsc.GenerateCommandLineCommands() - // expose this to internal components (for nunit testing) + // expose this to internal components (for unit testing) member internal fsc.InternalGenerateResponseFileCommands() = fsc.GenerateResponseFileCommands() member internal fsc.InternalExecuteTool(pathToTool, responseFileCommands, commandLineCommands) = diff --git a/src/FSharp.Build/Fsi.fs b/src/FSharp.Build/Fsi.fs index dd0ccff9754..dc362420db0 100644 --- a/src/FSharp.Build/Fsi.fs +++ b/src/FSharp.Build/Fsi.fs @@ -161,6 +161,34 @@ type public Fsi() as this = builder + let mutable bufferLimit = None + + let textOutput = + lazy System.Collections.Generic.Queue<_>(defaultArg bufferLimit 1024) + + override this.LogEventsFromTextOutput(line, msgImportance) = + if this.CaptureTextOutput then + textOutput.Value.Enqueue line + + match bufferLimit with + | Some limit when textOutput.Value.Count > limit -> textOutput.Value.Dequeue() |> ignore + | _ -> () + + base.LogEventsFromTextOutput(line, msgImportance) + + member _.BufferLimit + with get () = defaultArg bufferLimit 0 + and set limit = bufferLimit <- if limit = 0 then None else Some limit + + member val CaptureTextOutput = false with get, set + + [] + member this.TextOutput = + if this.CaptureTextOutput then + textOutput.Value |> String.concat Environment.NewLine + else + String.Empty + // --codepage : Specify the codepage to use when opening source files member _.CodePage with get () = codePage @@ -388,10 +416,10 @@ type public Fsi() as this = let builder = generateCommandLineBuilder () builder.GetCapturedArguments() |> String.concat Environment.NewLine - // expose this to internal components (for nunit testing) + // expose this to internal components (for unit testing) member internal fsi.InternalGenerateCommandLineCommands() = fsi.GenerateCommandLineCommands() - // expose this to internal components (for nunit testing) + // expose this to internal components (for unit testing) member internal fsi.InternalGenerateResponseFileCommands() = fsi.GenerateResponseFileCommands() member internal fsi.InternalExecuteTool(pathToTool, responseFileCommands, commandLineCommands) = diff --git a/src/FSharp.Build/Microsoft.FSharp.NetSdk.props b/src/FSharp.Build/Microsoft.FSharp.NetSdk.props index 792df8e2356..71dfca26382 100644 --- a/src/FSharp.Build/Microsoft.FSharp.NetSdk.props +++ b/src/FSharp.Build/Microsoft.FSharp.NetSdk.props @@ -130,6 +130,22 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and true + + + CompileFirst + + + + CompileBefore + + + + CompileAfter + + + + CompileLast + diff --git a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj index 98144131089..4e4aef01856 100644 --- a/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj +++ b/tests/EndToEndBuildTests/BasicProvider/BasicProvider.Tests/BasicProvider.Tests.fsproj @@ -7,6 +7,7 @@ false NO_GENERATIVE $(FSharpCoreShippedPackageVersionValue) + xunit @@ -21,8 +22,6 @@ - - diff --git a/tests/EndToEndBuildTests/ComboProvider/ComboProvider.Tests/ComboProvider.Tests.fsproj b/tests/EndToEndBuildTests/ComboProvider/ComboProvider.Tests/ComboProvider.Tests.fsproj index b884948e8b8..d4d410bacd4 100644 --- a/tests/EndToEndBuildTests/ComboProvider/ComboProvider.Tests/ComboProvider.Tests.fsproj +++ b/tests/EndToEndBuildTests/ComboProvider/ComboProvider.Tests/ComboProvider.Tests.fsproj @@ -7,6 +7,7 @@ false $(FSharpCoreShippedPackageVersionValue) NO_GENERATIVE + xunit @@ -18,8 +19,6 @@ - - diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs deleted file mode 100644 index 78067aa8c32..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/Nowarn.fs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -namespace CompilerDirectives - -open Xunit -open FSharp.Test.Compiler - -module Nowarn = - - let warn20Text = "The result of this expression has type 'string' 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'." - - let checkFileBugSource = """ -module A -#nowarn "20" -#line 1 "xyz.fs" -"" - """ - - let checkFileBugSource2 = """ -module A -#line 1 "xyz.fs" -#nowarn "20" -"" - """ - - - [] - let ``checkFile bug simulation for compatibility`` () = - - FSharp checkFileBugSource - |> withLangVersion80 - |> compile - |> shouldSucceed - - [] - let ``checkFile bug fixed leads to new warning`` () = - - FSharp checkFileBugSource - |> withLangVersion90 - |> compile - |> shouldFail - |> withDiagnostics [ - (Warning 20, Line 1, Col 1, Line 1, Col 3, warn20Text) - ] - - [] - let ``checkFile bug fixed, no warning if nowarn is correctly used`` () = - - FSharp checkFileBugSource2 - |> withLangVersion90 - |> compile - |> shouldSucceed 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 bf413c777d3..9b7cdc5a053 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs @@ -98,7 +98,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargets01_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -134,7 +134,7 @@ module CustomAttributes_AttributeUsage = let ``E_AttributeTargetIsField01_fs`` compilation = compilation |> withOptions ["--nowarn:25"] - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -187,7 +187,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsMethod02_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> withOptions ["--nowarn:25"] |> verifyCompile |> shouldFail @@ -218,7 +218,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsMethod03_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> withOptions ["--nowarn:25"] |> verifyCompile |> shouldFail @@ -336,7 +336,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsStruct_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -366,7 +366,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsClass_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -387,7 +387,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsClass01_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -485,7 +485,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsField03_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -505,7 +505,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsProperty01_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -525,7 +525,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsCtor01_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -562,7 +562,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetIsEnum01_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -599,7 +599,7 @@ module CustomAttributes_AttributeUsage = [] let ``E_AttributeTargetsIsDelegate01_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -648,7 +648,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = [] let ``E_AttributeTargetIsInterface_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -670,7 +670,7 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = [] let ``E_AttributeTargetIsClass02_fs`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -698,9 +698,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = // SOURCE=CLIMutableAttribute01.fs # CLIMutableAttribute01.fs [] - let ``CLIMutableAttribute01 preview`` compilation = + let ``CLIMutableAttribute01 90`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldSucceed @@ -724,9 +724,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = // SOURCE=E_CLIMutableAttribute.fs # E_CLIMutableAttribute.fs [] - let ``E_CLIMutableAttribute preview`` compilation = + let ``E_CLIMutableAttribute 90`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -761,9 +761,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = // SOURCE=E_AllowNullLiteral.fs # E_AllowNullLiteral.fs [] - let ``E_AllowNullLiteral preview`` compilation = + let ``E_AllowNullLiteral 90`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -788,9 +788,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = // SOURCE=AllowNullLiteral01.fs # AllowNullLiteral01.fs [] - let ``AllowNullLiteral01 preview`` compilation = + let ``AllowNullLiteral01 90`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldSucceed @@ -816,9 +816,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = // SOURCE=E_VolatileField.fs # E_VolatileField.fs [] - let ``E_VolatileField preview`` compilation = + let ``E_VolatileField 90`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -844,9 +844,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = // SOURCE=VolatileField01.fs # VolatileField01.fs [] - let ``VolatileField01 preview`` compilation = + let ``VolatileField01 90`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldSucceed @@ -865,9 +865,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = // SOURCE=E_SealedAttribute01.fs # E_SealedAttribute01.fs [] - let ``E_SealedAttribute01 preview`` compilation = + let ``E_SealedAttribute01 90`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -893,9 +893,9 @@ type InterruptibleLazy<'T> private (valueFactory: unit -> 'T) = // SOURCE=E_StructLayout01.fs # E_StructLayout01.fs [] - let ``E_StructLayout01 preview`` compilation = + let ``E_StructLayout01 90`` compilation = compilation - |> withLangVersionPreview + |> withLangVersion90 |> verifyCompile |> shouldFail |> withDiagnostics [ @@ -925,7 +925,7 @@ and [] """ [] - [] + [] [] let ``Regression for - F# 9 compiler cannot find constructor for attribute`` langVersion = FSharp missingConstructorRepro @@ -933,3 +933,36 @@ and [] |> verifyCompile |> shouldSucceed #endif + + [] // Regression for https://github.com/dotnet/fsharp/issues/14304 + let ``Construct an object with default and params parameters using parameterless constructor`` () = + Fsx """ +open System +open System.Runtime.InteropServices + +type DefaultAndParams([]x: int, [] value: string[]) = + inherit Attribute() + +type ParamsOnly([] value: string[]) = + inherit Attribute() + +type DefaultOnly([]x: int) = + inherit Attribute() + +[] +type Q1 = struct end + +[] // ok +type Q11 = struct end + +[] // ok +type Q12 = struct end + +[] +type Q2 = struct end + +[] +type Q3 = struct end + """ + |> typecheck + |> shouldSucceed \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Basic.fs index d67f22efdc8..c0a19c9ad3e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/LetBindings/Basic/Basic.fs @@ -144,13 +144,12 @@ module LetBindings_Basic = |> verifyCompile |> shouldFail |> withDiagnostics [ - (Error 267, Line 11, Col 18, Line 11, Col 19, "This is not a valid constant expression or custom attribute value") - (Error 837, Line 11, Col 13, Line 11, Col 31, "This is not a valid constant expression") - (Error 267, Line 14, Col 13, Line 14, Col 17, "This is not a valid constant expression or custom attribute value") - (Error 267, Line 17, Col 13, Line 17, Col 15, "This is not a valid constant expression or custom attribute value") - (Error 267, Line 20, Col 13, Line 20, Col 17, "This is not a valid constant expression or custom attribute value") - (Error 267, Line 23, Col 13, Line 23, Col 18, "This is not a valid constant expression or custom attribute value") - (Warning 3178, Line 26, Col 13, Line 26, Col 26, "This is not valid literal expression. The [] attribute will be ignored.") + (Error 267, Line 10, Col 18, Line 10, Col 19, "This is not a valid constant expression or custom attribute value") + (Error 837, Line 10, Col 13, Line 10, Col 31, "This is not a valid constant expression") + (Error 267, Line 16, Col 13, Line 16, Col 15, "This is not a valid constant expression or custom attribute value") + (Error 267, Line 19, Col 13, Line 19, Col 17, "This is not a valid constant expression or custom attribute value") + (Error 267, Line 22, Col 13, Line 22, Col 18, "This is not a valid constant expression or custom attribute value") + (Warning 3178, Line 25, Col 13, Line 25, Col 26, "This is not valid literal expression. The [] attribute will be ignored.") ] // SOURCE=E_Pathological01.fs SCFLAGS=--test:ErrorRanges # E_Pathological01.fs @@ -303,4 +302,4 @@ type C() = |> withDiagnostics [ (Warning 3582, Line 4, Col 5, Line 4, Col 12, "This is a function definition that shadows a union case. If this is what you want, ignore or suppress this warning. If you want it to be a union case deconstruction, add parentheses.") (Warning 3582, Line 5, Col 5, Line 5, Col 11, "This is a function definition that shadows a union case. If this is what you want, ignore or suppress this warning. If you want it to be a union case deconstruction, add parentheses.") - ] + ] \ No newline at end of file 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 aa3395e0b6f..c253d840657 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,11 +1,10 @@ // #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$ -//This is not a valid constant expression or custom attribute value$ -//This is not a valid constant expression or custom attribute value$ -//This is not a valid constant expression or custom attribute value$ -//This is not valid literal expression. The \[\] attribute will be ignored\.$ +//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$ +//This is not a valid constant expression or custom attribute value$ +//This is not a valid constant expression or custom attribute value$ +//This is not valid literal expression. The \[\] attribute will be ignored\.$ [] let lit01 = (let x = "2" in x) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest02.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest02.fs index c34bd114f35..9c166a47aac 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest02.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/ByrefSafetyAnalysis/MigratedTest02.fs @@ -57,4 +57,4 @@ module Tests = let test3 () = StaticTest.Test2 // is passing, but probably shouldn't be -printfn "Test Passed" +printf "TEST PASSED OK" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/Decimal.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/Decimal.fs new file mode 100644 index 00000000000..1f168db110f --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/Decimal.fs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Conformance.PatternMatching + +open Xunit +open FSharp.Test +open FSharp.Test.Compiler + +module Decimal = + + [] + let ``Decimal - literal01.fs - --test:ErrorRanges`` compilation = + compilation + |> asFsx + |> withOptions ["--test:ErrorRanges";] + |> compile + |> shouldSucceed + + [] + let ``Decimal - incompleteMatchesLiteral01.fs - --test:ErrorRanges`` compilation = + compilation + |> asFs + |> withOptions ["--test:ErrorRanges"] + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Warning 25, Line 7, Col 11, Line 7, Col 13, "Incomplete pattern matches on this expression. For example, the value '3M' 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/Decimal/incompleteMatchesLiteral01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/incompleteMatchesLiteral01.fs new file mode 100644 index 00000000000..2397eeee743 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/incompleteMatchesLiteral01.fs @@ -0,0 +1,11 @@ +[] +let One = 1m +[] +let Two = 2m + +let test() = + match 3m with + | 0m -> false + | One | Two -> false + +exit 0 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/literal01.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/literal01.fs new file mode 100644 index 00000000000..764958b9bd7 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/PatternMatching/Decimal/literal01.fs @@ -0,0 +1,26 @@ +// #Conformance #PatternMatching +#light + +// Pattern match decimal literals + +[] +let Decimal1 = 5m + +[] +let Decimal2 = 42.42m + +let testDecimal x = + match x with + | Decimal1 -> 1 + | Decimal2 -> 2 + | _ -> 0 + +if testDecimal 1m <> 0 then exit 1 + +if testDecimal Decimal1 <> 1 then exit 1 +if testDecimal 5m <> 1 then exit 1 + +if testDecimal Decimal2 <> 2 then exit 1 +if testDecimal 42.42m <> 2 then exit 1 + +exit 0 \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs index 9ac49148a78..d2dc41a3235 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Literals.fs @@ -176,36 +176,95 @@ let [] x = System.Int32.MaxValue + 1 } [] - let ``Compilation fails when using decimal arithmetic in literal``() = + let ``Arithmetic can be used for constructing decimal literals``() = FSharp """ module LiteralArithmetic -let [] x = 1m + 1m +[] +let x = 1m + 2m """ |> withLangVersion80 |> compile - |> shouldFail - |> withResults [ - { Error = Error 267 - Range = { StartLine = 4 - StartColumn = 21 - EndLine = 4 - EndColumn = 23 } - Message = "This is not a valid constant expression or custom attribute value" } - { Error = Error 267 - Range = { StartLine = 4 - StartColumn = 26 - EndLine = 4 - EndColumn = 28 } - Message = "This is not a valid constant expression or custom attribute value" } - { Error = Error 267 - Range = { StartLine = 4 - StartColumn = 21 - EndLine = 4 - EndColumn = 28 } - Message = "This is not a valid constant expression or custom attribute value" } + |> shouldSucceed + |> verifyIL [ + """.field public static initonly valuetype [runtime]System.Decimal x""" + """.custom instance void [runtime]System.Runtime.CompilerServices.DecimalConstantAttribute::.ctor(uint8, + uint8, + int32, + int32, + int32) = ( 01 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 + 00 00 )""" + """.maxstack 8""" + """IL_0000: ldc.i4.3""" + """IL_0001: ldc.i4.0""" + """IL_0002: ldc.i4.0""" + """IL_0003: ldc.i4.0""" + """IL_0004: ldc.i4.0""" + """IL_0005: newobj instance void [runtime]System.Decimal::.ctor(int32, + int32, + int32, + bool, + uint8)""" + """IL_000a: stsfld valuetype [runtime]System.Decimal LiteralArithmetic::x""" + """IL_000f: ret""" + ] + + [] + let ``Pattern matching decimal literal``() = + FSharp """ +module PatternMatch + +[] +let x = 5m + +let test () = + match x with + | 5m -> 0 + | _ -> 1 + """ + |> withLangVersion80 + |> compile + |> shouldSucceed + |> verifyIL [ + """.field public static initonly valuetype [runtime]System.Decimal x""" + """ .custom instance void [runtime]System.Runtime.CompilerServices.DecimalConstantAttribute::.ctor(uint8, + uint8, + int32, + int32, + int32) = ( 01 00 00 00 00 00 00 00 00 00 00 00 05 00 00 00 + 00 00 )""" + """IL_0016: call bool [netstandard]System.Decimal::op_Equality(valuetype [netstandard]System.Decimal, + valuetype [netstandard]System.Decimal)""" + """.maxstack 8""" + """IL_0000: ldc.i4.5""" + """IL_0001: ldc.i4.0""" + """IL_0002: ldc.i4.0""" + """IL_0003: ldc.i4.0""" + """IL_0004: ldc.i4.0""" + """IL_0005: newobj instance void [runtime]System.Decimal::.ctor(int32, + int32, + int32, + bool, + uint8)""" + """IL_000a: stsfld valuetype [runtime]System.Decimal PatternMatch::x""" + """IL_000f: ret""" ] + [] + let ``Multiple decimals literals can be created``() = + FSharp """ +module DecimalLiterals + +[] +let x = 41m + +[] +let y = 42m + """ + |> withLangVersion80 + |> compile + |> shouldSucceed + [] let ``Compilation fails when using arithmetic with a non-literal in literal``() = FSharp """ diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericCode.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericCode.fs new file mode 100644 index 00000000000..06c0b1f3031 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericCode.fs @@ -0,0 +1,19 @@ +module MyLibrary +let strictlyNotNull (x:obj) = () + +let myGenericFunction1 (p:_|null) = + match p with + | null -> () + | p -> strictlyNotNull p + +let myGenericFunction2 p = + match p with + | Null -> () + | NonNull p -> strictlyNotNull p + +let myGenericFunction3 p = + match p with + | null -> () + // By the time we typecheck `| null`, we assign T to be a nullable type. Imagine there could be plenty of code before this pattern match got to be typechecked. + // As of now, the inference decision in the middle of a function cannot suddenly switch from (T which supports null) (T | null, where T is not nullable) + | pnn -> strictlyNotNull (pnn |> Unchecked.nonNull) \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericCode.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericCode.fs.il.net472.bsl new file mode 100644 index 00000000000..0e958b024af --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericCode.fs.il.net472.bsl @@ -0,0 +1,222 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyLibrary + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public static void strictlyNotNull(object x) cil managed + { + + .maxstack 8 + IL_0000: ret + } + + .method public static void myGenericFunction1(!!a p) cil managed + { + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (!!a V_0, + !!a V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: box !!a + IL_0008: brfalse.s IL_000c + + IL_000a: br.s IL_000d + + IL_000c: ret + + IL_000d: ldloc.0 + IL_000e: stloc.1 + IL_000f: ldloc.1 + IL_0010: box !!a + IL_0015: call void MyLibrary::strictlyNotNull(object) + IL_001a: ret + } + + .method public static void myGenericFunction2(!!a p) cil managed + { + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (!!a V_0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2 V_1, + !!a V_2, + !!a V_3) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: stloc.2 + IL_0004: ldloc.2 + IL_0005: box !!a + IL_000a: brfalse.s IL_000e + + IL_000c: br.s IL_0016 + + IL_000e: ldnull + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2 class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2::NewChoice1Of2(!0) + IL_0014: br.s IL_001c + + IL_0016: ldloc.2 + IL_0017: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2 class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2::NewChoice2Of2(!1) + IL_001c: stloc.1 + IL_001d: ldloc.1 + IL_001e: isinst class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2/Choice2Of2 + IL_0023: brfalse.s IL_0027 + + IL_0025: br.s IL_0028 + + IL_0027: ret + + IL_0028: ldloc.1 + IL_0029: castclass class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2/Choice2Of2 + IL_002e: call instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2/Choice2Of2::get_Item() + IL_0033: stloc.3 + IL_0034: ldloc.3 + IL_0035: box !!a + IL_003a: call void MyLibrary::strictlyNotNull(object) + IL_003f: ret + } + + .method public static void myGenericFunction3(!!a p) cil managed + { + .param type a + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [1] + .custom instance void System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (!!a V_0, + !!a V_1, + !!a V_2, + !!a V_3) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: box !!a + IL_0008: brfalse.s IL_000c + + IL_000a: br.s IL_000d + + IL_000c: ret + + IL_000d: ldloc.0 + IL_000e: stloc.1 + IL_000f: ldloc.1 + IL_0010: stloc.2 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.3 + IL_0014: box !!a + IL_0019: call void MyLibrary::strictlyNotNull(object) + IL_001e: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyLibrary + extends [runtime]System.Object +{ +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8[] NullableFlags + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 scalarByteValue) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldc.i4.1 + IL_0008: newarr [runtime]System.Byte + IL_000d: dup + IL_000e: ldc.i4.0 + IL_000f: ldarg.1 + IL_0010: stelem.i1 + IL_0011: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_0016: ret + } + + .method public specialname rtspecialname instance void .ctor(uint8[] NullableFlags) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8[] System.Runtime.CompilerServices.NullableAttribute::NullableFlags + IL_000d: ret + } + +} + +.class private auto ansi beforefieldinit System.Runtime.CompilerServices.NullableContextAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field public uint8 Flag + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(uint8 Flag) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld uint8 System.Runtime.CompilerServices.NullableContextAttribute::Flag + IL_000d: ret + } + +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericCode.fs.il.netcore.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericCode.fs.il.netcore.bsl new file mode 100644 index 00000000000..ca54c9be1ee --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/GenericCode.fs.il.netcore.bsl @@ -0,0 +1,157 @@ + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.dll + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed MyLibrary + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.NullableContextAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .method public static void strictlyNotNull(object x) cil managed + { + + .maxstack 8 + IL_0000: ret + } + + .method public static void myGenericFunction1(!!a p) cil managed + { + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (!!a V_0, + !!a V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: box !!a + IL_0008: brfalse.s IL_000c + + IL_000a: br.s IL_000d + + IL_000c: ret + + IL_000d: ldloc.0 + IL_000e: stloc.1 + IL_000f: ldloc.1 + IL_0010: box !!a + IL_0015: call void MyLibrary::strictlyNotNull(object) + IL_001a: ret + } + + .method public static void myGenericFunction2(!!a p) cil managed + { + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (!!a V_0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2 V_1, + !!a V_2, + !!a V_3) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: stloc.2 + IL_0004: ldloc.2 + IL_0005: box !!a + IL_000a: brfalse.s IL_000e + + IL_000c: br.s IL_0016 + + IL_000e: ldnull + IL_000f: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2 class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2::NewChoice1Of2(!0) + IL_0014: br.s IL_001c + + IL_0016: ldloc.2 + IL_0017: call class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2 class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2::NewChoice2Of2(!1) + IL_001c: stloc.1 + IL_001d: ldloc.1 + IL_001e: isinst class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2/Choice2Of2 + IL_0023: brfalse.s IL_0027 + + IL_0025: br.s IL_0028 + + IL_0027: ret + + IL_0028: ldloc.1 + IL_0029: castclass class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2/Choice2Of2 + IL_002e: call instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpChoice`2/Choice2Of2::get_Item() + IL_0033: stloc.3 + IL_0034: ldloc.3 + IL_0035: box !!a + IL_003a: call void MyLibrary::strictlyNotNull(object) + IL_003f: ret + } + + .method public static void myGenericFunction3(!!a p) cil managed + { + .param type a + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 01 00 00 ) + .param [1] + .custom instance void [runtime]System.Runtime.CompilerServices.NullableAttribute::.ctor(uint8) = ( 01 00 02 00 00 ) + + .maxstack 3 + .locals init (!!a V_0, + !!a V_1, + !!a V_2, + !!a V_3) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloc.0 + IL_0003: box !!a + IL_0008: brfalse.s IL_000c + + IL_000a: br.s IL_000d + + IL_000c: ret + + IL_000d: ldloc.0 + IL_000e: stloc.1 + IL_000f: ldloc.1 + IL_0010: stloc.2 + IL_0011: ldloc.2 + IL_0012: stloc.3 + IL_0013: ldloc.3 + IL_0014: box !!a + IL_0019: call void MyLibrary::strictlyNotNull(object) + IL_001e: ret + } + +} + +.class private abstract auto ansi sealed ''.$MyLibrary + extends [runtime]System.Object +{ +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullnessMetadata.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullnessMetadata.fs index 3476cf07b2e..f0ebdfa0c34 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullnessMetadata.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Nullness/NullnessMetadata.fs @@ -89,6 +89,12 @@ let ``SupportsNull`` compilation = |> withNoWarn 52 |> verifyCompilation DoNotOptimize +[] +let ``GenericCode`` compilation = + compilation + |> withNoWarn 52 + |> verifyCompilation DoNotOptimize + module Interop = open System.IO diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs index 34263b3f7bc..53cb33b5b78 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/TypeMismatchTests.fs @@ -347,7 +347,7 @@ let f4 = |> withDiagnostics [ (Error 1, Line 6, Col 9, Line 6, Col 16, "This expression was expected to have type\n 'int' \nbut here has type\n 'string' ") (Error 1, Line 12, Col 13, Line 12, Col 16, "This expression was expected to have type\n 'int' \nbut here has type\n 'string' ") - (Error 193, Line 21, Col 9, Line 21, Col 24, "Type constraint mismatch. The type \n 'int list' \nis not compatible with type\n 'string seq' \n") + (Error 193, Line 21, Col 16, Line 21, Col 24, "Type constraint mismatch. The type \n 'int list' \nis not compatible with type\n 'string seq' \n") (Error 1, Line 28, Col 9, Line 28, Col 12, "This expression was expected to have type\n 'int64' \nbut here has type\n 'float' ") ] diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index 96265fdd24b..4b50b28aa12 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -33,7 +33,6 @@ - @@ -117,6 +116,7 @@ + @@ -259,6 +259,7 @@ + diff --git a/tests/FSharp.Compiler.ComponentTests/Interop/Literals.fs b/tests/FSharp.Compiler.ComponentTests/Interop/Literals.fs new file mode 100644 index 00000000000..5eeea2822b4 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Interop/Literals.fs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Interop + +open Xunit +open FSharp.Test.Compiler + +module ``Literals interop`` = + + [] + let ``Instantiate F# decimal literal from C#`` () = + let FSLib = + FSharp """ +namespace Interop.FS + +module DecimalLiteral = + [] + let x = 7m + """ + |> withName "FSLib" + + let app = + CSharp """ +using System; +using Interop.FS; +public class C { + public Decimal y = DecimalLiteral.x; +} + """ + |> withReferences [FSLib] + |> withName "CSharpApp" + + app + |> compile + |> shouldSucceed \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/CodeQuotationTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/CodeQuotationTests.fs index dc98a4be095..90a4a188e4f 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/CodeQuotationTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/CodeQuotationTests.fs @@ -39,3 +39,22 @@ let z : unit = |> withLangVersion50 |> compileAndRun |> shouldSucceed + + [] + let ``Quotation on decimal literal compiles and runs`` () = + FSharp """ +open Microsoft.FSharp.Quotations.DerivedPatterns + +[] +let x = 7m + +let expr = <@ x @> + +match expr with +| Decimal n -> printfn "%M" n +| _ -> failwith (string expr) + """ + |> asExe + |> withLangVersion80 + |> compileAndRun + |> shouldSucceed \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs index d5c6a5a0a63..9d276c13629 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ComputationExpressionTests.fs @@ -246,4 +246,402 @@ let run r2 r3 = |> shouldFail |> withDiagnostics [ (Error 3345, Line 22, Col 9, Line 22, Col 13, "use! may not be combined with and!") + ] + + [] + let ``This control construct may only be used if the computation expression builder defines a 'Bind' method`` () = + Fsx """ +module Result = + let zip x1 x2 = + match x1,x2 with + | Ok x1res, Ok x2res -> Ok (x1res, x2res) + | Error e, _ -> Error e + | _, Error e -> Error e + +type ResultBuilder() = + member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2 + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + member _.Delay(f) = f() + + member _.TryWith(r: Result<'T,'U>, f) = + match r with + | Ok x -> Ok x + | Error e -> f e + +let result = ResultBuilder() + +let run r2 r3 = + result { + let! a = r2 + return! a + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> 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 """ +module Result = + let zip x1 x2 = + match x1,x2 with + | Ok x1res, Ok x2res -> Ok (x1res, x2res) + | Error e, _ -> Error e + | _, Error e -> Error e + +type ResultBuilder() = + member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2 + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + member _.Delay(f) = f() + + member _.TryWith(r: Result<'T,'U>, f) = + match r with + | Ok x -> Ok x + | Error e -> f e + +let result = ResultBuilder() + +let run r2 r3 = + result { + use! a = r2 + return! a + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> 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 """ +query { + do! failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> 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 """ +query { + let! x = failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> 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 """ +query { + let! x = failwith "" + and! y = failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> 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 """ +query { + use! x = failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3143, Line 3, Col 5, Line 3, Col 9, "'let!', 'use!' and 'do!' expressions may not be used in queries") + ] + + [] + let ``do! expressions may not be used in queries(SynExpr.Sequential)`` () = + Fsx """ +query { + for c in [1..10] do + do! failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (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 """ +query { + for c in [1..10] do + let! x = failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> 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 """ +query { + for c in [1..10] do + let! x = failwith "" + and! y = failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> 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 """ +query { + for c in [1..10] do + use! x = failwith "" + yield 1 +} + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 3143, Line 4, Col 5, Line 4, Col 9, "'let!', 'use!' and 'do!' expressions may not be used in queries") + ] + + [] + let ``This control construct may only be used if the computation expression builder defines a 'Bind' method(match!)`` () = + Fsx """ +module Result = + let zip x1 x2 = + match x1,x2 with + | Ok x1res, Ok x2res -> Ok (x1res, x2res) + | Error e, _ -> Error e + | _, Error e -> Error e + +type ResultBuilder() = + member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2 + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + member _.Delay(f) = f() + + member _.TryWith(r: Result<'T,'U>, f) = + match r with + | Ok x -> Ok x + | Error e -> f e + +let result = ResultBuilder() + +let run r2 r3 = + result { + match! r2 with + | Ok x -> return x + | Error e -> return e + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 708, Line 23, Col 9, Line 23, Col 15, "This control construct may only be used if the computation expression builder defines a 'Bind' method") + ] + + [] + let ``This construct may only be used within computation expressions(match!)`` () = + Fsx """ +let run r2 r3 = + match! r2 with + | Ok x -> x + | Error e -> e + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> 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 """ +let f3 = + async { + if true then + yield "a" + else + yield "b" + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> 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 """ +let f3 = + async { + if true then + yield! "a" + else + yield "b" + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> 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`` () = + Fsx """ +module Result = + let zip x1 x2 = + match x1,x2 with + | Ok x1res, Ok x2res -> Ok (x1res, x2res) + | Error e, _ -> Error e + | _, Error e -> Error e + +type ResultBuilder() = + member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2 + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + member _.Delay(f) = f() + + member _.TryWith(r: Result<'T,'U>, f) = + match r with + | Ok x -> Ok x + | Error e -> f e + +let result = ResultBuilder() + +let run r2 r3 = + result { + match r2 with + | Ok x -> return x + | Error e -> return e + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> 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`` () = + Fsx """ +module Result = + let zip x1 x2 = + match x1,x2 with + | Ok x1res, Ok x2res -> Ok (x1res, x2res) + | Error e, _ -> Error e + | _, Error e -> Error e + +type ResultBuilder() = + member _.MergeSources(t1: Result<'T,'U>, t2: Result<'T1,'U>) = Result.zip t1 t2 + member _.BindReturn(x: Result<'T,'U>, f) = Result.map f x + member _.Delay(f) = f() + + member _.TryWith(r: Result<'T,'U>, f) = + match r with + | Ok x -> Ok x + | Error e -> f e + +let result = ResultBuilder() + +let run r2 r3 = + result { + match r2 with + | Ok x -> return! x + | Error e -> return e + } + """ + |> ignoreWarnings + |> typecheck + |> 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 ``Type constraint mismatch when using return!`` () = + Fsx """ +open System.Threading.Tasks + +let maybeTask = task { return false } + +let indexHandler (): Task = + task { + return! maybeTask + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 193, Line 8, Col 17, Line 8, Col 26, "Type constraint mismatch. The type \n 'TaskCode' \nis not compatible with type\n 'TaskCode' \n") + ] + + [] + let ``Type constraint mismatch when using return`` () = + Fsx """ +open System.Threading.Tasks + +let maybeTask = task { return false } + +let indexHandler (): Task = + task { + return maybeTask + } + """ + |> ignoreWarnings + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 1, Line 8, Col 16, Line 8, Col 25, "This expression was expected to have type + 'string' +but here has type + 'Task' ") ] \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs index de6d1c888ca..1edfbfd7961 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/NullableReferenceTypesTests.fs @@ -17,6 +17,49 @@ let typeCheckWithStrictNullness cu = |> withNullnessOptions |> typecheck + + +[] +let ``Can convert generic value to objnull arg`` () = + FSharp """module TestLib + +let writeObj(tw:System.IO.TextWriter, a:'a) = + tw.Write(a) + +writeObj(System.IO.TextWriter.Null,null) + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Can pass nulll to objnull arg`` () = + FSharp """module TestLib +let doStuff args = + let ty = typeof + let m = ty.GetMethod("ToString") |> Unchecked.nonNull + m.Invoke(null,args) + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + +[] +let ``Can cast from objTy to interfaceTy`` () = + FSharp """module TestLib +open System +let safeHolder : IDisposable = + { new obj() with + override x.Finalize() = (x :?> IDisposable).Dispose() + interface IDisposable with + member x.Dispose() = + GC.SuppressFinalize x + } + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldSucceed + [] let ``Does not duplicate warnings`` () = FSharp """ @@ -28,6 +71,66 @@ let getLength (x: string | null) = x.Length |> shouldFail |> withDiagnostics [Error 3261, Line 3, Col 36, Line 3, Col 44, "Nullness warning: The types 'string' and 'string | null' do not have compatible nullability."] +[] +let ``Does report warning on obj to static member`` () = + FSharp """ +type Test() = + member _.XX(o:obj) = () + static member X(o: obj) = () + static member XString(x:string) = () +let x: obj | null = null +Test.X x // warning expected +let y2 = Test.X(x) // warning also expected +Test.X(null:(obj|null)) // warning also expected +let t = Test() +t.XX(x) +Test.XString(null) +Test.XString("x":(string|null)) + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> 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." + Error 3261, Line 8, Col 10, Line 8, Col 19, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." + Error 3261, Line 9, Col 8, Line 9, Col 23, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." + Error 3261, Line 9, Col 1, Line 9, Col 24, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." + Error 3261, Line 11, Col 6, Line 11, Col 7, "Nullness warning: The type 'obj | null' supports 'null' but a non-null type is expected." + Error 3261, Line 11, Col 1, Line 11, Col 8, "Nullness warning: The types 'obj' and 'obj | null' do not have compatible nullability." + Error 3261, Line 12, Col 14, Line 12, Col 18, "Nullness warning: The type 'string' does not support 'null'." + Error 3261, Line 13, Col 14, Line 13, Col 31, "Nullness warning: The types 'string' and 'string | null' do not have equivalent nullability."] + +[] +let ``Typar infered to nonnull obj`` () = + + FSharp """module Tests +let asObj(x:obj) = x +let asObjNull(x:objnull) = x + +let genericWithoutNull x = asObj x +let genericWithNull x = asObjNull x + +let result0 = genericWithoutNull null +let result1 = genericWithoutNull ("":(obj|null)) +let result2 = genericWithoutNull 15 +let result3 = genericWithoutNull "xxx" +let result4 = genericWithoutNull ("xxx":(string|null)) +let result5 = genericWithNull null +let result6 = genericWithNull 15 +let result7 = genericWithNull "xxx" +let result8 = genericWithNull ("":(obj|null)) + + """ + |> asLibrary + |> typeCheckWithStrictNullness + |> shouldFail + |> 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``() = @@ -608,10 +711,16 @@ strictFunc("hi") |> ignore """ [] let ``Supports null in generic code`` () = FSharp """module MyLibrary -let myGenericFunction p = +let myGenericFunctionForInnerNotNull (p:_|null) = match p with | null -> () - | p -> printfn "%s" (p.ToString()) + | nnp -> printfn "%s" (nnp.ToString()) + +let myGenericFunctionSupportingNull (p) = + match p with + | null -> 0 + | nnp -> hash nnp + [] type X(p:int) = @@ -619,20 +728,15 @@ type X(p:int) = let myValOfX : X = null -myGenericFunction "HiThere" -myGenericFunction ("HiThere":string | null) -myGenericFunction (System.DateTime.Now) -myGenericFunction 123 -myGenericFunction myValOfX +myGenericFunctionForInnerNotNull "HiThere" +myGenericFunctionForInnerNotNull ("HiThere":string | null) +myGenericFunctionSupportingNull myValOfX |> ignore +myGenericFunctionSupportingNull ("HiThere":string | null) |> ignore """ |> asLibrary |> typeCheckWithStrictNullness - |> shouldFail - |> withDiagnostics - [Error 3261, Line 13, Col 19, Line 13, Col 28, "Nullness warning: The type 'string' does not support 'null'." - Error 193, Line 15, Col 20, Line 15, Col 39, "The type 'System.DateTime' does not have 'null' as a proper value" - Error 1, Line 16, Col 19, Line 16, Col 22, "The type 'int' does not have 'null' as a proper value"] + |> shouldSucceed [] let ``Null assignment in generic code`` () = 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 2757ab30aea..69b554bd48f 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 @@ -120,9 +120,9 @@ System.Console.WriteLine("a") System.Console.WriteLine("a", (null: obj[])) // Expected to give a Nullness warning KonsoleWithNulls.WriteLine("Hello world") -KonsoleWithNulls.WriteLine(null) // WRONG: gives an incorrect Nullness warning for String | null and String | null +KonsoleWithNulls.WriteLine(null) KonsoleWithNulls.WriteLine("Hello","world") -KonsoleWithNulls.WriteLine("Hello","world","there") // // WRONG: gives an incorrect Nullness warning for String | null and String | null +KonsoleWithNulls.WriteLine("Hello","world","there") KonsoleNoNulls.WriteLine("Hello world") try @@ -169,7 +169,7 @@ with :? System.ArgumentNullException -> () // Param array cases KonsoleNoNulls.WriteLine("Hello","world","there") -KonsoleWithNulls.WriteLine("Hello","world",null) // Expected to give a 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)[] | null)) diff --git a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl index 5154ce43e79..709c3c309b3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl +++ b/tests/FSharp.Compiler.ComponentTests/Language/Nullness/using-nullness-syntax-positive.fs.checknulls_on.err.bsl @@ -31,5 +31,6 @@ using-nullness-syntax-positive.fs (154,40)-(154,44) typecheck error Nullness war using-nullness-syntax-positive.fs (159,36)-(159,40) typecheck error Nullness warning: The type 'String' does not support 'null'. using-nullness-syntax-positive.fs (162,41)-(162,45) typecheck error Nullness warning: The type 'String' does not support 'null'. using-nullness-syntax-positive.fs (164,37)-(164,41) typecheck error Nullness warning: The type 'String' does not support 'null'. +using-nullness-syntax-positive.fs (173,42)-(173,46) typecheck error The constraints 'null' and 'not null' are inconsistent using-nullness-syntax-positive.fs (183,14)-(183,16) typecheck error Nullness warning: The type 'string' does not support 'null'. using-nullness-syntax-positive.fs (189,17)-(189,26) typecheck error Nullness warning: The type 'String' does not support 'null'. \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressionTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressionTests.fs index 982ae0c820b..8247eaf60e3 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/SequenceExpressionTests.fs @@ -442,4 +442,29 @@ let typedSeq = |> withErrorCode 30 |> withDiagnosticMessageMatches "Value restriction: The value 'typedSeq' has an inferred generic type" |> withDiagnosticMessageMatches "val typedSeq: '_a seq" - \ No newline at end of file + +[] +let ``yield may only be used within list, array, and sequence expressions``() = + Fsx """ +let f1 = yield [ 3; 4 ] +let f2 = yield! [ 3; 4 ] + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (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 """ +let f1 = return [ 3; 4 ] +let f2 = return! [ 3; 4 ] + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 748, Line 2, Col 10, Line 2, Col 16, "This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'."); + (Error 748, Line 3, Col 10, Line 3, Col 17, "This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'.") + ] \ 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 2490e301e05..3f17e0cfa11 100644 --- a/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs +++ b/tests/FSharp.Compiler.ComponentTests/Miscellaneous/FsharpSuiteMigrated.fs @@ -31,16 +31,15 @@ module ScriptRunner = let cu = cu |> withDefines defaultDefines match cu with | FS fsSource -> - File.Delete("test.ok") let engine = createEngine (fsSource.Options |> Array.ofList,version) let res = evalScriptFromDiskInSharedSession engine cu match res with | CompilationResult.Failure _ -> res - | CompilationResult.Success s -> - if File.Exists("test.ok") then + | CompilationResult.Success s -> + if engine.GetOutput().Contains "TEST PASSED OK" then res else - failwith $"Results looked correct, but 'test.ok' file was not created. Result: %A{s}" + failwith $"Results looked correct, but 'TEST PASSED OK' was not printed. Result: %A{s}" | _ -> failwith $"Compilation unit other than fsharp is not supported, cannot process %A{cu}" diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/HashConstraintTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/HashConstraintTests.fs index beb33a8bac5..ac624ec19a7 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/HashConstraintTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/HashConstraintTests.fs @@ -21,8 +21,7 @@ let noa<'n when 'n :> Node> (n: 'n option) = | Some n -> [| n :> Node |] """ |> printSignatures - |> should - equal + |> assertEqualIgnoreLineEnding """ module Foo diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/MemberTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/MemberTests.fs index 2452a900881..3475535249a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/MemberTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/MemberTests.fs @@ -15,8 +15,7 @@ type Foo() = member f.X with internal get (key1, key2) = true and public set (key1, key2) value = () """ |> printSignatures - |> should - equal + |> assertEqualIgnoreLineEnding """ module Foo @@ -38,8 +37,7 @@ type Foo() = member f.Y with public get () = 'y' and internal set y = ignore y """ |> printSignatures - |> should - equal + |> assertEqualIgnoreLineEnding """ module Foo diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/ModuleOrNamespaceTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/ModuleOrNamespaceTests.fs index d4d9d408df9..413e4a7fdf9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/ModuleOrNamespaceTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/ModuleOrNamespaceTests.fs @@ -20,8 +20,7 @@ type Map<'t,'v> = """ |> printSignatures |> prependNewline - |> should - equal + |> assertEqualIgnoreLineEnding """ namespace Foo.Types @@ -43,8 +42,7 @@ type Foo = """ |> printSignatures |> prependNewline - |> should - equal + |> assertEqualIgnoreLineEnding """ namespace Hey.There @@ -101,8 +99,7 @@ module internal CodePrinter = id""" |> printSignatures |> prependNewline - |> should - equal + |> assertEqualIgnoreLineEnding """ namespace Fantomas.Core @@ -156,7 +153,7 @@ open System.Runtime.CompilerServices do () """ |> printSignatures - |> should equal "namespace System" + |> assertEqualIgnoreLineEnding "namespace System" [] let ``Empty module`` () = @@ -167,7 +164,7 @@ module Foobar do () """ |> printSignatures - |> should equal "module Foobar" + |> assertEqualIgnoreLineEnding "module Foobar" [] let ``Two empty namespaces`` () = @@ -183,7 +180,7 @@ do () """ |> printSignatures |> prependNewline - |> should equal """ + |> assertEqualIgnoreLineEnding """ namespace Foo namespace Bar""" @@ -196,7 +193,7 @@ namespace rec Foobar do () """ |> printSignatures - |> should equal "namespace Foobar" + |> assertEqualIgnoreLineEnding "namespace Foobar" [] let ``Attribute on nested module`` () = @@ -211,7 +208,7 @@ module Area = """ |> printSignatures |> prependNewline - |> should equal """ + |> assertEqualIgnoreLineEnding """ namespace MyApp.Types [ (4))>] diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/NestedTypeTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/NestedTypeTests.fs index 669faca6d5f..4dfce060679 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/NestedTypeTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/NestedTypeTests.fs @@ -35,7 +35,7 @@ let f (g: Upper.Lower) = g.Meh() """ |> withReferences [ CSLib ] |> printSignatures - |> should equal + |> assertEqualIgnoreLineEnding """ module Sample @@ -74,7 +74,7 @@ let f (g: Root.Foo withReferences [ CSLib ] |> printSignatures - |> should equal + |> assertEqualIgnoreLineEnding """ module Sample diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/RecordTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/RecordTests.fs index 27c5159a3f3..cb5ec18da97 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/RecordTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/RecordTests.fs @@ -19,8 +19,7 @@ type PullActions = } """ |> printSignaturesWith 80 - |> should - equal + |> assertEqualIgnoreLineEnding """ module SignatureFileGeneration.MyModule @@ -63,7 +62,7 @@ type SomeTypeName = """ |> printSignatures |> prependNewline - |> should equal + |> assertEqualIgnoreLineEnding """ namespace MyApp.Types diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/access.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/access.fsx index a8c3798a685..6790e4dfbee 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/access.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/access.fsx @@ -278,7 +278,7 @@ let aa = match failures.Value with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/array.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/array.fsx index 8c55d727f92..dd61a8f7474 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/array.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/array.fsx @@ -1142,7 +1142,7 @@ let aa = match failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/libtest.fsx b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/libtest.fsx index 23c2125ab51..515e1428697 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/libtest.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestCasesForGenerationRoundTrip/libtest.fsx @@ -5651,7 +5651,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TestHelpers.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/TestHelpers.fs index 8f3d1019ae0..b778cb3d783 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TestHelpers.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TestHelpers.fs @@ -1,20 +1,15 @@ module Signatures.TestHelpers open System -open FsUnit +open Xunit open FSharp.Test.Compiler let prependNewline v = String.Concat("\n", v) -let equal x = - let x = - match box x with - | :? String as s -> s.Replace("\r\n", "\n") |> box - | x -> x - - equal x +let assertEqualIgnoreLineEnding (x: string) (y: string) = + Assert.Equal(x, y, ignoreLineEndingDifferences = true) let assertSingleSignatureBinding implementation signature = FSharp $"module A\n\n{implementation}" |> printSignatures - |> should equal $"\nmodule A\n\n{signature}" + |> assertEqualIgnoreLineEnding $"\nmodule A\n\n{signature}" diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs index 1494c465af9..d066d74dd9a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/TypeTests.fs @@ -44,7 +44,7 @@ and FormatSelectionRange = """ |> printSignatures |> prependNewline - |> should equal + |> assertEqualIgnoreLineEnding """ namespace Foo.Types @@ -87,7 +87,7 @@ type List<'E> with member this.X = this.Head """ |> printSignatures - |> should equal + |> assertEqualIgnoreLineEnding """ module Extensions type List<'E> with @@ -104,7 +104,7 @@ type Map<'K, 'V when 'K: comparison> with member m.X (t: 'T) (k: 'K) = Some k, ({| n = [|k|] |}, 0) """ |> printSignatures - |> should equal + |> assertEqualIgnoreLineEnding """ module Extensions type Map<'K,'V when 'K: comparison> with @@ -126,7 +126,7 @@ type ConcurrentDictionary<'key, 'value> with | _ -> None """ |> printSignatures - |> should equal + |> assertEqualIgnoreLineEnding """ module Extensions type System.Collections.Concurrent.ConcurrentDictionary<'key,'value> with @@ -161,7 +161,7 @@ type DataItem< ^input> with DataItem.Create< ^input>(stringValue, friendlyStringValue, item) """ |> printSignatures - |> should equal + |> assertEqualIgnoreLineEnding """ module Extensions @@ -237,7 +237,7 @@ type Foo = member x.Bar with get () = 5 and set v = ignore v """ |> printSignatures - |> should equal + |> assertEqualIgnoreLineEnding """ module Lib @@ -254,7 +254,7 @@ type Foo = member x.Bar with get (a:int) = 5 and set (a:int) v = ignore v """ |> printSignatures - |> should equal + |> assertEqualIgnoreLineEnding """ module Lib diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/CompilationFromCmdlineArgsTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/CompilationFromCmdlineArgsTests.fs index 4525d7286f2..9cfbbb9df80 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/CompilationFromCmdlineArgsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/CompilationFromCmdlineArgsTests.fs @@ -5,19 +5,19 @@ module CompilationFromCmdlineArgsTests = open System open System.IO open FSharp.Compiler.CodeAnalysis - open NUnit.Framework + open Xunit open CompilationTests // Point to a generated args.txt file. // Use scrape.fsx to generate an args.txt from a binary log file. // The path needs to be absolute. - let localProjects: string list = + let localProjects = [ @"C:\Projects\fantomas\src\Fantomas.Core\Fantomas.Core.args.txt" @"C:\Projects\FsAutoComplete\src\FsAutoComplete\FsAutoComplete.args.txt" @"C:\Projects\fsharp\src\Compiler\FSharp.Compiler.Service.args.txt" @"C:\Projects\fsharp\tests\FSharp.Compiler.ComponentTests\FSharp.Compiler.ComponentTests.args.txt" - ] + ] |> Seq.map (fun p -> [| box p |]) let checker = FSharpChecker.Create() @@ -43,16 +43,16 @@ module CompilationFromCmdlineArgsTests = for diag in diagnostics do printfn "%A" diag - Assert.That(exitCode, Is.Zero) + Assert.Equal(exitCode, 0) finally Environment.CurrentDirectory <- oldWorkDir - [] - [] + [] + [] let ``Test sequential type-checking`` (projectArgumentsFilePath: string) = testCompilerFromArgs Method.Sequential projectArgumentsFilePath - [] - [] + [] + [] let ``Test graph-based type-checking`` (projectArgumentsFilePath: string) = testCompilerFromArgs Method.Graph projectArgumentsFilePath diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/DependencyResolutionTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/DependencyResolutionTests.fs index 36a246d6ced..81adc540766 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/DependencyResolutionTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/DependencyResolutionTests.fs @@ -1,11 +1,14 @@ module TypeChecks.DependencyResolutionTests open TypeChecks.TestUtils -open NUnit.Framework +open Xunit open FSharp.Compiler.GraphChecking open Scenarios -[] +let scenarios = scenarios |> Seq.map (fun p -> [| box p |]) + +[] +[] let ``Supported scenario`` (scenario: Scenario) = let files = scenario.Files @@ -18,4 +21,4 @@ let ``Supported scenario`` (scenario: Scenario) = for file in scenario.Files do let expectedDeps = file.ExpectedDependencies let actualDeps = set graph.[file.Index] - Assert.AreEqual(expectedDeps, actualDeps, $"Dependencies don't match for {System.IO.Path.GetFileName file.FileName}") + Assert.True((expectedDeps = actualDeps), $"Dependencies don't match for {System.IO.Path.GetFileName file.FileName}") diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/FileContentMappingTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/FileContentMappingTests.fs index 12f171de5fa..070133a3d8d 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/FileContentMappingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/FileContentMappingTests.fs @@ -1,6 +1,6 @@ module TypeChecks.FileContentMappingTests -open NUnit.Framework +open Xunit open FSharp.Compiler.GraphChecking open TestUtils @@ -35,7 +35,7 @@ let private (|NestedModule|_|) value e = | FileContentEntry.NestedModule(name, nestedContent) -> if name = value then Some(nestedContent) else None | _ -> None -[] +[] let ``Top level module only exposes namespace`` () = let content = getContent @@ -45,10 +45,10 @@ module X.Y.Z """ match content with - | [ TopLevelNamespace "X.Y" [] ] -> Assert.Pass() + | [ TopLevelNamespace "X.Y" [] ] -> () | content -> Assert.Fail($"Unexpected content: {content}") -[] +[] let ``Top level namespace`` () = let content = getContent @@ -58,10 +58,10 @@ namespace X.Y """ match content with - | [ TopLevelNamespace "X.Y" [] ] -> Assert.Pass() + | [ TopLevelNamespace "X.Y" [] ] -> () | content -> Assert.Fail($"Unexpected content: {content}") -[] +[] let ``Open statement in top level module`` () = let content = getContent @@ -73,10 +73,10 @@ open A.B.C """ match content with - | [ TopLevelNamespace "X.Y" [ OpenStatement "A.B.C" ] ] -> Assert.Pass() + | [ TopLevelNamespace "X.Y" [ OpenStatement "A.B.C" ] ] -> () | content -> Assert.Fail($"Unexpected content: {content}") -[] +[] let ``PrefixedIdentifier in type annotation`` () = let content = getContent @@ -88,10 +88,10 @@ let fn (a: A.B.CType) = () """ match content with - | [ TopLevelNamespace "X.Y" [ PrefixedIdentifier "A.B" ] ] -> Assert.Pass() + | [ TopLevelNamespace "X.Y" [ PrefixedIdentifier "A.B" ] ] -> () | content -> Assert.Fail($"Unexpected content: {content}") -[] +[] let ``Nested module`` () = let content = getContent @@ -104,10 +104,10 @@ module Z = """ match content with - | [ TopLevelNamespace "X" [ NestedModule "Z" [] ] ] -> Assert.Pass() + | [ TopLevelNamespace "X" [ NestedModule "Z" [] ] ] -> () | content -> Assert.Fail($"Unexpected content: {content}") -[] +[] let ``Single ident module abbreviation`` () = let content = getContent @@ -119,13 +119,13 @@ module B = C """ match content with - | [ TopLevelNamespace "" [ PrefixedIdentifier "C" ] ] -> Assert.Pass() + | [ TopLevelNamespace "" [ PrefixedIdentifier "C" ] ] -> () | content -> Assert.Fail($"Unexpected content: {content}") module InvalidSyntax = - [] + [] let ``Nested module`` () = let content = getContent @@ -137,11 +137,11 @@ module InvalidSyntax = """ match content with - | [ TopLevelNamespace "" [] ] -> Assert.Pass() + | [ TopLevelNamespace "" [] ] -> () | content -> Assert.Fail($"Unexpected content: {content}") - [] + [] let ``Module above namespace`` () = let content = getContent @@ -153,5 +153,5 @@ module InvalidSyntax = """ match content with - | [ TopLevelNamespace "" [] ] -> Assert.Pass() + | [ TopLevelNamespace "" [] ] -> () | content -> Assert.Fail($"Unexpected content: {content}") diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/GraphProcessingTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/GraphProcessingTests.fs index f8a4c8d2d23..675294acf0c 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/GraphProcessingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/GraphProcessingTests.fs @@ -2,9 +2,9 @@ open System.Threading open FSharp.Compiler.GraphChecking.GraphProcessing -open NUnit.Framework +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" @@ -18,6 +18,6 @@ let ``When processing a node throws an exception, an exception is raised with th CancellationToken.None |> ignore ) - Assert.That(exn.Message, Is.EqualTo("Encountered exception when processing item '2'")) - Assert.That(exn.InnerException, Is.Not.Null) - Assert.That(exn.InnerException.Message, Is.EqualTo("Work exception")) + Assert.Equal(exn.Message, "Encountered exception when processing item '2'") + Assert.NotNull(exn.InnerException) + Assert.Equal(exn.InnerException.Message, "Work exception") diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/QueryTrieTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/QueryTrieTests.fs index 613d77a29ee..524535efa32 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/QueryTrieTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/QueryTrieTests.fs @@ -2,7 +2,7 @@ open System.Collections.Generic open System.Collections.Immutable -open NUnit.Framework +open Xunit open FSharp.Compiler.GraphChecking open FSharp.Compiler.GraphChecking.DependencyResolution @@ -757,24 +757,24 @@ let private fantomasCoreTrie: TrieNode = |] } -[] +[] let ``Query nonexistent node in trie`` () = let result = queryTrie fantomasCoreTrie [ "System"; "System"; "Runtime"; "CompilerServices" ] match result with - | QueryTrieNodeResult.NodeDoesNotExist -> Assert.Pass() + | QueryTrieNodeResult.NodeDoesNotExist -> () | result -> Assert.Fail $"Unexpected result: %A{result}" -[] +[] let ``Query node that does not expose data in trie`` () = let result = queryTrie fantomasCoreTrie [ "Fantomas"; "Core" ] match result with - | QueryTrieNodeResult.NodeDoesNotExposeData -> Assert.Pass() + | QueryTrieNodeResult.NodeDoesNotExposeData -> () | result -> Assert.Fail $"Unexpected result: %A{result}" -[] +[] let ``Query module node that exposes one file`` () = let result = queryTrie fantomasCoreTrie [ "Fantomas"; "Core"; "ISourceTextExtensions" ] @@ -782,10 +782,10 @@ let ``Query module node that exposes one file`` () = match result with | QueryTrieNodeResult.NodeExposesData file -> let file = Seq.exactlyOne file - Assert.AreEqual(indexOf "ISourceTextExtensions.fs", file) + Assert.Equal(indexOf "ISourceTextExtensions.fs", file) | result -> Assert.Fail $"Unexpected result: %A{result}" -[] +[] let ``ProcessOpenStatement full path match`` () = let state = FileContentQueryState.Create Set.empty @@ -794,4 +794,4 @@ let ``ProcessOpenStatement full path match`` () = processOpenPath fantomasCoreTrie [ "Fantomas"; "Core"; "AstExtensions" ] state let dep = Seq.exactlyOne result.FoundDependencies - Assert.AreEqual(indexOf "AstExtensions.fsi", dep) + Assert.Equal(indexOf "AstExtensions.fsi", dep) diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/TrieMappingTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/TrieMappingTests.fs index 6ad29818a2a..2a3d7b608ea 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/TrieMappingTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/TrieMappingTests.fs @@ -1,6 +1,6 @@ module TypeChecks.TrieMappingTests -open NUnit.Framework +open Xunit open FSharp.Compiler.GraphChecking open TestUtils @@ -8,7 +8,7 @@ let private noDependencies = Set.empty let private getLastTrie files = TrieMapping.mkTrie files |> Array.last |> snd -[] +[] let ``Basic trie`` () = let sampleFiles = [| @@ -49,22 +49,22 @@ type C = { CX: int; CY: int } | current -> Assert.Fail($"mkTrie should always return a TrieNodeInfo.Root, got {current}") let xNode = trie.Children.["X"] - Assert.AreEqual(1, xNode.Children.Count) + Assert.Equal(1, xNode.Children.Count) Assert.True(Seq.isEmpty xNode.Files) let yNode = xNode.Children["Y"] - Assert.AreEqual(2, yNode.Children.Count) - Assert.AreEqual(set [| 2 |], yNode.Files) + Assert.Equal(2, yNode.Children.Count) + Assert.Equal>(set [| 2 |], yNode.Files) let aNode = yNode.Children["A"] - Assert.AreEqual(0, aNode.Children.Count) - Assert.AreEqual(set [| 0 |], aNode.Files) + Assert.Equal(0, aNode.Children.Count) + Assert.Equal>(set [| 0 |], aNode.Files) let bNode = yNode.Children["B"] - Assert.AreEqual(0, bNode.Children.Count) - Assert.AreEqual(set [| 1 |], bNode.Files) + Assert.Equal(0, bNode.Children.Count) + Assert.Equal>(set [| 1 |], bNode.Files) -[] +[] let ``Toplevel AutoOpen module with prefixed namespace`` () = let trie = getLastTrie @@ -87,11 +87,11 @@ let a = 0 // Assert that both A and B expose file index 0 let aNode = trie.Children.["A"] - Assert.AreEqual(set [| 0 |], aNode.Files) + Assert.Equal>(set [| 0 |], aNode.Files) let bNode = aNode.Children.["B"] - Assert.AreEqual(set [| 0 |], bNode.Files) + Assert.Equal>(set [| 0 |], bNode.Files) -[] +[] let ``Toplevel AutoOpen module with multi prefixed namespace`` () = let trie = getLastTrie @@ -114,13 +114,13 @@ let a = 0 // Assert that B and C expose file index 0, namespace A should not. let aNode = trie.Children.["A"] - Assert.AreEqual(noDependencies, aNode.Files) + Assert.Equal>(noDependencies, aNode.Files) let bNode = aNode.Children.["B"] - Assert.AreEqual(set [| 0 |], bNode.Files) + Assert.Equal>(set [| 0 |], bNode.Files) let cNode = bNode.Children.["C"] - Assert.AreEqual(set [| 0 |], cNode.Files) + Assert.Equal>(set [| 0 |], cNode.Files) -[] +[] let ``Global namespace should link files to the root node`` () = let trie = getLastTrie @@ -159,9 +159,9 @@ type B = { Y : int } } |] - Assert.AreEqual(set [| 0; 1 |], trie.Files) + Assert.Equal>(set [| 0; 1 |], trie.Files) -[] +[] let ``Module with a single ident and AutoOpen attribute should link files to root`` () = let trie = getLastTrie @@ -202,10 +202,10 @@ type B = { Y : int } } |] - Assert.AreEqual(set [| 0; 1 |], trie.Files) - Assert.AreEqual(0, trie.Children.Count) + Assert.Equal>(set [| 0; 1 |], trie.Files) + Assert.Equal(0, trie.Children.Count) -[] +[] let ``Module with AutoOpen attribute and two ident should expose file at two levels`` () = let trie = getLastTrie @@ -226,13 +226,13 @@ type A = { A : int } } |] - Assert.AreEqual(noDependencies, trie.Files) + Assert.Equal>(noDependencies, trie.Files) let xNode = trie.Children.["X"] - Assert.AreEqual(set [| 0 |], xNode.Files) + Assert.Equal>(set [| 0 |], xNode.Files) let yNode = xNode.Children.["Y"] - Assert.AreEqual(set [| 0 |], yNode.Files) + Assert.Equal>(set [| 0 |], yNode.Files) -[] +[] let ``Module with AutoOpen attribute and three ident should expose file at last two levels`` () = let trie = getLastTrie @@ -253,15 +253,15 @@ type A = { A : int } } |] - Assert.AreEqual(noDependencies, trie.Files) + Assert.Equal>(noDependencies, trie.Files) let xNode = trie.Children.["X"] - Assert.AreEqual(noDependencies, xNode.Files) + Assert.Equal>(noDependencies, xNode.Files) let yNode = xNode.Children.["Y"] - Assert.AreEqual(set [| 0 |], yNode.Files) + Assert.Equal>(set [| 0 |], yNode.Files) let zNode = yNode.Children.["Z"] - Assert.AreEqual(set [| 0 |], zNode.Files) + Assert.Equal>(set [| 0 |], zNode.Files) -[] +[] let ``Nested AutoOpen module in namespace will expose the file to the namespace node`` () = let trie = getLastTrie @@ -284,15 +284,15 @@ module Z = } |] - Assert.AreEqual(noDependencies, trie.Files) + Assert.Equal>(noDependencies, trie.Files) let xNode = trie.Children.["X"] - Assert.AreEqual(noDependencies, xNode.Files) + Assert.Equal>(noDependencies, xNode.Files) let yNode = xNode.Children.["Y"] - Assert.AreEqual(set [| 0 |], yNode.Files) + Assert.Equal>(set [| 0 |], yNode.Files) let zNode = yNode.Children.["Z"] - Assert.AreEqual(set [| 0 |], zNode.Files) + Assert.Equal>(set [| 0 |], zNode.Files) -[] +[] let ``Two modules with the same name, only the first file exposes the index`` () = let trie = getLastTrie @@ -325,11 +325,11 @@ let _ = () } |] - Assert.AreEqual(1, trie.Children.Count) + Assert.Equal(1, trie.Children.Count) let aNode = trie.Children.["A"] - Assert.AreEqual(set [| 0 |], aNode.Files) + Assert.Equal>(set [| 0 |], aNode.Files) -[] +[] let ``Two nested modules with the same name, in named namespace`` () = let trie = getLastTrie @@ -352,11 +352,11 @@ module ``module`` = } |] - Assert.AreEqual(1, trie.Children.Count) + Assert.Equal(1, trie.Children.Count) let node = trie.Children.["N"] - Assert.AreEqual(1, node.Children.Count) + Assert.Equal(1, node.Children.Count) -[] +[] let ``Two nested modules with the same name, in namespace global`` () = let trie = getLastTrie @@ -380,9 +380,9 @@ module ``module`` = |] // namespace global leads to a Root entry, no further processing will be done. - Assert.AreEqual(set [| 0 |], trie.Files) + Assert.Equal>(set [| 0 |], trie.Files) -[] +[] let ``Two nested modules with the same name, in anonymous module`` () = let trie = getLastTrie @@ -403,10 +403,10 @@ module ``module`` = } |] - Assert.AreEqual(1, trie.Children.Count) + Assert.Equal(1, trie.Children.Count) Assert.True(trie.Children.ContainsKey("module")) -[] +[] let ``Two nested modules with the same name, in nested module`` () = let trie = getLastTrie @@ -432,10 +432,10 @@ module B = |] let bNode = trie.Children["A"].Children["B"] - Assert.AreEqual(1, bNode.Children.Count) + Assert.Equal(1, bNode.Children.Count) Assert.True(bNode.Children.ContainsKey("module")) -[] +[] let ``Two nested modules with the same name, in nested module in signature file`` () = let trie = getLastTrie @@ -459,10 +459,10 @@ module B = |] let bNode = trie.Children["A"].Children["B"] - Assert.AreEqual(1, bNode.Children.Count) + Assert.Equal(1, bNode.Children.Count) Assert.True(bNode.Children.ContainsKey("module")) -[] +[] let ``Two namespaces with the same name in the same implementation file`` () = let trie = getLastTrie @@ -486,9 +486,9 @@ module C = begin end |] let aNode = trie.Children["A"] - Assert.AreEqual(2, aNode.Children.Count) + Assert.Equal(2, aNode.Children.Count) -[] +[] let ``Two namespaces with the same name in the same signature file`` () = let trie = getLastTrie @@ -512,9 +512,9 @@ module C = begin end |] let aNode = trie.Children["A"] - Assert.AreEqual(2, aNode.Children.Count) + Assert.Equal(2, aNode.Children.Count) -[] +[] let ``Tries are built up incrementally`` () = let trie = TrieMapping.mkTrie @@ -542,12 +542,12 @@ let ``Tries are built up incrementally`` () = |] for idx, t in trie do - Assert.AreEqual(idx + 1, t.Children.Count) + Assert.Equal(idx + 1, t.Children.Count) module InvalidSyntax = - [] + [] let ``Unnamed module`` () = let trie = getLastTrie diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/TypedTreeGraph.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/TypedTreeGraph.fs index c4680870efc..dc89f4f9a4c 100644 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/TypedTreeGraph.fs +++ b/tests/FSharp.Compiler.ComponentTests/TypeChecks/Graph/TypedTreeGraph.fs @@ -7,7 +7,7 @@ open System.IO open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.Text open FSharp.Compiler.Symbols -open NUnit.Framework +open Xunit open FSharp.Compiler.GraphChecking open TypeChecks.TestUtils @@ -100,8 +100,8 @@ let graphFromTypedTree (checker: FSharpChecker) (projectOptions: FSharpProjectOp return files, graph } -[] -[] +[] +[] let ``Create Graph from typed tree`` (projectArgumentsFilePath: string) = let previousDir = Environment.CurrentDirectory @@ -181,7 +181,7 @@ let ``Create Graph from typed tree`` (projectArgumentsFilePath: string) = let isSuperSet = Set.isSuperset depsFromHeuristic depsFromTypedTree let delta = Set.difference depsFromTypedTree depsFromHeuristic - Assert.IsTrue( + Assert.True( isSuperSet, $"""{relativePath fileName} did not contain a superset of the typed tree dependencies: {source} is missing dependencies: %A{depNames delta}.""" diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs index 8a1bb95b2d2..cc027d098af 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/DependencyManagerInteractiveTests.fs @@ -760,10 +760,9 @@ x |> Seq.iter(fun r -> if found = expected.Length then sawExpectedOutput.Set() |> ignore let text = "#help" - use output = new RedirectConsoleOutput() use script = new FSharpScript(quiet = false, langVersion = LangVersion.V47) let mutable found = 0 - output.OutputProduced.Add (fun line -> verifyOutput line) + script.OutputProduced.Add (fun line -> verifyOutput line) let opt = script.Eval(text) |> getValue Assert.True(sawExpectedOutput.WaitOne(TimeSpan.FromSeconds(5.0)), sprintf "Expected to see error sentinel value written\nexpected:%A\nactual:%A" expected lines) @@ -811,10 +810,9 @@ x |> Seq.iter(fun r -> if found = expected.Length then sawExpectedOutput.Set() |> ignore let text = "#help" - use output = new RedirectConsoleOutput() use script = new FSharpScript(quiet = false, langVersion = LangVersion.Preview) let mutable found = 0 - output.OutputProduced.Add (fun line -> verifyOutput line) + script.OutputProduced.Add (fun line -> verifyOutput line) let opt = script.Eval(text) |> getValue Assert.True(sawExpectedOutput.WaitOne(TimeSpan.FromSeconds(5.0)), sprintf "Expected to see error sentinel value written\nexpected:%A\nactual:%A" expected lines) diff --git a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs index a8739d93390..aff47308ad2 100644 --- a/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs +++ b/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharpScriptTests.fs @@ -83,9 +83,7 @@ x [] member _.``Capture console input``() = - use input = new RedirectConsoleInput() - use script = new FSharpScript() - input.ProvideInput "stdin:1234\r\n" + use script = new FSharpScript(input = "stdin:1234\r\n") let opt = script.Eval("System.Console.ReadLine()") |> getValue let value = opt.Value Assert.Equal(typeof, value.ReflectionType) @@ -93,12 +91,11 @@ x [] member _.``Capture console output/error``() = - use output = new RedirectConsoleOutput() use script = new FSharpScript() use sawOutputSentinel = new ManualResetEvent(false) use sawErrorSentinel = new ManualResetEvent(false) - output.OutputProduced.Add (fun line -> if line = "stdout:1234" then sawOutputSentinel.Set() |> ignore) - output.ErrorProduced.Add (fun line -> if line = "stderr:5678" then sawErrorSentinel.Set() |> ignore) + script.OutputProduced.Add (fun line -> if line = "stdout:1234" then sawOutputSentinel.Set() |> ignore) + script.ErrorProduced.Add (fun line -> if line = "stderr:5678" then sawErrorSentinel.Set() |> ignore) script.Eval("printfn \"stdout:1234\"; eprintfn \"stderr:5678\"") |> ignoreValue Assert.True(sawOutputSentinel.WaitOne(TimeSpan.FromSeconds(5.0)), "Expected to see output sentinel value written") Assert.True(sawErrorSentinel.WaitOne(TimeSpan.FromSeconds(5.0)), "Expected to see error sentinel value written") @@ -305,11 +302,10 @@ printfn ""%A"" result [] member _.``Eval script with invalid PackageName should fail immediately``() = - use output = new RedirectConsoleOutput() use script = new FSharpScript(additionalArgs=[| |]) let mutable found = 0 let outp = System.Collections.Generic.List() - output.OutputProduced.Add( + script.OutputProduced.Add( fun line -> if line.Contains("error NU1101:") && line.Contains("FSharp.Really.Not.A.Package") then found <- found + 1 @@ -321,10 +317,9 @@ printfn ""%A"" result [] member _.``Eval script with invalid PackageName should fail immediately and resolve one time only``() = - use output = new RedirectConsoleOutput() use script = new FSharpScript(additionalArgs=[| |]) let mutable foundResolve = 0 - output.OutputProduced.Add (fun line -> if line.Contains("error NU1101:") then foundResolve <- foundResolve + 1) + script.OutputProduced.Add (fun line -> if line.Contains("error NU1101:") then foundResolve <- foundResolve + 1) let result, errors = script.Eval(""" #r "nuget:FSharp.Really.Not.A.Package" @@ -352,6 +347,22 @@ tInput.Length let value = opt.Value Assert.Equal(4L, downcast value.ReflectionValue) + [] // usessdkrefs is not a valid option for desktop compiler + member _.``ML - use assembly with ref dependencies and without refing SMemory``() = + let code = """ +#r "nuget:Microsoft.ML.OnnxTransformer,1.4.0" + +open System +open System.Numerics.Tensors +let inputValues = [| 12.0; 10.0; 17.0; 5.0 |] +let tInput = new DenseTensor(inputValues.AsMemory(), new ReadOnlySpan([|4|])) +tInput.Length +""" + use script = new FSharpScript(additionalArgs=[| "/usesdkrefs-" |]) + let opt = script.Eval(code) |> getValue + let value = opt.Value + Assert.Equal(4L, downcast value.ReflectionValue) + [] member _.``System.Device.Gpio - Ensure we reference the runtime version of the assembly``() = let code = """ diff --git a/tests/FSharp.Compiler.Service.Tests/AssemblyReaderShim.fs b/tests/FSharp.Compiler.Service.Tests/AssemblyReaderShim.fs index a38210a6fe4..ebe2c3dd61d 100644 --- a/tests/FSharp.Compiler.Service.Tests/AssemblyReaderShim.fs +++ b/tests/FSharp.Compiler.Service.Tests/AssemblyReaderShim.fs @@ -23,4 +23,4 @@ let x = 123 let fileName, options = mkTestFileAndOptions source [| |] checker.ParseAndCheckFileInProject(fileName, 0, SourceText.ofString source, options) |> Async.RunImmediate |> ignore - gotRequest |> should be True + gotRequest |> Assert.True diff --git a/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs b/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs index a2f4c122591..aa4cc9af679 100644 --- a/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs +++ b/tests/FSharp.Compiler.Service.Tests/CSharpProjectAnalysis.fs @@ -144,8 +144,8 @@ let _ = CSharpClass(0) match (ctor :?> FSharpMemberOrFunctionOrValue).DeclaringEntity with | Some e -> let members = e.MembersFunctionsAndValues - Seq.exists (fun (mfv : FSharpMemberOrFunctionOrValue) -> mfv.IsConstructor) members |> should be True - Seq.exists (fun (mfv : FSharpMemberOrFunctionOrValue) -> mfv.IsEffectivelySameAs ctor) members |> should be True + Seq.exists (fun (mfv : FSharpMemberOrFunctionOrValue) -> mfv.IsConstructor) members |> Assert.True + Seq.exists (fun (mfv : FSharpMemberOrFunctionOrValue) -> mfv.IsEffectivelySameAs ctor) members |> Assert.True | None -> failwith "Expected Some for DeclaringEntity" let getEntitiesUses source = @@ -172,7 +172,7 @@ let (s2: FSharp.Compiler.Service.Tests.String) = null |> List.filter (fun entity -> entity.LogicalName = "String") match stringSymbols with - | e1 :: e2 :: [] -> e1.IsEffectivelySameAs(e2) |> should be False + | e1 :: e2 :: [] -> e1.IsEffectivelySameAs(e2) |> Assert.False | _ -> sprintf "Expecting two symbols, got %A" stringSymbols |> failwith [] @@ -189,5 +189,5 @@ open FSharp.Compiler.Service.Tests.Linq |> List.filter (fun entity -> entity.LogicalName = "Linq") match stringSymbols with - | e1 :: e2 :: [] -> e1.IsEffectivelySameAs(e2) |> should be False + | e1 :: e2 :: [] -> e1.IsEffectivelySameAs(e2) |> Assert.False | _ -> sprintf "Expecting two symbols, got %A" stringSymbols |> failwith diff --git a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs index 3a7cf3eb68d..c8870dd700e 100644 --- a/tests/FSharp.Compiler.Service.Tests/ExprTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ExprTests.fs @@ -788,12 +788,12 @@ let ``Test Unoptimized Declarations Project1`` useTransparentCompiler = printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList |> Utils.filterHack - |> shouldPairwiseEqual (Utils.filterHack expected) + |> shouldEqual (Utils.filterHack expected) printDeclarations None (List.ofSeq file2.Declarations) |> Seq.toList |> Utils.filterHack - |> shouldPairwiseEqual (Utils.filterHack expected2) + |> shouldEqual (Utils.filterHack expected2) () @@ -930,12 +930,12 @@ let ``Test Optimized Declarations Project1`` useTransparentCompiler = printDeclarations None (List.ofSeq file1.Declarations) |> Seq.toList |> Utils.filterHack - |> shouldPairwiseEqual (Utils.filterHack expected) + |> shouldEqual (Utils.filterHack expected) printDeclarations None (List.ofSeq file2.Declarations) |> Seq.toList |> Utils.filterHack - |> shouldPairwiseEqual (Utils.filterHack expected2) + |> shouldEqual (Utils.filterHack expected2) () @@ -1045,11 +1045,11 @@ let testOperators dnName fsName excludedTests expectedUnoptimized expectedOptimi // fail test on first line that fails, show difference in output window resultUnoptFiltered - |> shouldPairwiseEqual expectedUnoptFiltered + |> shouldEqual expectedUnoptFiltered // fail test on first line that fails, show difference in output window resultOptFiltered - |> shouldPairwiseEqual expectedOptFiltered + |> shouldEqual expectedOptFiltered end [] @@ -3134,7 +3134,7 @@ let BigSequenceExpression(outFileOpt,docFileOpt,baseAddressOpt) = let createOptions() = createProjectOptions dirName [fileSource1] [] #if !NETFRAMEWORK && DEBUG -[] +[] #else [] [] @@ -3263,7 +3263,7 @@ let ``Test ProjectForWitnesses1`` useTransparentCompiler = |> Seq.toList printfn "actual:\n\n%A" actual actual - |> shouldPairwiseEqual expected + |> shouldEqual expected [] @@ -3380,7 +3380,7 @@ let ``Test ProjectForWitnesses2`` useTransparentCompiler = |> Seq.toList printfn "actual:\n\n%A" actual actual - |> shouldPairwiseEqual expected + |> shouldEqual expected //--------------------------------------------------------------------------------------------------------- // This project is for witness arguments, testing for https://github.com/dotnet/fsharp/issues/10364 @@ -3437,7 +3437,7 @@ let ``Test ProjectForWitnesses3`` useTransparentCompiler = |> Seq.toList printfn "actual:\n\n%A" actual actual - |> shouldPairwiseEqual expected + |> shouldEqual expected [] [] @@ -3532,7 +3532,7 @@ let ``Test ProjectForWitnesses4 GetWitnessPassingInfo`` useTransparentCompiler = |> Seq.toList printfn "actual:\n\n%A" actual actual - |> shouldPairwiseEqual expected + |> shouldEqual expected module internal ProjectForNoWarnHashDirective = diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl index 3ae2414fc07..42ec38ee366 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.debug.bsl @@ -1565,7 +1565,7 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILPropertyDefs Properties FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILPropertyDefs get_Properties() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILSecurityDecls SecurityDecls FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILSecurityDecls get_SecurityDecls() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDef With(Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Reflection.TypeAttributes], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodImplDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILEventDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILPropertyDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILAttributesStored], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILSecurityDecls], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]]]) +FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDef With(Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Reflection.TypeAttributes], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout], Microsoft.FSharp.Core.FSharpOption`1[Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodImplDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILEventDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILPropertyDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILAttributesStored], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILSecurityDecls]) FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess Access FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess get_Access() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefLayout Layout @@ -1574,20 +1574,18 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs NestedTypes FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs get_NestedTypes() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Int32 MetadataIndex FSharp.Compiler.AbstractIL.IL+ILTypeDef: Int32 get_MetadataIndex() +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] Implements +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] get_Implements() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] GenericParams FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] get_GenericParams() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] Implements -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Implements() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType] Extends FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Extends() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]] ImplementsCustomAttrs -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]] get_ImplementsCustomAttrs() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.Reflection.TypeAttributes Attributes FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.Reflection.TypeAttributes get_Attributes() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String Name FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String get_Name() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILTypeDefAdditionalFlags, ILSecurityDecls, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILTypeDefAdditionalFlags, ILSecurityDecls, ILAttributesStored) FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Nested: ILMemberAccess Item FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Nested: ILMemberAccess get_Item() FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Tags: Int32 Nested @@ -1773,6 +1771,20 @@ FSharp.Compiler.AbstractIL.IL+ILVersionInfo: UInt16 get_Major() FSharp.Compiler.AbstractIL.IL+ILVersionInfo: UInt16 get_Minor() FSharp.Compiler.AbstractIL.IL+ILVersionInfo: UInt16 get_Revision() FSharp.Compiler.AbstractIL.IL+ILVersionInfo: Void .ctor(UInt16, UInt16, UInt16, UInt16) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributes CustomAttrs +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributesStored CustomAttrsStored@ +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributesStored get_CustomAttrsStored() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILType Type +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILType get_Type() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Int32 Idx +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Int32 get_Idx() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: InterfaceImpl Create(ILType) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: InterfaceImpl Create(ILType, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: System.String ToString() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Void .ctor(Int32, ILType, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Void set_CustomAttrsStored(ILAttributesStored) FSharp.Compiler.AbstractIL.IL+MethodBody+IL: Internal.Utilities.Library.InterruptibleLazy`1[FSharp.Compiler.AbstractIL.IL+ILMethodBody] Item FSharp.Compiler.AbstractIL.IL+MethodBody+IL: Internal.Utilities.Library.InterruptibleLazy`1[FSharp.Compiler.AbstractIL.IL+ILMethodBody] get_Item() FSharp.Compiler.AbstractIL.IL+MethodBody+PInvoke: System.Lazy`1[FSharp.Compiler.AbstractIL.IL+PInvokeMethod] Item @@ -1909,6 +1921,7 @@ FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeInit FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeRef FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeSpec FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILVersionInfo +FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+InterfaceImpl FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+MethodBody FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+PublicKey FSharp.Compiler.AbstractIL.IL: ILAttributes emptyILCustomAttrs @@ -1957,6 +1970,8 @@ FSharp.Compiler.AbstractIL.IL: ILTypeDefs mkILTypeDefsComputed(Microsoft.FSharp. FSharp.Compiler.AbstractIL.IL: ILTypeDefs mkILTypeDefsFromArray(ILTypeDef[]) FSharp.Compiler.AbstractIL.IL: Int32 NoMetadataIdx FSharp.Compiler.AbstractIL.IL: Int32 get_NoMetadataIdx() +FSharp.Compiler.AbstractIL.IL: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] emptyILInterfaceImpls +FSharp.Compiler.AbstractIL.IL: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] get_emptyILInterfaceImpls() FSharp.Compiler.AbstractIL.ILBinaryReader+ILModuleReader: ILModuleDef ILModuleDef FSharp.Compiler.AbstractIL.ILBinaryReader+ILModuleReader: ILModuleDef get_ILModuleDef() FSharp.Compiler.AbstractIL.ILBinaryReader+ILModuleReader: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILAssemblyRef] ILAssemblyRefs @@ -2123,7 +2138,7 @@ FSharp.Compiler.CodeAnalysis.FSharpCheckProjectResults: System.String[] Dependen FSharp.Compiler.CodeAnalysis.FSharpCheckProjectResults: System.String[] get_DependencyFiles() FSharp.Compiler.CodeAnalysis.FSharpChecker: Boolean UsesTransparentCompiler FSharp.Compiler.CodeAnalysis.FSharpChecker: Boolean get_UsesTransparentCompiler() -FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker Create(Microsoft.FSharp.Core.FSharpOption`1[System.Int32], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`2[System.String,System.DateTime],Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[System.Object,System.IntPtr,System.Int32]]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker Create(Microsoft.FSharp.Core.FSharpOption`1[System.Int32], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`2[System.String,System.DateTime],Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[System.Object,System.IntPtr,System.Int32]]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker Instance FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker get_Instance() FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpProjectOptions GetProjectOptionsFromCommandLineArgs(System.String, System.String[], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) @@ -7591,7 +7606,13 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewConst(FSharp.C FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDebugPoint(FSharp.Compiler.Syntax.DebugPointAtLeafExpr, Boolean, FSharp.Compiler.Syntax.SynExpr) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDiscardAfterMissingQualificationAfterDot(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDo(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDoBang(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynExpr+DoBang: FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia get_trivia() +FSharp.Compiler.Syntax.SynExpr+DoBang: FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia trivia +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDoBang(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia) +FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia: FSharp.Compiler.Text.Range DoBangKeyword +FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia: FSharp.Compiler.Text.Range get_DoBangKeyword() +FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia: Void .ctor(FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotGet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.SynLongIdent, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotIndexedGet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotIndexedSet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) @@ -7647,8 +7668,22 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTyped(FSharp.C FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewUpcast(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewWhile(FSharp.Compiler.Syntax.DebugPointAtWhile, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewWhileBang(FSharp.Compiler.Syntax.DebugPointAtWhile, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewYieldOrReturn(System.Tuple`2[System.Boolean,System.Boolean], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewYieldOrReturnFrom(System.Tuple`2[System.Boolean,System.Boolean], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynExpr+YieldOrReturn: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia get_trivia() +FSharp.Compiler.Syntax.SynExpr+YieldOrReturn: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia trivia +FSharp.Compiler.Syntax.SynExpr+YieldOrReturnFrom: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia get_trivia() +FSharp.Compiler.Syntax.SynExpr+YieldOrReturnFrom: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia trivia +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewYieldOrReturn(System.Tuple`2[System.Boolean,System.Boolean], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia) +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewYieldOrReturnFrom(System.Tuple`2[System.Boolean,System.Boolean], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia) +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia: FSharp.Compiler.Text.Range YieldOrReturnFromKeyword +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia: FSharp.Compiler.Text.Range get_YieldOrReturnFromKeyword() +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia: Void .ctor(FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia Zero +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia get_Zero() +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia: FSharp.Compiler.Text.Range YieldOrReturnKeyword +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia: FSharp.Compiler.Text.Range get_YieldOrReturnKeyword() +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia: Void .ctor(FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+AddressOf FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+AnonRecd FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+App @@ -10188,7 +10223,9 @@ FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: FSharp.Compiler.SyntaxTr FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] EqualsRange FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_EqualsRange() FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: System.String ToString() -FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: FSharp.Compiler.Text.Range LetOrUseBangKeyword +FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: FSharp.Compiler.Text.Range get_LetOrUseBangKeyword() +FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Void .ctor(FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia: FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia Zero FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia: FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia get_Zero() FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] InKeyword diff --git a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl index 3ae2414fc07..42ec38ee366 100644 --- a/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl +++ b/tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.SurfaceArea.netstandard20.release.bsl @@ -1565,7 +1565,7 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILPropertyDefs Properties FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILPropertyDefs get_Properties() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILSecurityDecls SecurityDecls FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILSecurityDecls get_SecurityDecls() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDef With(Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Reflection.TypeAttributes], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodImplDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILEventDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILPropertyDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILAttributesStored], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILSecurityDecls], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]]]) +FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDef With(Microsoft.FSharp.Core.FSharpOption`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Reflection.TypeAttributes], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefLayout], Microsoft.FSharp.Core.FSharpOption`1[Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef]], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType]], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILFieldDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILMethodImplDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILEventDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILPropertyDefs], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILTypeDefAdditionalFlags], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILAttributesStored], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILSecurityDecls]) FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess Access FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefAccess get_Access() FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefLayout Layout @@ -1574,20 +1574,18 @@ FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs NestedTypes FSharp.Compiler.AbstractIL.IL+ILTypeDef: ILTypeDefs get_NestedTypes() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Int32 MetadataIndex FSharp.Compiler.AbstractIL.IL+ILTypeDef: Int32 get_MetadataIndex() +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] Implements +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] get_Implements() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] GenericParams FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef] get_GenericParams() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] Implements -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Implements() FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType] Extends FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType] get_Extends() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]] ImplementsCustomAttrs -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]] get_ImplementsCustomAttrs() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.Reflection.TypeAttributes Attributes FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.Reflection.TypeAttributes get_Attributes() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String Name FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String ToString() FSharp.Compiler.AbstractIL.IL+ILTypeDef: System.String get_Name() -FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILType], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[FSharp.Compiler.AbstractIL.IL+ILAttributesStored,System.Int32]]], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILTypeDefAdditionalFlags, ILSecurityDecls, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+ILTypeDef: Void .ctor(System.String, System.Reflection.TypeAttributes, ILTypeDefLayout, Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]], Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILGenericParameterDef], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.AbstractIL.IL+ILType], ILMethodDefs, ILTypeDefs, ILFieldDefs, ILMethodImplDefs, ILEventDefs, ILPropertyDefs, ILTypeDefAdditionalFlags, ILSecurityDecls, ILAttributesStored) FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Nested: ILMemberAccess Item FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Nested: ILMemberAccess get_Item() FSharp.Compiler.AbstractIL.IL+ILTypeDefAccess+Tags: Int32 Nested @@ -1773,6 +1771,20 @@ FSharp.Compiler.AbstractIL.IL+ILVersionInfo: UInt16 get_Major() FSharp.Compiler.AbstractIL.IL+ILVersionInfo: UInt16 get_Minor() FSharp.Compiler.AbstractIL.IL+ILVersionInfo: UInt16 get_Revision() FSharp.Compiler.AbstractIL.IL+ILVersionInfo: Void .ctor(UInt16, UInt16, UInt16, UInt16) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributes CustomAttrs +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributes get_CustomAttrs() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributesStored CustomAttrsStored +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributesStored CustomAttrsStored@ +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILAttributesStored get_CustomAttrsStored() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILType Type +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: ILType get_Type() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Int32 Idx +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Int32 get_Idx() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: InterfaceImpl Create(ILType) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: InterfaceImpl Create(ILType, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: System.String ToString() +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Void .ctor(Int32, ILType, ILAttributesStored) +FSharp.Compiler.AbstractIL.IL+InterfaceImpl: Void set_CustomAttrsStored(ILAttributesStored) FSharp.Compiler.AbstractIL.IL+MethodBody+IL: Internal.Utilities.Library.InterruptibleLazy`1[FSharp.Compiler.AbstractIL.IL+ILMethodBody] Item FSharp.Compiler.AbstractIL.IL+MethodBody+IL: Internal.Utilities.Library.InterruptibleLazy`1[FSharp.Compiler.AbstractIL.IL+ILMethodBody] get_Item() FSharp.Compiler.AbstractIL.IL+MethodBody+PInvoke: System.Lazy`1[FSharp.Compiler.AbstractIL.IL+PInvokeMethod] Item @@ -1909,6 +1921,7 @@ FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeInit FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeRef FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILTypeSpec FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+ILVersionInfo +FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+InterfaceImpl FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+MethodBody FSharp.Compiler.AbstractIL.IL: FSharp.Compiler.AbstractIL.IL+PublicKey FSharp.Compiler.AbstractIL.IL: ILAttributes emptyILCustomAttrs @@ -1957,6 +1970,8 @@ FSharp.Compiler.AbstractIL.IL: ILTypeDefs mkILTypeDefsComputed(Microsoft.FSharp. FSharp.Compiler.AbstractIL.IL: ILTypeDefs mkILTypeDefsFromArray(ILTypeDef[]) FSharp.Compiler.AbstractIL.IL: Int32 NoMetadataIdx FSharp.Compiler.AbstractIL.IL: Int32 get_NoMetadataIdx() +FSharp.Compiler.AbstractIL.IL: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] emptyILInterfaceImpls +FSharp.Compiler.AbstractIL.IL: Internal.Utilities.Library.InterruptibleLazy`1[Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+InterfaceImpl]] get_emptyILInterfaceImpls() FSharp.Compiler.AbstractIL.ILBinaryReader+ILModuleReader: ILModuleDef ILModuleDef FSharp.Compiler.AbstractIL.ILBinaryReader+ILModuleReader: ILModuleDef get_ILModuleDef() FSharp.Compiler.AbstractIL.ILBinaryReader+ILModuleReader: Microsoft.FSharp.Collections.FSharpList`1[FSharp.Compiler.AbstractIL.IL+ILAssemblyRef] ILAssemblyRefs @@ -2123,7 +2138,7 @@ FSharp.Compiler.CodeAnalysis.FSharpCheckProjectResults: System.String[] Dependen FSharp.Compiler.CodeAnalysis.FSharpCheckProjectResults: System.String[] get_DependencyFiles() FSharp.Compiler.CodeAnalysis.FSharpChecker: Boolean UsesTransparentCompiler FSharp.Compiler.CodeAnalysis.FSharpChecker: Boolean get_UsesTransparentCompiler() -FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker Create(Microsoft.FSharp.Core.FSharpOption`1[System.Int32], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`2[System.String,System.DateTime],Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[System.Object,System.IntPtr,System.Int32]]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) +FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker Create(Microsoft.FSharp.Core.FSharpOption`1[System.Int32], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.LegacyReferenceResolver], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`2[System.String,System.DateTime],Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[System.Object,System.IntPtr,System.Int32]]]], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.CodeAnalysis.DocumentSource], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker Instance FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpChecker get_Instance() FSharp.Compiler.CodeAnalysis.FSharpChecker: FSharp.Compiler.CodeAnalysis.FSharpProjectOptions GetProjectOptionsFromCommandLineArgs(System.String, System.String[], Microsoft.FSharp.Core.FSharpOption`1[System.DateTime], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean], Microsoft.FSharp.Core.FSharpOption`1[System.Boolean]) @@ -7591,7 +7606,13 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewConst(FSharp.C FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDebugPoint(FSharp.Compiler.Syntax.DebugPointAtLeafExpr, Boolean, FSharp.Compiler.Syntax.SynExpr) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDiscardAfterMissingQualificationAfterDot(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDo(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDoBang(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynExpr+DoBang: FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia get_trivia() +FSharp.Compiler.Syntax.SynExpr+DoBang: FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia trivia +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDoBang(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia) +FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia: FSharp.Compiler.Text.Range DoBangKeyword +FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia: FSharp.Compiler.Text.Range get_DoBangKeyword() +FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynExprDoBangTrivia: Void .ctor(FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotGet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Syntax.SynLongIdent, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotIndexedGet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewDotIndexedSet(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range, FSharp.Compiler.Text.Range) @@ -7647,8 +7668,22 @@ FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewTyped(FSharp.C FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewUpcast(FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynType, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewWhile(FSharp.Compiler.Syntax.DebugPointAtWhile, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewWhileBang(FSharp.Compiler.Syntax.DebugPointAtWhile, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewYieldOrReturn(System.Tuple`2[System.Boolean,System.Boolean], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) -FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewYieldOrReturnFrom(System.Tuple`2[System.Boolean,System.Boolean], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range) +FSharp.Compiler.Syntax.SynExpr+YieldOrReturn: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia get_trivia() +FSharp.Compiler.Syntax.SynExpr+YieldOrReturn: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia trivia +FSharp.Compiler.Syntax.SynExpr+YieldOrReturnFrom: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia get_trivia() +FSharp.Compiler.Syntax.SynExpr+YieldOrReturnFrom: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia trivia +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewYieldOrReturn(System.Tuple`2[System.Boolean,System.Boolean], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia) +FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr NewYieldOrReturnFrom(System.Tuple`2[System.Boolean,System.Boolean], FSharp.Compiler.Syntax.SynExpr, FSharp.Compiler.Text.Range, FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia) +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia: FSharp.Compiler.Text.Range YieldOrReturnFromKeyword +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia: FSharp.Compiler.Text.Range get_YieldOrReturnFromKeyword() +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnFromTrivia: Void .ctor(FSharp.Compiler.Text.Range) +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia Zero +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia: FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia get_Zero() +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia: FSharp.Compiler.Text.Range YieldOrReturnKeyword +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia: FSharp.Compiler.Text.Range get_YieldOrReturnKeyword() +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia: System.String ToString() +FSharp.Compiler.SyntaxTrivia.SynExprYieldOrReturnTrivia: Void .ctor(FSharp.Compiler.Text.Range) FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+AddressOf FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+AnonRecd FSharp.Compiler.Syntax.SynExpr: FSharp.Compiler.Syntax.SynExpr+App @@ -10188,7 +10223,9 @@ FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: FSharp.Compiler.SyntaxTr FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] EqualsRange FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] get_EqualsRange() FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: System.String ToString() -FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Void .ctor(Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) +FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: FSharp.Compiler.Text.Range LetOrUseBangKeyword +FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: FSharp.Compiler.Text.Range get_LetOrUseBangKeyword() +FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseBangTrivia: Void .ctor(FSharp.Compiler.Text.Range, Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range]) FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia: FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia Zero FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia: FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia get_Zero() FSharp.Compiler.SyntaxTrivia.SynExprLetOrUseTrivia: Microsoft.FSharp.Core.FSharpOption`1[FSharp.Compiler.Text.Range] InKeyword diff --git a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs index 9ce34ec9be7..ed245117916 100644 --- a/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ModuleReaderCancellationTests.fs @@ -115,7 +115,7 @@ type PreTypeDefData = mkILMethods [] let typeAttributes = TypeAttributes.Public - ILTypeDef(this.Name, typeAttributes, ILTypeDefLayout.Auto, [], None, [], + ILTypeDef(this.Name, typeAttributes, ILTypeDefLayout.Auto, emptyILInterfaceImpls, [], None, methodsDefs, mkILTypeDefs [], mkILFields [], emptyILMethodImpls, mkILEvents [], mkILProperties [], ILTypeDefAdditionalFlags.None, emptyILSecurityDecls, emptyILCustomAttrsStored) diff --git a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs index 237c49d5794..78d03ac8a9b 100644 --- a/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs +++ b/tests/FSharp.Compiler.Service.Tests/ProjectAnalysisTests.fs @@ -713,7 +713,7 @@ let ``Test project2 all symbols in signature`` () = "field x"; "field y"; "GenericClass`1"; "generic parameter T"; "member .ctor"; "member GenericMethod"; "generic parameter U"] |> List.sort - shouldPairwiseEqual e r + shouldEqual e r [] let ``Test project2 all uses of all signature symbols`` () = @@ -5813,7 +5813,7 @@ let ``References from #r nuget are included in script project options`` () = |> Seq.choose (fun f -> f.FileName |> Option.map Path.GetFileName) |> Seq.distinct printfn "%s" (assemblyNames |> String.concat "\n") - assemblyNames |> should contain "Dapper.dll" + Assert.Contains("Dapper.dll", assemblyNames) module internal EmptyProject = let base2 = getTemporaryFileName () diff --git a/tests/FSharp.Compiler.Service.Tests/Symbols.fs b/tests/FSharp.Compiler.Service.Tests/Symbols.fs index c63dca9f6de..e0082fcde30 100644 --- a/tests/FSharp.Compiler.Service.Tests/Symbols.fs +++ b/tests/FSharp.Compiler.Service.Tests/Symbols.fs @@ -68,7 +68,7 @@ extern int private c() |> List.zip decls |> List.iter (fun (actual, expected) -> match actual with - | SynModuleDecl.Let (_, [SynBinding (accessibility = access)], _) -> Option.map string access |> should equal expected + | SynModuleDecl.Let (_, [SynBinding (accessibility = access)], _) -> Option.map string access |> shouldEqual expected | decl -> failwithf "unexpected decl: %O" decl) [ "a", (true, false, false, false) @@ -79,7 +79,7 @@ extern int private c() | :? FSharpMemberOrFunctionOrValue as mfv -> let access = mfv.Accessibility (access.IsPublic, access.IsProtected, access.IsInternal, access.IsPrivate) - |> should equal expected + |> shouldEqual expected | _ -> failwithf "Couldn't get mfv: %s" name) [] @@ -289,7 +289,7 @@ type E = Ns1.Ns2.T match symbolUse.Symbol with | :? FSharpEntity as entity -> entity.AbbreviatedType.Format(symbolUse.DisplayContext) - |> should equal expectedPrintedType + |> shouldEqual expectedPrintedType | _ -> failwithf "Couldn't get entity: %s" symbolName) @@ -388,7 +388,7 @@ let tester: int folks = Cons(1, Nil) match symbolUse.Symbol with | :? FSharpMemberOrFunctionOrValue as v -> v.FullType.Format (symbolUse.DisplayContext.WithPrefixGenericParameters()) - |> should equal prefixForm + |> shouldEqual prefixForm | _ -> failwithf "Couldn't get member: %s" entity [] @@ -406,7 +406,7 @@ let tester: Folks = Cons(1, Nil) match symbolUse.Symbol with | :? FSharpMemberOrFunctionOrValue as v -> v.FullType.Format (symbolUse.DisplayContext.WithSuffixGenericParameters()) - |> should equal suffixForm + |> shouldEqual suffixForm | _ -> failwithf "Couldn't get member: %s" entity [] @@ -431,7 +431,7 @@ let tester2: int Group = [] match symbolUse.Symbol with | :? FSharpMemberOrFunctionOrValue as v -> v.FullType.Format symbolUse.DisplayContext - |> should equal expectedTypeFormat + |> shouldEqual expectedTypeFormat | _ -> failwithf "Couldn't get member: %s" entityName ) @@ -497,10 +497,10 @@ let f2 b1 b2 b3 b4 b5 = | :? FSharpMemberOrFunctionOrValue as mfv -> match symbolTypes.TryGetValue(mfv.DisplayName) with | true, Some expectedType -> - mfv.FullType.TypeDefinition.DisplayName |> should equal expectedType + mfv.FullType.TypeDefinition.DisplayName |> shouldEqual expectedType | true, None -> - mfv.FullType.IsGenericParameter |> should equal true - mfv.FullType.AllInterfaces.Count |> should equal 0 + mfv.FullType.IsGenericParameter |> shouldEqual true + mfv.FullType.AllInterfaces.Count |> shouldEqual 0 | _ -> () | _ -> () diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj index 93143ca4103..2ba4f6f837d 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj @@ -25,11 +25,6 @@ true - - $(DefineConstants);XUNIT - $(DefineConstants);NUNIT - - 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 29d086d0f20..950432ccc8e 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 @@ -11,74 +11,46 @@ open Xunit open System.Threading open System.Threading.Tasks -type RunWithContinuationsTest_WhatToDo = - | Exit - | Cancel - | Throw +module AsyncType = -type AsyncType() = + type ExpectedContinuation = Success | Exception | Cancellation - let ignoreSynchCtx f = - f () + [] + let startWithContinuations() = - [] - let mutable spinloop = true - - let waitASec (t:Task) = - let result = t.Wait(TimeSpan(hours=0,minutes=0,seconds=1)) - Assert.True(result, "Task did not finish after waiting for a second.") + let cont actual expected _ = + if expected <> actual then + failwith $"expected {expected} continuation, but ran {actual}" - [] - member _.StartWithContinuations() = + let onSuccess = cont Success + let onException = cont Exception + let onCancellation = cont Cancellation - let mutable whatToDo = Exit + let expect expected computation = + Async.StartWithContinuations(computation, onSuccess expected, onException expected, onCancellation expected) - let asyncWorkflow() = - async { - let currentState = whatToDo - - // Act - let result = - match currentState with - | Exit -> 1 - | Cancel -> Async.CancelDefaultToken() - sleep(1 * 1000) - 0 - | Throw -> raise <| System.Exception("You asked me to do it!") - - return result - } + async { + Async.CancelDefaultToken() + return () + } |> expect Cancellation - let onSuccess x = - match whatToDo with - | Cancel | Throw - -> Assert.Fail("Expected onSuccess but whatToDo was not Exit", [| whatToDo |]) - | Exit - -> () + async { failwith "computation failed" } |> expect Exception - let onException x = - match whatToDo with - | Exit | Cancel - -> Assert.Fail("Expected onException but whatToDo was not Throw", [| whatToDo |]) - | Throw -> () + async { return () } |> expect Success - let onCancel x = - match whatToDo with - | Exit | Throw - -> Assert.Fail("Expected onCancel but whatToDo was not Cancel", [| whatToDo |]) - | Cancel -> () - // Run it once. - whatToDo <- Exit - Async.StartWithContinuations(asyncWorkflow(), onSuccess, onException, onCancel) - whatToDo <- Cancel - Async.StartWithContinuations(asyncWorkflow(), onSuccess, onException, onCancel) +type AsyncType() = - whatToDo <- Throw - Async.StartWithContinuations(asyncWorkflow(), onSuccess, onException, onCancel) + let ignoreSynchCtx f = + f () - () + [] + let mutable spinloop = true + + let waitASec (t:Task) = + let result = t.Wait(TimeSpan(hours=0,minutes=0,seconds=1)) + Assert.True(result, "Task did not finish after waiting for a second.") [] member _.AsyncRunSynchronouslyReusesThreadPoolThread() = diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/IntConversionsTestGenerator.fsx b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/IntConversionsTestGenerator.fsx index d30d3bb324e..42f7bf98b6d 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/IntConversionsTestGenerator.fsx +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/IntConversionsTestGenerator.fsx @@ -45,7 +45,7 @@ do // This file is automatically generated by IntConversionsTestGenerator.fsx namespace FSharp.Core.UnitTests open System -open NUnit.Framework +open XUnit open FSharp.Core.UnitTests.LibraryTestFx module UInt8 = @@ -56,7 +56,6 @@ module Int8 = let MinValue = SByte.MinValue let MaxValue = SByte.MaxValue -[] type IntConversionsGenerated() = " @@ -70,7 +69,7 @@ type IntConversionsGenerated() = // -1 converted to unsigned types. Should become MaxValues let signedToUnsignedGenerator target = signedInts |> List.iter (fun source-> - prn "[]" + prn "[]" prn "member this.``%s.m1.To.%s`` () =" source.alias target.alias shift () prn "let i : %s = -1%s" source.alias source.suffix @@ -82,7 +81,7 @@ type IntConversionsGenerated() = // -1 converted to signed types. Should stay -1. let signedToSignedGenerator target = signedInts |> List.iter (fun source-> - prn "[]" + prn "[]" prn "member this.``%s.m1.To.%s`` () =" source.alias target.alias shift () prn "let minus1 : %s = -1%s" target.alias target.suffix @@ -96,7 +95,7 @@ type IntConversionsGenerated() = let unsignedToWiderGenerator target = unsignedInts |> List.filter (fun source -> source.width < target.width) |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``%s.MaxValue.To.%s`` () =" source.alias target.alias shift () prn "let sourceMaxValue : %s = %s%s" target.alias (maxValueAsHexLiteral source) target.suffix @@ -109,7 +108,7 @@ type IntConversionsGenerated() = let unsignedToNarrowerSignedGenerator target = unsignedInts |> List.filter (fun source -> source.width >= target.width) |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``%s.MaxValue.To.%s`` () =" source.alias target.alias shift () prn "Assert.AreEqual (-1%s, %s %s.MaxValue)" target.suffix target.alias source.name @@ -121,7 +120,7 @@ type IntConversionsGenerated() = let unsignedToNarrowerUnsignedGenerator target = unsignedInts |> List.filter (fun source -> source.width >= target.width) |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``%s.MaxValue.To.%s`` () =" source.alias target.alias shift () prn "Assert.AreEqual (%s.MaxValue, %s %s.MaxValue)" target.name target.alias source.name @@ -131,7 +130,7 @@ type IntConversionsGenerated() = // -1 to signed nativeint stays -1 signedInts |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``%s.m1.To.nativeint`` () =" source.alias shift () prn "Assert.AreEqual (-1n, nativeint -1%s)" source.suffix @@ -140,7 +139,7 @@ type IntConversionsGenerated() = // unsigned MaxValues to signed nativeint stay same for narrower types, become -1 for wider types unsignedInts |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``%s.MaxValue.To.nativeint`` () =" source.alias shift () prn "if sizeof > sizeof<%s> then" source.alias @@ -162,7 +161,7 @@ type IntConversionsGenerated() = // -1 to unsigned nativeint should become MaxValue signedInts |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``%s.m1.To.unativeint`` () =" source.alias shift () prn "Assert.AreEqual (this.UnativeintMaxValue, unativeint -1%s)" source.suffix @@ -171,7 +170,7 @@ type IntConversionsGenerated() = // unsigned MaxValues to unsigned nativeint stay same for narrower types, become MaxValue for wider types unsignedInts |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``%s.m1.To.unativeint`` () =" source.alias shift () prn "if sizeof > sizeof<%s> then" source.alias @@ -188,7 +187,7 @@ type IntConversionsGenerated() = // -1 converted to unsigned types. Should throw let checkedSignedToUnsignedGenerator target = signedInts |> List.iter (fun source-> - prn "[]" + prn "[]" prn "member this.``Checked.%s.m1.To.%s`` () =" source.alias target.alias shift () prn "let i : %s = -1%s" source.alias source.suffix @@ -200,7 +199,7 @@ type IntConversionsGenerated() = // -1 converted to signed types. Should stay -1. let signedToSignedGenerator target = signedInts |> List.iter (fun source-> - prn "[]" + prn "[]" prn "member this.``Checked.%s.m1.To.%s`` () =" source.alias target.alias shift () prn "let minus1 : %s = -1%s" target.alias target.suffix @@ -214,7 +213,7 @@ type IntConversionsGenerated() = let checkedUnsignedToWiderGenerator target = unsignedInts |> List.filter (fun source -> source.width < target.width) |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``Checked.%s.MaxValue.To.%s`` () =" source.alias target.alias shift () prn "let sourceMaxValue : %s = %s%s" target.alias (maxValueAsHexLiteral source) target.suffix @@ -227,7 +226,7 @@ type IntConversionsGenerated() = let checkedUnsignedToNarrowerSignedGenerator target = unsignedInts |> List.filter (fun source -> source.width >= target.width && target.alias <> "int8") |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``Checked.%s.MaxValue.To.%s`` () =" source.alias target.alias shift () prn "CheckThrowsExn (fun () -> Checked.%s %s.MaxValue |> ignore)" target.alias source.name @@ -239,7 +238,7 @@ type IntConversionsGenerated() = let checkedUnsignedToNarrowerUnsignedGenerator target = unsignedInts |> List.filter (fun source -> source.width > target.width) |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``Checked.%s.MaxValue.To.%s`` () =" source.alias target.alias shift () prn "CheckThrowsExn (fun () -> Checked.%s %s.MaxValue |> ignore)" target.alias source.name @@ -249,7 +248,7 @@ type IntConversionsGenerated() = // -1 to signed nativeint stays -1 signedInts |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``Checked.%s.m1.To.nativeint`` () =" source.alias shift () prn "Assert.AreEqual (-1n, Checked.nativeint -1%s)" source.suffix @@ -258,7 +257,7 @@ type IntConversionsGenerated() = // unsigned MaxValues to signed nativeint stay same for narrower types, throw for wider types unsignedInts |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``Checked.%s.MaxValue.To.nativeint`` () =" source.alias shift () prn "if sizeof > sizeof<%s> then" source.alias @@ -272,7 +271,7 @@ type IntConversionsGenerated() = // -1 to unsigned nativeint should throw signedInts |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``Checked.%s.m1.To.unativeint`` () =" source.alias shift () prn "CheckThrowsExn (fun () -> Checked.unativeint -1%s |> ignore)" source.suffix @@ -281,7 +280,7 @@ type IntConversionsGenerated() = // unsigned MaxValues to unsigned nativeint stay same for narrower types, throw for wider types unsignedInts |> List.iter (fun source -> - prn "[]" + prn "[]" prn "member this.``Checked.%s.MaxValue.To.unativeint`` () =" source.alias shift () prn "if sizeof >= sizeof<%s> then" source.alias diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 19c3793d64e..f535bc21c5a 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -12,7 +12,7 @@ open FSharp.Test.Utilities open FSharp.Test.ScriptHelpers open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.CSharp -open NUnit.Framework +open Xunit open System open System.Collections.Immutable open System.IO @@ -1129,7 +1129,7 @@ Actual: fOnFail() updateBaseLineIfEnvironmentSaysSo baseline createBaselineErrors baseline actual - Assert.AreEqual(expected, actual, convenienceBaselineInstructions baseline expected actual) + Assert.True((expected = actual), convenienceBaselineInstructions baseline expected actual) elif FileSystem.FileExistsShim baseline.FilePath then FileSystem.FileDeleteShim baseline.FilePath @@ -1162,7 +1162,7 @@ Actual: createBaselineErrors bsl.FSBaseline errorsActual updateBaseLineIfEnvironmentSaysSo bsl.FSBaseline let errorMsg = (convenienceBaselineInstructions bsl.FSBaseline errorsExpectedBaseLine errorsActual) - Assert.AreEqual(errorsExpectedBaseLine, errorsActual, errorMsg) + Assert.True((errorsExpectedBaseLine = errorsActual), errorMsg) elif FileSystem.FileExistsShim(bsl.FSBaseline.FilePath) then FileSystem.FileDeleteShim(bsl.FSBaseline.FilePath) @@ -1494,7 +1494,7 @@ Actual: let inline checkEqual k a b = if a <> b then - Assert.AreEqual(a, b, $"%s{what}: Mismatch in %s{k}, expected '%A{a}', got '%A{b}'.\nAll errors:\n%s{sourceErrorsAsStr}\nExpected errors:\n%s{expectedErrorsAsStr}") + failwith $"%s{what}: Mismatch in %s{k}, expected '%A{a}', got '%A{b}'.\nAll errors:\n%s{sourceErrorsAsStr}\nExpected errors:\n%s{expectedErrorsAsStr}" // For lists longer than 100 errors: expectedErrors |> List.iter System.Diagnostics.Debug.WriteLine @@ -1504,8 +1504,7 @@ Actual: (sourceErrors, expectedErrors) ||> List.iter2 (fun actual expected -> - - Assert.AreEqual(expected, actual, $"Mismatched error message:\nExpecting: {expected}\nActual: {actual}\n")) + Assert.Equal(expected, actual)) let adjust (adjust: int) (result: CompilationResult) : CompilationResult = match result with @@ -1624,7 +1623,7 @@ Actual: match Assert.shouldBeSameMultilineStringSets expectedContent actualErrors with | None -> () - | Some diff -> Assert.That(diff, Is.Empty, path) + | Some diff -> Assert.True(String.IsNullOrEmpty(diff), path) result @@ -1707,7 +1706,7 @@ Actual: | None -> failwith "Execution output is missing, cannot check exit code." | Some o -> match o with - | ExecutionOutput e -> Assert.AreEqual(e.ExitCode, expectedExitCode, sprintf "Exit code was expected to be: %A, but got %A." expectedExitCode e.ExitCode) + | ExecutionOutput e -> Assert.Equal(expectedExitCode, e.ExitCode) | _ -> failwith "Cannot check exit code on this run result." result @@ -1744,7 +1743,7 @@ Actual: let private assertEvalOutput (selector: FsiValue -> 'T) (value: 'T) (result: CompilationResult) : CompilationResult = match result.RunOutput with | None -> failwith "Execution output is missing cannot check value." - | Some (EvalOutput (Ok (Some e))) -> Assert.AreEqual(value, (selector e)) + | Some (EvalOutput (Ok (Some e))) -> Assert.Equal<'T>(value, (selector e)) | Some (EvalOutput (Ok None )) -> failwith "Cannot assert value of evaluation, since it is None." | Some (EvalOutput (Result.Error ex)) -> raise ex | Some _ -> failwith "Only 'eval' output is supported." diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs index 0713d5fa8d2..fc2875d8955 100644 --- a/tests/FSharp.Test.Utilities/CompilerAssert.fs +++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs @@ -21,7 +21,7 @@ open System.Runtime.Loader open FSharp.Test.Utilities open Microsoft.CodeAnalysis open Microsoft.CodeAnalysis.CSharp -open NUnit.Framework +open Xunit open TestFramework open System.Collections.Immutable @@ -149,12 +149,12 @@ type TestCompilation = let diagnostics = c.GetDiagnostics () if not diagnostics.IsEmpty then - NUnit.Framework.Assert.Fail ("CSharp source diagnostics:\n" + (diagnostics |> Seq.map (fun x -> x.GetMessage () + "\n") |> Seq.reduce (+))) + Assert.Fail ("CSharp source diagnostics:\n" + (diagnostics |> Seq.map (fun x -> x.GetMessage () + "\n") |> Seq.reduce (+))) | TestCompilation.IL (_, result) -> let errors, _ = result.Value if errors.Length > 0 then - NUnit.Framework.Assert.Fail ("IL source errors: " + errors) + Assert.Fail ("IL source errors: " + errors) member this.EmitAsFile (outputPath: string) = match this with @@ -484,7 +484,7 @@ module rec CompilerAssertHelpers = let checkEqual k a b = if a <> b then - Assert.AreEqual(a, b, sprintf $"Mismatch in %s{k}, expected '%A{a}', got '%A{b}'.\nAll errors:\n%s{errorsAsStr}") + failwithf $"Mismatch in %s{k}, expected '%A{a}', got '%A{b}'.\nAll errors:\n%s{errorsAsStr}" checkEqual "Errors" (Array.length expectedErrors) errors.Length @@ -771,18 +771,18 @@ Updated automatically, please check diffs in your pull request, changes must be exn |> Option.iter raise) static member ExecutionHasOutput(cmpl: Compilation, expectedOutput: string) = - CompilerAssert.Execute(cmpl, newProcess = true, onOutput = (fun output -> Assert.AreEqual(expectedOutput, output, sprintf "'%s' = '%s'" expectedOutput output))) + CompilerAssert.Execute(cmpl, newProcess = true, onOutput = (fun 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.RunImmediate - Assert.IsEmpty(parseResults.Diagnostics, sprintf "Parse errors: %A" parseResults.Diagnostics) + Assert.Empty(parseResults.Diagnostics) match fileAnswer with | FSharpCheckFileAnswer.Aborted -> Assert.Fail("Type Checker Aborted") | FSharpCheckFileAnswer.Succeeded(typeCheckResults) -> - Assert.IsEmpty(typeCheckResults.Diagnostics, sprintf "Type Check errors: %A" typeCheckResults.Diagnostics) + Assert.Empty(typeCheckResults.Diagnostics) static member PassWithOptions options (source: string) = let defaultOptions = defaultProjectOptions TargetFramework.Current @@ -790,13 +790,13 @@ Updated automatically, please check diffs in your pull request, changes must be let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, options) |> Async.RunImmediate - Assert.IsEmpty(parseResults.Diagnostics, sprintf "Parse errors: %A" parseResults.Diagnostics) + Assert.Empty(parseResults.Diagnostics) match fileAnswer with | FSharpCheckFileAnswer.Aborted -> Assert.Fail("Type Checker Aborted") | FSharpCheckFileAnswer.Succeeded(typeCheckResults) -> - Assert.IsEmpty(typeCheckResults.Diagnostics, sprintf "Type Check errors: %A" typeCheckResults.Diagnostics) + Assert.Empty(typeCheckResults.Diagnostics) static member TypeCheckWithErrorsAndOptionsAgainstBaseLine options (sourceDirectory:string) (sourceFile: string) = let absoluteSourceFile = System.IO.Path.Combine(sourceDirectory, sourceFile) @@ -809,7 +809,7 @@ Updated automatically, please check diffs in your pull request, changes must be { defaultOptions with OtherOptions = Array.append options defaultOptions.OtherOptions; SourceFiles = [|sourceFile|] }) |> Async.RunImmediate - Assert.IsEmpty(parseResults.Diagnostics, sprintf "Parse errors: %A" parseResults.Diagnostics) + Assert.Empty(parseResults.Diagnostics) match fileAnswer with | FSharpCheckFileAnswer.Aborted -> Assert.Fail("Type Checker Aborted") @@ -827,7 +827,7 @@ Updated automatically, please check diffs in your pull request, changes must be |> String.concat "\n" File.WriteAllText(Path.ChangeExtension(absoluteSourceFile,"err"), errorsActual) - Assert.AreEqual(errorsExpectedBaseLine.Replace("\r\n","\n"), errorsActual.Replace("\r\n","\n")) + Assert.Equal(errorsExpectedBaseLine.Replace("\r\n","\n"), errorsActual.Replace("\r\n","\n")) static member TypeCheckWithOptionsAndName options name (source: string) = let errors = @@ -895,7 +895,7 @@ Updated automatically, please check diffs in your pull request, changes must be static member TypeCheck(options, name, source: string) = let parseResults, checkResults = CompilerAssert.ParseAndTypeCheck(options, name, source) - Assert.IsEmpty(parseResults.Diagnostics, sprintf "Parse errors: %A" parseResults.Diagnostics) + Assert.Empty(parseResults.Diagnostics) checkResults @@ -1044,7 +1044,7 @@ Updated automatically, please check diffs in your pull request, changes must be else (expectedErrorMessages, errorMessages) ||> Seq.iter2 (fun expectedErrorMessage errorMessage -> - Assert.AreEqual(expectedErrorMessage, errorMessage) + Assert.Equal(expectedErrorMessage, errorMessage) ) static member RunScript source expectedErrorMessages = @@ -1069,13 +1069,13 @@ Updated automatically, please check diffs in your pull request, changes must be |> Array.distinctBy (fun e -> e.Severity, e.ErrorNumber, e.StartLine, e.StartColumn, e.EndLine, e.EndColumn, e.Message) printfn $"diagnostics: %A{[| for e in errors -> e.Severity, e.ErrorNumber, e.StartLine, e.StartColumn, e.EndLine, e.EndColumn, e.Message |]}" - Assert.AreEqual(Array.length expectedParseErrors, errors.Length, sprintf "Parse errors: %A" parseResults.Diagnostics) + Assert.True((Array.length expectedParseErrors = errors.Length), sprintf "Parse errors: %A" parseResults.Diagnostics) Array.zip errors expectedParseErrors |> Array.iter (fun (info, expectedError) -> let (expectedSeverity: FSharpDiagnosticSeverity, expectedErrorNumber: int, expectedErrorRange: int * int * int * int, expectedErrorMsg: string) = expectedError - Assert.AreEqual(expectedSeverity, info.Severity) - Assert.AreEqual(expectedErrorNumber, info.ErrorNumber, "expectedErrorNumber") - Assert.AreEqual(expectedErrorRange, (info.StartLine, info.StartColumn + 1, info.EndLine, info.EndColumn + 1), "expectedErrorRange") - Assert.AreEqual(expectedErrorMsg, info.Message, "expectedErrorMsg") + Assert.Equal(expectedSeverity, info.Severity) + Assert.Equal(expectedErrorNumber, info.ErrorNumber) + Assert.Equal(expectedErrorRange, (info.StartLine, info.StartColumn + 1, info.EndLine, info.EndColumn + 1)) + Assert.Equal(expectedErrorMsg, info.Message) ) diff --git a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj index 3700eda8514..7ccc5306751 100644 --- a/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj +++ b/tests/FSharp.Test.Utilities/FSharp.Test.Utilities.fsproj @@ -62,7 +62,6 @@ - diff --git a/tests/FSharp.Test.Utilities/ILChecker.fs b/tests/FSharp.Test.Utilities/ILChecker.fs index 15579833bcd..4474ef01c10 100644 --- a/tests/FSharp.Test.Utilities/ILChecker.fs +++ b/tests/FSharp.Test.Utilities/ILChecker.fs @@ -6,7 +6,7 @@ open System open System.IO open System.Text.RegularExpressions -open NUnit.Framework +open Xunit open TestFramework [] diff --git a/tests/FSharp.Test.Utilities/ProjectGeneration.fs b/tests/FSharp.Test.Utilities/ProjectGeneration.fs index c8cc066daa7..78feb049435 100644 --- a/tests/FSharp.Test.Utilities/ProjectGeneration.fs +++ b/tests/FSharp.Test.Utilities/ProjectGeneration.fs @@ -944,7 +944,6 @@ type ProjectWorkflowBuilder ?checker: FSharpChecker, ?useGetSource, ?useChangeNotifications, - ?useSyntaxTreeCache, ?useTransparentCompiler, ?runTimeout, ?autoStart, @@ -973,7 +972,6 @@ type ProjectWorkflowBuilder enablePartialTypeChecking = defaultArg enablePartialTypeChecking true, captureIdentifiersWhenParsing = true, documentSource = (if useGetSource then DocumentSource.Custom getSource else DocumentSource.FileSystem), - useSyntaxTreeCache = defaultArg useSyntaxTreeCache false, useTransparentCompiler = useTransparentCompiler )) diff --git a/tests/FSharp.Test.Utilities/ScriptHelpers.fs b/tests/FSharp.Test.Utilities/ScriptHelpers.fs index aaaf5c458d8..688941934c9 100644 --- a/tests/FSharp.Test.Utilities/ScriptHelpers.fs +++ b/tests/FSharp.Test.Utilities/ScriptHelpers.fs @@ -3,7 +3,6 @@ namespace FSharp.Test.ScriptHelpers open System -open System.Collections.Generic open System.IO open System.Text open System.Threading @@ -11,7 +10,7 @@ open FSharp.Compiler open FSharp.Compiler.Interactive.Shell open FSharp.Compiler.Diagnostics open FSharp.Compiler.EditorServices -open FSharp.Test.Utilities +open FSharp.Test [] type LangVersion = @@ -25,7 +24,26 @@ type LangVersion = | Latest | SupportsMl -type FSharpScript(?additionalArgs: string[], ?quiet: bool, ?langVersion: LangVersion) = +type private EventedTextWriter() = + inherit TextWriter() + let sb = StringBuilder() + let sw = new StringWriter() + let lineWritten = Event() + member _.LineWritten = lineWritten.Publish + override _.Encoding = Encoding.UTF8 + override _.Write(c: char) = + if c = '\n' then + let line = + let v = sb.ToString() + if v.EndsWith("\r") then v.Substring(0, v.Length - 1) + else v + sb.Clear() |> ignore + sw.WriteLine line + lineWritten.Trigger(line) + else sb.Append(c) |> ignore + override _.ToString() = sw.ToString() + +type FSharpScript(?additionalArgs: string[], ?quiet: bool, ?langVersion: LangVersion, ?input: string) = let additionalArgs = defaultArg additionalArgs [||] let quiet = defaultArg quiet true @@ -54,13 +72,32 @@ type FSharpScript(?additionalArgs: string[], ?quiet: bool, ?langVersion: LangVer let argv = Array.append baseArgs additionalArgs + let inReader = new StringReader(defaultArg input "") + let outWriter = new EventedTextWriter() + let errorWriter = new EventedTextWriter() + + let previousIn, previousOut, previousError = Console.In, Console.Out, Console.Error + + do + Console.SetIn inReader + Console.SetOut outWriter + Console.SetError errorWriter + let fsi = FsiEvaluationSession.Create (config, argv, stdin, stdout, stderr) member _.ValueBound = fsi.ValueBound member _.Fsi = fsi - member _.Eval(code: string, ?cancellationToken: CancellationToken, ?desiredCulture: Globalization.CultureInfo) = + member _.OutputProduced = outWriter.LineWritten + + member _.ErrorProduced = errorWriter.LineWritten + + member _.GetOutput() = string outWriter + + member _.GetErrorOutput() = string errorWriter + + member this.Eval(code: string, ?cancellationToken: CancellationToken, ?desiredCulture: Globalization.CultureInfo) = let originalCulture = Thread.CurrentThread.CurrentCulture Thread.CurrentThread.CurrentCulture <- Option.defaultValue Globalization.CultureInfo.InvariantCulture desiredCulture @@ -88,7 +125,11 @@ type FSharpScript(?additionalArgs: string[], ?quiet: bool, ?langVersion: LangVer } interface IDisposable with - member this.Dispose() = ((this.Fsi) :> IDisposable).Dispose() + member this.Dispose() = + ((this.Fsi) :> IDisposable).Dispose() + Console.SetIn previousIn + Console.SetOut previousOut + Console.SetError previousError [] module TestHelpers = @@ -101,15 +142,3 @@ module TestHelpers = | Error ex -> raise ex let ignoreValue = getValue >> ignore - - let getTempDir () = - let sysTempDir = Path.GetTempPath() - let customTempDirName = Guid.NewGuid().ToString("D") - let fullDirName = Path.Combine(sysTempDir, customTempDirName) - let dirInfo = Directory.CreateDirectory(fullDirName) - { new Object() with - member _.ToString() = dirInfo.FullName - interface IDisposable with - member _.Dispose() = - dirInfo.Delete(true) - } diff --git a/tests/FSharp.Test.Utilities/TestFramework.fs b/tests/FSharp.Test.Utilities/TestFramework.fs index d32ce4fcda8..6e1611beb5c 100644 --- a/tests/FSharp.Test.Utilities/TestFramework.fs +++ b/tests/FSharp.Test.Utilities/TestFramework.fs @@ -9,6 +9,7 @@ open System.Diagnostics open Scripting open Xunit open FSharp.Compiler.IO +open Xunit.Sdk let getShortId() = Guid.NewGuid().ToString().[..7] @@ -141,7 +142,7 @@ module Commands = let copy workDir source dest = log "copy /y %s %s" source dest File.Copy( source |> getfullpath workDir, dest |> getfullpath workDir, true) - CmdResult.Success + CmdResult.Success "" let mkdir_p workDir dir = log "mkdir %s" dir @@ -183,19 +184,6 @@ module Commands = let fsc workDir exec (dotNetExe: FilePath) (fscExe: FilePath) flags srcFiles = let args = (sprintf "%s %s" flags (srcFiles |> Seq.ofList |> String.concat " ")) -#if FSC_IN_PROCESS - // This is not yet complete - printfn "Hosted Compiler:" - printfn "workdir: %A\nargs: %A"workdir args - let fscCompiler = FSharp.Compiler.Hosted.FscCompiler() - let exitCode, _stdin, _stdout = FSharp.Compiler.Hosted.CompilerHelpers.fscCompile workDir (FSharp.Compiler.Hosted.CompilerHelpers.parseCommandLine args) - - match exitCode with - | 0 -> CmdResult.Success - | err -> - let msg = sprintf "Error running command '%s' with args '%s' in directory '%s'" fscExe args workDir - CmdResult.ErrorLevel (msg, err) -#else ignore workDir #if NETCOREAPP exec dotNetExe (fscExe + " " + args) @@ -204,7 +192,6 @@ module Commands = printfn "fscExe: %A" fscExe printfn "args: %A" args exec fscExe args -#endif #endif let csc exec cscExe flags srcFiles = @@ -441,15 +428,23 @@ let logConfig (cfg: TestConfig) = log "PEVERIFY = %s" cfg.PEVERIFY log "---------------------------------------------------------------" +let checkOutputPassed (output: string) = + Assert.True(output.Contains "TEST PASSED OK", $"Output does not contain 'TEST PASSED OK':\n{output}") + +let checkResultPassed result = + match result with + | CmdResult.ErrorLevel (msg1, err) -> Assert.Fail (sprintf "%s. ERRORLEVEL %d" msg1 err) + | CmdResult.Success output -> checkOutputPassed output + let checkResult result = match result with | CmdResult.ErrorLevel (msg1, err) -> Assert.Fail (sprintf "%s. ERRORLEVEL %d" msg1 err) - | CmdResult.Success -> () + | CmdResult.Success _ -> () let checkErrorLevel1 result = match result with | CmdResult.ErrorLevel (_,1) -> () - | CmdResult.Success | CmdResult.ErrorLevel _ -> Assert.Fail (sprintf "Command passed unexpectedly") + | CmdResult.Success _ | CmdResult.ErrorLevel _ -> Assert.Fail (sprintf "Command passed unexpectedly") let envVars () = System.Environment.GetEnvironmentVariables () @@ -497,27 +492,13 @@ let createConfigWithEmptyDirectory() = let cfg = suiteHelpers.Value { cfg with Directory = createTemporaryDirectory "temp" } -[] -type FileGuard(path: string) = - let remove path = if FileSystem.FileExistsShim(path) then Commands.rm (Path.GetTempPath()) path - do if not (Path.IsPathRooted(path)) then failwithf "path '%s' must be absolute" path - do remove path - member x.Path = path - member x.Exists = x.Path |> FileSystem.FileExistsShim - member x.CheckExists() = - if not x.Exists then - failwith (sprintf "exit code 0 but %s file doesn't exists" (x.Path |> Path.GetFileName)) - - interface IDisposable with - member x.Dispose () = remove path - - type RedirectToType = | Overwrite of FilePath | Append of FilePath type RedirectTo = - | Inherit + | Ignore + | Collect | Output of RedirectToType | OutputAndError of RedirectToType * RedirectToType | OutputAndErrorToSameFile of RedirectToType @@ -541,8 +522,8 @@ module Command = let redirectType = function Overwrite x -> sprintf ">%s" x | Append x -> sprintf ">>%s" x let outF = function - | Inherit -> "" - | Output r-> sprintf " 1%s" (redirectType r) + | Ignore | Collect -> "" + | Output r -> sprintf " 1%s" (redirectType r) | OutputAndError (r1, r2) -> sprintf " 1%s 2%s" (redirectType r1) (redirectType r2) | OutputAndErrorToSameFile r -> sprintf " 1%s 2>1" (redirectType r) | Error r -> sprintf " 2%s" (redirectType r) @@ -579,9 +560,12 @@ module Command = let outF fCont cmdArgs = match redirect.Output with - | RedirectTo.Inherit -> - use toLog = redirectToLog () - fCont { cmdArgs with RedirectOutput = Some (toLog.Post); RedirectError = Some (toLog.Post) } + | Ignore -> + fCont { cmdArgs with RedirectOutput = Some ignore; RedirectError = Some ignore } + | Collect -> + use out = redirectTo (new StringWriter()) + use error = redirectTo (new StringWriter()) + fCont { cmdArgs with RedirectOutput = Some out.Post; RedirectError = Some error.Post } | Output r -> use writer = openWrite r use outFile = redirectTo writer @@ -612,18 +596,21 @@ module Command = let alwaysSuccess _ = () -let execArgs = { Output = Inherit; Input = None; } +let execArgs = { Output = Ignore; Input = None; } let execAppend cfg stdoutPath stderrPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { execArgs with Output = OutputAndError(Append(stdoutPath), Append(stderrPath)) } p >> checkResult let execAppendIgnoreExitCode cfg stdoutPath stderrPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { execArgs with Output = OutputAndError(Append(stdoutPath), Append(stderrPath)) } p >> alwaysSuccess let exec cfg p = Command.exec cfg.Directory cfg.EnvironmentVariables execArgs p >> checkResult +let execAndCheckPassed cfg p = Command.exec cfg.Directory cfg.EnvironmentVariables { execArgs with Output = Collect } p >> checkResultPassed let execExpectFail cfg p = Command.exec cfg.Directory cfg.EnvironmentVariables execArgs p >> checkErrorLevel1 let execIn cfg workDir p = Command.exec workDir cfg.EnvironmentVariables execArgs p >> checkResult -let execBothToOutNoCheck cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = OutputAndErrorToSameFile(Overwrite(outFile)) } p +let execBothToOutNoCheck cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = OutputAndErrorToSameFile(Overwrite(outFile)) } p let execBothToOut cfg workDir outFile p = execBothToOutNoCheck cfg workDir outFile p >> checkResult +let execBothToOutCheckPassed cfg workDir outFile p = execBothToOutNoCheck cfg workDir outFile p >> checkResultPassed let execBothToOutExpectFail cfg workDir outFile p = execBothToOutNoCheck cfg workDir outFile p >> checkErrorLevel1 let execAppendOutIgnoreExitCode cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = Output(Append(outFile)) } p >> alwaysSuccess let execAppendErrExpectFail cfg errPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { execArgs with Output = Error(Overwrite(errPath)) } p >> checkErrorLevel1 -let execStdin cfg l p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = Inherit; Input = Some(RedirectInput(l)) } p >> checkResult +let execStdin cfg l p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = Ignore; Input = Some(RedirectInput(l)) } p >> checkResult +let execStdinCheckPassed cfg l p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = Collect; Input = Some(RedirectInput(l)) } p >> checkResultPassed let execStdinAppendBothIgnoreExitCode cfg stdoutPath stderrPath stdinPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = OutputAndError(Append(stdoutPath), Append(stderrPath)); Input = Some(RedirectInput(stdinPath)) } p >> alwaysSuccess let fsc cfg arg = Printf.ksprintf (Commands.fsc cfg.Directory (exec cfg) cfg.DotNetExe cfg.FSC) arg let fscIn cfg workDir arg = Printf.ksprintf (Commands.fsc workDir (execIn cfg workDir) cfg.DotNetExe cfg.FSC) arg @@ -639,6 +626,7 @@ let ilasm cfg arg = Printf.ksprintf (Commands.ilasm (exec cfg) cfg.ILASM) arg let peverify _cfg _test = printfn "PEVerify is disabled, need to migrate to ILVerify instead, see https://github.com/dotnet/fsharp/issues/13854" //Commands.peverify (exec cfg) cfg.PEVERIFY "/nologo" let peverifyWithArgs _cfg _args _test = printfn "PEVerify is disabled, need to migrate to ILVerify instead, see https://github.com/dotnet/fsharp/issues/13854" //Commands.peverify (exec cfg) cfg.PEVERIFY args let fsi cfg = Printf.ksprintf (Commands.fsi (exec cfg) cfg.FSI) +let fsiCheckPassed cfg = Printf.ksprintf (Commands.fsi (execAndCheckPassed cfg) cfg.FSI) #if !NETCOREAPP let fsiAnyCpu cfg = Printf.ksprintf (Commands.fsi (exec cfg) cfg.FSIANYCPU) let sn cfg = Printf.ksprintf (Commands.sn (exec cfg) cfg.SN) @@ -646,10 +634,10 @@ let sn cfg = Printf.ksprintf (Commands.sn (exec cfg) cfg.SN) let fsi_script cfg = Printf.ksprintf (Commands.fsi (exec cfg) cfg.FSI_FOR_SCRIPTS) let fsiExpectFail cfg = Printf.ksprintf (Commands.fsi (execExpectFail cfg) cfg.FSI) let fsiAppendIgnoreExitCode cfg stdoutPath stderrPath = Printf.ksprintf (Commands.fsi (execAppendIgnoreExitCode cfg stdoutPath stderrPath) cfg.FSI) -let fileguard cfg fileName = Commands.getfullpath cfg.Directory fileName |> (fun x -> new FileGuard(x)) let getfullpath cfg = Commands.getfullpath cfg.Directory let fileExists cfg fileName = Commands.fileExists cfg.Directory fileName |> Option.isSome let fsiStdin cfg stdinPath = Printf.ksprintf (Commands.fsi (execStdin cfg stdinPath) cfg.FSI) +let fsiStdinCheckPassed cfg stdinPath = Printf.ksprintf (Commands.fsi (execStdinCheckPassed cfg stdinPath) cfg.FSI) let fsiStdinAppendBothIgnoreExitCode cfg stdoutPath stderrPath stdinPath = Printf.ksprintf (Commands.fsi (execStdinAppendBothIgnoreExitCode cfg stdoutPath stderrPath stdinPath) cfg.FSI) let rm cfg x = Commands.rm cfg.Directory x let rmdir cfg x = Commands.rmdir cfg.Directory x diff --git a/tests/FSharp.Test.Utilities/Utilities.fs b/tests/FSharp.Test.Utilities/Utilities.fs index 199f047dfd1..6ed885d4e44 100644 --- a/tests/FSharp.Test.Utilities/Utilities.fs +++ b/tests/FSharp.Test.Utilities/Utilities.fs @@ -38,86 +38,23 @@ type FactForDESKTOPAttribute() = do base.Skip <- "NETCOREAPP is not supported runtime for this kind of test, it is intended for DESKTOP only" #endif - // This file mimics how Roslyn handles their compilation references for compilation testing module Utilities = - - type CapturedTextReader() = - inherit TextReader() - let queue = Queue() - member _.ProvideInput(text: string) = - for c in text.ToCharArray() do - queue.Enqueue(c) - override _.Peek() = - if queue.Count > 0 then queue.Peek() |> int else -1 - override _.Read() = - if queue.Count > 0 then queue.Dequeue() |> int else -1 - - type RedirectConsoleInput() = - let oldStdIn = Console.In - let newStdIn = new CapturedTextReader() - do Console.SetIn(newStdIn) - member _.ProvideInput(text: string) = - newStdIn.ProvideInput(text) - interface IDisposable with - member _.Dispose() = - Console.SetIn(oldStdIn) - newStdIn.Dispose() - - type EventedTextWriter() = - inherit TextWriter() - let sb = StringBuilder() - let lineWritten = Event() - member _.LineWritten = lineWritten.Publish - override _.Encoding = Encoding.UTF8 - override _.Write(c: char) = - if c = '\n' then - let line = - let v = sb.ToString() - if v.EndsWith("\r") then v.Substring(0, v.Length - 1) - else v - sb.Clear() |> ignore - lineWritten.Trigger(line) - else sb.Append(c) |> ignore - - type RedirectConsoleOutput() = - let outputProduced = Event() - let errorProduced = Event() + type RedirectConsole() = let oldStdOut = Console.Out let oldStdErr = Console.Error - let newStdOut = new EventedTextWriter() - let newStdErr = new EventedTextWriter() - - do newStdOut.LineWritten.Add outputProduced.Trigger - do newStdErr.LineWritten.Add errorProduced.Trigger + let newStdOut = new StringWriter() + let newStdErr = new StringWriter() do Console.SetOut(newStdOut) do Console.SetError(newStdErr) + member _.Output () = string newStdOut - member _.OutputProduced = outputProduced.Publish - - member _.ErrorProduced = errorProduced.Publish + member _.ErrorOutput () =string newStdErr interface IDisposable with member _.Dispose() = Console.SetOut(oldStdOut) Console.SetError(oldStdErr) - newStdOut.Dispose() - newStdErr.Dispose() - - type RedirectConsole() = - let redirector = new RedirectConsoleOutput() - let outputLines = StringBuilder() - let errorLines = StringBuilder() - - do redirector.OutputProduced.Add (fun line -> lock outputLines <| fun () -> outputLines.AppendLine line |>ignore) - do redirector.ErrorProduced.Add(fun line -> lock errorLines <| fun () -> errorLines.AppendLine line |>ignore) - - member _.Output () = lock outputLines outputLines.ToString - - member _.ErrorOutput () = lock errorLines errorLines.ToString - - interface IDisposable with - member _.Dispose() = (redirector :> IDisposable).Dispose() type Async with static member RunImmediate (computation: Async<'T>, ?cancellationToken ) = diff --git a/tests/README.md b/tests/README.md index 8f36be0195a..40c9a35b177 100644 --- a/tests/README.md +++ b/tests/README.md @@ -19,7 +19,7 @@ ## Framework for testing -The following test frameworks and libraries will be used for new test projects **[xUnit Test Framework](https://xunit.net/), [FluentAssertions](https://fluentassertions.com/) (+ [FsUnit](https://fsprojects.github.io/FsUnit/) and [FsCheck](https://github.com/fscheck/FsCheck) when needed)**. All existing NUnit test suites will be migrated to xUnit. +The following test frameworks and libraries will be used for new test projects **[xUnit Test Framework](https://xunit.net/), [FluentAssertions](https://fluentassertions.com/) (+ [FsUnit](https://fsprojects.github.io/FsUnit/) and [FsCheck](https://github.com/fscheck/FsCheck) when needed)**. **Justification:** @@ -93,7 +93,6 @@ Existing FSharpQA and Cambridge need to be migrated to corresponding test projec ## Next steps -* [**In Progress**] Migrate existing `NUnit` tests to xUnit. * Clean up CompilerAssert. * Make PEVerify tests work in netcore/non-windows environment. * Start migration of existing (namely, FSharpQA and Cambridge) suites to xUnit-based projects. diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs index 464b7ca7d13..078cffd9e60 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs @@ -481,7 +481,7 @@ let _ = if !failures then (System.Console.Out.WriteLine "Test Failed"; exit 1) do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) """, (fun verifier -> verifier.VerifyIL [ diff --git a/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs b/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs index 715a1e060a1..c6269705d17 100644 --- a/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs +++ b/tests/fsharp/Compiler/Conformance/DataExpressions/ComputationExpressions.fs @@ -281,7 +281,7 @@ let ceResult : Trace = return if y then x else -1 } """ - [| FSharpDiagnosticSeverity.Error, 3344, (6, 9, 8, 35), "This feature is not supported in this version of F#. You may need to add /langversion:preview to use this feature." |] + [| FSharpDiagnosticSeverity.Error, 3344, (7, 9, 7, 13), "This feature is not supported in this version of F#. You may need to add /langversion:preview to use this feature." |] [] let ``AndBang TraceMultiBindingMonoid`` () = @@ -582,7 +582,7 @@ let _ = return x + y } """ - [|(FSharpDiagnosticSeverity.Error, 3343, (6, 9, 6, 25), "The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a 'Bind2' method or appropriate 'MergeSources' and 'Bind' methods")|] + [|(FSharpDiagnosticSeverity.Error, 3343, (6, 9, 6, 13), "The 'let! ... and! ...' construct may only be used if the computation expression builder defines either a 'Bind2' method or appropriate 'MergeSources' and 'Bind' methods")|] [] let ``AndBang Negative TraceApplicative missing Bind and BindReturn`` () = @@ -596,7 +596,7 @@ let _ = return x + y } """ - [|(FSharpDiagnosticSeverity.Error, 708, (6, 9, 6, 25), "This control construct may only be used if the computation expression builder defines a 'Bind' method")|] + [|(FSharpDiagnosticSeverity.Error, 708, (6, 9, 6, 13), "This control construct may only be used if the computation expression builder defines a 'Bind' method")|] [] @@ -612,7 +612,7 @@ let _ = return x + y } """ - [| FSharpDiagnosticSeverity.Error, 708, (7, 9, 7, 25), "This control construct may only be used if the computation expression builder defines a 'Bind' method" |] + [| FSharpDiagnosticSeverity.Error, 708, (7, 9, 7, 13), "This control construct may only be used if the computation expression builder defines a 'Bind' method" |] [] let ``AndBang TraceApplicative with do-bang`` () = diff --git a/tests/fsharp/Libraries/Async/AsyncTests.fs b/tests/fsharp/Compiler/Libraries/Core/Async/AsyncTests.fs similarity index 88% rename from tests/fsharp/Libraries/Async/AsyncTests.fs rename to tests/fsharp/Compiler/Libraries/Core/Async/AsyncTests.fs index 04a82a97160..708e7e58e2e 100644 --- a/tests/fsharp/Libraries/Async/AsyncTests.fs +++ b/tests/fsharp/Compiler/Libraries/Core/Async/AsyncTests.fs @@ -1,14 +1,14 @@ -namespace FSharp.Libraries.UnitTests +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -open System -open NUnit.Framework -open FSharp.Compiler.UnitTests +namespace FSharp.Compiler.UnitTests + +open Xunit +open FSharp.Test -[] module AsyncTests = // Regression for FSHARP1.0:5969 // Async.StartChild: error when wait async is executed more than once - [] + [] let ``Execute Async multiple times``() = CompilerAssert.CompileExeAndRun """ @@ -30,7 +30,7 @@ exit 0 // Regression for FSHARP1.0:5970 // Async.StartChild: race in implementation of ResultCell in FSharp.Core - [] + [] let ``Joining StartChild``() = CompilerAssert.CompileExeAndRun """ @@ -59,7 +59,7 @@ exit 0 """ // Regression test for FSHARP1.0:6086 - [] + [] let ``Mailbox Async dot not StackOverflow``() = CompilerAssert.CompileExeAndRun """ @@ -132,7 +132,8 @@ exit 0 """ // Regression for FSHARP1.0:5971 - [] + + [] let ``StartChild do not throw ObjectDisposedException``() = CompilerAssert.CompileExeAndRun """ @@ -144,8 +145,7 @@ printfn "%A" (b |> Async.RunSynchronously |> Async.RunSynchronously) exit 0 """ - - [] + [] let ``StartChild test Trampoline HijackLimit``() = CompilerAssert.CompileExeAndRun """ diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 5bd5feda50a..6673da9f911 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -3,7 +3,7 @@ net472;$(FSharpNetCoreProductTargetFramework) - $(FSharpNetCoreProductTargetFramework) + $(FSharpNetCoreProductTargetFramework) win-x86;win-x64 $(AssetTargetFallback);portable-net45+win8+wp8+wpa81 true @@ -76,6 +76,7 @@ + diff --git a/tests/fsharp/TypeProviderTests.fs b/tests/fsharp/TypeProviderTests.fs index 04b82f1c818..ab9f2e7e5ef 100644 --- a/tests/fsharp/TypeProviderTests.fs +++ b/tests/fsharp/TypeProviderTests.fs @@ -2,7 +2,7 @@ #if INTERACTIVE //#r @"../../release/net40/bin/FSharp.Compiler.dll" -#r @"../../packages/NUnit.3.5.0/lib/net45/nunit.framework.dll" +#r @"../../packages/xunit.assert/2.9.0/lib/net6.0/xunit.assert.dll" #load "../../src/scripts/scriptlib.fsx" #load "../FSharp.Test.Utilities/TestFramework.fs" #load "single-test.fs" @@ -69,11 +69,9 @@ let diamondAssembly () = exec cfg ("." ++ "test3.exe") "" - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "%s" cfg.fsi_flags ["test3.fsx"] - - testOkFile.CheckExists() + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test3.fsx"] [] let globalNamespace () = @@ -286,18 +284,16 @@ let splitAssembly subdir project = fsc cfg "--out:test.exe -r:provider.dll" ["test.fsx"] begin - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() end begin - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] end // Do the same thing with different load locations for the type provider design-time component @@ -326,19 +322,16 @@ let splitAssembly subdir project = fsc cfg "--out:test.exe -r:provider.dll" ["test.fsx"] - begin - use testOkFile = fileguard cfg "test.ok" + begin - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() end begin - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] end clean() diff --git a/tests/fsharp/core/access/test.fsx b/tests/fsharp/core/access/test.fsx index 21a8c056ee0..3a8bfd0e6f3 100644 --- a/tests/fsharp/core/access/test.fsx +++ b/tests/fsharp/core/access/test.fsx @@ -274,7 +274,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK"; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/anon/test.fsx b/tests/fsharp/core/anon/test.fsx index 580772b3446..6b065cdd7f0 100644 --- a/tests/fsharp/core/anon/test.fsx +++ b/tests/fsharp/core/anon/test.fsx @@ -86,7 +86,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/apporder/test.fsx b/tests/fsharp/core/apporder/test.fsx index 7830de44c1a..5dc19b65fde 100644 --- a/tests/fsharp/core/apporder/test.fsx +++ b/tests/fsharp/core/apporder/test.fsx @@ -1130,7 +1130,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/array-no-dot/test.fsx b/tests/fsharp/core/array-no-dot/test.fsx index 4cba7c3268b..569c477c5eb 100644 --- a/tests/fsharp/core/array-no-dot/test.fsx +++ b/tests/fsharp/core/array-no-dot/test.fsx @@ -435,7 +435,7 @@ let aa = match failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/array/test.fsx b/tests/fsharp/core/array/test.fsx index 69d1feada8c..ceed74ab3b4 100644 --- a/tests/fsharp/core/array/test.fsx +++ b/tests/fsharp/core/array/test.fsx @@ -1142,7 +1142,7 @@ let aa = match failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/asyncStackTraces/test.fsx b/tests/fsharp/core/asyncStackTraces/test.fsx index abbd3ec0a4b..34c82a8804c 100644 --- a/tests/fsharp/core/asyncStackTraces/test.fsx +++ b/tests/fsharp/core/asyncStackTraces/test.fsx @@ -176,6 +176,6 @@ let aa = exit 1 else stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 diff --git a/tests/fsharp/core/attributes/test.fsx b/tests/fsharp/core/attributes/test.fsx index 30509f450fd..e17fd3404f1 100644 --- a/tests/fsharp/core/attributes/test.fsx +++ b/tests/fsharp/core/attributes/test.fsx @@ -1358,7 +1358,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/auto-widen/5.0/test.fsx b/tests/fsharp/core/auto-widen/5.0/test.fsx index 83d2f46ab2b..74f1af4fdb9 100644 --- a/tests/fsharp/core/auto-widen/5.0/test.fsx +++ b/tests/fsharp/core/auto-widen/5.0/test.fsx @@ -459,7 +459,7 @@ let aa = match failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> printfn "Test Failed, failures = %A" failures diff --git a/tests/fsharp/core/auto-widen/minimal/test.fsx b/tests/fsharp/core/auto-widen/minimal/test.fsx index 92e7cfc56da..bf0e11b64a6 100644 --- a/tests/fsharp/core/auto-widen/minimal/test.fsx +++ b/tests/fsharp/core/auto-widen/minimal/test.fsx @@ -2,5 +2,5 @@ #r "System.Xml.XDocument.dll" let ns : System.Xml.Linq.XNamespace = "" -System.IO.File.WriteAllText("test.ok","ok") +printf "TEST PASSED OK" ; exit 0 \ No newline at end of file diff --git a/tests/fsharp/core/auto-widen/preview-default-warns/test.fsx b/tests/fsharp/core/auto-widen/preview-default-warns/test.fsx index 2989aa19071..ea91533c0dd 100644 --- a/tests/fsharp/core/auto-widen/preview-default-warns/test.fsx +++ b/tests/fsharp/core/auto-widen/preview-default-warns/test.fsx @@ -566,7 +566,7 @@ let aa = match failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> printfn "Test Failed, failures = %A" failures diff --git a/tests/fsharp/core/auto-widen/preview/test.fsx b/tests/fsharp/core/auto-widen/preview/test.fsx index e5e11b074dd..50eaae85f62 100644 --- a/tests/fsharp/core/auto-widen/preview/test.fsx +++ b/tests/fsharp/core/auto-widen/preview/test.fsx @@ -644,7 +644,7 @@ let aa = match failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> printfn "Test Failed, failures = %A" failures diff --git a/tests/fsharp/core/comprehensions-hw/test.fsx b/tests/fsharp/core/comprehensions-hw/test.fsx index 54ccfa1f167..bd47019704e 100644 --- a/tests/fsharp/core/comprehensions-hw/test.fsx +++ b/tests/fsharp/core/comprehensions-hw/test.fsx @@ -1048,7 +1048,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/comprehensions/test.fsx b/tests/fsharp/core/comprehensions/test.fsx index c6cad18b75c..4d9664404cb 100644 --- a/tests/fsharp/core/comprehensions/test.fsx +++ b/tests/fsharp/core/comprehensions/test.fsx @@ -1488,7 +1488,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/control/test.fsx b/tests/fsharp/core/control/test.fsx index 98db3309532..6c80ca0d72b 100644 --- a/tests/fsharp/core/control/test.fsx +++ b/tests/fsharp/core/control/test.fsx @@ -2100,7 +2100,7 @@ let aa = exit 1 else stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 #endif diff --git a/tests/fsharp/core/controlChamenos/test.fsx b/tests/fsharp/core/controlChamenos/test.fsx index b95bfff4c80..5742662a53c 100644 --- a/tests/fsharp/core/controlChamenos/test.fsx +++ b/tests/fsharp/core/controlChamenos/test.fsx @@ -123,6 +123,6 @@ let aa = exit 1 else stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 #endif diff --git a/tests/fsharp/core/controlMailbox/test.fsx b/tests/fsharp/core/controlMailbox/test.fsx index fc8a1cc7aea..98d6a7d2f31 100644 --- a/tests/fsharp/core/controlMailbox/test.fsx +++ b/tests/fsharp/core/controlMailbox/test.fsx @@ -624,6 +624,6 @@ let aa = exit 1 else stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 #endif diff --git a/tests/fsharp/core/controlStackOverflow/test.fsx b/tests/fsharp/core/controlStackOverflow/test.fsx index 735b09173c9..f3678844b05 100644 --- a/tests/fsharp/core/controlStackOverflow/test.fsx +++ b/tests/fsharp/core/controlStackOverflow/test.fsx @@ -415,6 +415,6 @@ let aa = else stdout.WriteLine "Test Passed" log "ALL OK, HAPPY HOLIDAYS, MERRY CHRISTMAS!" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 #endif diff --git a/tests/fsharp/core/controlWebExt/test.fsx b/tests/fsharp/core/controlWebExt/test.fsx index 42a43aed573..23e5bf5071e 100644 --- a/tests/fsharp/core/controlWebExt/test.fsx +++ b/tests/fsharp/core/controlWebExt/test.fsx @@ -233,7 +233,7 @@ let aa = if not failures.IsEmpty then (stdout.WriteLine("Test Failed, failures = {0}", failures); exit 1) else (stdout.WriteLine "Test Passed"; log "ALL OK, HAPPY HOLIDAYS, MERRY CHRISTMAS!" - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; // debug: why is the fsi test failing? is it because test.ok does not exist? if System.IO.File.Exists("test.ok") then stdout.WriteLine ("test.ok found at {0}", System.IO.FileInfo("test.ok").FullName) diff --git a/tests/fsharp/core/controlWpf/test.fsx b/tests/fsharp/core/controlWpf/test.fsx index 25ad5eff208..400f196c652 100644 --- a/tests/fsharp/core/controlWpf/test.fsx +++ b/tests/fsharp/core/controlWpf/test.fsx @@ -27,8 +27,8 @@ async { printfn "Test Failed" app.Shutdown(128) else - printfn "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" + printf "TEST PASSED OK" ; app.Shutdown(0) } |> Async.StartImmediate diff --git a/tests/fsharp/core/csext/test.fsx b/tests/fsharp/core/csext/test.fsx index c77a7307642..224fd9dd047 100644 --- a/tests/fsharp/core/csext/test.fsx +++ b/tests/fsharp/core/csext/test.fsx @@ -321,7 +321,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/enum/test.fsx b/tests/fsharp/core/enum/test.fsx index 2bc2d41d783..bf80f12bdc7 100644 --- a/tests/fsharp/core/enum/test.fsx +++ b/tests/fsharp/core/enum/test.fsx @@ -49,7 +49,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/events/test.fs b/tests/fsharp/core/events/test.fs index 0050a8d5635..e9921fcbe25 100644 --- a/tests/fsharp/core/events/test.fs +++ b/tests/fsharp/core/events/test.fs @@ -537,5 +537,5 @@ module EventWithNonPublicDelegateTypes_DevDiv271288 = let _ = if failures.Length > 0 then (printfn "Tests Failed: %A" failures; exit 1) else (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/core/fileorder/test.fsx b/tests/fsharp/core/fileorder/test.fsx index 6981cdcc03a..8c874d7d6b5 100644 --- a/tests/fsharp/core/fileorder/test.fsx +++ b/tests/fsharp/core/fileorder/test.fsx @@ -19,5 +19,5 @@ let aa = if !failures then (stdout.WriteLine "Test Failed"; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) \ No newline at end of file diff --git a/tests/fsharp/core/forexpression/test.fsx b/tests/fsharp/core/forexpression/test.fsx index 141fc4677e1..257cdf308f3 100644 --- a/tests/fsharp/core/forexpression/test.fsx +++ b/tests/fsharp/core/forexpression/test.fsx @@ -168,5 +168,5 @@ let RUN() = !failures #else let aa = if !failures then stdout.WriteLine "Test Failed"; exit 1 - else stdout.WriteLine "Test Passed"; System.IO.File.WriteAllText("test.ok","ok"); exit 0 + else stdout.WriteLine "Test Passed"; printf "TEST PASSED OK"; exit 0 #endif diff --git a/tests/fsharp/core/fsfromcs/test.cs b/tests/fsharp/core/fsfromcs/test.cs index 5281b3469e0..7c27491f789 100644 --- a/tests/fsharp/core/fsfromcs/test.cs +++ b/tests/fsharp/core/fsfromcs/test.cs @@ -311,7 +311,7 @@ static int Main() //let tup3 = (2,3,4) //let tup4 = (2,3,4,5) - System.Console.WriteLine("Test Passed."); + System.Console.WriteLine("TEST PASSED OK"); return 0; } diff --git a/tests/fsharp/core/fsfromfsviacs/test.fsx b/tests/fsharp/core/fsfromfsviacs/test.fsx index 7974a4ce47b..e7c47575bd8 100644 --- a/tests/fsharp/core/fsfromfsviacs/test.fsx +++ b/tests/fsharp/core/fsfromfsviacs/test.fsx @@ -487,7 +487,7 @@ let _ = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/fsi-load/test.fsx b/tests/fsharp/core/fsi-load/test.fsx index f81654365e7..062ea882adc 100644 --- a/tests/fsharp/core/fsi-load/test.fsx +++ b/tests/fsharp/core/fsi-load/test.fsx @@ -17,6 +17,6 @@ module OtherModule = let _ = stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 diff --git a/tests/fsharp/core/fsi-reference/test.fsx b/tests/fsharp/core/fsi-reference/test.fsx index 16867d6f344..393b44151c2 100644 --- a/tests/fsharp/core/fsi-reference/test.fsx +++ b/tests/fsharp/core/fsi-reference/test.fsx @@ -4,5 +4,5 @@ let c = new ReferenceAssembly.MyClass() let _ = c.X // If this fails then the jit blows up so this file will not get written. -let os = System.IO.File.CreateText "test.ok" in os.Close() +printf "TEST PASSED OK" ; exit 0 diff --git a/tests/fsharp/core/fsi-reload/load1.fsx b/tests/fsharp/core/fsi-reload/load1.fsx index 0f7fba67329..44b24cddab5 100644 --- a/tests/fsharp/core/fsi-reload/load1.fsx +++ b/tests/fsharp/core/fsi-reload/load1.fsx @@ -2,4 +2,4 @@ #load "a1.fs" #load "a2.fs" -let os = System.IO.File.CreateText "test.ok" in os.Close() +printf "TEST PASSED OK" ; diff --git a/tests/fsharp/core/fsi-reload/load2.fsx b/tests/fsharp/core/fsi-reload/load2.fsx index a30cad3826f..d87b4e10df0 100644 --- a/tests/fsharp/core/fsi-reload/load2.fsx +++ b/tests/fsharp/core/fsi-reload/load2.fsx @@ -2,4 +2,4 @@ #load "b1.fs" #load "b2.fsi" "b2.fs" -let os = System.IO.File.CreateText "test.ok" in os.Close() +printf "TEST PASSED OK" ; diff --git a/tests/fsharp/core/fsi-reload/test1.ml b/tests/fsharp/core/fsi-reload/test1.ml index e9f0a57fa91..9cc77a02eb1 100644 --- a/tests/fsharp/core/fsi-reload/test1.ml +++ b/tests/fsharp/core/fsi-reload/test1.ml @@ -72,6 +72,6 @@ printf "x = %b\n" (X x = X 3) printf "x = %d\n" (3 : x_t) ;; -begin ignore (3 : x_t); ignore (3 : Nested.x_t); ignore (3 : Test1.Nested.x_t); ignore (3 : Test1.x_t); let os = System.IO.File.CreateText "test.ok" in os.Close() end;; +begin ignore (3 : x_t); ignore (3 : Nested.x_t); ignore (3 : Test1.Nested.x_t); ignore (3 : Test1.x_t); printf "TEST PASSED OK" end;; #quit;; diff --git a/tests/fsharp/core/fsi-shadowcopy/test1.fsx b/tests/fsharp/core/fsi-shadowcopy/test1.fsx index 3e34e651775..93f2765b719 100644 --- a/tests/fsharp/core/fsi-shadowcopy/test1.fsx +++ b/tests/fsharp/core/fsi-shadowcopy/test1.fsx @@ -23,8 +23,7 @@ let next = compiled 30000;; //compile will fail because shadow copy is disabled if next = false then printfn "Succeeded -- compile fail because file locked due to --shadowcopyreferences-" - use os = System.IO.File.CreateText "test1.ok" - os.Close() + printf "TEST PASSED OK" ; else printfn "Failed -- compile succeeded but should have failed due to file lock because of --shadowcopyReferences-. Suspect test error";; diff --git a/tests/fsharp/core/fsi-shadowcopy/test2.fsx b/tests/fsharp/core/fsi-shadowcopy/test2.fsx index 34da503c636..94633d0819e 100644 --- a/tests/fsharp/core/fsi-shadowcopy/test2.fsx +++ b/tests/fsharp/core/fsi-shadowcopy/test2.fsx @@ -30,8 +30,7 @@ if next = true then printfn "Succeeded -- compile worked because file not locked due to --shadowcopyReferences+" if verifyGetEntryAssembly then printfn "Succeeded -- GetEntryAssembly() returned not null" - use os = System.IO.File.CreateText "test2.ok" - os.Close() + printf "TEST PASSED OK" ; else printfn "Failed -- GetEntryAssembly() returned null" else diff --git a/tests/fsharp/core/fsiAndModifiers/test.fsx b/tests/fsharp/core/fsiAndModifiers/test.fsx index 16b3d33aee0..c63ddcf384f 100644 --- a/tests/fsharp/core/fsiAndModifiers/test.fsx +++ b/tests/fsharp/core/fsiAndModifiers/test.fsx @@ -139,7 +139,7 @@ module PinTests = if errors.IsEmpty then - System.IO.File.WriteAllText("test.ok", "") + printf "TEST PASSED OK" ; exit(0) else for error in errors do diff --git a/tests/fsharp/core/genericmeasures/test.fsx b/tests/fsharp/core/genericmeasures/test.fsx index b7de5c84aaa..ade03d4fb4c 100644 --- a/tests/fsharp/core/genericmeasures/test.fsx +++ b/tests/fsharp/core/genericmeasures/test.fsx @@ -80,7 +80,7 @@ module Core_genericMeasures = #else RunAll(); stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 #endif diff --git a/tests/fsharp/core/indent/version46/test.fsx b/tests/fsharp/core/indent/version46/test.fsx index b9d41a04da5..3cc566d6981 100644 --- a/tests/fsharp/core/indent/version46/test.fsx +++ b/tests/fsharp/core/indent/version46/test.fsx @@ -105,7 +105,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/indent/version47/test.fsx b/tests/fsharp/core/indent/version47/test.fsx index 9a119b4c89f..1cc563cb0aa 100644 --- a/tests/fsharp/core/indent/version47/test.fsx +++ b/tests/fsharp/core/indent/version47/test.fsx @@ -85,7 +85,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/innerpoly/test.fsx b/tests/fsharp/core/innerpoly/test.fsx index e03b322d1c0..c9a8c714bc6 100644 --- a/tests/fsharp/core/innerpoly/test.fsx +++ b/tests/fsharp/core/innerpoly/test.fsx @@ -483,7 +483,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/int32/test.fsx b/tests/fsharp/core/int32/test.fsx index a6dec0ea0af..1c6a500c55a 100644 --- a/tests/fsharp/core/int32/test.fsx +++ b/tests/fsharp/core/int32/test.fsx @@ -425,7 +425,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/large/conditionals/LargeConditionals-200.fs b/tests/fsharp/core/large/conditionals/LargeConditionals-200.fs index d1910edcce4..330bfa99801 100644 --- a/tests/fsharp/core/large/conditionals/LargeConditionals-200.fs +++ b/tests/fsharp/core/large/conditionals/LargeConditionals-200.fs @@ -207,4 +207,4 @@ let expectedValues() = if rnd.Next(3) = 1 then 1 else 4 printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +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 40840fbdb13..71c3dec00a3 100644 --- a/tests/fsharp/core/large/conditionals/LargeConditionals-maxtested.fs +++ b/tests/fsharp/core/large/conditionals/LargeConditionals-maxtested.fs @@ -421,4 +421,4 @@ let expectedValues() = if rnd.Next(3) = 1 then 1 else 4 printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +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 5a1aa0697bb..d4e5f29e270 100644 --- a/tests/fsharp/core/large/lets/LargeLets-500.fs +++ b/tests/fsharp/core/large/lets/LargeLets-500.fs @@ -506,4 +506,4 @@ let expectedValues() = let x = x + rnd.Next(3) x printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) +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 9f220268b6e..2c9a0ee6007 100644 --- a/tests/fsharp/core/large/lets/LargeLets-maxtested.fs +++ b/tests/fsharp/core/large/lets/LargeLets-maxtested.fs @@ -792,4 +792,4 @@ let expectedValues() = let x = x + rnd.Next(3) x printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) +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 b46244887a7..0b610e54c1d 100644 --- a/tests/fsharp/core/large/lists/LargeList-500.fs +++ b/tests/fsharp/core/large/lists/LargeList-500.fs @@ -504,4 +504,4 @@ let expectedValues = 1 ] printfn "length = %d" expectedValues.Length -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +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 4dac865609a..33624f1275b 100644 --- a/tests/fsharp/core/large/matches/LargeMatches-200.fs +++ b/tests/fsharp/core/large/matches/LargeMatches-200.fs @@ -306,4 +306,4 @@ let expectedValues() = | None -> 4 printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +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 a220824334d..1c992ab7a43 100644 --- a/tests/fsharp/core/large/matches/LargeMatches-maxtested.fs +++ b/tests/fsharp/core/large/matches/LargeMatches-maxtested.fs @@ -462,4 +462,4 @@ let expectedValues() = | None -> 4 printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +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 404817e2a4f..966651362be 100644 --- a/tests/fsharp/core/large/mixed/LargeSequentialLet-500.fs +++ b/tests/fsharp/core/large/mixed/LargeSequentialLet-500.fs @@ -1008,4 +1008,4 @@ let expectedValues() = let mutable x = x + 1 x printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/mixed/LargeSequentialLet-maxtested.fs b/tests/fsharp/core/large/mixed/LargeSequentialLet-maxtested.fs index 404817e2a4f..966651362be 100644 --- a/tests/fsharp/core/large/mixed/LargeSequentialLet-maxtested.fs +++ b/tests/fsharp/core/large/mixed/LargeSequentialLet-maxtested.fs @@ -1008,4 +1008,4 @@ let expectedValues() = let mutable x = x + 1 x printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/large/sequential/LargeSequential-500.fs b/tests/fsharp/core/large/sequential/LargeSequential-500.fs index adfd85723c8..98709915acc 100644 --- a/tests/fsharp/core/large/sequential/LargeSequential-500.fs +++ b/tests/fsharp/core/large/sequential/LargeSequential-500.fs @@ -506,4 +506,4 @@ let expectedValues() = x <- x + rnd.Next(3) x printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +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 e28abe4c379..b5fcb01d945 100644 --- a/tests/fsharp/core/large/sequential/LargeSequential-maxtested.fs +++ b/tests/fsharp/core/large/sequential/LargeSequential-maxtested.fs @@ -6712,4 +6712,4 @@ let expectedValues() = x <- x + rnd.Next(3) x printfn "expectedValues() = %A" (expectedValues()) -System.IO.File.WriteAllLines("test.ok", ["ok"]) \ No newline at end of file +printf "TEST PASSED OK" ; \ No newline at end of file diff --git a/tests/fsharp/core/lazy/test.fsx b/tests/fsharp/core/lazy/test.fsx index 7b2424252df..a15a1aa33d8 100644 --- a/tests/fsharp/core/lazy/test.fsx +++ b/tests/fsharp/core/lazy/test.fsx @@ -78,7 +78,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/letrec-mutrec/test.fs b/tests/fsharp/core/letrec-mutrec/test.fs index 9f571cf2a9d..720b441cb38 100644 --- a/tests/fsharp/core/letrec-mutrec/test.fs +++ b/tests/fsharp/core/letrec-mutrec/test.fs @@ -203,6 +203,6 @@ do if !failures then (stdout.WriteLine "Test Failed"; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + 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 e9a830ec488..c04592ad0f2 100644 --- a/tests/fsharp/core/letrec-mutrec2/test.fs +++ b/tests/fsharp/core/letrec-mutrec2/test.fs @@ -337,6 +337,6 @@ let aa = do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) #endif \ No newline at end of file diff --git a/tests/fsharp/core/letrec/test.fsx b/tests/fsharp/core/letrec/test.fsx index 27f03ce0213..9d7ea6fbea4 100644 --- a/tests/fsharp/core/letrec/test.fsx +++ b/tests/fsharp/core/letrec/test.fsx @@ -812,7 +812,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/libtest/test.fsx b/tests/fsharp/core/libtest/test.fsx index 370cb4918af..fae232ae5e9 100644 --- a/tests/fsharp/core/libtest/test.fsx +++ b/tests/fsharp/core/libtest/test.fsx @@ -559,9 +559,9 @@ do test "cwewvewho0" (match box(Some 3) with :? option -> false | _ - do test "cwewvewho-" (match box([3]) with :? list as v -> (v = [3]) | _ -> false) do test "cwewvewhoa" (match box([3]) with :? list as v -> false | _ -> true) -do test "cwewvewhos" (match (null:obj) with :? list as v -> false | _ -> true) +do test "cwewvewhos" (match (null:obj) with :? list as v -> false | _ -> true) -let pattest<'a> (obj:obj) fail (succeed : 'a -> bool) = match obj with :? 'a as x -> succeed x | _ -> fail() +let pattest<'a> (obj:objnull) fail (succeed : 'a -> bool) = match obj with :? 'a as x -> succeed x | _ -> fail() do test "cwewvewhoq" (pattest (box(1)) (fun () -> false) (fun v -> v = 1)) do test "cwewvewhow" (pattest (null) (fun () -> true ) (fun _ -> false)) @@ -5646,7 +5646,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/lift/test.fsx b/tests/fsharp/core/lift/test.fsx index f47e1ba5972..24ec381a256 100644 --- a/tests/fsharp/core/lift/test.fsx +++ b/tests/fsharp/core/lift/test.fsx @@ -64,7 +64,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/longnames/test.fsx b/tests/fsharp/core/longnames/test.fsx index 577dc547a6d..963f31d4b25 100644 --- a/tests/fsharp/core/longnames/test.fsx +++ b/tests/fsharp/core/longnames/test.fsx @@ -695,7 +695,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/map/test.fsx b/tests/fsharp/core/map/test.fsx index 2e80355e94a..b093d33ff33 100644 --- a/tests/fsharp/core/map/test.fsx +++ b/tests/fsharp/core/map/test.fsx @@ -177,7 +177,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/math/lalgebra/test.fsx b/tests/fsharp/core/math/lalgebra/test.fsx index c09351a1a99..30f8dda47f6 100644 --- a/tests/fsharp/core/math/lalgebra/test.fsx +++ b/tests/fsharp/core/math/lalgebra/test.fsx @@ -313,7 +313,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/math/numbers/test.fsx b/tests/fsharp/core/math/numbers/test.fsx index d9b8eb2edd7..7e1fb5ecb04 100644 --- a/tests/fsharp/core/math/numbers/test.fsx +++ b/tests/fsharp/core/math/numbers/test.fsx @@ -290,7 +290,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/math/numbersVS2008/test.fsx b/tests/fsharp/core/math/numbersVS2008/test.fsx index ec3adaf70c8..d51423a94f3 100644 --- a/tests/fsharp/core/math/numbersVS2008/test.fsx +++ b/tests/fsharp/core/math/numbersVS2008/test.fsx @@ -276,7 +276,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/measures/test.fsx b/tests/fsharp/core/measures/test.fsx index f1dec887c09..83357564018 100644 --- a/tests/fsharp/core/measures/test.fsx +++ b/tests/fsharp/core/measures/test.fsx @@ -612,7 +612,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/basics-hw-mutrec/test.fs b/tests/fsharp/core/members/basics-hw-mutrec/test.fs index 5b53e85196f..cd66176d435 100644 --- a/tests/fsharp/core/members/basics-hw-mutrec/test.fs +++ b/tests/fsharp/core/members/basics-hw-mutrec/test.fs @@ -37,6 +37,6 @@ module StaticInitializerTest3 = let _ = if not failures.Value.IsEmpty then (eprintfn "Test Failed, failures = %A" failures.Value; exit 1) else (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/core/members/basics-hw/test.fsx b/tests/fsharp/core/members/basics-hw/test.fsx index e04a76f7ec2..641cb5dbc76 100644 --- a/tests/fsharp/core/members/basics-hw/test.fsx +++ b/tests/fsharp/core/members/basics-hw/test.fsx @@ -5663,7 +5663,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/basics/test.fs b/tests/fsharp/core/members/basics/test.fs index efcaa000692..466e6cdd5b7 100644 --- a/tests/fsharp/core/members/basics/test.fs +++ b/tests/fsharp/core/members/basics/test.fs @@ -3481,7 +3481,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/ctree/test.fsx b/tests/fsharp/core/members/ctree/test.fsx index 117a36d1c18..c12dcd73a61 100644 --- a/tests/fsharp/core/members/ctree/test.fsx +++ b/tests/fsharp/core/members/ctree/test.fsx @@ -64,7 +64,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/factors-mutrec/test.fs b/tests/fsharp/core/members/factors-mutrec/test.fs index 8619ec8e785..e8532addec1 100644 --- a/tests/fsharp/core/members/factors-mutrec/test.fs +++ b/tests/fsharp/core/members/factors-mutrec/test.fs @@ -152,6 +152,6 @@ let Gaussian1DPriorFactorNode((var: VariableNode), mean, variance) = let _ = if !failures then (stdout.WriteLine "Test Failed"; exit 1) else (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/core/members/factors/test.fsx b/tests/fsharp/core/members/factors/test.fsx index b2ebe8dbcf4..e8b83b4fa6b 100644 --- a/tests/fsharp/core/members/factors/test.fsx +++ b/tests/fsharp/core/members/factors/test.fsx @@ -276,7 +276,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/incremental-hw-mutrec/test.fsx b/tests/fsharp/core/members/incremental-hw-mutrec/test.fsx index d8543c40291..a661090396c 100644 --- a/tests/fsharp/core/members/incremental-hw-mutrec/test.fsx +++ b/tests/fsharp/core/members/incremental-hw-mutrec/test.fsx @@ -659,6 +659,6 @@ module ExceptionsWithAugmentations = let _ = if !failures then (stdout.WriteLine "Test Failed"; exit 1) else (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/core/members/incremental-hw/test.fsx b/tests/fsharp/core/members/incremental-hw/test.fsx index 0c3ede8a6b7..0fbc223b8e1 100644 --- a/tests/fsharp/core/members/incremental-hw/test.fsx +++ b/tests/fsharp/core/members/incremental-hw/test.fsx @@ -740,7 +740,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/incremental/test.fsx b/tests/fsharp/core/members/incremental/test.fsx index 57015d42851..88b493e0cda 100644 --- a/tests/fsharp/core/members/incremental/test.fsx +++ b/tests/fsharp/core/members/incremental/test.fsx @@ -717,7 +717,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/ops-mutrec/test.fs b/tests/fsharp/core/members/ops-mutrec/test.fs index 1ff8f31135f..b4eae93feb8 100644 --- a/tests/fsharp/core/members/ops-mutrec/test.fs +++ b/tests/fsharp/core/members/ops-mutrec/test.fs @@ -382,6 +382,6 @@ module TraitCallsAndConstructors = let _ = if !failures then (stdout.WriteLine "Test Failed"; exit 1) else (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK" exit 0) diff --git a/tests/fsharp/core/members/ops/test.fsx b/tests/fsharp/core/members/ops/test.fsx index a7b611ee9cd..c8ef75f93be 100644 --- a/tests/fsharp/core/members/ops/test.fsx +++ b/tests/fsharp/core/members/ops/test.fsx @@ -416,7 +416,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/self-identifier/version46/test.fs b/tests/fsharp/core/members/self-identifier/version46/test.fs index 5a53a84a4cb..8bd41b0555c 100644 --- a/tests/fsharp/core/members/self-identifier/version46/test.fs +++ b/tests/fsharp/core/members/self-identifier/version46/test.fs @@ -54,7 +54,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/members/self-identifier/version47/test.fs b/tests/fsharp/core/members/self-identifier/version47/test.fs index 76bc777ae0d..2a648678b4e 100644 --- a/tests/fsharp/core/members/self-identifier/version47/test.fs +++ b/tests/fsharp/core/members/self-identifier/version47/test.fs @@ -76,7 +76,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/nameof/preview/test.fsx b/tests/fsharp/core/nameof/preview/test.fsx index 0a952ab823f..4921b12d53e 100644 --- a/tests/fsharp/core/nameof/preview/test.fsx +++ b/tests/fsharp/core/nameof/preview/test.fsx @@ -417,7 +417,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/namespaces/test2.fs b/tests/fsharp/core/namespaces/test2.fs index 4ad843fb442..90a5d6bfe41 100644 --- a/tests/fsharp/core/namespaces/test2.fs +++ b/tests/fsharp/core/namespaces/test2.fs @@ -28,7 +28,7 @@ module UnionTestsWithSignature = exit 1 else stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 #endif diff --git a/tests/fsharp/core/nested/test.fsx b/tests/fsharp/core/nested/test.fsx index 388db9ecc23..410d0f510a3 100644 --- a/tests/fsharp/core/nested/test.fsx +++ b/tests/fsharp/core/nested/test.fsx @@ -64,7 +64,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/patterns/test.fsx b/tests/fsharp/core/patterns/test.fsx index 1eb20080910..dce360f5996 100644 --- a/tests/fsharp/core/patterns/test.fsx +++ b/tests/fsharp/core/patterns/test.fsx @@ -1735,7 +1735,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/pinvoke/test.fsx b/tests/fsharp/core/pinvoke/test.fsx index 7f83b24fd41..29c079e145d 100644 --- a/tests/fsharp/core/pinvoke/test.fsx +++ b/tests/fsharp/core/pinvoke/test.fsx @@ -152,7 +152,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | messages -> printfn "%A" messages diff --git a/tests/fsharp/core/printf-interpolated/test.fsx b/tests/fsharp/core/printf-interpolated/test.fsx index b1891f31ad9..810d7bfd675 100644 --- a/tests/fsharp/core/printf-interpolated/test.fsx +++ b/tests/fsharp/core/printf-interpolated/test.fsx @@ -292,7 +292,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/printf/test.fsx b/tests/fsharp/core/printf/test.fsx index cf78d1a8cbd..a3ae40791a3 100644 --- a/tests/fsharp/core/printf/test.fsx +++ b/tests/fsharp/core/printf/test.fsx @@ -9339,7 +9339,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/queriesCustomQueryOps/test.fsx b/tests/fsharp/core/queriesCustomQueryOps/test.fsx index d542e5d0f4d..4b26f71babd 100644 --- a/tests/fsharp/core/queriesCustomQueryOps/test.fsx +++ b/tests/fsharp/core/queriesCustomQueryOps/test.fsx @@ -459,7 +459,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx b/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx index 59583445916..da0505782be 100644 --- a/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx +++ b/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx @@ -1004,7 +1004,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/queriesNullableOperators/test.fsx b/tests/fsharp/core/queriesNullableOperators/test.fsx index 1cb230749b5..5e400fb5644 100644 --- a/tests/fsharp/core/queriesNullableOperators/test.fsx +++ b/tests/fsharp/core/queriesNullableOperators/test.fsx @@ -311,7 +311,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/queriesOverIEnumerable/test.fsx b/tests/fsharp/core/queriesOverIEnumerable/test.fsx index cb77ad63828..fefcdc309f3 100644 --- a/tests/fsharp/core/queriesOverIEnumerable/test.fsx +++ b/tests/fsharp/core/queriesOverIEnumerable/test.fsx @@ -1002,7 +1002,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/queriesOverIQueryable/test.fsx b/tests/fsharp/core/queriesOverIQueryable/test.fsx index c6e507dfa61..d5a8b6c6858 100644 --- a/tests/fsharp/core/queriesOverIQueryable/test.fsx +++ b/tests/fsharp/core/queriesOverIQueryable/test.fsx @@ -2445,7 +2445,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/quotes/test.fsx b/tests/fsharp/core/quotes/test.fsx index 41efacfbc8d..7aa339449cf 100644 --- a/tests/fsharp/core/quotes/test.fsx +++ b/tests/fsharp/core/quotes/test.fsx @@ -5938,7 +5938,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | errs -> printfn "Test Failed, errors = %A" errs diff --git a/tests/fsharp/core/quotesDebugInfo/test.fsx b/tests/fsharp/core/quotesDebugInfo/test.fsx index 63b68a71777..e2bdcd55ce3 100644 --- a/tests/fsharp/core/quotesDebugInfo/test.fsx +++ b/tests/fsharp/core/quotesDebugInfo/test.fsx @@ -646,7 +646,7 @@ let aa = match !failures with | 0 -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/quotesInMultipleModules/module2.fsx b/tests/fsharp/core/quotesInMultipleModules/module2.fsx index 62a2f9e6e21..c24c10e54bf 100644 --- a/tests/fsharp/core/quotesInMultipleModules/module2.fsx +++ b/tests/fsharp/core/quotesInMultipleModules/module2.fsx @@ -37,7 +37,7 @@ if not test3 then if test1 && test2 && test3 then stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0 else exit 1 diff --git a/tests/fsharp/core/recordResolution/test.fsx b/tests/fsharp/core/recordResolution/test.fsx index 13af38e0d92..545b7b81a7b 100644 --- a/tests/fsharp/core/recordResolution/test.fsx +++ b/tests/fsharp/core/recordResolution/test.fsx @@ -56,5 +56,5 @@ module Ex3 = let a2 = { FA = 1 } let r = a2 :> A2 //this produces warnings, but proves that a2 is indeed of type A2. -System.IO.File.WriteAllText("test.ok","ok") +printf "TEST PASSED OK" ; exit 0 \ No newline at end of file diff --git a/tests/fsharp/core/reflect/test2.fs b/tests/fsharp/core/reflect/test2.fs index 5b4a58e5b8e..78e876605a9 100644 --- a/tests/fsharp/core/reflect/test2.fs +++ b/tests/fsharp/core/reflect/test2.fs @@ -330,7 +330,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/refnormalization/test.fs b/tests/fsharp/core/refnormalization/test.fs index 40c34e96927..994868999e5 100644 --- a/tests/fsharp/core/refnormalization/test.fs +++ b/tests/fsharp/core/refnormalization/test.fs @@ -25,5 +25,5 @@ let main args = printfn "Actual: %A " versions 1 else - File.WriteAllText("test.ok", "ok") + printf "TEST PASSED OK" ; 0 diff --git a/tests/fsharp/core/seq/test.fsx b/tests/fsharp/core/seq/test.fsx index b62a55882aa..62f39fe5f3c 100644 --- a/tests/fsharp/core/seq/test.fsx +++ b/tests/fsharp/core/seq/test.fsx @@ -768,7 +768,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/state-machines/test.fsx b/tests/fsharp/core/state-machines/test.fsx index 5fae4c96b7a..f171bfdbe7b 100644 --- a/tests/fsharp/core/state-machines/test.fsx +++ b/tests/fsharp/core/state-machines/test.fsx @@ -663,7 +663,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/subtype/test.fsx b/tests/fsharp/core/subtype/test.fsx index 688682206e0..c813ee3ff3a 100644 --- a/tests/fsharp/core/subtype/test.fsx +++ b/tests/fsharp/core/subtype/test.fsx @@ -1768,7 +1768,7 @@ module GenericPropertyConstraintSolvedByRecord = /// overload, even before the full signature of the trait constraint was known. module MethodOverloadingForTraitConstraintsIsNotDeterminedUntilSignatureIsKnown = type X = - static member Method (a: obj) = 1 + static member Method (a: objnull) = 1 static member Method (a: int) = 2 static member Method (a: int64) = 3 @@ -2339,7 +2339,7 @@ module TestSubtypeMatching11 = [] type E() = inherit A() - let toName (x: obj * obj) = + let toName (x: objnull * objnull) = match x with | null, :? E -> "0E" | (:? A), :? E -> "AE" @@ -2418,7 +2418,7 @@ module TestSubtypeMatching12 = type C() = interface IC - let toName (x: obj) = + let toName (x: objnull) = match x with | null -> "null" | :? IA when false -> "IA fail" @@ -2444,7 +2444,7 @@ module TestSubtypeMatching13 = type C() = interface IC - let toName (x: obj) = + let toName (x: objnull) = match x with | null when false -> "null" | :? IA -> "IA" @@ -2545,7 +2545,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/syntax/test.fsx b/tests/fsharp/core/syntax/test.fsx index c961992da28..c85225a5a73 100644 --- a/tests/fsharp/core/syntax/test.fsx +++ b/tests/fsharp/core/syntax/test.fsx @@ -1841,7 +1841,7 @@ let aa = match !failures with | false -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/tlr/test.fsx b/tests/fsharp/core/tlr/test.fsx index bb8f1bcbf94..3d799fd1fd9 100644 --- a/tests/fsharp/core/tlr/test.fsx +++ b/tests/fsharp/core/tlr/test.fsx @@ -380,7 +380,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/topinit/test_deterministic_init.fs b/tests/fsharp/core/topinit/test_deterministic_init.fs index ea3d5f9df1d..55474ff38a2 100644 --- a/tests/fsharp/core/topinit/test_deterministic_init.fs +++ b/tests/fsharp/core/topinit/test_deterministic_init.fs @@ -597,5 +597,5 @@ printfn "Touching value in module Lib85..." printfn " --> Lib85.x = %A" Lib85.x printfn "Checking this did cause initialization of module Lib85..." checkInitialized "Lib85" InitFlag85.init -System.IO.File.WriteAllText("test.ok","ok") +printf "TEST PASSED OK" ; exit 0 diff --git a/tests/fsharp/core/unicode/test.fsx b/tests/fsharp/core/unicode/test.fsx index 10089e9dd0b..3954ee440cd 100644 --- a/tests/fsharp/core/unicode/test.fsx +++ b/tests/fsharp/core/unicode/test.fsx @@ -139,7 +139,7 @@ let aa = match !failures with | [] -> stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; exit 0 | _ -> stdout.WriteLine "Test Failed" diff --git a/tests/fsharp/core/unitsOfMeasure/test.fs b/tests/fsharp/core/unitsOfMeasure/test.fs index b2a40a8759f..fa7244122aa 100644 --- a/tests/fsharp/core/unitsOfMeasure/test.fs +++ b/tests/fsharp/core/unitsOfMeasure/test.fs @@ -201,7 +201,7 @@ let main argv = // test2 for _ in CreateBadImageFormatException () do () - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; match failures with | [] -> diff --git a/tests/fsharp/nunitConf.fs b/tests/fsharp/nunitConf.fs deleted file mode 100644 index 1397b3ed778..00000000000 --- a/tests/fsharp/nunitConf.fs +++ /dev/null @@ -1,240 +0,0 @@ -module NUnitConf - -open System -open System.IO -open NUnit.Framework - -open TestConfig -open PlatformHelpers -open FSharpTestSuiteTypes - -let checkResult result = - match result with - | CmdResult.ErrorLevel (msg1, err) -> Assert.Fail (sprintf "%s. ERRORLEVEL %d" msg1 err) - | CmdResult.Success -> () - -let checkErrorLevel1 result = - match result with - | CmdResult.ErrorLevel (_,1) -> () - | CmdResult.Success | CmdResult.ErrorLevel _ -> Assert.Fail (sprintf "Command passed unexpectedly") - -let envVars () = - System.Environment.GetEnvironmentVariables () - |> Seq.cast - |> Seq.map (fun d -> d.Key :?> string, d.Value :?> string) - |> Map.ofSeq - -let initializeSuite () = - -#if DEBUG - let configurationName = "debug" -#else - let configurationName = "release" -#endif - let env = envVars () - - let cfg = - let c = config configurationName env - let usedEnvVars = c.EnvironmentVariables |> Map.add "FSC" c.FSC - { c with EnvironmentVariables = usedEnvVars } - - logConfig cfg - - cfg - - -let suiteHelpers = lazy (initializeSuite ()) - -[] -type public InitializeSuiteAttribute () = - inherit TestActionAttribute() - - override x.BeforeTest details = - if details.IsSuite - then suiteHelpers.Force() |> ignore - - override x.AfterTest _details = - () - - override x.Targets = ActionTargets.Test ||| ActionTargets.Suite - - -[] -[] -() - -let fsharpSuiteDirectory = __SOURCE_DIRECTORY__ - -let testConfig testDir = - let cfg = suiteHelpers.Value - let dir = Path.GetFullPath(fsharpSuiteDirectory/testDir) - log "------------------ %s ---------------" dir - log "cd %s" dir - { cfg with Directory = dir} - -[] -type FileGuard(path: string) = - let remove path = if File.Exists(path) then Commands.rm (Path.GetTempPath()) path - do if not (Path.IsPathRooted(path)) then failwithf "path '%s' must be absolute" path - do remove path - member x.Path = path - member x.Exists = x.Path |> File.Exists - member x.CheckExists() = - if not x.Exists then - failwith (sprintf "exit code 0 but %s file doesn't exists" (x.Path |> Path.GetFileName)) - - interface IDisposable with - member x.Dispose () = remove path - - -type RedirectToType = - | Overwrite of FilePath - | Append of FilePath - -type RedirectTo = - | Inherit - | Output of RedirectToType - | OutputAndError of RedirectToType * RedirectToType - | OutputAndErrorToSameFile of RedirectToType - | Error of RedirectToType - -type RedirectFrom = - | RedirectInput of FilePath - -type RedirectInfo = - { Output : RedirectTo - Input : RedirectFrom option } - - -module Command = - - let logExec _dir path args redirect = - let inF = - function - | None -> "" - | Some(RedirectInput l) -> sprintf " <%s" l - let redirectType = function Overwrite x -> sprintf ">%s" x | Append x -> sprintf ">>%s" x - let outF = - function - | Inherit -> "" - | Output r-> sprintf " 1%s" (redirectType r) - | OutputAndError (r1, r2) -> sprintf " 1%s 2%s" (redirectType r1) (redirectType r2) - | OutputAndErrorToSameFile r -> sprintf " 1%s 2>1" (redirectType r) - | Error r -> sprintf " 2%s" (redirectType r) - sprintf "%s%s%s%s" path (match args with "" -> "" | x -> " " + x) (inF redirect.Input) (outF redirect.Output) - - let exec dir envVars redirect path args = - let { Output = o; Input = i} = redirect - - let inputWriter sources (writer: StreamWriter) = - let pipeFile name = async { - let path = Commands.getfullpath dir name - use reader = File.OpenRead (path) - use ms = new MemoryStream() - do! reader.CopyToAsync (ms) |> (Async.AwaitIAsyncResult >> Async.Ignore) - ms.Position <- 0L - try - do! ms.CopyToAsync(writer.BaseStream) |> (Async.AwaitIAsyncResult >> Async.Ignore) - do! writer.FlushAsync() |> (Async.AwaitIAsyncResult >> Async.Ignore) - with - | :? System.IO.IOException -> //input closed is ok if process is closed - () - } - sources |> pipeFile |> Async.RunSynchronously - - let inF fCont cmdArgs = - match i with - | None -> fCont cmdArgs - | Some(RedirectInput l) -> fCont { cmdArgs with RedirectInput = Some (inputWriter l) } - - let openWrite rt = - let fullpath = Commands.getfullpath dir - match rt with - | Append p -> File.AppendText( p |> fullpath) - | Overwrite p -> new StreamWriter(new FileStream(p |> fullpath, FileMode.Create)) - - let outF fCont cmdArgs = - match o with - | RedirectTo.Inherit -> - use toLog = redirectToLog () - fCont { cmdArgs with RedirectOutput = Some (toLog.Post); RedirectError = Some (toLog.Post) } - | Output r -> - use writer = openWrite r - use outFile = redirectTo writer - use toLog = redirectToLog () - fCont { cmdArgs with RedirectOutput = Some (outFile.Post); RedirectError = Some (toLog.Post) } - | OutputAndError (r1,r2) -> - use writer1 = openWrite r1 - use writer2 = openWrite r2 - use outFile1 = redirectTo writer1 - use outFile2 = redirectTo writer2 - fCont { cmdArgs with RedirectOutput = Some (outFile1.Post); RedirectError = Some (outFile2.Post) } - | OutputAndErrorToSameFile r -> - use writer = openWrite r - use outFile = redirectTo writer - fCont { cmdArgs with RedirectOutput = Some (outFile.Post); RedirectError = Some (outFile.Post) } - | Error r -> - use writer = openWrite r - use outFile = redirectTo writer - use toLog = redirectToLog () - fCont { cmdArgs with RedirectOutput = Some (toLog.Post); RedirectError = Some (outFile.Post) } - - let exec cmdArgs = - log "%s" (logExec dir path args redirect) - Process.exec cmdArgs dir envVars path args - - { RedirectOutput = None; RedirectError = None; RedirectInput = None } - |> (outF (inF exec)) - -let alwaysSuccess _ = () - -let execArgs = { Output = Inherit; Input = None; } -let execAppend cfg stdoutPath stderrPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { execArgs with Output = OutputAndError(Append(stdoutPath), Append(stderrPath)) } p >> checkResult -let execAppendIgnoreExitCode cfg stdoutPath stderrPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { execArgs with Output = OutputAndError(Append(stdoutPath), Append(stderrPath)) } p >> alwaysSuccess -let exec cfg p = Command.exec cfg.Directory cfg.EnvironmentVariables execArgs p >> checkResult -let execExpectFail cfg p = Command.exec cfg.Directory cfg.EnvironmentVariables execArgs p >> checkErrorLevel1 -let execIn cfg workDir p = Command.exec workDir cfg.EnvironmentVariables execArgs p >> checkResult -let execBothToOut cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = OutputAndErrorToSameFile(Overwrite(outFile)) } p >> checkResult -let execAppendOutIgnoreExitCode cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = Output(Append(outFile)) } p >> alwaysSuccess -let execAppendErrExpectFail cfg errPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { execArgs with Output = Error(Overwrite(errPath)) } p -let execStdin cfg l p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = Inherit; Input = Some(RedirectInput(l)) } p >> checkResult -let execStdinAppendBothIgnoreExitCode cfg stdoutPath stderrPath stdinPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = OutputAndError(Append(stdoutPath), Append(stderrPath)); Input = Some(RedirectInput(stdinPath)) } p >> alwaysSuccess - -let fsc cfg arg = Printf.ksprintf (Commands.fsc cfg.Directory (exec cfg) cfg.FSC) arg -let fscIn cfg workDir arg = Printf.ksprintf (Commands.fsc workDir (execIn cfg workDir) cfg.FSC) arg -let fscAppend cfg stdoutPath stderrPath arg = Printf.ksprintf (Commands.fsc cfg.Directory (execAppend cfg stdoutPath stderrPath) cfg.FSC) arg -let fscAppendIgnoreExitCode cfg stdoutPath stderrPath arg = Printf.ksprintf (Commands.fsc cfg.Directory (execAppendIgnoreExitCode cfg stdoutPath stderrPath) cfg.FSC) arg -let fscBothToOut cfg out arg = Printf.ksprintf (Commands.fsc cfg.Directory (execBothToOut cfg cfg.Directory out) cfg.FSC) arg - -let fscAppendErrExpectFail cfg errPath arg = Printf.ksprintf (fun flags sources -> Commands.fsc cfg.Directory (execAppendErrExpectFail cfg errPath) cfg.FSC flags sources |> checkErrorLevel1) arg - -let csc cfg arg = Printf.ksprintf (Commands.csc (exec cfg) cfg.CSC) arg -let ildasm cfg arg = Printf.ksprintf (Commands.ildasm (exec cfg) cfg.ILDASM) arg -let peverify cfg = Commands.peverify (exec cfg) cfg.PEVERIFY "/nologo" -let sn cfg outfile arg = execAppendOutIgnoreExitCode cfg cfg.Directory outfile cfg.SN arg -let peverifyWithArgs cfg args = Commands.peverify (exec cfg) cfg.PEVERIFY args -let fsi cfg = Printf.ksprintf (Commands.fsi (exec cfg) cfg.FSI) -let fsiExpectFail cfg = Printf.ksprintf (Commands.fsi (execExpectFail cfg) cfg.FSI) -let fsiAppendIgnoreExitCode cfg stdoutPath stderrPath = Printf.ksprintf (Commands.fsi (execAppendIgnoreExitCode cfg stdoutPath stderrPath) cfg.FSI) -let fileguard cfg = (Commands.getfullpath cfg.Directory) >> (fun x -> new FileGuard(x)) -let getfullpath cfg = Commands.getfullpath cfg.Directory -let fileExists cfg = Commands.fileExists cfg.Directory >> Option.isSome -let fsiStdin cfg stdinPath = Printf.ksprintf (Commands.fsi (execStdin cfg stdinPath) cfg.FSI) -let fsiStdinAppendBothIgnoreExitCode cfg stdoutPath stderrPath stdinPath = Printf.ksprintf (Commands.fsi (execStdinAppendBothIgnoreExitCode cfg stdoutPath stderrPath stdinPath) cfg.FSI) -let rm cfg x = Commands.rm cfg.Directory x -let mkdir cfg = Commands.mkdir_p cfg.Directory -let copy_y cfg f = Commands.copy_y cfg.Directory f >> checkResult - -let fsdiff cfg a b = - let out = new ResizeArray() - let redirectOutputToFile path args = - log "%s %s" path args - use toLog = redirectToLog () - Process.exec { RedirectOutput = Some (function null -> () | s -> out.Add(s)); RedirectError = Some toLog.Post; RedirectInput = None; } cfg.Directory cfg.EnvironmentVariables path args - do (Commands.fsdiff redirectOutputToFile cfg.FSDIFF a b) |> (fun _ -> ()) - out.ToArray() |> List.ofArray - -let requireENCulture () = - match System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName with - | "en" -> true - | _ -> false diff --git a/tests/fsharp/perf/graph/test.ml b/tests/fsharp/perf/graph/test.ml index 1e34121064f..e19614be84e 100644 --- a/tests/fsharp/perf/graph/test.ml +++ b/tests/fsharp/perf/graph/test.ml @@ -538,5 +538,5 @@ end let _ = test() do (System.Console.WriteLine "Test Passed"; - System.IO.File.WriteAllText ("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/perf/nbody/test.ml b/tests/fsharp/perf/nbody/test.ml index 4ec5b9862a1..06b94f4c674 100644 --- a/tests/fsharp/perf/nbody/test.ml +++ b/tests/fsharp/perf/nbody/test.ml @@ -143,6 +143,6 @@ let _ = test "dce98nj" (main 500000 = "-0.169096567") do (System.Console.WriteLine "Test Passed"; - System.IO.File.WriteAllText ("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/regression/12322/test.fsx b/tests/fsharp/regression/12322/test.fsx index 755937aedd4..855a3a2bb51 100644 --- a/tests/fsharp/regression/12322/test.fsx +++ b/tests/fsharp/regression/12322/test.fsx @@ -1489,6 +1489,6 @@ module LotsOfLets = // This is a compilation test, not a lot actually happens in the test do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) diff --git a/tests/fsharp/regression/12383/test.fs b/tests/fsharp/regression/12383/test.fs index ae10696c9ae..b94d328988d 100644 --- a/tests/fsharp/regression/12383/test.fs +++ b/tests/fsharp/regression/12383/test.fs @@ -2940,6 +2940,6 @@ let inline translate opcode = let translate2 opcode = translate opcode do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) diff --git a/tests/fsharp/regression/13219/test.fsx b/tests/fsharp/regression/13219/test.fsx index c6ff7817805..be2ff9c7421 100644 --- a/tests/fsharp/regression/13219/test.fsx +++ b/tests/fsharp/regression/13219/test.fsx @@ -18,5 +18,5 @@ type System.Object with // This is a compilation test, not a lot actually happens in the test do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) diff --git a/tests/fsharp/regression/13710/test.fsx b/tests/fsharp/regression/13710/test.fsx index e80a3ecd54b..22b0c34dcec 100644 --- a/tests/fsharp/regression/13710/test.fsx +++ b/tests/fsharp/regression/13710/test.fsx @@ -12,6 +12,6 @@ printfn $"{auth.Test}" // This is a compilation test, not a lot actually happens in the test do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) diff --git a/tests/fsharp/regression/26/test.ml b/tests/fsharp/regression/26/test.ml index 525ae7c5e97..287a42bed6a 100644 --- a/tests/fsharp/regression/26/test.ml +++ b/tests/fsharp/regression/26/test.ml @@ -27,6 +27,6 @@ let _ = if (compare [| |] [| |] <> 0) then fail "Test Failed (abcwlvero02)" let _ = System.Console.Error.WriteLine "Test Passed" do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/regression/321/test.ml b/tests/fsharp/regression/321/test.ml index 8669efdbbb8..61f99fc21ac 100644 --- a/tests/fsharp/regression/321/test.ml +++ b/tests/fsharp/regression/321/test.ml @@ -25,5 +25,5 @@ exception Bad_xml_structure of string let _ = (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/regression/655/main.fs b/tests/fsharp/regression/655/main.fs index 2a5f4da2d93..424f52c3b36 100644 --- a/tests/fsharp/regression/655/main.fs +++ b/tests/fsharp/regression/655/main.fs @@ -6,7 +6,7 @@ let xI = x :> Datafile let _ = (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) diff --git a/tests/fsharp/regression/656/form.fs b/tests/fsharp/regression/656/form.fs index 70bd3f707c2..de189dba38f 100644 --- a/tests/fsharp/regression/656/form.fs +++ b/tests/fsharp/regression/656/form.fs @@ -928,5 +928,5 @@ do Application.Run(mainForm) let _ = (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK" ; exit 0) diff --git a/tests/fsharp/regression/83/test.ml b/tests/fsharp/regression/83/test.ml index 5dad355c937..1188cc35d02 100644 --- a/tests/fsharp/regression/83/test.ml +++ b/tests/fsharp/regression/83/test.ml @@ -41,6 +41,6 @@ let _ = if !failures then (System.Console.Out.WriteLine "Test Failed"; exit 1) do (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/regression/84/test.ml b/tests/fsharp/regression/84/test.ml index b2e868f53b8..b8f9ec7ce0c 100644 --- a/tests/fsharp/regression/84/test.ml +++ b/tests/fsharp/regression/84/test.ml @@ -5,7 +5,7 @@ let _ = | true -> (System.Console.Out.WriteLine "Test Failed"; exit 1) | false -> (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) let _ = (System.Console.Out.WriteLine "Test Ended"; exit 100) diff --git a/tests/fsharp/regression/86/test.ml b/tests/fsharp/regression/86/test.ml index 4b1abe343f6..2ec7219e0be 100644 --- a/tests/fsharp/regression/86/test.ml +++ b/tests/fsharp/regression/86/test.ml @@ -4,7 +4,7 @@ let _ = if '\\' = '\092' & "\\" = "\092" then (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) else (System.Console.Out.WriteLine "Test Failed"; exit 1) diff --git a/tests/fsharp/regression/OverloadResolution-bug/test.fsx b/tests/fsharp/regression/OverloadResolution-bug/test.fsx index ff87afb18cb..c3d3669c450 100644 --- a/tests/fsharp/regression/OverloadResolution-bug/test.fsx +++ b/tests/fsharp/regression/OverloadResolution-bug/test.fsx @@ -31,5 +31,5 @@ module TestOfObj = | _ -> None - System.IO.File.WriteAllText("test.ok","ok") + printf "TEST PASSED OK" ; printfn "Succeeded" diff --git a/tests/fsharp/regression/literal-value-bug-2/test.fsx b/tests/fsharp/regression/literal-value-bug-2/test.fsx index e529df8c863..fa15406ebcc 100644 --- a/tests/fsharp/regression/literal-value-bug-2/test.fsx +++ b/tests/fsharp/regression/literal-value-bug-2/test.fsx @@ -30,7 +30,7 @@ let result = 1 if result = 0 then - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; printfn "Succeeded" else printfn "Failed: %d" result diff --git a/tests/fsharp/regression/struct-tuple-bug-1/test.fsx b/tests/fsharp/regression/struct-tuple-bug-1/test.fsx index e70c5934575..88852695706 100644 --- a/tests/fsharp/regression/struct-tuple-bug-1/test.fsx +++ b/tests/fsharp/regression/struct-tuple-bug-1/test.fsx @@ -14,7 +14,7 @@ let _ = printfn "Test Failed" exit 1 else - printfn "Test Passed" - System.IO.File.WriteAllText("test.ok", "ok") + printf "TEST PASSED OK" + printf "TEST PASSED OK" ; exit 0 () \ No newline at end of file diff --git a/tests/fsharp/regression/tuple-bug-1/test.ml b/tests/fsharp/regression/tuple-bug-1/test.ml index d839ccd0733..bead09c38dd 100644 --- a/tests/fsharp/regression/tuple-bug-1/test.ml +++ b/tests/fsharp/regression/tuple-bug-1/test.ml @@ -25,6 +25,6 @@ let _ = if !failures then (System.Console.Out.WriteLine "Test Failed"; exit 1) else (System.Console.Out.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index a84de9a8c94..5869e27aee0 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -87,6 +87,9 @@ let generateOverrides = let template = @" + + + " template @@ -189,7 +192,6 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo - " template |> replace "$(UTILITYSOURCEITEMS)" pc.UtilitySourceItems false false CompileItem.Compile @@ -209,7 +211,6 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo |> replaceTokens "$(RestoreFromArtifactsPath)" (Path.GetFullPath(__SOURCE_DIRECTORY__) + "/../../artifacts/packages/" + configuration) generateProjBody -let lockObj = obj() let singleTestBuildAndRunCore cfg copyFiles p languageVersion = let sources = [] let loadSources = [] @@ -225,22 +226,7 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion = // targetFramework optimize = "net472" OR net5.0 etc ... // optimize = true or false let executeSingleTestBuildAndRun outputType compilerType targetFramework optimize buildOnly = - let mutable result = false - let directory = - let mutable result = "" - lock lockObj <| (fun () -> - let rec loop () = - let pathToArtifacts = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "../../../..")) - if Path.GetFileName(pathToArtifacts) <> "artifacts" then failwith "FSharp.Cambridge did not find artifacts directory --- has the location changed????" - let pathToTemp = Path.Combine(pathToArtifacts, "Temp") - let projectDirectory = Path.Combine(pathToTemp, "FSharp.Cambridge", Guid.NewGuid().ToString() + ".tmp") - if Directory.Exists(projectDirectory) then - loop () - else - Directory.CreateDirectory(projectDirectory) |>ignore - projectDirectory - result <- loop()) - result + let directory = cfg.Directory let pc = { OutputType = outputType @@ -269,47 +255,30 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion = let propsFileName = Path.Combine(directory, "Directory.Build.props") let overridesFileName = Path.Combine(directory, "Directory.Overrides.targets") let projectFileName = Path.Combine(directory, Guid.NewGuid().ToString() + ".tmp" + ".fsproj") - try - // Clean up directory - Directory.CreateDirectory(directory) |> ignore - copyFilesToDest cfg.Directory directory - try File.Delete(Path.Combine(directory, "FSharp.Core.dll")) with _ -> () - emitFile targetsFileName targetsBody - emitFile overridesFileName overridesBody - let buildOutputFile = Path.Combine(directory, "buildoutput.txt") - if outputType = OutputType.Exe then - let executeFsc testCompilerVersion targetFramework = - let propsBody = generateProps testCompilerVersion cfg.BUILD_CONFIG - emitFile propsFileName propsBody - let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG languageVersion - emitFile projectFileName projectBody - use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - let cfg = { cfg with Directory = directory } - let result = execBothToOutNoCheck cfg directory buildOutputFile cfg.DotNetExe (sprintf "run -f %s" targetFramework) - if not (buildOnly) then - result |> checkResult - testOkFile.CheckExists() - executeFsc compilerType targetFramework - if buildOnly then verifyResults (findFirstSourceFile pc) buildOutputFile - else - let executeFsi testCompilerVersion targetFramework = - let propsBody = generateProps testCompilerVersion cfg.BUILD_CONFIG - emitFile propsFileName propsBody - let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG languageVersion - emitFile projectFileName projectBody - use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - let cfg = { cfg with Directory = directory } - execBothToOut cfg directory buildOutputFile cfg.DotNetExe "build /t:RunFSharpScript" - testOkFile.CheckExists() - executeFsi compilerType targetFramework - result <- true - finally - if result <> false then - try Directory.Delete(directory, true) with _ -> () - else - printfn "Configuration: %s" cfg.Directory - printfn "Directory: %s" directory - printfn "Filename: %s" projectFileName + emitFile targetsFileName targetsBody + emitFile overridesFileName overridesBody + let buildOutputFile = Path.Combine(directory, "buildoutput.txt") + if outputType = OutputType.Exe then + let executeFsc testCompilerVersion targetFramework = + let propsBody = generateProps testCompilerVersion cfg.BUILD_CONFIG + emitFile propsFileName propsBody + let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG languageVersion + emitFile projectFileName projectBody + let cfg = { cfg with Directory = directory } + let result = execBothToOutNoCheck cfg directory buildOutputFile cfg.DotNetExe (sprintf "run -f %s" targetFramework) + if not (buildOnly) then + result |> checkResultPassed + executeFsc compilerType targetFramework + if buildOnly then verifyResults (findFirstSourceFile pc) buildOutputFile + else + let executeFsi testCompilerVersion targetFramework = + let propsBody = generateProps testCompilerVersion cfg.BUILD_CONFIG + emitFile propsFileName propsBody + let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG languageVersion + emitFile projectFileName projectBody + let cfg = { cfg with Directory = directory } + execBothToOutCheckPassed cfg directory buildOutputFile cfg.DotNetExe $"build /t:RunFSharpScriptAndPrintOutput" + executeFsi compilerType targetFramework match p with #if NETCOREAPP @@ -321,19 +290,15 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion = | FSI_NETFX_STDIN -> use _cleanup = (cleanUpFSharpCore cfg) - use testOkFile = new FileGuard (getfullpath cfg "test.ok") let sources = extraSources |> List.filter (fileExists cfg) - fsiStdin cfg (sources |> List.rev |> List.head) "" [] //use last file, because `cmd < a.txt b.txt` redirect b.txt only - - testOkFile.CheckExists() + fsiStdinCheckPassed cfg (sources |> List.rev |> List.head) "" [] //use last file, because `cmd < a.txt b.txt` redirect b.txt only | FSC_NETFX_TEST_ROUNDTRIP_AS_DLL -> // Compile as a DLL to exercise pickling of interface data, then recompile the original source file referencing this DLL // The second compilation will not utilize the information from the first in any meaningful way, but the // compiler will unpickle the interface and optimization data, so we test unpickling as well. use _cleanup = (cleanUpFSharpCore cfg) - use testOkFile = new FileGuard (getfullpath cfg "test.ok") let sources = extraSources |> List.filter (fileExists cfg) @@ -343,9 +308,8 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion = peverify cfg "test--optimize-lib.dll" peverify cfg "test--optimize-client-of-lib.exe" - exec cfg ("." ++ "test--optimize-client-of-lib.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize-client-of-lib.exe") "" - testOkFile.CheckExists() #endif let singleTestBuildAndRunAux cfg p = diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 7fdab667a00..ed99adda96a 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -35,37 +35,32 @@ module CoreTests = let ``subtype-langversion-checknulls`` () = let cfg = testConfig "core/subtype" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test-checknulls.exe -g --checknulls" cfg.fsc_flags ["test.fsx"] - exec cfg ("." ++ "test-checknulls.exe") "" + execAndCheckPassed cfg ("." ++ "test-checknulls.exe") "" - testOkFile.CheckExists() [] let ``subtype-langversion-no-checknulls`` () = let cfg = testConfig "core/subtype" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test-no-checknulls.exe -g --checknulls-" cfg.fsc_flags ["test.fsx"] - exec cfg ("." ++ "test-no-checknulls.exe") "" + execAndCheckPassed cfg ("." ++ "test-no-checknulls.exe") "" - testOkFile.CheckExists() [] let ``subtype-langversion-46`` () = let cfg = testConfig "core/subtype" - use testOkFile = fileguard cfg "test.ok" - fsc cfg "%s -o:test-langversion-46.exe -g --langversion:4.6" cfg.fsc_flags ["test.fsx"] - exec cfg ("." ++ "test-langversion-46.exe") "" + execAndCheckPassed cfg ("." ++ "test-langversion-46.exe") "" - testOkFile.CheckExists() #endif @@ -94,75 +89,71 @@ module CoreTests = let cfg = { cfg with fsc_flags = sprintf "%s --preferreduilang:en-US --test:StackSpan" cfg.fsc_flags} begin - use testOkFile = fileguard cfg "test.ok" + singleNegTest cfg "test" fsc cfg "%s -o:test.exe -g" cfg.fsc_flags ["test.fsx"] // Execution is disabled until we can be sure .NET 4.7.2 is on the machine - //exec cfg ("." ++ "test.exe") "" + //execAndCheckPassed cfg ("." ++ "test.exe") "" - //testOkFile.CheckExists() + //checkPassed() end begin - use testOkFile = fileguard cfg "test2.ok" singleNegTest cfg "test2" fsc cfg "%s -o:test2.exe -g" cfg.fsc_flags ["test2.fsx"] // Execution is disabled until we can be sure .NET 4.7.2 is on the machine - //exec cfg ("." ++ "test.exe") "" + //execAndCheckPassed cfg ("." ++ "test.exe") "" - //testOkFile.CheckExists() + //checkPassed() end begin - use testOkFile = fileguard cfg "test3.ok" singleNegTest cfg "test3" fsc cfg "%s -o:test3.exe -g" cfg.fsc_flags ["test3.fsx"] // Execution is disabled until we can be sure .NET 4.7.2 is on the machine - //exec cfg ("." ++ "test.exe") "" + //execAndCheckPassed cfg ("." ++ "test.exe") "" - //testOkFile.CheckExists() + //checkPassed() end [] let asyncStackTraces () = let cfg = testConfig "core/asyncStackTraces" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe -g --tailcalls- --optimize-" cfg.fsc_flags ["test.fsx"] - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() [] let ``state-machines-non-optimized`` () = let cfg = testConfig "core/state-machines" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe -g --tailcalls- --optimize-" cfg.fsc_flags ["test.fsx"] peverify cfg "test.exe" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() [] let ``state-machines-optimized`` () = let cfg = testConfig "core/state-machines" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe -g --tailcalls+ --optimize+" cfg.fsc_flags ["test.fsx"] @@ -170,7 +161,6 @@ module CoreTests = exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() [] let ``state-machines neg-resumable-01`` () = @@ -186,90 +176,79 @@ module CoreTests = [] let ``lots-of-conditionals``() = let cfg = testConfig "core/large/conditionals" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeConditionals-200.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-conditionals-maxtested``() = let cfg = testConfig "core/large/conditionals" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeConditionals-maxtested.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-lets``() = let cfg = testConfig "core/large/lets" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeLets-500.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-lets-maxtested``() = let cfg = testConfig "core/large/lets" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeLets-maxtested.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-lists``() = let cfg = testConfig "core/large/lists" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test-500.exe " cfg.fsc_flags ["LargeList-500.fs"] - exec cfg ("." ++ "test-500.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test-500.exe") "" [] let ``lots-of-matches``() = let cfg = testConfig "core/large/matches" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeMatches-200.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-matches-maxtested``() = let cfg = testConfig "core/large/matches" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeMatches-maxtested.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-sequential-and-let``() = let cfg = testConfig "core/large/mixed" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeSequentialLet-500.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-sequential-and-let-maxtested``() = let cfg = testConfig "core/large/mixed" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeSequentialLet-maxtested.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-sequential``() = let cfg = testConfig "core/large/sequential" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeSequential-500.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" [] let ``lots-of-sequential-maxtested``() = let cfg = testConfig "core/large/sequential" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test.exe " cfg.fsc_flags ["LargeSequential-maxtested.fs"] - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" #endif @@ -295,19 +274,17 @@ module CoreTests = peverify cfg "test.exe" begin - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() end begin - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "-r:lib.dll" ["test.fsx"] + fsiCheckPassed cfg "-r:lib.dll" ["test.fsx"] - testOkFile.CheckExists() end [] @@ -322,13 +299,12 @@ module CoreTests = peverify cfg "testcs.exe" - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "" ["test.fs"] + fsiCheckPassed cfg "" ["test.fs"] - testOkFile.CheckExists() - exec cfg ("." ++ "testcs.exe") "" + execAndCheckPassed cfg ("." ++ "testcs.exe") "" // @@ -355,7 +331,7 @@ module CoreTests = // fsiStdin cfg "%s %s" cfg.fsi_flags flags "test1.fsx" // // // if NOT EXIST test1.ok goto SetError - // testOkFile.CheckExists() + // checkPassed() // // // [] @@ -377,7 +353,7 @@ module CoreTests = // fsiStdin cfg "%s %s" cfg.fsi_flags flags "test2.fsx" // // // if NOT EXIST test2.ok goto SetError - // testOkFile.CheckExists() + // checkPassed() // @@ -446,9 +422,9 @@ module CoreTests = csc cfg """/nologo /r:"%s" /r:System.Core.dll /r:lib--optimize.dll /out:test--optimize.exe""" cfg.FSCOREDLLPATH ["test.cs"] - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - exec cfg ("." ++ "test--optimize.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" [] let fsfromfsviacs () = @@ -467,21 +443,21 @@ module CoreTests = peverify cfg "test.exe" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" // Same with library references the other way around fsc cfg "%s -r:lib.dll -r:lib3.dll -r:lib2.dll -o:test.exe -g" cfg.fsc_flags ["test.fsx"] peverify cfg "test.exe" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" // Same without the reference to lib.dll - testing an incomplete reference set, but only compiling a subset of the code fsc cfg "%s --define:NO_LIB_REFERENCE -r:lib3.dll -r:lib2.dll -o:test.exe -g" cfg.fsc_flags ["test.fsx"] peverify cfg "test.exe" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" // some features missing in 4.7 for version in ["4.7"] do @@ -509,35 +485,22 @@ module CoreTests = let cfg = testConfig "core/fsi-reference" - begin - use testOkFile = fileguard cfg "test.ok" + begin fsc cfg @"--target:library -o:ImplementationAssembly\ReferenceAssemblyExample.dll" ["ImplementationAssembly.fs"] fsc cfg @"--target:library -o:ReferenceAssembly\ReferenceAssemblyExample.dll" ["ReferenceAssembly.fs"] - fsiStdin cfg "test.fsx" "" [] - testOkFile.CheckExists() + fsiStdinCheckPassed cfg "test.fsx" "" [] end [] let ``fsi-reload`` () = let cfg = testConfig "core/fsi-reload" + + fsiStdinCheckPassed cfg "test1.ml" " --langversion:5.0 --mlcompatibility --maxerrors:1" [] + + fsiCheckPassed cfg "%s --maxerrors:1" cfg.fsi_flags ["load1.fsx"] - begin - use testOkFile = fileguard cfg "test.ok" - fsiStdin cfg "test1.ml" " --langversion:5.0 --mlcompatibility --maxerrors:1" [] - testOkFile.CheckExists() - end - - begin - use testOkFile = fileguard cfg "test.ok" - fsi cfg "%s --maxerrors:1" cfg.fsi_flags ["load1.fsx"] - testOkFile.CheckExists() - end - - begin - use testOkFile = fileguard cfg "test.ok" - fsi cfg "%s --maxerrors:1" cfg.fsi_flags ["load2.fsx"] - testOkFile.CheckExists() - end + + fsiCheckPassed cfg "%s --maxerrors:1" cfg.fsi_flags ["load2.fsx"] fsc cfg "" ["load1.fsx"] fsc cfg "" ["load2.fsx"] @@ -551,11 +514,7 @@ module CoreTests = fsiStdin cfg "prepare.fsx" "--maxerrors:1" [] - use testOkFile = fileguard cfg "test.ok" - - fsiStdin cfg "test.fsx" "--maxerrors:1" [] - - testOkFile.CheckExists() + fsiStdinCheckPassed cfg "test.fsx" "--maxerrors:1" [] [] let ``genericmeasures-FSC_NETFX_TEST_ROUNDTRIP_AS_DLL`` () = singleTestBuildAndRun "core/genericmeasures" FSC_NETFX_TEST_ROUNDTRIP_AS_DLL @@ -595,27 +554,24 @@ module CoreTests = singleNegTest cfg "negativetest" begin - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() end begin - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() end begin - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "test--optimize.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" - testOkFile.CheckExists() end // Debug with @@ -633,10 +589,10 @@ module CoreTests = let ``fsi b 2>c`` = // "%FSI%" %fsc_flags_errors_ok% --nologo z.raw.output.test.default.txt 2>&1 - let ``exec b 2>c`` (inFile, outFile, errFile) p = + let ``execAndCheckPassed b 2>c`` (inFile, outFile, errFile) p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = OutputAndError(Overwrite(outFile), Overwrite(errFile)); Input = Some(RedirectInput(inFile)); } p >> checkResult - Printf.ksprintf (fun flags (inFile, outFile, errFile) -> Commands.fsi (``exec b 2>c`` (inFile, outFile, errFile)) cfg.FSI flags []) + Printf.ksprintf (fun flags (inFile, outFile, errFile) -> Commands.fsi (``execAndCheckPassed b 2>c`` (inFile, outFile, errFile)) cfg.FSI flags []) let fsc_flags_errors_ok = "" @@ -819,9 +775,8 @@ module CoreTests = peverify cfg "test.exe" begin - use testOkFile = fileguard cfg "test.ok" - exec cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() + + execAndCheckPassed cfg ("." ++ "test.exe") "" end fsc cfg "%s -o:test-with-debug-data.exe --quotations-debug+ -r cslib.dll -g" cfg.fsc_flags ["test.fsx"] @@ -833,23 +788,20 @@ module CoreTests = peverify cfg "test--optimize.exe" begin - use testOkFile = fileguard cfg "test.ok" + - fsi cfg "%s -r cslib.dll" cfg.fsi_flags ["test.fsx"] + fsiCheckPassed cfg "%s -r cslib.dll" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() end begin - use testOkFile = fileguard cfg "test.ok" - exec cfg ("." ++ "test-with-debug-data.exe") "" - testOkFile.CheckExists() + + execAndCheckPassed cfg ("." ++ "test-with-debug-data.exe") "" end begin - use testOkFile = fileguard cfg "test.ok" - exec cfg ("." ++ "test--optimize.exe") "" - testOkFile.CheckExists() + + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" end // Previously a comment here said: @@ -948,7 +900,7 @@ module CoreTests = peverify cfg "test.exe" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" log "== Compiling F# Library and Code, when empty file libfile2.fs IS included" fsc cfg "%s -a --optimize -o:lib2.dll " cfg.fsc_flags ["libfile1.fs"; "libfile2.fs"] @@ -959,7 +911,7 @@ module CoreTests = peverify cfg "test2.exe" - exec cfg ("." ++ "test2.exe") "" + execAndCheckPassed cfg ("." ++ "test2.exe") "" // Repro for https://github.com/dotnet/fsharp/issues/2679 [] @@ -1008,26 +960,24 @@ module CoreTests = let ``libtest-langversion-checknulls`` () = let cfg = testConfig "core/libtest" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test-checknulls.exe -g --checknulls" cfg.fsc_flags ["test.fsx"] - exec cfg ("." ++ "test-checknulls.exe") "" + execAndCheckPassed cfg ("." ++ "test-checknulls.exe") "" - testOkFile.CheckExists() [] let ``libtest-langversion-46`` () = let cfg = testConfig "core/libtest" - use testOkFile = fileguard cfg "test.ok" + fsc cfg "%s -o:test-langversion-46.exe -g --langversion:4.6" cfg.fsc_flags ["test.fsx"] - exec cfg ("." ++ "test-langversion-46.exe") "" + execAndCheckPassed cfg ("." ++ "test-langversion-46.exe") "" - testOkFile.CheckExists() [] let ``no-warn-2003-tests`` () = @@ -1240,23 +1190,14 @@ module CoreTests = peverify cfg "test--optimize.exe" - use testOkFile = fileguard cfg "test.ok" + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" - use testOkFile2 = fileguard cfg "test.ok" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" - testOkFile2.CheckExists() - - use testOkFile3 = fileguard cfg "test.ok" - - exec cfg ("." ++ "test--optimize.exe") "" - - testOkFile3.CheckExists() [] @@ -1271,17 +1212,11 @@ module CoreTests = peverify cfg "test--optimize.exe" - use testOkFile = fileguard cfg "test.ok" - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] - use testOkFile2 = fileguard cfg "test.ok" - exec cfg ("." ++ "test.exe") "" - testOkFile2.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" - use testOkFile3 = fileguard cfg "test.ok" - exec cfg ("." ++ "test--optimize.exe") "" - testOkFile3.CheckExists() + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" [] let queriesOverIEnumerable () = @@ -1295,23 +1230,15 @@ module CoreTests = peverify cfg "test--optimize.exe" - use testOkFile = fileguard cfg "test.ok" - - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] - - testOkFile.CheckExists() + - use testOkFile2 = fileguard cfg "test.ok" + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] - exec cfg ("." ++ "test.exe") "" - testOkFile2.CheckExists() + execAndCheckPassed cfg ("." ++ "test.exe") "" - use testOkFile3 = fileguard cfg "test.ok" - - exec cfg ("." ++ "test--optimize.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" - testOkFile3.CheckExists() [] let queriesOverIQueryable () = @@ -1325,23 +1252,18 @@ module CoreTests = peverify cfg "test--optimize.exe" - use testOkFile = fileguard cfg "test.ok" - fsi cfg "%s" cfg.fsi_flags ["test.fsx"] + + fsiCheckPassed cfg "%s" cfg.fsi_flags ["test.fsx"] - testOkFile.CheckExists() - use testOkFile2 = fileguard cfg "test.ok" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile2.CheckExists() - use testOkFile3 = fileguard cfg "test.ok" - exec cfg ("." ++ "test--optimize.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" - testOkFile3.CheckExists() [] @@ -1356,23 +1278,17 @@ module CoreTests = peverify cfg "test--optimize.exe" - use testOkFile = fileguard cfg "test.ok" - fsi cfg "%s --quotations-debug+" cfg.fsi_flags ["test.fsx"] - - testOkFile.CheckExists() + + fsiCheckPassed cfg "%s --quotations-debug+" cfg.fsi_flags ["test.fsx"] - use testOkFile2 = fileguard cfg "test.ok" - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile2.CheckExists() - use testOkFile3 = fileguard cfg "test.ok" - exec cfg ("." ++ "test--optimize.exe") "" + execAndCheckPassed cfg ("." ++ "test--optimize.exe") "" - testOkFile3.CheckExists() [] @@ -1399,30 +1315,24 @@ module CoreTests = peverify cfg "module2-opt.exe" - use testOkFile = fileguard cfg "test.ok" - - fsi cfg "%s -r module1.dll" cfg.fsi_flags ["module2.fsx"] - - testOkFile.CheckExists() + + fsiCheckPassed cfg "%s -r module1.dll" cfg.fsi_flags ["module2.fsx"] - use testOkFile = fileguard cfg "test.ok" - exec cfg ("." ++ "module2.exe") "" - testOkFile.CheckExists() + - use testOkFile = fileguard cfg "test.ok" + execAndCheckPassed cfg ("." ++ "module2.exe") "" - exec cfg ("." ++ "module2-opt.exe") "" + - testOkFile.CheckExists() + execAndCheckPassed cfg ("." ++ "module2-opt.exe") "" - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "module2-staticlink.exe") "" + execAndCheckPassed cfg ("." ++ "module2-staticlink.exe") "" - testOkFile.CheckExists() #endif @@ -1442,26 +1352,23 @@ module CoreTests = //TestCase1 // Build a program that references v2 of ascendent and v1 of dependent. // Note that, even though ascendent v2 references dependent v2, the reference is marked as v1. - use TestOk = fileguard cfg "test.ok" + fsc cfg @"%s -o:test1.exe -r:version1\DependentAssembly.dll -r:version2\AscendentAssembly.dll --optimize- -g" cfg.fsc_flags ["test.fs"] - exec cfg ("." ++ "test1.exe") "DependentAssembly-1.0.0.0 AscendentAssembly-2.0.0.0" - TestOk.CheckExists() + execAndCheckPassed cfg ("." ++ "test1.exe") "DependentAssembly-1.0.0.0 AscendentAssembly-2.0.0.0" //TestCase2 // Build a program that references v1 of ascendent and v2 of dependent. // Note that, even though ascendent v1 references dependent v1, the reference is marked as v2 which was passed in. - use TestOk = fileguard cfg "test.ok" + fsc cfg @"%s -o:test2.exe -r:version2\DependentAssembly.dll -r:version1\AscendentAssembly.dll --optimize- -g" cfg.fsc_flags ["test.fs"] - exec cfg ("." ++ "test2.exe") "DependentAssembly-2.0.0.0 AscendentAssembly-1.0.0.0" - TestOk.CheckExists() + execAndCheckPassed cfg ("." ++ "test2.exe") "DependentAssembly-2.0.0.0 AscendentAssembly-1.0.0.0" //TestCase3 // Build a program that references v1 of ascendent and v1 and v2 of dependent. // Verifies that compiler uses first version of a duplicate assembly passed on command line. - use TestOk = fileguard cfg "test.ok" + fsc cfg @"%s -o:test3.exe -r:version1\DependentAssembly.dll -r:version2\DependentAssembly.dll -r:version1\AscendentAssembly.dll --optimize- -g" cfg.fsc_flags ["test.fs"] - exec cfg ("." ++ "test3.exe") "DependentAssembly-1.0.0.0 AscendentAssembly-1.0.0.0" - TestOk.CheckExists() + execAndCheckPassed cfg ("." ++ "test3.exe") "DependentAssembly-1.0.0.0 AscendentAssembly-1.0.0.0" [] @@ -1628,11 +1535,10 @@ module CoreTests = peverify cfg "test.exe" - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() [] let verify () = @@ -1867,11 +1773,10 @@ module RegressionTests = peverify cfg "test.exe" - use testOkFile = fileguard cfg "test.ok" + - exec cfg ("." ++ "test.exe") "" + execAndCheckPassed cfg ("." ++ "test.exe") "" - testOkFile.CheckExists() // This test is disabled in coreclr builds dependent on fixing : https://github.com/dotnet/fsharp/issues/2600 [] diff --git a/tests/fsharp/tools/eval/test.fsx b/tests/fsharp/tools/eval/test.fsx index 69431999bbc..9fb17c1d870 100644 --- a/tests/fsharp/tools/eval/test.fsx +++ b/tests/fsharp/tools/eval/test.fsx @@ -2797,5 +2797,5 @@ let _ = exit 1 else stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0 diff --git a/tests/fsharp/typeProviders/diamondAssembly/test3.fsx b/tests/fsharp/typeProviders/diamondAssembly/test3.fsx index 51e5f1803e7..d3350294831 100644 --- a/tests/fsharp/typeProviders/diamondAssembly/test3.fsx +++ b/tests/fsharp/typeProviders/diamondAssembly/test3.fsx @@ -162,7 +162,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typeProviders/globalNamespace/test.fsx b/tests/fsharp/typeProviders/globalNamespace/test.fsx index 133be281594..f0201d7d252 100644 --- a/tests/fsharp/typeProviders/globalNamespace/test.fsx +++ b/tests/fsharp/typeProviders/globalNamespace/test.fsx @@ -24,7 +24,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typeProviders/helloWorld/test.fsx b/tests/fsharp/typeProviders/helloWorld/test.fsx index e528e8da949..59d811bc5a0 100644 --- a/tests/fsharp/typeProviders/helloWorld/test.fsx +++ b/tests/fsharp/typeProviders/helloWorld/test.fsx @@ -1192,7 +1192,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typeProviders/helloWorldCSharp/test.fsx b/tests/fsharp/typeProviders/helloWorldCSharp/test.fsx index 936e670a305..a4a1fbe3228 100644 --- a/tests/fsharp/typeProviders/helloWorldCSharp/test.fsx +++ b/tests/fsharp/typeProviders/helloWorldCSharp/test.fsx @@ -26,7 +26,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typeProviders/splitAssemblyTools/test.fsx b/tests/fsharp/typeProviders/splitAssemblyTools/test.fsx index e25871ab5f8..ba7cc6b9e34 100644 --- a/tests/fsharp/typeProviders/splitAssemblyTools/test.fsx +++ b/tests/fsharp/typeProviders/splitAssemblyTools/test.fsx @@ -26,7 +26,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typeProviders/splitAssemblyTypeproviders/test.fsx b/tests/fsharp/typeProviders/splitAssemblyTypeproviders/test.fsx index e25871ab5f8..ba7cc6b9e34 100644 --- a/tests/fsharp/typeProviders/splitAssemblyTypeproviders/test.fsx +++ b/tests/fsharp/typeProviders/splitAssemblyTypeproviders/test.fsx @@ -26,7 +26,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typeProviders/wedgeAssembly/test3.fsx b/tests/fsharp/typeProviders/wedgeAssembly/test3.fsx index 7e6125c4be9..1a3c546d17a 100644 --- a/tests/fsharp/typeProviders/wedgeAssembly/test3.fsx +++ b/tests/fsharp/typeProviders/wedgeAssembly/test3.fsx @@ -108,7 +108,7 @@ let _ = if not failures.IsEmpty then (printfn "Test Failed, failures = %A" failures; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/fsharp/typecheck/full-rank-arrays/test.fsx b/tests/fsharp/typecheck/full-rank-arrays/test.fsx index 0a062adae4a..d8800170979 100644 --- a/tests/fsharp/typecheck/full-rank-arrays/test.fsx +++ b/tests/fsharp/typecheck/full-rank-arrays/test.fsx @@ -107,5 +107,5 @@ let _ = let x = Class1() x.RunTests() System.Console.WriteLine "Test Passed"; - System.IO.File.WriteAllText ("test.ok", "ok"); + printf "TEST PASSED OK" exit 0 diff --git a/tests/fsharp/typecheck/misc/test.ml b/tests/fsharp/typecheck/misc/test.ml index 4a2e5c89332..14bc16ae51f 100644 --- a/tests/fsharp/typecheck/misc/test.ml +++ b/tests/fsharp/typecheck/misc/test.ml @@ -33,5 +33,5 @@ let _ = * So avoid using ;; *) System.Console.WriteLine "Test Passed"; - System.IO.File.WriteAllText ("test.ok", "ok"); + printf "TEST PASSED OK"; exit 0 diff --git a/tests/fsharp/typecheck/sigs/neg104.vsbsl b/tests/fsharp/typecheck/sigs/neg104.vsbsl index 12c1c451d3e..165b4348e35 100644 --- a/tests/fsharp/typecheck/sigs/neg104.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg104.vsbsl @@ -19,12 +19,12 @@ neg104.fs(35,19,35,20): parse error FS0010: Unexpected symbol '}' in definition. neg104.fs(36,1,36,1): parse error FS0010: Incomplete structured construct at or before this point in implementation file -neg104.fs(8,9,8,30): typecheck error FS0750: This construct may only be used within computation expressions +neg104.fs(8,9,8,15): typecheck error FS0750: This construct may only be used within computation expressions -neg104.fs(10,9,10,30): typecheck error FS0750: This construct may only be used within computation expressions +neg104.fs(10,9,10,15): typecheck error FS0750: This construct may only be used within computation expressions neg104.fs(20,9,20,15): typecheck error FS0025: Incomplete pattern matches on this expression. neg104.fs(23,9,23,15): typecheck error FS0025: Incomplete pattern matches on this expression. -neg104.fs(35,9,35,18): typecheck error FS0748: This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'. +neg104.fs(35,9,35,15): typecheck error FS0748: 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/typecheck/sigs/neg107.bsl b/tests/fsharp/typecheck/sigs/neg107.bsl index 30b24d25c59..580233b4775 100644 --- a/tests/fsharp/typecheck/sigs/neg107.bsl +++ b/tests/fsharp/typecheck/sigs/neg107.bsl @@ -33,11 +33,11 @@ neg107.fsx(28,55,28,66): typecheck error FS0425: The type of a first-class funct neg107.fsx(30,49,30,54): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. -neg107.fsx(30,57,30,65): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. +neg107.fsx(30,64,30,65): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. neg107.fsx(31,70,31,75): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. -neg107.fsx(31,78,31,86): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. +neg107.fsx(31,85,31,86): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. neg107.fsx(32,13,32,30): typecheck error FS3301: The function or method has an invalid return type 'Async>'. This is not permitted by the rules of Common IL. @@ -49,13 +49,13 @@ neg107.fsx(32,48,32,53): typecheck error FS0406: The byref-typed variable 'a' is neg107.fsx(32,48,32,53): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg107.fsx(32,56,32,64): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg107.fsx(32,63,32,64): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg107.fsx(32,56,32,64): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. +neg107.fsx(32,63,32,64): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. -neg107.fsx(32,56,32,64): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg107.fsx(32,63,32,64): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg107.fsx(32,56,32,64): typecheck error FS0425: The type of a first-class function cannot contain byrefs +neg107.fsx(32,63,32,64): typecheck error FS0425: The type of a first-class function cannot contain byrefs neg107.fsx(32,48,32,53): typecheck error FS0425: The type of a first-class function cannot contain byrefs @@ -69,13 +69,13 @@ neg107.fsx(33,56,33,61): typecheck error FS0406: The byref-typed variable 'a' is neg107.fsx(33,56,33,61): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg107.fsx(33,64,33,72): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg107.fsx(33,71,33,72): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg107.fsx(33,64,33,72): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. +neg107.fsx(33,71,33,72): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. -neg107.fsx(33,64,33,72): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg107.fsx(33,71,33,72): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg107.fsx(33,64,33,72): typecheck error FS0425: The type of a first-class function cannot contain byrefs +neg107.fsx(33,71,33,72): typecheck error FS0425: The type of a first-class function cannot contain byrefs neg107.fsx(33,56,33,61): typecheck error FS0425: The type of a first-class function cannot contain byrefs diff --git a/tests/fsharp/typecheck/sigs/neg107.vsbsl b/tests/fsharp/typecheck/sigs/neg107.vsbsl index 30b24d25c59..580233b4775 100644 --- a/tests/fsharp/typecheck/sigs/neg107.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg107.vsbsl @@ -33,11 +33,11 @@ neg107.fsx(28,55,28,66): typecheck error FS0425: The type of a first-class funct neg107.fsx(30,49,30,54): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. -neg107.fsx(30,57,30,65): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. +neg107.fsx(30,64,30,65): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. neg107.fsx(31,70,31,75): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. -neg107.fsx(31,78,31,86): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. +neg107.fsx(31,85,31,86): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. neg107.fsx(32,13,32,30): typecheck error FS3301: The function or method has an invalid return type 'Async>'. This is not permitted by the rules of Common IL. @@ -49,13 +49,13 @@ neg107.fsx(32,48,32,53): typecheck error FS0406: The byref-typed variable 'a' is neg107.fsx(32,48,32,53): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg107.fsx(32,56,32,64): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg107.fsx(32,63,32,64): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg107.fsx(32,56,32,64): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. +neg107.fsx(32,63,32,64): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. -neg107.fsx(32,56,32,64): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg107.fsx(32,63,32,64): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg107.fsx(32,56,32,64): typecheck error FS0425: The type of a first-class function cannot contain byrefs +neg107.fsx(32,63,32,64): typecheck error FS0425: The type of a first-class function cannot contain byrefs neg107.fsx(32,48,32,53): typecheck error FS0425: The type of a first-class function cannot contain byrefs @@ -69,13 +69,13 @@ neg107.fsx(33,56,33,61): typecheck error FS0406: The byref-typed variable 'a' is neg107.fsx(33,56,33,61): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg107.fsx(33,64,33,72): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg107.fsx(33,71,33,72): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg107.fsx(33,64,33,72): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. +neg107.fsx(33,71,33,72): typecheck error FS0406: The byref-typed variable 'a' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. -neg107.fsx(33,64,33,72): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. +neg107.fsx(33,71,33,72): typecheck error FS0412: A type instantiation involves a byref type. This is not permitted by the rules of Common IL. -neg107.fsx(33,64,33,72): typecheck error FS0425: The type of a first-class function cannot contain byrefs +neg107.fsx(33,71,33,72): typecheck error FS0425: The type of a first-class function cannot contain byrefs neg107.fsx(33,56,33,61): typecheck error FS0425: The type of a first-class function cannot contain byrefs diff --git a/tests/fsharp/typecheck/sigs/neg20.bsl b/tests/fsharp/typecheck/sigs/neg20.bsl index ea20ab65acf..5229dcaacf6 100644 --- a/tests/fsharp/typecheck/sigs/neg20.bsl +++ b/tests/fsharp/typecheck/sigs/neg20.bsl @@ -67,7 +67,7 @@ but given a 'B list' The type 'A' does not match the type 'B' -neg20.fs(80,23,80,39): typecheck error FS0193: Type constraint mismatch. The type +neg20.fs(80,30,80,39): typecheck error FS0193: Type constraint mismatch. The type 'C list' is not compatible with type 'B seq' diff --git a/tests/fsharp/typecheck/sigs/neg59.bsl b/tests/fsharp/typecheck/sigs/neg59.bsl index 624750b9352..a938f0d271c 100644 --- a/tests/fsharp/typecheck/sigs/neg59.bsl +++ b/tests/fsharp/typecheck/sigs/neg59.bsl @@ -41,6 +41,6 @@ neg59.fs(113,15,113,25): typecheck error FS3140: 'while' expressions may not be neg59.fs(118,15,118,25): typecheck error FS3140: 'while' expressions may not be used in queries -neg59.fs(124,17,124,25): typecheck error FS3144: 'return' and 'return!' may not be used in queries +neg59.fs(124,17,124,23): typecheck error FS3144: 'return' and 'return!' may not be used in queries -neg59.fs(128,17,128,26): typecheck error FS3144: 'return' and 'return!' may not be used in queries +neg59.fs(128,17,128,24): typecheck error FS3144: 'return' and 'return!' may not be used in queries diff --git a/tests/fsharp/typecheck/sigs/neg61.bsl b/tests/fsharp/typecheck/sigs/neg61.bsl index e0b2fb5eafb..b0e6b151a2c 100644 --- a/tests/fsharp/typecheck/sigs/neg61.bsl +++ b/tests/fsharp/typecheck/sigs/neg61.bsl @@ -59,15 +59,13 @@ neg61.fs(86,13,86,16): typecheck error FS3141: 'try/finally' expressions may not neg61.fs(92,13,92,70): typecheck error FS3142: 'use' expressions may not be used in queries -neg61.fs(97,13,97,33): typecheck error FS3143: 'let!', 'use!' and 'do!' expressions may not be used in queries +neg61.fs(97,13,97,17): typecheck error FS3143: 'let!', 'use!' and 'do!' expressions may not be used in queries -neg61.fs(102,13,102,28): typecheck error FS3145: This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type. +neg61.fs(102,13,102,16): typecheck error FS3143: 'let!', 'use!' and 'do!' expressions may not be used in queries -neg61.fs(102,13,102,28): typecheck error FS3143: 'let!', 'use!' and 'do!' expressions may not be used in queries +neg61.fs(107,13,107,19): typecheck error FS3144: 'return' and 'return!' may not be used in queries -neg61.fs(107,13,107,21): typecheck error FS3144: 'return' and 'return!' may not be used in queries - -neg61.fs(111,13,111,24): typecheck error FS3144: 'return' and 'return!' may not be used in queries +neg61.fs(111,13,111,20): typecheck error FS3144: 'return' and 'return!' may not be used in queries neg61.fs(114,13,114,21): typecheck error FS3145: This is not a known query operator. Query operators are identifiers such as 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' and 'averageBy', defined using corresponding methods on the 'QueryBuilder' type. diff --git a/tests/fsharp/typecheck/sigs/version50/neg20.bsl b/tests/fsharp/typecheck/sigs/version50/neg20.bsl index 169c18e8573..394f7777b2a 100644 --- a/tests/fsharp/typecheck/sigs/version50/neg20.bsl +++ b/tests/fsharp/typecheck/sigs/version50/neg20.bsl @@ -98,7 +98,7 @@ but given a 'B list' The type 'A' does not match the type 'B' -neg20.fs(80,23,80,39): typecheck error FS0193: Type constraint mismatch. The type +neg20.fs(80,30,80,39): typecheck error FS0193: Type constraint mismatch. The type 'C list' is not compatible with type 'B seq' diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturn.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturn.fs index a0bb521f1af..5010e70386b 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturn.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturn.fs @@ -1,6 +1,6 @@ // #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$ +//This control construct may only be used if the computation expression builder defines a 'Return' method$ type R = S of string diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturnFrom.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturnFrom.fs index 24f20ffb9ac..f8185a9b7fa 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturnFrom.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingReturnFrom.fs @@ -1,6 +1,6 @@ // #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$ +//This control construct may only be used if the computation expression builder defines a 'ReturnFrom' method$ type R = S of string diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYield.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYield.fs index b731412bfa6..7251faf3978 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYield.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYield.fs @@ -1,6 +1,6 @@ // #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$ +//This control construct may only be used if the computation expression builder defines a 'Yield' method$ type R = S of string diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYieldFrom.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYieldFrom.fs index 63ada5cd6be..3777c375f2b 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYieldFrom.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/ComputationExpressions/E_MissingYieldFrom.fs @@ -1,6 +1,6 @@ // #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$ +//This control construct may only be used if the computation expression builder defines a 'YieldFrom' method$ type R = S of string diff --git a/tests/fsharpqa/Source/Conformance/LexicalAnalysis/IdentifiersAndKeywords/backtickmoduleandtypenames.fsx b/tests/fsharpqa/Source/Conformance/LexicalAnalysis/IdentifiersAndKeywords/backtickmoduleandtypenames.fsx index 20aede76c20..47debdeb71f 100644 --- a/tests/fsharpqa/Source/Conformance/LexicalAnalysis/IdentifiersAndKeywords/backtickmoduleandtypenames.fsx +++ b/tests/fsharpqa/Source/Conformance/LexicalAnalysis/IdentifiersAndKeywords/backtickmoduleandtypenames.fsx @@ -75,5 +75,5 @@ let aa = if !failures then (stdout.WriteLine "Test Failed"; exit 1) do (stdout.WriteLine "Test Passed"; - System.IO.File.WriteAllText("test.ok","ok"); + printf "TEST PASSED OK"; exit 0) diff --git a/tests/scripts/scriptlib.fsx b/tests/scripts/scriptlib.fsx index b074b78ba25..853aecb496e 100644 --- a/tests/scripts/scriptlib.fsx +++ b/tests/scripts/scriptlib.fsx @@ -82,7 +82,7 @@ module Scripting = type FilePath = string type CmdResult = - | Success + | Success of output: string | ErrorLevel of string * int type CmdArguments = @@ -156,7 +156,8 @@ module Scripting = p.WaitForExit() match p.ExitCode with - | 0 -> Success + | 0 -> + Success(string out) | errCode -> let msg = sprintf "Error running command '%s' with args '%s' in directory '%s'.\n---- stdout below --- \n%s\n---- stderr below --- \n%s " exePath arguments workDir (out.ToString()) (err.ToString()) ErrorLevel (msg, errCode) diff --git a/tests/service/FsUnit.fs b/tests/service/FsUnit.fs index e5b0962449c..e17be411776 100644 --- a/tests/service/FsUnit.fs +++ b/tests/service/FsUnit.fs @@ -1,66 +1,6 @@ module FsUnit -open System.Diagnostics -open NUnit.Framework -open NUnit.Framework.Constraints +open Xunit -[] -let should (f : 'a -> #Constraint) x (y : obj) = - let c = f x - let y = - match y with - | :? (unit -> unit) -> box (TestDelegate(y :?> unit -> unit)) - | _ -> y - Assert.That(y, c) - -let equal x = EqualConstraint(x) - -/// like "should equal", but validates same-type let shouldEqual (x: 'a) (y: 'a) = - Assert.AreEqual(x, y, sprintf "Expected: %A\nActual: %A" x y) - -/// Same as 'shouldEqual' but goes pairwise over the collections. Lengths must be equal. -let shouldPairwiseEqual (x: seq<_>) (y: seq<_>) = - // using enumerators, because Seq.iter2 allows different lengths silently - let ex = x.GetEnumerator() - let ey = y.GetEnumerator() - let mutable countx = 0 - let mutable county = 0 - while ex.MoveNext() do - countx <- countx + 1 - if ey.MoveNext() then - county <- county + 1 - ey.Current |> shouldEqual ex.Current - - while ex.MoveNext() do countx <- countx + 1 - while ey.MoveNext() do county <- county + 1 - if countx <> county then - Assert.Fail("Collections are of unequal lengths, expected length {0}, actual length is {1}.", countx, county) - -let notEqual x = NotConstraint(EqualConstraint(x)) - -let contain x = ContainsConstraint(x) - -let haveLength n = Has.Length.EqualTo(n) - -let haveCount n = Has.Count.EqualTo(n) - -let endWith (s:string) = EndsWithConstraint(s) - -let startWith (s:string) = StartsWithConstraint(s) - -let be = id - -let Null = NullConstraint() - -let Empty = EmptyConstraint() - -let EmptyString = EmptyStringConstraint() - -let True = TrueConstraint() - -let False = FalseConstraint() - -let sameAs x = SameAsConstraint(x) - -let throw = Throws.TypeOf \ No newline at end of file + Assert.Equal<'a>(x, y) \ No newline at end of file diff --git a/tests/service/data/DifferingOutputDir/Dir1/OutputDir1/FSharp.Core.dll b/tests/service/data/DifferingOutputDir/Dir1/OutputDir1/FSharp.Core.dll deleted file mode 100644 index ae969cedb0c..00000000000 Binary files a/tests/service/data/DifferingOutputDir/Dir1/OutputDir1/FSharp.Core.dll and /dev/null differ diff --git a/tests/service/data/DifferingOutputDir/Dir1/Test1.fsproj b/tests/service/data/DifferingOutputDir/Dir1/Test1.fsproj deleted file mode 100644 index 668428f1ac0..00000000000 --- a/tests/service/data/DifferingOutputDir/Dir1/Test1.fsproj +++ /dev/null @@ -1,63 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {116cc2f9-f987-4b3d-915a-34cac04a73da} - Library - Test1 - Test1 - Test1 - False - 11 - - - True - full - False - False - OutputDir1 - DEBUG;TRACE - 3 - x86 - bin\Debug\Test1.xml - - - pdbonly - True - True - Test1\bin\Release\ - TRACE - 3 - x86 - bin\Release\Test1.xml - False - - - - ..\..\..\..\..\packages\Microsoft.Portable.FSharp.Core.10.1.0\lib\profiles\net40\FSharp.Core.dll - false - - - - - - - - - - - - - - - ..\..\..\..\..\packages\NUnit\lib\nunit.framework.dll - True - True - - - - - \ No newline at end of file diff --git a/tests/service/data/DifferingOutputDir/Dir2/OutputDir2/FSharp.Core.dll b/tests/service/data/DifferingOutputDir/Dir2/OutputDir2/FSharp.Core.dll deleted file mode 100644 index ae969cedb0c..00000000000 Binary files a/tests/service/data/DifferingOutputDir/Dir2/OutputDir2/FSharp.Core.dll and /dev/null differ diff --git a/tests/service/data/DifferingOutputDir/Dir2/Test2.fsproj b/tests/service/data/DifferingOutputDir/Dir2/Test2.fsproj deleted file mode 100644 index e90751876da..00000000000 --- a/tests/service/data/DifferingOutputDir/Dir2/Test2.fsproj +++ /dev/null @@ -1,69 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {116cc2f9-f987-4b3d-915a-34cac04a73db} - Exe - Test2 - Test2 - Test2 - False - 11 - - - True - full - False - False - OutputDir2 - DEBUG;TRACE - 3 - x86 - bin\Debug\Test2.xml - - - pdbonly - True - True - Test2\bin\Release\ - TRACE - 3 - x86 - bin\Release\Test2.xml - False - - - - ..\..\..\..\..\packages\Microsoft.Portable.FSharp.Core.10.1.0\lib\profiles\net40\FSharp.Core.dll - false - - - - - - - - - - - - {116cc2f9-f987-4b3d-915a-34cac04a73da} - Test1 - - - - - - - - ..\..\..\..\..\packages\NUnit\lib\nunit.framework.dll - True - True - - - - - \ No newline at end of file diff --git a/tests/service/data/FsAndFsiFiles.fsproj b/tests/service/data/FsAndFsiFiles.fsproj deleted file mode 100644 index a31365c73f1..00000000000 --- a/tests/service/data/FsAndFsiFiles.fsproj +++ /dev/null @@ -1,63 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {116cc2f9-f987-4b3d-915a-34cac04a73da} - Library - Test1 - Test1 - bin\$(Configuration)\ - False - 11 - - - True - full - False - False - DEBUG;TRACE - 3 - x86 - bin\Debug\Test1.xml - - - pdbonly - True - True - TRACE - 3 - x86 - bin\Release\Test1.xml - False - - - - ..\..\..\packages\Microsoft.Portable.FSharp.Core.10.1.0\lib\profiles\net40\FSharp.Core.dll - - - - - - - - - - - - - - - - - - ..\..\..\packages\NUnit\lib\nunit.framework.dll - True - True - - - - - \ No newline at end of file diff --git a/tests/service/data/Malformed.fsproj b/tests/service/data/Malformed.fsproj deleted file mode 100644 index 1079189f2d5..00000000000 --- a/tests/service/data/Malformed.fsproj +++ /dev/null @@ -1 +0,0 @@ -Not even slightly like a project diff --git a/tests/service/data/MultiLanguageProject/ConsoleApplication1.fsproj b/tests/service/data/MultiLanguageProject/ConsoleApplication1.fsproj deleted file mode 100644 index 4aef2e13364..00000000000 --- a/tests/service/data/MultiLanguageProject/ConsoleApplication1.fsproj +++ /dev/null @@ -1,79 +0,0 @@ - - - - - Debug - AnyCPU - 2.0 - 252a5848-1864-43fd-8fde-aab146410dee - Exe - ConsoleApplication1 - ConsoleApplication1 - v4.5 - true - ConsoleApplication1 - - - true - full - false - false - bin\Debug\ - DEBUG;TRACE - 3 - AnyCPU - bin\Debug\ConsoleApplication1.xml - true - - - pdbonly - true - true - bin\Release\ - TRACE - 3 - AnyCPU - bin\Release\ConsoleApplication1.xml - true - - - - - ..\..\..\..\packages\Microsoft.Portable.FSharp.Core.10.1.0\lib\profiles\net40\FSharp.Core.dll - false - - - - - - - - - - - ConsoleApplication2 - {31b31546-8348-4be1-9890-1f17ba70fd21} - True - - - ConsoleApplication3 - {24795688-ce64-4475-a326-3175f1a40f68} - True - - - - 11 - - - - - - - ..\..\..\..\packages\NUnit\lib\nunit.framework.dll - True - True - - - - - \ No newline at end of file diff --git a/tests/service/data/MultiLanguageProject/ConsoleApplication2.fsproj b/tests/service/data/MultiLanguageProject/ConsoleApplication2.fsproj deleted file mode 100644 index f70cb6693ad..00000000000 --- a/tests/service/data/MultiLanguageProject/ConsoleApplication2.fsproj +++ /dev/null @@ -1,71 +0,0 @@ - - - - - Debug - AnyCPU - 2.0 - 31b31546-8348-4be1-9890-1f17ba70fd21 - Exe - ConsoleApplication2 - ConsoleApplication2 - v4.5 - true - ConsoleApplication2 - - - true - full - false - false - bin\Debug\ - DEBUG;TRACE - 3 - AnyCPU - bin\Debug\ConsoleApplication2.xml - true - - - pdbonly - true - true - bin\Release\ - TRACE - 3 - AnyCPU - bin\Release\ConsoleApplication2.xml - true - - - - - ..\..\..\..\packages\Microsoft.Portable.FSharp.Core.10.1.0\lib\profiles\net40\FSharp.Core.dll - false - - - - - - - - - - - ConsoleApplication3 - {24795688-ce64-4475-a326-3175f1a40f68} - True - - - - - - - - ..\..\..\..\packages\NUnit\lib\nunit.framework.dll - True - True - - - - - \ No newline at end of file diff --git a/tests/service/data/MultiLanguageProject/ConsoleApplication3.csproj b/tests/service/data/MultiLanguageProject/ConsoleApplication3.csproj deleted file mode 100644 index b285b3505c1..00000000000 --- a/tests/service/data/MultiLanguageProject/ConsoleApplication3.csproj +++ /dev/null @@ -1,66 +0,0 @@ - - - - - Debug - AnyCPU - {24795688-CE64-4475-A326-3175F1A40F68} - Exe - Properties - ConsoleApplication3 - ConsoleApplication3 - v4.5 - 512 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - ..\..\..\..\packages\NUnit\lib\nunit.framework.dll - True - True - - - - - \ No newline at end of file diff --git a/tests/service/data/ScriptProject/BaseLib1.fs b/tests/service/data/ScriptProject/BaseLib1.fs deleted file mode 100644 index d3be7d2a54e..00000000000 --- a/tests/service/data/ScriptProject/BaseLib1.fs +++ /dev/null @@ -1,3 +0,0 @@ -module BaseLib1 - -let add2 x = x + 2 \ No newline at end of file diff --git a/tests/service/data/ScriptProject/BaseLib2.fs b/tests/service/data/ScriptProject/BaseLib2.fs deleted file mode 100644 index 3277193dd5f..00000000000 --- a/tests/service/data/ScriptProject/BaseLib2.fs +++ /dev/null @@ -1,3 +0,0 @@ -module BaseLib2 - -let add10 x = x + 10 \ No newline at end of file diff --git a/tests/service/data/ScriptProject/Lib1.fsx b/tests/service/data/ScriptProject/Lib1.fsx deleted file mode 100644 index 53833dc65c1..00000000000 --- a/tests/service/data/ScriptProject/Lib1.fsx +++ /dev/null @@ -1,2 +0,0 @@ -#load "BaseLib1.fs" -let add3 = BaseLib1.add2 >> ((+) 1) \ No newline at end of file diff --git a/tests/service/data/ScriptProject/Lib2.fsx b/tests/service/data/ScriptProject/Lib2.fsx deleted file mode 100644 index 7f6261cf09e..00000000000 --- a/tests/service/data/ScriptProject/Lib2.fsx +++ /dev/null @@ -1,2 +0,0 @@ -#load "BaseLib1.fs" -let add4 = BaseLib1.add2 >> ((+) 2) \ No newline at end of file diff --git a/tests/service/data/ScriptProject/Lib3.fs b/tests/service/data/ScriptProject/Lib3.fs deleted file mode 100644 index 8524ace2599..00000000000 --- a/tests/service/data/ScriptProject/Lib3.fs +++ /dev/null @@ -1,3 +0,0 @@ -module Lib3 - -let add6 = ((+) 6) \ No newline at end of file diff --git a/tests/service/data/ScriptProject/Lib4.fs b/tests/service/data/ScriptProject/Lib4.fs deleted file mode 100644 index 108bfbc45db..00000000000 --- a/tests/service/data/ScriptProject/Lib4.fs +++ /dev/null @@ -1,3 +0,0 @@ -module Lib4 - -let add8 = ((+) 8) \ No newline at end of file diff --git a/tests/service/data/ScriptProject/Lib5.fsx b/tests/service/data/ScriptProject/Lib5.fsx deleted file mode 100644 index ec2ecacb183..00000000000 --- a/tests/service/data/ScriptProject/Lib5.fsx +++ /dev/null @@ -1,2 +0,0 @@ -#load "BaseLib2.fs" -let add12 = BaseLib2.add10 >> ((+) 2) \ No newline at end of file diff --git a/tests/service/data/ScriptProject/Main1.fsx b/tests/service/data/ScriptProject/Main1.fsx deleted file mode 100644 index 90086fc76d6..00000000000 --- a/tests/service/data/ScriptProject/Main1.fsx +++ /dev/null @@ -1,4 +0,0 @@ -#load "Lib1.fsx" -#load "Lib2.fsx" -Lib1.add3 5 |> printfn "%i" -Lib2.add4 5 |> printfn "%i" \ No newline at end of file diff --git a/tests/service/data/ScriptProject/Main2.fsx b/tests/service/data/ScriptProject/Main2.fsx deleted file mode 100644 index 906fd5d19ce..00000000000 --- a/tests/service/data/ScriptProject/Main2.fsx +++ /dev/null @@ -1,6 +0,0 @@ -#load "Lib1.fsx" -#load "Lib2.fsx" -#load "Lib3.fs" -Lib1.add3 5 |> printfn "%i" -Lib2.add4 5 |> printfn "%i" -Lib3.add6 5 |> printfn "%i" \ No newline at end of file diff --git a/tests/service/data/ScriptProject/Main3.fsx b/tests/service/data/ScriptProject/Main3.fsx deleted file mode 100644 index 8df731bd958..00000000000 --- a/tests/service/data/ScriptProject/Main3.fsx +++ /dev/null @@ -1,4 +0,0 @@ -#load "Lib3.fs" -#load "Lib4.fs" -Lib3.add6 5 |> printfn "%i" -Lib4.add8 5 |> printfn "%i" diff --git a/tests/service/data/ScriptProject/Main4.fsx b/tests/service/data/ScriptProject/Main4.fsx deleted file mode 100644 index 6da860748fb..00000000000 --- a/tests/service/data/ScriptProject/Main4.fsx +++ /dev/null @@ -1,6 +0,0 @@ -#load "Lib5.fsx" -#load "Lib1.fsx" -#load "Lib2.fsx" -Lib1.add3 5 |> printfn "%i" -Lib2.add4 5 |> printfn "%i" -Lib5.add12 5 |> printfn "%i" diff --git a/tests/service/data/ScriptProject/MainBad.fsx b/tests/service/data/ScriptProject/MainBad.fsx deleted file mode 100644 index 52b4ce4e8a7..00000000000 --- a/tests/service/data/ScriptProject/MainBad.fsx +++ /dev/null @@ -1,2 +0,0 @@ -#load "Nonexistent1.fsx" -#r "Nonexistent.dll" diff --git a/tests/service/data/Space in name.fsproj b/tests/service/data/Space in name.fsproj deleted file mode 100644 index 36ff02de930..00000000000 --- a/tests/service/data/Space in name.fsproj +++ /dev/null @@ -1,67 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {116cc2f9-f987-4b3d-915a-34cac04a73db} - Exe - Test2 - Test2 - Test2 - False - ..\..\..\$(Configuration)\net40\bin - - - True - full - False - False - DEBUG;TRACE - 3 - x86 - bin\Debug\Test2.xml - - - pdbonly - True - True - TRACE - 3 - x86 - bin\Release\Test2.xml - False - - - - ..\..\..\packages\Microsoft.Portable.FSharp.Core.4.3.0\lib\profiles\net40\FSharp.Core.dll - false - - - - - - - - - - - - {116cc2f9-f987-4b3d-915a-34cac04a73da} - Test1 - - - - - - - - ..\..\..\packages\NUnit\lib\nunit.framework.dll - True - True - - - - - \ No newline at end of file diff --git a/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl b/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl index 2c7ca108bc8..16e62c6c1aa 100644 --- a/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl +++ b/tests/service/data/SyntaxTree/ComputationExpression/MultipleSynExprAndBangHaveRangeThatStartsAtAndAndEndsAfterExpression.fs.bsl @@ -39,9 +39,12 @@ ImplFile (5,4--5,24), { AndBangKeyword = (5,4--5,8) EqualsRange = (5,13--5,14) InKeyword = None })], - YieldOrReturn ((false, true), Ident bar, (6,4--6,14)), - (3,4--6,14), { EqualsRange = Some (3,13--3,14) }), - (2,6--7,1)), (2,0--7,1)), (2,0--7,1))], PreXmlDocEmpty, [], - None, (2,0--7,1), { LeadingKeyword = None })], (true, true), + YieldOrReturn + ((false, true), Ident bar, (6,4--6,14), + { YieldOrReturnKeyword = (6,4--6,10) }), (3,4--6,14), + { LetOrUseBangKeyword = (3,4--3,8) + EqualsRange = Some (3,13--3,14) }), (2,6--7,1)), + (2,0--7,1)), (2,0--7,1))], PreXmlDocEmpty, [], None, (2,0--7,1), + { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl b/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl index 105a94f5b46..9ee7e15f532 100644 --- a/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl +++ b/tests/service/data/SyntaxTree/ComputationExpression/SynExprAndBangRangeStartsAtAndAndEndsAfterExpression.fs.bsl @@ -28,9 +28,12 @@ ImplFile (5,4--5,24), { AndBangKeyword = (5,4--5,8) EqualsRange = (5,13--5,14) InKeyword = None })], - YieldOrReturn ((false, true), Ident bar, (7,4--7,14)), - (3,4--7,14), { EqualsRange = Some (3,13--3,14) }), - (2,6--8,1)), (2,0--8,1)), (2,0--8,1))], PreXmlDocEmpty, [], - None, (2,0--8,1), { LeadingKeyword = None })], (true, true), + YieldOrReturn + ((false, true), Ident bar, (7,4--7,14), + { YieldOrReturnKeyword = (7,4--7,10) }), (3,4--7,14), + { LetOrUseBangKeyword = (3,4--3,8) + EqualsRange = Some (3,13--3,14) }), (2,6--8,1)), + (2,0--8,1)), (2,0--8,1))], PreXmlDocEmpty, [], None, (2,0--8,1), + { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs.bsl b/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs.bsl index 7cc9b348848..517c835a63a 100644 --- a/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/List - Comprehension 01.fs.bsl @@ -12,8 +12,9 @@ ImplFile Named (SynIdent (x, None), false, None, (3,6--3,7)), ArrayOrList (false, [], (3,11--3,13)), YieldOrReturn - ((true, false), Const (Unit, (3,17--3,19)), (3,14--3,19)), - (3,2--3,19)), (3,0--3,21)), (3,0--3,21))], + ((true, false), Const (Unit, (3,17--3,19)), (3,14--3,19), + { YieldOrReturnKeyword = (3,14--3,16) }), (3,2--3,19)), + (3,0--3,21)), (3,0--3,21))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,21), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs.bsl b/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs.bsl index 1a89da1b0fb..9897592fb0a 100644 --- a/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/List - Comprehension 02.fs.bsl @@ -15,7 +15,8 @@ ImplFile ((true, false), ArbitraryAfterError ("typedSequentialExprBlockR1", (3,16--3,16)), - (3,14--3,16)), (3,2--3,16)), (3,0--3,18)), (3,0--3,18))], + (3,14--3,16), { YieldOrReturnKeyword = (3,14--3,16) }), + (3,2--3,16)), (3,0--3,18)), (3,0--3,18))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,18), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/Expression/Rarrow 01.fs.bsl b/tests/service/data/SyntaxTree/Expression/Rarrow 01.fs.bsl index 9d7e7af2125..c3c454436ce 100644 --- a/tests/service/data/SyntaxTree/Expression/Rarrow 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/Rarrow 01.fs.bsl @@ -5,8 +5,8 @@ ImplFile ([Module], false, NamedModule, [Expr (YieldOrReturn - ((true, true), Const (Int32 1, (3,3--3,4)), (3,0--3,4)), - (3,0--3,4))], + ((true, true), Const (Int32 1, (3,3--3,4)), (3,0--3,4), + { YieldOrReturnKeyword = (3,0--3,2) }), (3,0--3,4))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,4), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/Expression/Rarrow 02.fs.bsl b/tests/service/data/SyntaxTree/Expression/Rarrow 02.fs.bsl index 54570b38728..3a0af632862 100644 --- a/tests/service/data/SyntaxTree/Expression/Rarrow 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/Rarrow 02.fs.bsl @@ -7,7 +7,7 @@ ImplFile (YieldOrReturn ((true, true), ArbitraryAfterError ("typedSequentialExprBlockR1", (3,2--3,2)), - (3,0--3,2)), (3,0--3,2))], + (3,0--3,2), { YieldOrReturnKeyword = (3,0--3,2) }), (3,0--3,2))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,2), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/Expression/Rarrow 03.fs.bsl b/tests/service/data/SyntaxTree/Expression/Rarrow 03.fs.bsl index e0d4104ac0a..ceae74bf09b 100644 --- a/tests/service/data/SyntaxTree/Expression/Rarrow 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/Rarrow 03.fs.bsl @@ -9,8 +9,9 @@ ImplFile YieldOrReturn ((true, true), ArbitraryAfterError - ("typedSequentialExprBlockR1", (3,5--3,5)), (3,3--3,5)), - (3,0--3,5)), (3,0--3,5))], + ("typedSequentialExprBlockR1", (3,5--3,5)), (3,3--3,5), + { YieldOrReturnKeyword = (3,3--3,5) }), (3,0--3,5), + { YieldOrReturnKeyword = (3,0--3,2) }), (3,0--3,5))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--3,5), { LeadingKeyword = Module (1,0--1,6) })], (true, true), { ConditionalDirectives = [] diff --git a/tests/service/data/SyntaxTree/Expression/SynExprDoContainsTheRangeOfTheDoKeyword.fs.bsl b/tests/service/data/SyntaxTree/Expression/SynExprDoContainsTheRangeOfTheDoKeyword.fs.bsl index e33ddf8bde9..4b3437c248d 100644 --- a/tests/service/data/SyntaxTree/Expression/SynExprDoContainsTheRangeOfTheDoKeyword.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/SynExprDoContainsTheRangeOfTheDoKeyword.fs.bsl @@ -14,7 +14,9 @@ ImplFile Named (SynIdent (a, None), false, None, (2,4--2,5)), None, Sequential (SuppressNeither, true, Do (Ident foobar, (3,4--4,14)), - DoBang (Ident foobarBang, (5,4--6,18)), (3,4--6,18), + DoBang + (Ident foobarBang, (5,4--6,18), + { DoBangKeyword = (5,4--5,7) }), (3,4--6,18), { SeparatorRange = None }), (2,4--2,5), NoneAtLet, { LeadingKeyword = Let (2,0--2,3) InlineKeyword = None diff --git a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl index 7dfd05fc1ad..0264686482c 100644 --- a/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/SynExprLetOrUseBangContainsTheRangeOfTheEqualsSign.fs.bsl @@ -26,9 +26,11 @@ ImplFile EqualsRange = (4,11--4,12) InKeyword = None })], YieldOrReturn - ((false, true), Const (Unit, (5,11--5,13)), (5,4--5,13)), - (3,4--5,13), { EqualsRange = Some (3,11--3,12) }), - (2,5--6,1)), (2,0--6,1)), (2,0--6,1))], PreXmlDocEmpty, [], - None, (2,0--6,1), { LeadingKeyword = None })], (true, true), + ((false, true), Const (Unit, (5,11--5,13)), (5,4--5,13), + { YieldOrReturnKeyword = (5,4--5,10) }), (3,4--5,13), + { LetOrUseBangKeyword = (3,4--3,8) + EqualsRange = Some (3,11--3,12) }), (2,5--6,1)), + (2,0--6,1)), (2,0--6,1))], PreXmlDocEmpty, [], None, (2,0--6,1), + { LeadingKeyword = None })], (true, true), { ConditionalDirectives = [] CodeComments = [] }, set [])) diff --git a/tests/service/data/SyntaxTree/Expression/WhileBang 01.fs.bsl b/tests/service/data/SyntaxTree/Expression/WhileBang 01.fs.bsl index 936525524f3..deb6d27aa83 100644 --- a/tests/service/data/SyntaxTree/Expression/WhileBang 01.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/WhileBang 01.fs.bsl @@ -13,8 +13,9 @@ ImplFile (false, YieldOrReturn ((false, true), Const (Bool true, (3,22--3,26)), - (3,15--3,26)), (3,13--3,28)), (3,7--3,28)), - Const (Int32 2, (4,4--4,5)), (3,0--4,5)), (3,0--4,5)); + (3,15--3,26), { YieldOrReturnKeyword = (3,15--3,21) }), + (3,13--3,28)), (3,7--3,28)), Const (Int32 2, (4,4--4,5)), + (3,0--4,5)), (3,0--4,5)); Expr (Const (Int32 3, (6,0--6,1)), (6,0--6,1))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--6,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), diff --git a/tests/service/data/SyntaxTree/Expression/WhileBang 02.fs.bsl b/tests/service/data/SyntaxTree/Expression/WhileBang 02.fs.bsl index b12f9b0df18..52eaca7bfdc 100644 --- a/tests/service/data/SyntaxTree/Expression/WhileBang 02.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/WhileBang 02.fs.bsl @@ -13,8 +13,9 @@ ImplFile (false, YieldOrReturn ((false, true), Const (Bool true, (3,22--3,26)), - (3,15--3,26)), (3,13--3,28)), (3,7--3,28)), - Const (Int32 2, (4,4--4,5)), (3,0--5,4)), (3,0--5,4)); + (3,15--3,26), { YieldOrReturnKeyword = (3,15--3,21) }), + (3,13--3,28)), (3,7--3,28)), Const (Int32 2, (4,4--4,5)), + (3,0--5,4)), (3,0--5,4)); Expr (Const (Int32 3, (7,0--7,1)), (7,0--7,1))], PreXmlDoc ((1,0), FSharp.Compiler.Xml.XmlDocCollector), [], None, (1,0--7,1), { LeadingKeyword = Module (1,0--1,6) })], (true, true), diff --git a/tests/service/data/SyntaxTree/Expression/WhileBang 03.fs.bsl b/tests/service/data/SyntaxTree/Expression/WhileBang 03.fs.bsl index a5793465b34..437c23a2c6b 100644 --- a/tests/service/data/SyntaxTree/Expression/WhileBang 03.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/WhileBang 03.fs.bsl @@ -20,7 +20,9 @@ ImplFile (false, YieldOrReturn ((false, true), Const (Bool true, (4,26--4,30)), - (4,19--4,30)), (4,17--4,32)), (4,11--4,32)), + (4,19--4,30), + { YieldOrReturnKeyword = (4,19--4,25) }), + (4,17--4,32)), (4,11--4,32)), ArbitraryAfterError ("whileBody1", (6,0--6,1)), (4,4--4,35)), (3,4--3,5), Yes (3,0--4,35), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None diff --git a/tests/service/data/SyntaxTree/Expression/WhileBang 04.fs.bsl b/tests/service/data/SyntaxTree/Expression/WhileBang 04.fs.bsl index 863c8aaabfe..70db990cb0e 100644 --- a/tests/service/data/SyntaxTree/Expression/WhileBang 04.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/WhileBang 04.fs.bsl @@ -20,7 +20,9 @@ ImplFile (false, YieldOrReturn ((false, true), Const (Bool true, (4,26--4,30)), - (4,19--4,30)), (4,17--4,32)), (4,11--4,32)), + (4,19--4,30), + { YieldOrReturnKeyword = (4,19--4,25) }), + (4,17--4,32)), (4,11--4,32)), ArbitraryAfterError ("whileBody1", (5,0--5,0)), (4,4--4,35)), (3,4--3,5), Yes (3,0--4,35), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None diff --git a/tests/service/data/SyntaxTree/Expression/WhileBang 05.fs.bsl b/tests/service/data/SyntaxTree/Expression/WhileBang 05.fs.bsl index e2f5875ef4b..a8b4a21543b 100644 --- a/tests/service/data/SyntaxTree/Expression/WhileBang 05.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/WhileBang 05.fs.bsl @@ -20,7 +20,9 @@ ImplFile (false, YieldOrReturn ((false, true), Const (Bool true, (4,26--4,30)), - (4,19--4,30)), (4,17--4,32)), (4,11--4,32)), + (4,19--4,30), + { YieldOrReturnKeyword = (4,19--4,25) }), + (4,17--4,32)), (4,11--4,32)), Const (Int32 2, (5,8--5,9)), (4,4--5,9)), (3,4--3,5), Yes (3,0--5,9), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None diff --git a/tests/service/data/SyntaxTree/Expression/WhileBang 06.fs.bsl b/tests/service/data/SyntaxTree/Expression/WhileBang 06.fs.bsl index 3c8ef1cbebf..df87ceb6a9d 100644 --- a/tests/service/data/SyntaxTree/Expression/WhileBang 06.fs.bsl +++ b/tests/service/data/SyntaxTree/Expression/WhileBang 06.fs.bsl @@ -20,7 +20,9 @@ ImplFile (false, YieldOrReturn ((false, true), Const (Bool true, (4,26--4,30)), - (4,19--4,30)), (4,17--4,32)), (4,11--4,32)), + (4,19--4,30), + { YieldOrReturnKeyword = (4,19--4,25) }), + (4,17--4,32)), (4,11--4,32)), Const (Int32 2, (5,4--5,5)), (4,4--5,5)), (3,4--3,5), Yes (3,0--5,5), { LeadingKeyword = Let (3,0--3,3) InlineKeyword = None diff --git a/tests/service/data/Test1.fsproj b/tests/service/data/Test1.fsproj deleted file mode 100644 index 11917790084..00000000000 --- a/tests/service/data/Test1.fsproj +++ /dev/null @@ -1,61 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {116cc2f9-f987-4b3d-915a-34cac04a73da} - Library - Test1 - Test1 - bin\$(Configuration)\ - False - 11 - - - True - full - False - False - DEBUG;TRACE - 3 - x86 - bin\Debug\Test1.xml - - - pdbonly - True - True - TRACE - 3 - x86 - bin\Release\Test1.xml - False - - - - ..\..\..\packages\Microsoft.Portable.FSharp.Core.10.1.0\lib\profiles\net40\FSharp.Core.dll - false - - - - - - - - - - - - - - - ..\..\..\packages\NUnit\lib\nunit.framework.dll - True - True - - - - - \ No newline at end of file diff --git a/tests/service/data/Test2.fsproj b/tests/service/data/Test2.fsproj deleted file mode 100644 index fff033794e4..00000000000 --- a/tests/service/data/Test2.fsproj +++ /dev/null @@ -1,68 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {116cc2f9-f987-4b3d-915a-34cac04a73db} - ..\..\..\$(Configuration)\net40\bin - Exe - Test2 - Test2 - Test2 - False - 11 - - - True - full - False - False - DEBUG;TRACE - 3 - x86 - bin\Debug\Test2.xml - - - pdbonly - True - True - TRACE - 3 - x86 - bin\Release\Test2.xml - False - - - - ..\..\..\packages\Microsoft.Portable.FSharp.Core.10.1.0\lib\profiles\net40\FSharp.Core.dll - false - - - - - - - - - - - - {116cc2f9-f987-4b3d-915a-34cac04a73da} - Test1 - - - - - - - - ..\..\..\packages\NUnit\lib\nunit.framework.dll - True - True - - - - - \ No newline at end of file diff --git a/tests/service/data/Test3.fsproj b/tests/service/data/Test3.fsproj deleted file mode 100644 index 5ea53f2766c..00000000000 --- a/tests/service/data/Test3.fsproj +++ /dev/null @@ -1,62 +0,0 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {116cc2f9-f987-4b3d-915a-34cac04a73db} - ..\..\..\$(Configuration)\net40\bin - Exe - Test2 - Test2 - Test2 - False - 11 - - - True - full - False - False - DEBUG;TRACE - 3 - x86 - bin\Debug\Test2.xml - - - pdbonly - True - True - TRACE - 3 - x86 - bin\Release\Test2.xml - False - - - - ..\..\..\packages\Microsoft.Portable.FSharp.Core.10.1.0\lib\profiles\net40\FSharp.Core.dll - false - - - - - - - - - - - - - - - ..\..\..\packages\NUnit\lib\nunit.framework.dll - True - True - - - - - \ No newline at end of file diff --git a/tests/service/data/ToolsVersion12.fsproj b/tests/service/data/ToolsVersion12.fsproj deleted file mode 100644 index 96156711bc4..00000000000 --- a/tests/service/data/ToolsVersion12.fsproj +++ /dev/null @@ -1,58 +0,0 @@ - - - - - Debug - AnyCPU - 2.0 - 00000000-0000-0000-0000-000000000002 - Exe - Main - Main - v4.7.2 - Main - - - true - full - false - false - bin - DEBUG;TRACE - 3 - AnyCPU - false - - - pdbonly - true - true - bin - TRACE - 3 - AnyCPU - false - - - - - - - - - - 11 - - - - - - - ..\..\..\packages\NUnit\lib\nunit.framework.dll - True - True - - - - - \ No newline at end of file diff --git a/tests/service/data/testscript.fsx b/tests/service/data/testscript.fsx deleted file mode 100644 index 3b0c82647f2..00000000000 --- a/tests/service/data/testscript.fsx +++ /dev/null @@ -1 +0,0 @@ -let x = 1 \ No newline at end of file diff --git a/vsintegration/src/FSharp.Editor/CodeFixes/RemoveReturnOrYield.fs b/vsintegration/src/FSharp.Editor/CodeFixes/RemoveReturnOrYield.fs index cbc22219a12..ec376552709 100644 --- a/vsintegration/src/FSharp.Editor/CodeFixes/RemoveReturnOrYield.fs +++ b/vsintegration/src/FSharp.Editor/CodeFixes/RemoveReturnOrYield.fs @@ -30,7 +30,11 @@ type internal RemoveReturnOrYieldCodeFixProvider [] () = parseResults.TryRangeOfExprInYieldOrReturn errorRange.Start |> ValueOption.ofOption |> ValueOption.map (fun exprRange -> RoslynHelpers.FSharpRangeToTextSpan(sourceText, exprRange)) - |> ValueOption.map (fun exprSpan -> [ TextChange(context.Span, sourceText.GetSubText(exprSpan).ToString()) ]) + |> ValueOption.map (fun exprSpan -> + [ + // meaning: keyword + spacing before the expression + TextChange(TextSpan(context.Span.Start, exprSpan.Start - context.Span.Start), "") + ]) |> ValueOption.map (fun changes -> let title = let text = sourceText.GetSubText(context.Span).ToString() diff --git a/vsintegration/src/FSharp.Editor/FSharp.Editor.resx b/vsintegration/src/FSharp.Editor/FSharp.Editor.resx index 6678a2d98e3..26b96dcc405 100644 --- a/vsintegration/src/FSharp.Editor/FSharp.Editor.resx +++ b/vsintegration/src/FSharp.Editor/FSharp.Editor.resx @@ -212,8 +212,7 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) +Enable fast find references & rename (restart required) Advanced diff --git a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs index 0e8e5ec4912..18cb516b6a9 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs @@ -117,8 +117,6 @@ type internal FSharpWorkspaceServiceFactory [] let enableLiveBuffers = editorOptions.Advanced.IsUseLiveBuffersEnabled - let useSyntaxTreeCache = editorOptions.LanguageServicePerformance.UseSyntaxTreeCache - let enableInMemoryCrossProjectReferences = editorOptions.LanguageServicePerformance.EnableInMemoryCrossProjectReferences @@ -158,7 +156,6 @@ type internal FSharpWorkspaceServiceFactory [] TelemetryEvents.LanguageServiceStarted, [| nameof enableLiveBuffers, enableLiveBuffers - nameof useSyntaxTreeCache, useSyntaxTreeCache nameof enableParallelReferenceResolution, enableParallelReferenceResolution nameof enableInMemoryCrossProjectReferences, enableInMemoryCrossProjectReferences nameof enableFastFindReferences, enableFastFindReferences @@ -199,7 +196,6 @@ type internal FSharpWorkspaceServiceFactory [] })) else DocumentSource.FileSystem), - useSyntaxTreeCache = useSyntaxTreeCache, useTransparentCompiler = useTransparentCompiler ) diff --git a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs index e178610a614..ef67e6482ba 100644 --- a/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs +++ b/vsintegration/src/FSharp.Editor/Options/EditorOptions.fs @@ -89,7 +89,6 @@ type LanguageServicePerformanceOptions = EnableParallelReferenceResolution: bool EnableFastFindReferencesAndRename: bool EnablePartialTypeChecking: bool - UseSyntaxTreeCache: bool KeepAllBackgroundResolutions: bool KeepAllBackgroundSymbolUses: bool EnableBackgroundItemKeyStoreAndSemanticClassification: bool @@ -104,7 +103,6 @@ type LanguageServicePerformanceOptions = EnableParallelReferenceResolution = false EnableFastFindReferencesAndRename = true EnablePartialTypeChecking = true - UseSyntaxTreeCache = FSharpExperimentalFeaturesEnabledAutomatically KeepAllBackgroundResolutions = false KeepAllBackgroundSymbolUses = false EnableBackgroundItemKeyStoreAndSemanticClassification = true diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf index a3f8a6866da..421cc037111 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.cs.xlf @@ -174,9 +174,8 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) - Možnosti výkonu pro ukládání do mezipaměti a projekt F#; +Enable fast find references & rename (restart required) + Možnosti výkonu pro ukládání do mezipaměti a projekt F#; Povolit odkazy mezi projekty v paměti; Povolit_částečnou_kontrolu_typu; Možnosti výkonu pro IntelliSense; diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf index 3e4406c116a..ff2a415b3a0 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.de.xlf @@ -174,9 +174,8 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) - Optionen zur F#-Projekt- und Cacheleistung; +Enable fast find references & rename (restart required) + Optionen zur F#-Projekt- und Cacheleistung; Proj_ektübergreifende Verweise im Arbeitsspeicher aktivieren; Aktivieren der partiellen Typüberprüfung; Optionen zur IntelliSense-Leistung; diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf index c5bfa64a6a9..5df84b54acc 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.es.xlf @@ -174,9 +174,8 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) - Opciones de rendimiento de almacenamiento en caché y proyectos de F#; +Enable fast find references & rename (restart required) + Opciones de rendimiento de almacenamiento en caché y proyectos de F#; Habilitar referencias entre proyectos en memoria; Enable_partial_type_checking; Opciones de rendimiento de IntelliSense; diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf index c005861d9d2..efe15d65037 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.fr.xlf @@ -174,9 +174,8 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) - Options relatives aux performances de la mise en cache et des projets F#; +Enable fast find references & rename (restart required) + Options relatives aux performances de la mise en cache et des projets F#; Activer les références de projet croisé en mémoire; Enable_partial_type_checking; Options relatives aux performances d’IntelliSense; diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf index eb46a794f9a..ca32c029946 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.it.xlf @@ -174,9 +174,8 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) - Opzioni per le prestazioni di memorizzazione nella cache e progetti F#; +Enable fast find references & rename (restart required) + Opzioni per le prestazioni di memorizzazione nella cache e progetti F#; _Abilita i riferimenti tra progetti in memoria; Abilita il controllo parziale dei tipi; Opzioni per le prestazioni IntelliSense; diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf index 4f7b8bd5bb6..44ca609e1cd 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ja.xlf @@ -174,9 +174,8 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) - F# プロジェクトとキャッシュのパフォーマンス オプション; +Enable fast find references & rename (restart required) + F# プロジェクトとキャッシュのパフォーマンス オプション; メモリ内のプロジェクト間参照を有効にする; Enable_partial_type_checking; IntelliSense のパフォーマンス オプション; diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf index 79baefda419..66cfbeed575 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ko.xlf @@ -174,9 +174,8 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) - F# 프로젝트 및 캐싱 성능 옵션; +Enable fast find references & rename (restart required) + F# 프로젝트 및 캐싱 성능 옵션; 메모리 내 크로스 프로젝트 참조 사용; Enable_partial_type_checking; IntelliSense 성능 옵션; diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf index 6d450552e60..1675887bd6d 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pl.xlf @@ -174,9 +174,8 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) - Opcje wydajności projektu i buforowania języka F#; +Enable fast find references & rename (restart required) + Opcje wydajności projektu i buforowania języka F#; Włącz odwołania między projektami w pamięci; Włącz_częściową_kontrolę_typu; Opcje wydajności funkcji IntelliSense; diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf index 7c8333a532d..f6770d970de 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.pt-BR.xlf @@ -174,9 +174,8 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) - Projeto em F# e opções de desempenho em cache; +Enable fast find references & rename (restart required) + Projeto em F# e opções de desempenho em cache; _Habilitar referências de projeto cruzado na memória; Habilitar verificação parcial de tipo; Opções de desempenho do IntelliSense; diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf index d08337f4b20..bc8554237a8 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.ru.xlf @@ -174,9 +174,8 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) - Параметры производительности проекта и кэширования F#; +Enable fast find references & rename (restart required) + Параметры производительности проекта и кэширования F#; Включить перекрестные ссылки проектов в памяти; Enable_partial_type_checking; Параметры производительности IntelliSense; diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf index f5b0b5efe44..cf2198ba7d3 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.tr.xlf @@ -174,9 +174,8 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) - F# Proje ve Önbelleğe Alma Performansı Seçenekleri; +Enable fast find references & rename (restart required) + F# Proje ve Önbelleğe Alma Performansı Seçenekleri; Bellek içi çapraz proje başvurularını etkinleştir; Kısmi_tür_denetlemeyi_etkinleştir; IntelliSense Performans Seçenekleri; diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf index 0ef2ccbe69e..16a89acc021 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hans.xlf @@ -174,9 +174,8 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) - F# 项目和缓存性能选项; +Enable fast find references & rename (restart required) + F# 项目和缓存性能选项; 启用内存中跨项目引用; Enable_partial_type_checking; IntelliSense 性能选项; diff --git a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf index c415e1e0f18..932d4de3e61 100644 --- a/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf +++ b/vsintegration/src/FSharp.Editor/xlf/FSharp.Editor.zh-Hant.xlf @@ -174,9 +174,8 @@ Time until stale results are used (in milliseconds); Parallelization (requires restart); Enable parallel type checking with signature files; Enable parallel reference resolution; -Enable fast find references & rename (restart required); -Cache parsing results (experimental) - F# 專案與快取效能選項; +Enable fast find references & rename (restart required) + F# 專案與快取效能選項; 允許記憶體內跨專案參考; 啟用部分型別檢查; IntelliSense 效能選項; diff --git a/vsintegration/src/FSharp.UIResources/AdvancedOptionsControl.xaml b/vsintegration/src/FSharp.UIResources/AdvancedOptionsControl.xaml index 7374280f296..9ca2756d7d9 100644 --- a/vsintegration/src/FSharp.UIResources/AdvancedOptionsControl.xaml +++ b/vsintegration/src/FSharp.UIResources/AdvancedOptionsControl.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Microsoft.VisualStudio.FSharp.UIResources" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="400"> + d:DesignHeight="600" d:DesignWidth="400"> diff --git a/vsintegration/src/FSharp.UIResources/LanguageServicePerformanceOptionControl.xaml b/vsintegration/src/FSharp.UIResources/LanguageServicePerformanceOptionControl.xaml index a5c5f1c0b6f..8671fe16434 100644 --- a/vsintegration/src/FSharp.UIResources/LanguageServicePerformanceOptionControl.xaml +++ b/vsintegration/src/FSharp.UIResources/LanguageServicePerformanceOptionControl.xaml @@ -6,7 +6,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Microsoft.VisualStudio.FSharp.UIResources" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="400"> + d:DesignHeight="600" d:DesignWidth="400"> @@ -48,9 +48,6 @@ - diff --git a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs index 816ef8529ab..e0244a62086 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.Designer.cs +++ b/vsintegration/src/FSharp.UIResources/Strings.Designer.cs @@ -636,15 +636,6 @@ public static string Unused_opens_code_fix { } } - /// - /// Looks up a localized string similar to Cache parsing results (experimental). - /// - public static string Use_syntax_tree_cache { - get { - return ResourceManager.GetString("Use_syntax_tree_cache", resourceCulture); - } - } - /// /// Looks up a localized string similar to Use Transparent Compiler (restart required). /// diff --git a/vsintegration/src/FSharp.UIResources/Strings.resx b/vsintegration/src/FSharp.UIResources/Strings.resx index 0320ddffdec..61b3bab1750 100644 --- a/vsintegration/src/FSharp.UIResources/Strings.resx +++ b/vsintegration/src/FSharp.UIResources/Strings.resx @@ -261,9 +261,6 @@ Send additional performance telemetry - - Cache parsing results (experimental) - Enable partial type checking diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf index 95dc810a26a..0c938e3f447 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.cs.xlf @@ -327,11 +327,6 @@ Použít transparentní kompilátor (vyžaduje se restart) - - Cache parsing results (experimental) - Výsledky analýzy mezipaměti (experimentální) - - \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf index 6e201a60236..99bac691cac 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.de.xlf @@ -327,11 +327,6 @@ Transparenten Compiler verwenden (Neustart erforderlich) - - Cache parsing results (experimental) - Cacheanalyseergebnisse (experimentell) - - \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf index 937fea2e341..5ae03505500 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.es.xlf @@ -327,11 +327,6 @@ Uso del compilador transparente (es necesario reiniciar) - - Cache parsing results (experimental) - Resultados del análisis de la caché (experimental) - - \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf index dd4be9eef28..283e9d5d0f8 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.fr.xlf @@ -327,11 +327,6 @@ Utiliser Transparent Compiler (redémarrage requis) - - Cache parsing results (experimental) - Résultats de l'analyse du cache (expérimental) - - \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf index e62949f4fdd..9c534e8f8dd 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.it.xlf @@ -327,11 +327,6 @@ Usa il compilatore Transparent (riavvio necessario) - - Cache parsing results (experimental) - Risultati dell'analisi della cache (sperimentale) - - \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf index 69f5861f1a2..0e0bb91c628 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ja.xlf @@ -327,11 +327,6 @@ Transparent Compiler を使用する (再起動が必要) - - Cache parsing results (experimental) - キャッシュ解析の結果 (試験段階) - - \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf index 74e14a586c5..0d92ba2bb3a 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ko.xlf @@ -327,11 +327,6 @@ 투명한 컴파일러 사용(다시 시작해야 함) - - Cache parsing results (experimental) - 캐시 구문 분석 결과(실험적) - - \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf index e2da85eb9c9..16ab9bfc3a1 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pl.xlf @@ -327,11 +327,6 @@ Użyj kompilatora przezroczystego (wymagane ponowne uruchomienie) - - Cache parsing results (experimental) - Wyniki analizy pamięci podręcznej (eksperymentalne) - - \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf index 21ff767429b..82976646315 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.pt-BR.xlf @@ -327,11 +327,6 @@ Use o Compilador Transparente (é necessário reiniciar) - - Cache parsing results (experimental) - Resultados da análise de cache (experimental) - - \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf index 861bdc7d935..737584669c1 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.ru.xlf @@ -327,11 +327,6 @@ Использовать прозрачный компилятор (требуется перезагрузка) - - Cache parsing results (experimental) - Результаты анализа кэша (экспериментальная функция) - - \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf index b94552de1fe..d6763de0ed5 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.tr.xlf @@ -327,11 +327,6 @@ Saydam Derleyiciyi kullan (yeniden başlatma gereklidir) - - Cache parsing results (experimental) - Ayrıştırma sonuçlarını önbelleğe al (deneysel) - - \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf index 662eee779b1..917893a6b9c 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hans.xlf @@ -327,11 +327,6 @@ 使用透明编译器(需要重启) - - Cache parsing results (experimental) - 缓存分析结果(实验性) - - \ No newline at end of file diff --git a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf index 569cbc1694a..0eeef704704 100644 --- a/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf +++ b/vsintegration/src/FSharp.UIResources/xlf/Strings.zh-Hant.xlf @@ -327,11 +327,6 @@ 使用透明編譯器 (需要重新啟動) - - Cache parsing results (experimental) - 快取剖析結果 (實驗性) - - \ No newline at end of file diff --git a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveReturnOrYieldTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveReturnOrYieldTests.fs index 23d5908d557..a93bd4f6a3a 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveReturnOrYieldTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveReturnOrYieldTests.fs @@ -102,3 +102,50 @@ let answer question = let actual = codeFix |> tryFix code Auto Assert.Equal(expected, actual) + +[] +let ``Handles spaces`` () = + let code = + """ +let answer question = + yield 42 +""" + + let expected = + Some + { + Message = "Remove 'yield'" + FixedCode = + """ +let answer question = + 42 +""" + } + + let actual = codeFix |> tryFix code Auto + + Assert.Equal(expected, actual) + +[] +let ``Handles new lines`` () = + let code = + """ +let answer question = + return! + 42 +""" + + let expected = + Some + { + Message = "Remove 'return!'" + FixedCode = + """ +let answer question = + 42 +""" + } + + let actual = codeFix |> tryFix code Auto + + Assert.Equal(expected, actual) diff --git a/vsintegration/tests/Salsa/SalsaUtils.fs b/vsintegration/tests/Salsa/SalsaUtils.fs index 1e6caca05d9..4b00dcc6b89 100644 --- a/vsintegration/tests/Salsa/SalsaUtils.fs +++ b/vsintegration/tests/Salsa/SalsaUtils.fs @@ -9,7 +9,7 @@ open Microsoft.VisualStudio.FSharp.LanguageService open Microsoft.VisualStudio.TextManager.Interop open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.EditorServices -open NUnit.Framework +open Xunit open Salsa.Salsa @@ -208,7 +208,7 @@ module internal VsOpsUtils = 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.IsTrue(Array.isEmpty completions, "Expected empty completion list but got some items") + Assert.True(Array.isEmpty completions, "Expected empty completion list but got some items") /// Verify that the given completion list contains a member with the given name let AssertCompListContains(completions : CompletionItem[], membername) = @@ -263,7 +263,7 @@ module internal VsOpsUtils = // 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 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 + if markerLines > 1 then Assert.Fail(sprintf "Found marker [%s] multiple times in source file." marker) // Replace marker with "." let replaceMarker = @@ -310,11 +310,11 @@ module internal VsOpsUtils = -> 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? - Assert.AreEqual (toFind, id) + Assert.Equal (toFind, id) // Do the lines of code match what we expect? // - Eliminate white space to eliminate trivial errors // - +1 to adjust for 1-index line numbers - Assert.AreEqual ( + Assert.Equal ( expLine.Trim(), (span.iStartLine |> (+) 1 |> GetLineNumber (OpenFileViaOpenFile(file.VS, actFile))).Trim () ) @@ -327,8 +327,8 @@ module internal VsOpsUtils = // Error cases | (Some (x,_), None) - -> Assert.Fail <| sprintf "Expected to find the definition of '%s' but GotoDefn failed." x + -> Assert.Fail(sprintf "Expected to find the definition of '%s' but GotoDefn failed." x) | (None, Some (_,file)) - -> Assert.Fail <| sprintf "Expected GotoDefn to fail, but it went to a definition in file %s" file + -> Assert.Fail(sprintf "Expected GotoDefn to fail, but it went to a definition in file %s" file) diff --git a/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj b/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj index 6b060d58780..353e08336a6 100644 --- a/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj +++ b/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj @@ -66,7 +66,7 @@ - + diff --git a/vsintegration/tests/Salsa/salsa.fs b/vsintegration/tests/Salsa/salsa.fs index ea12fea391f..6ac626f9fcb 100644 --- a/vsintegration/tests/Salsa/salsa.fs +++ b/vsintegration/tests/Salsa/salsa.fs @@ -1476,7 +1476,7 @@ module internal Salsa = vs.LanguageService <- ls vs :> VisualStudio with e -> - // Need to just print the error because NUnit has not fully initialized the exception at this point. + // 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() diff --git a/vsintegration/tests/UnitTests/AssemblyResolver.fs b/vsintegration/tests/UnitTests/AssemblyResolver.fs index 65e717f2618..aab95cc46fc 100644 --- a/vsintegration/tests/UnitTests/AssemblyResolver.fs +++ b/vsintegration/tests/UnitTests/AssemblyResolver.fs @@ -1,6 +1,5 @@ namespace Microsoft.VisualStudio.FSharp -open NUnit.Framework open System open System.IO open System.Reflection @@ -46,9 +45,3 @@ module AssemblyResolver = match found() with | None -> Unchecked.defaultof | Some name -> Assembly.Load(name) ) - -[] -type public AssemblyResolverTestFixture () = - - [] - member public _.Init () = AssemblyResolver.addResolver () diff --git a/vsintegration/tests/UnitTests/DocCommentIdParserTests.fs b/vsintegration/tests/UnitTests/DocCommentIdParserTests.fs index b9cc39f66dc..a20cc3381a9 100644 --- a/vsintegration/tests/UnitTests/DocCommentIdParserTests.fs +++ b/vsintegration/tests/UnitTests/DocCommentIdParserTests.fs @@ -1,14 +1,11 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -[] + module Tests.ServiceAnalysis.DocCommentIdParser -open NUnit.Framework +open Xunit open Microsoft.VisualStudio.FSharp.Editor - - - -[] +[] let ``Test DocCommentId parser``() = let testData = dict [ "T:N.X.Nested", DocCommentId.Type ["N"; "X"; "Nested"]; diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs index be79eb48a9f..cb08d34ae88 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs @@ -7,7 +7,7 @@ open Microsoft.VisualStudio.FSharp.LanguageService open Salsa.Salsa open Salsa.VsMocks open Salsa.VsOpsUtils -open NUnit.Framework +open Xunit open UnitTests.TestLib.Salsa open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService @@ -25,7 +25,6 @@ module StandardSettings = let AC x y = AutoCompleteExpected(x,y) let DC x y = DotCompleteExpected(x,y) -[][] type UsingMSBuild() as this = inherit LanguageServiceBaseTests() @@ -212,11 +211,10 @@ type UsingMSBuild() as this = fileContents, marker, (fun completions -> - Assert.AreNotEqual(0,completions.Length) + Assert.NotEqual(0,completions.Length) let found = completions |> Array.exists(fun (CompletionItem(s,_,_,_,_)) -> s = expected) if not(found) then - printfn "Expected: %A to contain %s" completions expected - Assert.Fail() + failwithf "Expected: %A to contain %s" completions expected ), ?addtlRefAssy = addtlRefAssy ) @@ -232,7 +230,7 @@ type UsingMSBuild() as this = let (_, _, file) = this.CreateSingleFileProject(fileContents) MoveCursorToEndOfMarker(file,marker) let completions = AutoCompleteAtCursor file - Assert.AreNotEqual(0,completions.Length) + Assert.NotEqual(0,completions.Length) member public this.TestCompletionNotShowingWhenFastUpdate (firstSrc : string list) secondSrc marker = let (_, _, file) = this.CreateSingleFileProject(firstSrc) @@ -270,7 +268,7 @@ type UsingMSBuild() as this = let completions = DotCompletionAtStartOfMarker file marker AssertCompListIsEmpty(completions) - [] + [] member this.``AutoCompletion.ObjectMethods``() = let code = [ @@ -315,7 +313,7 @@ type UsingMSBuild() as this = test "DU_3." "DU_3." ["ExtensionPropObj"; "ExtensionMethodObj"; "Equals"] ["GetHashCode"] // no gethashcode, has equals defined in DU3 type test "DU_4." "DU_4." ["ExtensionPropObj"; "ExtensionMethodObj"; "GetHashCode"] ["Equals"] // no equals, has gethashcode defined in DU4 type - [] + [] member this.``AutoCompletion.BeforeThis``() = let code = [ @@ -348,9 +346,7 @@ type UsingMSBuild() as this = AssertCtrlSpaceCompletionListIsEmptyNoCoffeeBreak c "this." AssertAutoCompleteCompletionListIsEmptyNoCoffeeBreak c "this." - [] - [] - [] + [] member this.``TypeProvider.VisibilityChecksForGeneratedTypes``() = let extraRefs = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")] let check = DoWithAutoCompleteUsingExtraRefs extraRefs None true SourceFileKind.FS BackgroundRequestReason.MemberSelect @@ -385,49 +381,48 @@ type UsingMSBuild() as this = AssertCompListDoesNotContainAny(ci, ["f"; "ProtectedProp"; "ProtectedM"; "PrivateProp"; "PrivateM"]) - [] member public this.``AdjacentToDot_01``() = testAutoCompleteAdjacentToDot ".." - [] member public this.``AdjacentToDot_02``() = testAutoCompleteAdjacentToDot ".<" - [] member public this.``AdjacentToDot_03``() = testAutoCompleteAdjacentToDot ".>" - [] member public this.``AdjacentToDot_04``() = testAutoCompleteAdjacentToDot ".=" - [] member public this.``AdjacentToDot_05``() = testAutoCompleteAdjacentToDot ".!=" - [] member public this.``AdjacentToDot_06``() = testAutoCompleteAdjacentToDot ".$" - [] member public this.``AdjacentToDot_07``() = testAutoCompleteAdjacentToDot ".[]" - [] member public this.``AdjacentToDot_08``() = testAutoCompleteAdjacentToDot ".[]<-" - [] member public this.``AdjacentToDot_09``() = testAutoCompleteAdjacentToDot ".[,]<-" - [] member public this.``AdjacentToDot_10``() = testAutoCompleteAdjacentToDot ".[,,]<-" - [] member public this.``AdjacentToDot_11``() = testAutoCompleteAdjacentToDot ".[,,,]<-" - [] member public this.``AdjacentToDot_12``() = testAutoCompleteAdjacentToDot ".[,,,]" - [] member public this.``AdjacentToDot_13``() = testAutoCompleteAdjacentToDot ".[,,]" - [] member public this.``AdjacentToDot_14``() = testAutoCompleteAdjacentToDot ".[,]" - [] member public this.``AdjacentToDot_15``() = testAutoCompleteAdjacentToDot ".[..]" - [] member public this.``AdjacentToDot_16``() = testAutoCompleteAdjacentToDot ".[..,..]" - [] member public this.``AdjacentToDot_17``() = testAutoCompleteAdjacentToDot ".[..,..,..]" - [] member public this.``AdjacentToDot_18``() = testAutoCompleteAdjacentToDot ".[..,..,..,..]" - [] member public this.``AdjacentToDot_19``() = testAutoCompleteAdjacentToDot ".()" - [] member public this.``AdjacentToDot_20``() = testAutoCompleteAdjacentToDot ".()<-" - [] member public this.``AdjacentToDot_02_Negative``() = testAutoCompleteAdjacentToDotNegative ".<" - [] member public this.``AdjacentToDot_03_Negative``() = testAutoCompleteAdjacentToDotNegative ".>" - [] member public this.``AdjacentToDot_04_Negative``() = testAutoCompleteAdjacentToDotNegative ".=" - [] member public this.``AdjacentToDot_05_Negative``() = testAutoCompleteAdjacentToDotNegative ".!=" - [] member public this.``AdjacentToDot_06_Negative``() = testAutoCompleteAdjacentToDotNegative ".$" - [] member public this.``AdjacentToDot_07_Negative``() = testAutoCompleteAdjacentToDotNegative ".[]" - [] member public this.``AdjacentToDot_08_Negative``() = testAutoCompleteAdjacentToDotNegative ".[]<-" - [] member public this.``AdjacentToDot_09_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,]<-" - [] member public this.``AdjacentToDot_10_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,]<-" - [] member public this.``AdjacentToDot_11_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,,]<-" - [] member public this.``AdjacentToDot_12_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,,]" - [] member public this.``AdjacentToDot_13_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,]" - [] member public this.``AdjacentToDot_14_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,]" - [] member public this.``AdjacentToDot_15_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..]" - [] member public this.``AdjacentToDot_16_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..,..]" - [] member public this.``AdjacentToDot_17_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..,..,..]" - [] member public this.``AdjacentToDot_18_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..,..,..,..]" - [] member public this.``AdjacentToDot_19_Negative``() = testAutoCompleteAdjacentToDotNegative ".()" - [] member public this.``AdjacentToDot_20_Negative``() = testAutoCompleteAdjacentToDotNegative ".()<-" - [] member public this.``AdjacentToDot_21_Negative``() = testAutoCompleteAdjacentToDotNegative ".+." - - [] - [] + [] member public this.``AdjacentToDot_01``() = testAutoCompleteAdjacentToDot ".." + [] member public this.``AdjacentToDot_02``() = testAutoCompleteAdjacentToDot ".<" + [] member public this.``AdjacentToDot_03``() = testAutoCompleteAdjacentToDot ".>" + [] member public this.``AdjacentToDot_04``() = testAutoCompleteAdjacentToDot ".=" + [] member public this.``AdjacentToDot_05``() = testAutoCompleteAdjacentToDot ".!=" + [] member public this.``AdjacentToDot_06``() = testAutoCompleteAdjacentToDot ".$" + [] member public this.``AdjacentToDot_07``() = testAutoCompleteAdjacentToDot ".[]" + [] member public this.``AdjacentToDot_08``() = testAutoCompleteAdjacentToDot ".[]<-" + [] member public this.``AdjacentToDot_09``() = testAutoCompleteAdjacentToDot ".[,]<-" + [] member public this.``AdjacentToDot_10``() = testAutoCompleteAdjacentToDot ".[,,]<-" + [] member public this.``AdjacentToDot_11``() = testAutoCompleteAdjacentToDot ".[,,,]<-" + [] member public this.``AdjacentToDot_12``() = testAutoCompleteAdjacentToDot ".[,,,]" + [] member public this.``AdjacentToDot_13``() = testAutoCompleteAdjacentToDot ".[,,]" + [] member public this.``AdjacentToDot_14``() = testAutoCompleteAdjacentToDot ".[,]" + [] member public this.``AdjacentToDot_15``() = testAutoCompleteAdjacentToDot ".[..]" + [] member public this.``AdjacentToDot_16``() = testAutoCompleteAdjacentToDot ".[..,..]" + [] member public this.``AdjacentToDot_17``() = testAutoCompleteAdjacentToDot ".[..,..,..]" + [] member public this.``AdjacentToDot_18``() = testAutoCompleteAdjacentToDot ".[..,..,..,..]" + [] member public this.``AdjacentToDot_19``() = testAutoCompleteAdjacentToDot ".()" + [] member public this.``AdjacentToDot_20``() = testAutoCompleteAdjacentToDot ".()<-" + [] member public this.``AdjacentToDot_02_Negative``() = testAutoCompleteAdjacentToDotNegative ".<" + [] member public this.``AdjacentToDot_03_Negative``() = testAutoCompleteAdjacentToDotNegative ".>" + [] member public this.``AdjacentToDot_04_Negative``() = testAutoCompleteAdjacentToDotNegative ".=" + [] member public this.``AdjacentToDot_05_Negative``() = testAutoCompleteAdjacentToDotNegative ".!=" + [] member public this.``AdjacentToDot_06_Negative``() = testAutoCompleteAdjacentToDotNegative ".$" + [] member public this.``AdjacentToDot_07_Negative``() = testAutoCompleteAdjacentToDotNegative ".[]" + [] member public this.``AdjacentToDot_08_Negative``() = testAutoCompleteAdjacentToDotNegative ".[]<-" + [] member public this.``AdjacentToDot_09_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,]<-" + [] member public this.``AdjacentToDot_10_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,]<-" + [] member public this.``AdjacentToDot_11_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,,]<-" + [] member public this.``AdjacentToDot_12_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,,]" + [] member public this.``AdjacentToDot_13_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,,]" + [] member public this.``AdjacentToDot_14_Negative``() = testAutoCompleteAdjacentToDotNegative ".[,]" + [] member public this.``AdjacentToDot_15_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..]" + [] member public this.``AdjacentToDot_16_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..,..]" + [] member public this.``AdjacentToDot_17_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..,..,..]" + [] member public this.``AdjacentToDot_18_Negative``() = testAutoCompleteAdjacentToDotNegative ".[..,..,..,..]" + [] member public this.``AdjacentToDot_19_Negative``() = testAutoCompleteAdjacentToDotNegative ".()" + [] member public this.``AdjacentToDot_20_Negative``() = testAutoCompleteAdjacentToDotNegative ".()<-" + [] member public this.``AdjacentToDot_21_Negative``() = testAutoCompleteAdjacentToDotNegative ".+." + + [] member public this.``LambdaOverloads.Completion``() = let prologue = "open System.Linq" let cases = @@ -452,8 +447,7 @@ type UsingMSBuild() as this = let code = [prologue; case] AssertCtrlSpaceCompleteContains code "(*$*)x.Len" ["Length"] [] - [] - [] + [] member public this.``Query.CompletionInJoinOn``() = let code = [ @@ -467,7 +461,7 @@ type UsingMSBuild() as this = - [] + [] member public this.``TupledArgsInLambda.Completion.Bug312557_1``() = let code = [ @@ -477,7 +471,7 @@ type UsingMSBuild() as this = ] AssertCtrlSpaceCompleteContains code "(*MARKER*)" ["xxx"; "yyy"] [] - [] + [] member public this.``TupledArgsInLambda.Completion.Bug312557_2``() = let code = [ @@ -491,7 +485,7 @@ type UsingMSBuild() as this = AssertCtrlSpaceCompleteContains code "b a" ["aaa"; "bbb"] [] AssertCtrlSpaceCompleteContains code "a b" ["aaa"; "bbb"] [] - [] + [] member this.``AutoCompletion.OnTypeConstraintError``() = let code = [ @@ -508,14 +502,12 @@ type UsingMSBuild() as this = ] AssertCtrlSpaceCompleteContains code "abcd." ["Bar"; "Equals"; "GetHashCode"; "GetType"; "InternalMethod"; "PublicMethodForIntellisense"; "ToString"] [] - [] - [] + [] member public this.``RangeOperator.IncorrectUsage``() = AssertCtrlSpaceCompletionListIsEmpty [".."] ".." AssertCtrlSpaceCompletionListIsEmpty ["..."] "..." - [] - [] + [] member public this.``Inherit.CompletionInConstructorArguments1``() = let code = [ @@ -524,8 +516,7 @@ type UsingMSBuild() as this = ] AssertCtrlSpaceCompleteContains code "inherit A(a" ["abs"] [] - [] - [] + [] member public this.``Inherit.CompletionInConstructorArguments2``() = let code = [ @@ -534,8 +525,7 @@ type UsingMSBuild() as this = ] AssertCtrlSpaceCompleteContains code "System.String." ["Empty"] ["Array"; "Collections"] - [] - [] + [] member public this.``ObjectInitializer.CompletionForProperties``() = let typeDef1 = [ @@ -602,8 +592,7 @@ type UsingMSBuild() as this = AssertCtrlSpaceCompleteContains (typeDef4 @ ["new M.A<_, _>(S = 1)"]) "A<_, _>(S = 1" [] ["NonSettableProperty"; "SettableProperty"] AssertCtrlSpaceCompleteContains (typeDef4 @ ["new M.A<_, _>(S = 1,)"]) "A<_, _>(S = 1," ["AnotherSettableProperty"] ["NonSettableProperty"] - [] - [] + [] member public this.``ObjectInitializer.CompletionForSettableExtensionProperties``() = let typeDef = [ @@ -615,8 +604,7 @@ type UsingMSBuild() as this = AssertCtrlSpaceCompleteContains (typeDef @ ["open Ext"; "A((**))"]) "A((**)" ["XYZ"] [] // positive AssertCtrlSpaceCompleteContains (typeDef @ ["A((**))"]) "A((**)" [] ["XYZ"] // negative - [] - [] + [] member public this.``ObjectInitializer.CompletionForNamedParameters``() = let typeDef1 = [ @@ -639,8 +627,7 @@ type UsingMSBuild() as this = AssertCtrlSpaceCompleteContains (typeDef2 @ ["A.Run<_>(x = 1)"]) ".Run<_>(x" ["xyz"] [] AssertCtrlSpaceCompleteContains (typeDef2 @ ["A.Run<_>(x = 1,)"]) ".Run<_>(x = 1," ["xyz"; "zyx"] [] - [] - [] + [] member public this.``ObjectInitializer.CompletionForSettablePropertiesInReturnValue``() = let typeDef1 = [ @@ -675,8 +662,7 @@ type UsingMSBuild() as this = AssertCtrlSpaceCompleteContains (typeDef2 @ ["A.Run<_>(Settable = 1,)"]) ".Run<_>(Settable = 1," ["Settable0"] ["NonSettable"] - [] - [] + [] member public this.``RangeOperator.CorrectUsage``() = let useCases = [ @@ -697,7 +683,7 @@ type UsingMSBuild() as this = - [] + [] member public this.``Array.Length.InForRange``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let a = [|1;2;3|] @@ -706,7 +692,7 @@ for i in 0..a."] [ "Length" ] // should contain [ ] // should not contain - [] + [] member public this.``ProtectedMembers.BaseClass`` () = let sourceCode = [ @@ -716,7 +702,7 @@ for i in 0..a."] ] AssertCtrlSpaceCompleteContains sourceCode "x." ["Message"; "HResult"] [] - [] + [] member public this.``ProtectedMembers.SelfOrDerivedClass`` () = let sources = [ @@ -737,9 +723,7 @@ for i in 0..a."] AssertCtrlSpaceCompleteContains src "x." ["Message"; "HResult"] [] - [] - [] - [] + [] member public this.``Records.DotCompletion.ConstructingRecords1``() = let prologue = "type OuterRec = {XX : int; YY : string}" @@ -754,8 +738,7 @@ for i in 0..a."] let code = [prologue; code] AssertCtrlSpaceCompleteContains code marker should ["abs"] - [] - [] + [] member public this.``Records.DotCompletion.ConstructingRecords2``() = let prologue = [ @@ -774,8 +757,7 @@ for i in 0..a."] let code = prologue @ [code] AssertCtrlSpaceCompleteContains code marker should shouldnot - [] - [] + [] member public this.``Records.CopyOnUpdate``() = let prologue = [ @@ -793,8 +775,7 @@ for i in 0..a."] let code = prologue @ [code] AssertCtrlSpaceCompleteContains code marker ["a"; "b"] ["abs"] - [] - [] + [] member public this.``Records.CopyOnUpdate.NoFieldsCompletionBeforeWith``() = let code = [ @@ -804,8 +785,7 @@ for i in 0..a."] ] AssertCtrlSpaceCompleteContains code "{r " [] ["AAA"] - [] - [] + [] member public this.``Records.Constructors1``() = let prologue = [ @@ -825,8 +805,7 @@ for i in 0..a."] let code = prologue @ [code] AssertCtrlSpaceCompleteContains code marker ["field1"; "field2"] ["abs"] - [] - [] + [] member public this.``Records.Constructors2.UnderscoresInNames``() = let prologue = [ @@ -845,14 +824,12 @@ for i in 0..a."] AssertCtrlSpaceCompleteContains code marker ["_field1"; "_field2"] ["abs"] - [] - [] + [] member public this.``Records.NestedRecordPatterns``() = let code = ["[1..({contents = 5}).]"] AssertCtrlSpaceCompleteContains code "5})." ["Value"; "contents"] ["CompareTo"] - [] - [] + [] member public this.``Records.Separators1``() = let useCases = [ @@ -872,8 +849,7 @@ for i in 0..a."] printfn "%A" code AssertCtrlSpaceCompleteContains code marker ["abs"] ["AAA"; "BBB"] - [] - [] + [] member public this.``Records.Separators2``() = let useCases = [ @@ -909,8 +885,7 @@ for i in 0..a."] printfn "%A" code AssertCtrlSpaceCompleteContains code marker should ["abs"] - [] - [] + [] member public this.``Records.Inherits``() = let prologue = [ @@ -935,8 +910,7 @@ for i in 0..a."] printfn "%s" (String.concat "\r\n" code) AssertCtrlSpaceCompleteContains code marker should ["abs"] - [] - [] + [] member public this.``Records.MissingBindings``() = let prologue = [ @@ -956,8 +930,7 @@ for i in 0..a."] printfn "%s" (String.concat "\r\n" code) AssertCtrlSpaceCompleteContains code marker should ["abs"] - [] - [] + [] member public this.``Records.WRONG.ErrorsInFirstBinding``() = // errors in the first binding are critical now let prologue = @@ -976,8 +949,7 @@ for i in 0..a."] let code = prologue @ [code] AssertCtrlSpaceCompleteContains code marker [] ["field1"; "field2"] - [] - [] + [] member public this.``Records.InferByFieldsInPriorMethodArguments``() = let prologue = @@ -1005,7 +977,7 @@ for i in 0..a."] let code = prologue @ [code] AssertCtrlSpaceCompleteContains code marker should [] - [] + [] member this.``Completion.DetectInterfaces``() = let shouldBeInterface = [ @@ -1028,7 +1000,7 @@ for i in 0..a."] AssertCtrlSpaceCompleteContains ifs "(*M*)" ["seq"] ["obj"] - [] + [] member this.``Completion.DetectClasses``() = let shouldBeClass = @@ -1056,7 +1028,7 @@ for i in 0..a."] for cls in shouldBeClass do AssertCtrlSpaceCompleteContains cls "(*M*)" ["obj"] ["seq"] - [] + [] member this.``Completion.DetectUnknownCompletionContext``() = let content = [ @@ -1066,7 +1038,7 @@ for i in 0..a."] AssertCtrlSpaceCompleteContains content "(*M*)" ["obj"; "seq"] ["abs"] - [] + [] member this.``Completion.DetectInvalidCompletionContext``() = let shouldBeInvalid = [ @@ -1105,7 +1077,7 @@ for i in 0..a."] AssertCtrlSpaceCompletionListIsEmpty invalid "(*M*)" - [] + [] member this.``Completion.LongIdentifiers``() = // System.Diagnostics.Debugger.Launch() |> ignore AssertCtrlSpaceCompleteContains @@ -1188,8 +1160,7 @@ for i in 0..a."] ["Collections"; "IDisposable"] [] - [] - [] + [] member public this.``Query.GroupJoin.CompletionInIncorrectJoinRelations``() = let code = [ @@ -1202,8 +1173,7 @@ for i in 0..a."] AssertCtrlSpaceCompleteContains code "(x." ["CompareTo"] ["abs"] AssertCtrlSpaceCompleteContains code "? y." ["Chars"; "Length"] ["abs"] - [] - [] + [] member public this.``Query.Join.CompletionInIncorrectJoinRelations``() = let code = [ @@ -1216,8 +1186,7 @@ for i in 0..a."] AssertCtrlSpaceCompleteContains code "(x." ["CompareTo"] ["abs"] AssertCtrlSpaceCompleteContains code "? y." ["Chars"; "Length"] ["abs"] - [] - [] + [] member public this.``Query.ForKeywordCanCompleteIntoIdentifier``() = let code = [ @@ -1229,7 +1198,7 @@ for i in 0..a."] ] AssertCtrlSpaceCompleteContains code "for" ["form"] [] // 'for' is a keyword, but should not prevent completion - [] + [] member public this.``ObjInstance.InheritedClass.MethodsWithDiffAccessibility``() = AssertAutoCompleteContainsNoCoffeeBreak [ "type Base = @@ -1249,7 +1218,7 @@ derived.derivedField"] [ "baseField"; "derivedField" ] // should contain [ "baseFieldPrivate"; "derivedFieldPrivate" ] // should not contain - [] + [] member public this.``ObjInstance.InheritedClass.MethodsWithDiffAccessibilityWithSameNameMethod``() = AssertAutoCompleteContainsNoCoffeeBreak [ "type Base = @@ -1270,7 +1239,7 @@ derived.derivedField"] [ "baseField"; "derivedField" ] // should contain [ "baseFieldPrivate"; "derivedFieldPrivate" ] // should not contain - [] + [] member public this.``Visibility.InheritedClass.MethodsWithDiffAccessibility``() = AssertAutoCompleteContainsNoCoffeeBreak [ "type Base = @@ -1289,7 +1258,7 @@ type Derived = [ "baseField"; "derivedField"; "derivedFieldPrivate" ] // should contain [ "baseFieldPrivate" ] // should not contain - [] + [] member public this.``Visibility.InheritedClass.MethodsWithDiffAccessibilityWithSameNameMethod``() = AssertAutoCompleteContainsNoCoffeeBreak [ "type Base = @@ -1309,7 +1278,7 @@ type Derived = [ "baseField"; "derivedField"; "derivedFieldPrivate" ] // should contain [ "baseFieldPrivate" ] // should not contain - [] + [] member public this.``Visibility.InheritedClass.MethodsWithSameNameMethod``() = AssertAutoCompleteContainsNoCoffeeBreak [ "type MyClass = @@ -1330,7 +1299,7 @@ let x = new MyClass2(0) [ "foo" ] // should contain [ ] // should not contain - [] + [] member public this.``Identifier.Array.AfterassertKeyword``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let x = [1;2;3] " @@ -1339,7 +1308,7 @@ let x = new MyClass2(0) [ "Head" ] // should contain (from List) [ "Listeners" ] // should not contain (from System.Diagnostics.Debug) - [] + [] member public this.``CtrlSpaceCompletion.Bug130670.Case1``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak [ "let i = async.Return(4)" ] @@ -1347,7 +1316,7 @@ let x = new MyClass2(0) [ "AbstractClassAttribute" ] // should contain (top-level) [ "GetType" ] // should not contain (object instance method) - [] + [] member public this.``CtrlSpaceCompletion.Bug130670.Case2``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak [ """ @@ -1357,7 +1326,7 @@ let x = new MyClass2(0) [ "AbstractClassAttribute" ] // should contain (top-level) [ "CompareTo" ] // should not contain (instance method on int) - [] + [] member public this.``CtrlSpaceCompletion.Bug294974.Case1``() = AssertCtrlSpaceCompleteContains @@ -1368,7 +1337,7 @@ let x = new MyClass2(0) [ "xxx" ] // should contain (completions before dot) [ "IsEmpty" ] // should not contain (completions after dot) - [] + [] member public this.``CtrlSpaceCompletion.Bug294974.Case2``() = AssertCtrlSpaceCompleteContains [ """ @@ -1378,7 +1347,7 @@ let x = new MyClass2(0) [ "AbstractClassAttribute" ] // should contain (top-level) [ "IsEmpty" ] // should not contain (completions after dot) - [] + [] member public this.``ObsoleteProperties.6377_1``() = AssertAutoCompleteContainsNoCoffeeBreak [ "System.Security.SecurityManager." ] @@ -1386,7 +1355,7 @@ let x = new MyClass2(0) [ "GetStandardSandbox" ] // should contain [ "get_SecurityEnabled"; "set_SecurityEnabled" ] // should not contain - [] + [] member public this.``ObsoleteProperties.6377_2``() = AssertAutoCompleteContainsNoCoffeeBreak [ "System.Threading.Thread.CurrentThread." ] @@ -1394,7 +1363,7 @@ let x = new MyClass2(0) [ "CurrentCulture" ] // should contain: just make sure something shows [ "get_ApartmentState"; "set_ApartmentState" ] // should not contain - [] + [] member public this.``PopupsVersusCtrlSpaceOnDotDot.FirstDot.Popup``() = AssertAutoCompleteContainsNoCoffeeBreak [ "System.Console..BackgroundColor" ] @@ -1402,7 +1371,7 @@ let x = new MyClass2(0) [ "BackgroundColor" ] // should contain (from prior System.Console) [ "abs" ] // should not contain (top-level autocomplete on empty identifier) - [] + [] member public this.``PopupsVersusCtrlSpaceOnDotDot.FirstDot.CtrlSpace``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak [ "System.Console..BackgroundColor" ] @@ -1410,17 +1379,17 @@ let x = new MyClass2(0) [ "BackgroundColor" ] // should contain (from prior System.Console) [ "abs" ] // should not contain (top-level autocomplete on empty identifier) - [] + [] member public this.``DotCompletionInPatternsPartOfLambda``() = let content = ["let _ = fun x . -> x + 1"] AssertCtrlSpaceCompletionListIsEmpty content "x ." - [] + [] member public this.``DotCompletionInBrokenLambda``() = let content = ["1 |> id (fun x .> x)"] AssertCtrlSpaceCompletionListIsEmpty content "x ." - [] + [] member public this.``DotCompletionInPatterns``() = let useCases = [ @@ -1433,7 +1402,7 @@ let x = new MyClass2(0) AssertCtrlSpaceCompletionListIsEmpty source marker - [] + [] member public this.``DotCompletionWithBrokenLambda``() = let errors = [ @@ -1458,8 +1427,7 @@ let x = new MyClass2(0) AssertCtrlSpaceCompleteContains source marker should shouldnot - [] - [] + [] member public this.``AfterConstructor.5039_1``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let someCall(x) = null" @@ -1468,8 +1436,7 @@ let x = new MyClass2(0) [ "ReadBlock" ] // should contain (StringReader) [ "LastIndexOfAny" ] // should not contain (String) - [] - [] + [] member public this.``AfterConstructor.5039_1.CoffeeBreak``() = AssertAutoCompleteContains [ "let someCall(x) = null" @@ -1478,7 +1445,7 @@ let x = new MyClass2(0) [ "ReadBlock" ] // should contain (StringReader) [ "LastIndexOfAny" ] // should not contain (String) - [] + [] member public this.``AfterConstructor.5039_2``() = AssertAutoCompleteContainsNoCoffeeBreak [ "System.Random()." ] @@ -1486,7 +1453,7 @@ let x = new MyClass2(0) [ "NextDouble" ] // should contain [ ] // should not contain - [] + [] member public this.``AfterConstructor.5039_3``() = AssertAutoCompleteContainsNoCoffeeBreak [ "System.Collections.Generic.List()." ] @@ -1494,7 +1461,7 @@ let x = new MyClass2(0) [ "BinarySearch" ] // should contain [ ] // should not contain - [] + [] member public this.``AfterConstructor.5039_4``() = AssertAutoCompleteContainsNoCoffeeBreak [ "System.Collections.Generic.List()." ] @@ -1502,7 +1469,7 @@ let x = new MyClass2(0) [ "BinarySearch" ] // should contain [ ] // should not contain - [] + [] member public this.``Literal.809979``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let value=uint64." ] @@ -1510,7 +1477,7 @@ let x = new MyClass2(0) [ ] // should contain [ "Parse" ] // should not contain - [] + [] member public this.``NameSpace.AsConstructor``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak [ "new System.DateTime()" ] @@ -1518,7 +1485,7 @@ let x = new MyClass2(0) ["System";"Array2D"] ["DaysInMonth"; "AddDays" ] // should contain top level info, no static or instance DateTime members! - [] + [] member public this.``DotAfterApplication1``() = AssertAutoCompleteContainsNoCoffeeBreak ["let g a = new System.Random()" @@ -1527,7 +1494,7 @@ let x = new MyClass2(0) ["Next"] [ ] - [] + [] member public this.``DotAfterApplication2``() = AssertAutoCompleteContainsNoCoffeeBreak ["let g a = new System.Random()" @@ -1536,7 +1503,7 @@ let x = new MyClass2(0) ["Head"] [ ] - [] + [] member public this.``Quickinfo.809979``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let value=uint64." ] @@ -1545,19 +1512,19 @@ let x = new MyClass2(0) [ "Parse" ] // should not contain /// No intellisense in comments/strings! - [] + [] member public this.``InString``() = this.VerifyCtrlSpaceCompListIsEmptyAtEndOfMarker( fileContents = """ // System.C """ , marker = "// System.C" ) - [] + [] member public this.``InComment``() = this.VerifyCtrlSpaceCompListIsEmptyAtEndOfMarker( fileContents = """ let s = "System.C" """, marker = "\"System.C") /// Intellisense at the top level (on white space) - [] + [] member public this.``Identifier.OnWhiteSpace.AtTopLevel``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["(*marker*) "] @@ -1566,7 +1533,7 @@ let x = new MyClass2(0) ["Int32"] /// Intellisense at the top level (after a partial token). All matches should be shown even if there is a unique match - [] + [] member public this.``TopLevelIdentifier.AfterPartialToken1``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let foobaz = 1" @@ -1575,7 +1542,7 @@ let x = new MyClass2(0) ["System";"Array2D";"foobaz"] ["Int32"] - [] + [] member public this.``TopLevelIdentifier.AfterPartialToken2``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let foobaz = 1" @@ -1585,7 +1552,7 @@ let x = new MyClass2(0) [] (* these issues have not been fixed yet, but when they are, here are some tests - [] + [] member public this.``AutoComplete.Bug65730``() = AssertAutoCompleteContains [ "let f x y = x.Equals(y)" ] @@ -1593,7 +1560,7 @@ let x = new MyClass2(0) [ "Equals" ] // should contain [ ] // should not contain - [] + [] member public this.``AutoComplete.Bug65731_A``() = AssertAutoCompleteContains [ @@ -1605,7 +1572,7 @@ let x = new MyClass2(0) [ "a" ] // should contain [ ] // should not contain - [] + [] member public this.``AutoComplete.Bug65731_B``() = AssertAutoCompleteContains [ @@ -1617,7 +1584,7 @@ let x = new MyClass2(0) [ "a" ] // should contain [ ] // should not contain - [] + [] member public this.``AutoComplete.Bug69654_0``() = let code = [ @" let q = @@ -1646,7 +1613,7 @@ let x = new MyClass2(0) gpatcc.AssertExactly(0,0) - [] + [] member public this.``AutoComplete.Bug69654_1``() = let code = [ "let s = async {" @@ -1685,7 +1652,7 @@ let x = new MyClass2(0) gpatcc.AssertExactly(0,0) - [] + [] member public this.``AutoComplete.Bug69654_2``() = let code = [ "let s = async {" @@ -1725,7 +1692,7 @@ let x = new MyClass2(0) gpatcc.AssertExactly(0,0) *) - [] + [] member public this.``List.AfterAddLinqNamespace.Bug3754``() = let code = ["open System.Xml.Linq" @@ -1735,7 +1702,7 @@ let x = new MyClass2(0) let completions = AutoCompleteAtCursor file AssertCompListContainsAll(completions, [ "map"; "filter" ] ) - [] + [] member public this.``Global``() = AssertAutoCompleteContainsNoCoffeeBreak ["global."] @@ -1743,7 +1710,7 @@ let x = new MyClass2(0) ["System"; "Microsoft" ] [] - [] + [] member public this.``Duplicates.Bug4103a``() = let code = [ @@ -1762,7 +1729,7 @@ let x = new MyClass2(0) AssertEqualWithMessage(2, occurrences, "The entry for 'Expr.Var' is duplicated.") /// Testing autocomplete after a dot directly following method call - [] + [] member public this.``AfterMethod.Bug2296``() = AssertAutoCompleteContainsNoCoffeeBreak [ "type System.Int32 with" @@ -1773,7 +1740,7 @@ let x = new MyClass2(0) [] /// Testing autocomplete after a dot directly following overloaded method call - [] + [] member public this.``AfterMethod.Overloaded.Bug2296``() = AssertAutoCompleteContainsNoCoffeeBreak ["type System.Boolean with" @@ -1783,7 +1750,7 @@ let x = new MyClass2(0) ["BooleanMember"] [] - [] + [] member public this.``BasicGlobalMemberList``() = AssertAutoCompleteContainsNoCoffeeBreak ["let x = 1" @@ -1792,7 +1759,7 @@ let x = new MyClass2(0) ["CompareTo"; "GetHashCode"] [] - [] + [] member public this.``CharLiteral``() = AssertAutoCompleteContainsNoCoffeeBreak ["let x = \"foo\"" @@ -1802,7 +1769,7 @@ let x = new MyClass2(0) ["CompareTo";"GetHashCode"] [] - [] + [] member public this.``GlobalMember.ListOnIdentifierEndingWithTick``() = AssertAutoCompleteContainsNoCoffeeBreak ["let x' = 1" @@ -1811,7 +1778,7 @@ let x = new MyClass2(0) ["CompareTo";"GetHashCode"] [] - [] + [] member public this.``GlobalMember.ListOnIdentifierContainingTick``() = AssertAutoCompleteContainsNoCoffeeBreak ["let x'y = 1" @@ -1820,7 +1787,7 @@ let x = new MyClass2(0) ["CompareTo";"GetHashCode"] [] - [] + [] member public this.``GlobalMember.ListWithPartialMember1``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let x = 1" @@ -1829,7 +1796,7 @@ let x = new MyClass2(0) ["CompareTo";"GetHashCode"] [] - [] + [] member public this.``GlobalMember.ListWithPartialMember2``() = AssertAutoCompleteContainsNoCoffeeBreak ["let x = 1" @@ -1839,7 +1806,7 @@ let x = new MyClass2(0) [] /// Wrong intellisense for array - [] + [] member public this.``DotOff.Parenthesized.Expr``() = AssertAutoCompleteContainsNoCoffeeBreak ["let string_of_int (x:int) = x.ToString()" @@ -1850,7 +1817,7 @@ let x = new MyClass2(0) [] /// Wrong intellisense for array - [] + [] member public this.``DotOff.ArrayIndexerNotation``() = AssertAutoCompleteContainsNoCoffeeBreak ["let string_of_int (x:int) = x.ToString()" @@ -1861,7 +1828,7 @@ let x = new MyClass2(0) [] /// Wrong intellisense for array - [] + [] member public this.``DotOff.ArraySliceNotation1``() = AssertAutoCompleteContainsNoCoffeeBreak ["let string_of_int (x:int) = x.ToString()" @@ -1873,7 +1840,7 @@ let x = new MyClass2(0) ["Length"] [] - [] + [] member public this.``DotOff.ArraySliceNotation2``() = AssertAutoCompleteContainsNoCoffeeBreak ["let string_of_int (x:int) = x.ToString()" @@ -1885,7 +1852,7 @@ let x = new MyClass2(0) ["Length"] [] - [] + [] member public this.``DotOff.ArraySliceNotation3``() = AssertAutoCompleteContainsNoCoffeeBreak ["let string_of_int (x:int) = x.ToString()" @@ -1897,7 +1864,7 @@ let x = new MyClass2(0) ["Length"] [] - [] + [] member public this.``DotOff.DictionaryIndexer``() = AssertAutoCompleteContainsNoCoffeeBreak ["let dict = new System.Collections.Generic.Dictionary()" @@ -1907,13 +1874,13 @@ let x = new MyClass2(0) [] /// intellisense on DOT - [] + [] member public this.``EmptyFile.Dot.Bug1115``() = this.VerifyAutoCompListIsEmptyAtEndOfMarker( fileContents = "." , marker = ".") - [] + [] member public this.``Identifier.NonDottedNamespace.Bug1347``() = this.AssertCtrlSpaceCompletionContains( ["open System" @@ -1926,7 +1893,7 @@ let x = new MyClass2(0) "let x = Mic", "Microsoft") - [] + [] member public this.``MatchStatement.WhenClause.Bug2519``() = AssertAutoCompleteContainsNoCoffeeBreak ["type DU = X of int" @@ -1938,7 +1905,7 @@ let x = new MyClass2(0) ["CompareTo";"GetHashCode"] [] - [] + [] member public this.``String.BeforeIncompleteModuleDefinition.Bug2385``() = AssertAutoCompleteContainsNoCoffeeBreak ["let s = \"hello\"." @@ -1947,7 +1914,7 @@ let x = new MyClass2(0) ["Substring";"GetHashCode"] [] - [] + [] member public this.``Project.FsFileWithBuildAction``() = AssertAutoCompleteContainsNoCoffeeBreak ["let i = 4" @@ -1958,7 +1925,7 @@ let x = new MyClass2(0) [] /// Dotting off a string literal should work. - [] + [] member public this.``DotOff.String``() = AssertAutoCompleteContainsNoCoffeeBreak ["\"x\". (*marker*)" @@ -1968,7 +1935,7 @@ let x = new MyClass2(0) [] /// FEATURE: Pressing dot (.) after an local variable will produce an Intellisense list of members the user may select. - [] + [] member public this.``BasicLocalMemberList``() = AssertAutoCompleteContainsNoCoffeeBreak ["let MyFunction (s:string) = " @@ -1979,7 +1946,7 @@ let x = new MyClass2(0) ["Substring";"GetHashCode"] [] - [] + [] member public this.``LocalMemberList.WithPartialMemberEntry1``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let MyFunction (s:string) = " @@ -1990,7 +1957,7 @@ let x = new MyClass2(0) ["Substring";"GetHashCode"] [] - [] + [] member public this.``LocalMemberList.WithPartialMemberEntry2``() = AssertAutoCompleteContainsNoCoffeeBreak ["let MyFunction (s:string) = " @@ -2001,8 +1968,7 @@ let x = new MyClass2(0) ["Substring";"GetHashCode"] [] - [] - [] + [] member public this.``CurriedArguments.Regression1``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let fffff x y = 1" @@ -2014,7 +1980,7 @@ let x = new MyClass2(0) ["fffff"] [] - [] + [] member public this.``CurriedArguments.Regression2``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let fffff x y = 1" @@ -2026,7 +1992,7 @@ let x = new MyClass2(0) ["fffff"] [] - [] + [] member public this.``CurriedArguments.Regression3``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let fffff x y = 1" @@ -2038,7 +2004,7 @@ let x = new MyClass2(0) ["ggggg"] [] - [] + [] member public this.``CurriedArguments.Regression4``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let fffff x y = 1" @@ -2050,7 +2016,7 @@ let x = new MyClass2(0) ["ggggg"] [] - [] + [] member public this.``CurriedArguments.Regression5``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let fffff x y = 1" @@ -2062,7 +2028,7 @@ let x = new MyClass2(0) ["ggggg"] [] - [] + [] member public this.``CurriedArguments.Regression6``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["let fffff x y = 1" @@ -2075,7 +2041,7 @@ let x = new MyClass2(0) [] // Test whether standard types appear in the completion list under both F# and .NET name - [] + [] member public this.``StandardTypes.Bug4403``() = AssertCtrlSpaceCompleteContainsNoCoffeeBreak ["open System"; "let x=" ] @@ -2084,7 +2050,7 @@ let x = new MyClass2(0) [ ] // Test whether standard types appear in the completion list under both F# and .NET name - [] + [] member public this.``ValueDeclarationHidden.Bug4405``() = AssertAutoCompleteContainsNoCoffeeBreak [ "do " @@ -2094,7 +2060,7 @@ let x = new MyClass2(0) ["IndexOf"; "Substring"] [ ] - [] + [] member public this.``StringFunctions``() = let code = [ @@ -2105,7 +2071,7 @@ let x = new MyClass2(0) MoveCursorToEndOfMarker(file,"String.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length > 0) + Assert.True(completions.Length > 0) for completion in completions do match completion with | CompletionItem(_,_,_,_,DeclarationType.Method) -> () @@ -2113,7 +2079,7 @@ let x = new MyClass2(0) // FEATURE: Pressing ctrl+space or ctrl+j will give a list of valid completions. - [] + [] //Verified at least "Some" is contained in the Ctrl-Space Completion list member public this.``NonDotCompletion``() = this.AssertCtrlSpaceCompletionContains( @@ -2121,10 +2087,7 @@ let x = new MyClass2(0) "x = S", "Some") - [] - [] - [] - [] + [] // This test case checks Pressing ctrl+space on the provided Type instance method shows list of valid completions member this.``TypeProvider.EditorHideMethodsAttribute.InstanceMethod.CtrlSpaceCompletionContains``() = this.AssertCtrlSpaceCompletionContains( @@ -2135,10 +2098,7 @@ let x = new MyClass2(0) expected = "IM1", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] // This test case checks Pressing ctrl+space on the provided Type Event shows list of valid completions member this.``TypeProvider.EditorHideMethodsAttribute.Event.CtrlSpaceCompletionContains``() = this.AssertCtrlSpaceCompletionContains( @@ -2149,9 +2109,7 @@ let x = new MyClass2(0) expected = "Event1", addtlRefAssy = [PathRelativeToTestAssembly(@"EditorHideMethodsAttribute.dll")]) - [] - [] - [] + [] // This test case checks Pressing ctrl+space on the provided Type static parameter and verify "int" is in the list just to make sure bad things don't happen and autocomplete window pops up member this.``TypeProvider.EditorHideMethodsAttribute.Type.CtrlSpaceCompletionContains``() = this.AssertCtrlSpaceCompletionContains( @@ -2163,7 +2121,7 @@ let x = new MyClass2(0) // In this bug, pressing dot after this was producing an invalid member list. - [] + [] member public this.``Class.Self.Bug1544``() = this.VerifyAutoCompListIsEmptyAtEndOfMarker( fileContents = " @@ -2172,14 +2130,14 @@ let x = new MyClass2(0) marker = "this.") // No completion list at the end of file. - [] + [] member public this.``Identifier.AfterDefined.Bug1545``() = this.AutoCompletionListNotEmpty ["let x = [|\"hello\"|]" "x."] "x." - [] + [] member public this.``Bug243082.DotAfterNewBreaksCompletion`` () = this.AutoCompletionListNotEmpty [ @@ -2190,7 +2148,7 @@ let x = new MyClass2(0) "let z = new A."] "s." - [] + [] member public this.``Bug243082.DotAfterNewBreaksCompletion2`` () = this.AutoCompletionListNotEmpty [ @@ -2199,9 +2157,7 @@ let x = new MyClass2(0) "new System."] "s." - [] - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest0``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2211,9 +2167,7 @@ let x = new MyClass2(0) list = ["sin"], addtlRefAssy=standard40AssemblyRefs ) - [] - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest0b``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2223,9 +2177,7 @@ let x = new MyClass2(0) list = ["query"], addtlRefAssy=standard40AssemblyRefs ) - [] - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest1``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2235,9 +2187,7 @@ let x = new MyClass2(0) list = ["select"], addtlRefAssy=standard40AssemblyRefs ) - [] - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest1b``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2249,9 +2199,7 @@ let x = new MyClass2(0) - [] - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest2``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2262,9 +2210,7 @@ let x = new MyClass2(0) addtlRefAssy=standard40AssemblyRefs ) - [] - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest3``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2275,8 +2221,7 @@ let x = new MyClass2(0) addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest3b``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2288,8 +2233,7 @@ let x = new MyClass2(0) - [] - [] + [] member this.``QueryExpression.CtrlSpaceSmokeTest3c``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2300,8 +2244,7 @@ let x = new MyClass2(0) addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member this.``AsyncExpression.CtrlSpaceSmokeTest3d``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -2349,11 +2292,8 @@ let x = new MyClass2(0) let y = x + 1 (*TYPING*)""" ] - [] + [] /// This is the case where at (*TYPING*) we first type 1...N-1 characters of the target custom operation and then invoke the completion list, and we check that the completion list contains the custom operation - [] - [] - [] member this.``QueryExpression.CtrlSpaceSystematic1``() = let rec strictPrefixes (s:string) = seq { if s.Length > 1 then let s = s.[0..s.Length-2] in yield s; yield! strictPrefixes s} for customOperation in ["select";"skip";"contains";"groupJoin"] do @@ -2433,10 +2373,7 @@ let x = new MyClass2(0) if failures.Count <> 0 || unexpectedSuccesses.Count <> 0 then raise <| new Exception("there were unexpected results, see console output for details") - [] - [] - [] - [] + [] member this.``QueryExpressions.QueryAndSequenceExpressionWithForYieldLoopSystematic``() = let prefix = """ @@ -2494,9 +2431,7 @@ let aaaaaa = [| "1" |] this.WordByWordSystematicTestWithSpecificExpectations(prefix, suffixes, lines, ["seq";"query"], knownFailures) - [] - [] - [] + [] /// Incrementally enter a seq{ .. while ...} loop and check for availability of intellisense etc. member this.``SequenceExpressions.SequenceExprWithWhileLoopSystematic``() = @@ -2535,10 +2470,7 @@ let aaaaaa = 0 this.WordByWordSystematicTestWithSpecificExpectations(prefix, suffixes, lines, [""], knownFailures) - [] - [] - [] - [] + [] /// Incrementally enter query with a 'join' and check for availability of quick info, auto completion and dot completion member this.``QueryAndOtherExpressions.WordByWordSystematicJoinQueryOnSingleLine``() = @@ -2589,11 +2521,8 @@ let aaaaaa = 0 this.WordByWordSystematicTestWithSpecificExpectations(prefix, suffixes, lines, [""], knownFailures) - [] + [] /// This is a sanity check that the multiple-line case is much the same as the single-line case - [] - [] - [] member this.``QueryAndOtherExpressions.WordByWordSystematicJoinQueryOnMultipleLine``() = let prefix = """ @@ -2739,8 +2668,7 @@ let x = query { for bbbb in abbbbc(*D0*) do this.WordByWordSystematicTestWithSpecificExpectations(prefix, suffixes, lines, [""], knownFailures) - [] - [] + [] /// This is the case where (*TYPING*) nothing has been typed yet and we invoke the completion list /// This is a known failure right now for some of the example files above. member this.``QueryExpression.CtrlSpaceSystematic2``() = @@ -2767,14 +2695,14 @@ let x = query { for bbbb in abbbbc(*D0*) do let completions = time1 CtrlSpaceCompleteAtCursor file "Time of first autocomplete." AssertCompListContainsAll(completions, expected) - [] + [] member public this.``Parameter.CommonCase.Bug2884``() = this.AutoCompleteRecoveryTest ([ "type T1(aaa1) =" " do (" ], "do (", [ "aaa1" ]) - [] + [] member public this.``Parameter.SubsequentLet.Bug2884``() = this.AutoCompleteRecoveryTest ([ @@ -2782,7 +2710,7 @@ let x = query { for bbbb in abbbbc(*D0*) do " do (" "let a = 0" ], "do (", [ "aaa1" ]) - [] + [] member public this.``Parameter.SubsequentMember.Bug2884``() = this.AutoCompleteRecoveryTest ([ @@ -2791,7 +2719,7 @@ let x = query { for bbbb in abbbbc(*D0*) do " do (" " member x.Bar = 0" ], "do (", [ "aaa1"; "aaa2" ]) - [] + [] member public this.``Parameter.System.DateTime.Bug2884``() = this.AutoCompleteRecoveryTest ([ @@ -2799,7 +2727,7 @@ let x = query { for bbbb in abbbbc(*D0*) do " member x.Foo(aaa2) = " " let dt = new System.DateTime(" ], "Time(", [ "aaa1"; "aaa2" ]) - [] + [] member public this.``Parameter.DirectAfterDefined.Bug2884``() = this.AutoCompleteRecoveryTest ([ @@ -2807,21 +2735,21 @@ let x = query { for bbbb in abbbbc(*D0*) do " let aaa1 = 0" " (" ], "(", [ "aaa1" ]) - [] + [] member public this.``NotShowInfo.LetBinding.Bug3602``() = this.VerifyAutoCompListIsEmptyAtEndOfMarker( fileContents = "let s. = \"Hello world\" ()", marker = "let s.") - [] + [] member public this.``NotShowInfo.FunctionParameter.Bug3602``() = this.VerifyAutoCompListIsEmptyAtEndOfMarker( fileContents = "let foo s. = s + \"Hello world\" ()", marker = "let foo s.") - [] + [] member public this.``NotShowInfo.ClassMemberDeclA.Bug3602``() = this.TestCompletionNotShowingWhenFastUpdate [ @@ -2837,7 +2765,7 @@ let x = query { for bbbb in abbbbc(*D0*) do "(*marker*) this." // Another test case for the same thing - this goes through a different code path - [] + [] member public this.``NotShowInfo.ClassMemberDeclB.Bug3602``() = this.TestCompletionNotShowingWhenFastUpdate [ @@ -2852,7 +2780,7 @@ let x = query { for bbbb in abbbbc(*D0*) do "()" ] "marker$" - [] + [] member public this.``ComputationExpression.LetBang``() = AssertAutoCompleteContainsNoCoffeeBreak ["let http(url:string) = " @@ -2884,19 +2812,19 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertCompListContainsAll(completions, expected) gpatcc.AssertExactly(0,0) - [] + [] member public this.``Generics.Typeof``() = this.TestGenericAutoComplete ("let _ = typeof.", [ "Assembly"; "AssemblyQualifiedName"; (* ... *) ]) - [] + [] member public this.``Generics.NonGenericTypeMembers``() = this.TestGenericAutoComplete ("let _ = GT2.", [ "R"; "S" ]) - [] + [] member public this.``Generics.GenericTypeMembers``() = this.TestGenericAutoComplete ("let _ = GT.", [ "P"; "Q" ]) - //[] // keep disabled unless trying to prove that UnhandledExceptionHandler is working + //[] // keep disabled unless trying to prove that UnhandledExceptionHandler is working member public this.EnsureThatUnhandledExceptionsCauseAnAssert() = // Do something that causes LanguageService to load AssertAutoCompleteContains @@ -2913,7 +2841,7 @@ let x = query { for bbbb in abbbbc(*D0*) do t.Start() System.Threading.Thread.Sleep(1000) - [] + [] member public this.``DotBetweenParens.Bug175360.Case1``() = AssertAutoCompleteContains [ @@ -2923,7 +2851,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "ToDecimal" ] // should contain [] // should not contain - [] + [] member public this.``DotBetweenParens.Bug175360.Case2``() = AssertAutoCompleteContains [ "[| 1 |].(0)" ] @@ -2931,8 +2859,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Clone" ] // should contain [] // should not contain - [] - [] + [] member public this.``GenericType.Self.Bug69673_1.01``() = AssertCtrlSpaceCompleteContains ["type Base(o:obj) = class end" @@ -2945,7 +2872,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["this"] [] - [] + [] member public this.``GenericType.Self.Bug69673_1.02``() = AssertCtrlSpaceCompleteContains ["type Base(o:obj) = class end" @@ -2958,7 +2885,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["this"] [] - [] + [] member public this.``GenericType.Self.Bug69673_1.03``() = AssertCtrlSpaceCompleteContains ["type Base(o:obj) = class end" @@ -2971,7 +2898,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["this"] [] - [] + [] member public this.``GenericType.Self.Bug69673_1.04``() = AssertAutoCompleteContains ["type Base(o:obj) = class end" @@ -2984,8 +2911,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["Bar"] [] - [] - [] + [] member public this.``GenericType.Self.Bug69673_2.1``() = AssertAutoCompleteContains ["type Base(o:obj) = class end" @@ -2999,8 +2925,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["this"] [] - [] - [] + [] member public this.``GenericType.Self.Bug69673_2.2``() = AssertAutoCompleteContains ["type Base(o:obj) = class end" @@ -3014,7 +2939,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["this"] [] - [] + [] member public this.``UnitMeasure.Bug78932_1``() = AssertAutoCompleteContains [ @" @@ -3027,7 +2952,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Kg" ] // should contain [ ] // should not contain - [] + [] member public this.``UnitMeasure.Bug78932_2``() = // Note: in this case, pressing '.' does not automatically pop up a completion list in VS, but ctrl-space does get the right list // This is just like how @@ -3044,7 +2969,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Kg" ] // should contain [ ] // should not contain - [] + [] member public this.``Array.AfterOperator...Bug65732_A``() = AssertAutoCompleteContains [ "let r = [1 .. System.Int32.MaxValue]" ] @@ -3052,7 +2977,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Int32" ] // should contain [ "abs" ] // should not contain (from top level) - [] + [] member public this.``Array.AfterOperator...Bug65732_B``() = AssertCtrlSpaceCompleteContains [ "let r = [System.Int32.MaxValue..42]" ] @@ -3060,7 +2985,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "abs" ] // should contain (top level) [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Array.AfterOperator...Bug65732_B2``() = AssertCtrlSpaceCompleteContains [ "let r = [System.Int32.MaxValue.. 42]" ] @@ -3068,7 +2993,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "abs" ] // should contain (top level) [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Array.AfterOperator...Bug65732_B3``() = AssertCtrlSpaceCompleteContains [ "let r = [System.Int32.MaxValue .. 42]" ] @@ -3076,7 +3001,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "abs" ] // should contain (top level) [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Array.AfterOperator...Bug65732_C``() = AssertCtrlSpaceCompleteContains [ "let r = [System.Int32.MaxValue..]" ] @@ -3084,7 +3009,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "abs" ] // should contain (top level) [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Array.AfterOperator...Bug65732_D``() = AssertCtrlSpaceCompleteContains [ "let r = [System.Int32.MaxValue .. ]" ] @@ -3094,7 +3019,7 @@ let x = query { for bbbb in abbbbc(*D0*) do // Verify the auto completion after the close-parentheses, // there should be auto completion - [] + [] member public this.``Array.AfterParentheses.Bug175360``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let a = 10." @@ -3103,7 +3028,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "ToDecimal" ] // should contain (top level) [ ] // should not contain - [] + [] member public this.``Identifier.FuzzyDefined.Bug67133``() = AssertAutoCompleteContainsNoCoffeeBreak [ "let gDateTime (arr: System.DateTime[]) =" @@ -3112,7 +3037,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["AddDays"] [] - [] + [] member public this.``Identifier.FuzzyDefined.Bug67133.Negative``() = let code = [ "let gDateTime (arr: DateTime[]) =" // Note: no 'open System', so DateTime is unknown " arr.[0]." ] @@ -3124,7 +3049,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertCompListContainsExactly(completions, []) // we don't want any completions on . when has unknown type due to errors // (In particular, we don't want the "didn't find any completions, so just show top-level entities like 'abs' here" logic to kick in.) - [] + [] member public this.``Class.Property.Bug69150_A``() = AssertCtrlSpaceCompleteContains [ "type ClassType(x : int) =" @@ -3134,7 +3059,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Value" ] // should contain [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Class.Property.Bug69150_B``() = AssertCtrlSpaceCompleteContains [ "type ClassType(x : int) =" @@ -3144,7 +3069,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Value" ] // should contain [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Class.Property.Bug69150_C``() = AssertCtrlSpaceCompleteContains [ "type ClassType(x : int) =" @@ -3155,7 +3080,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Value" ] // should contain [ "CompareTo" ] // should not contain (from Int32) - [] + [] member public this.``Class.Property.Bug69150_D``() = AssertCtrlSpaceCompleteContains [ "type ClassType(x : int) =" @@ -3165,7 +3090,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Value" ] // should contain [ "VolatileFieldAttribute" ] // should not contain (from top-level) - [] + [] member public this.``Class.Property.Bug69150_E``() = AssertCtrlSpaceCompleteContains [ "type ClassType(x : int) =" @@ -3175,7 +3100,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Value" ] // should contain [ "VolatileFieldAttribute" ] // should not contain (from top-level) - [] + [] member public this.``AssignmentToProperty.Bug231283``() = AssertCtrlSpaceCompleteContains [""" @@ -3190,7 +3115,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "AbstractClassAttribute" ] // top-level completions [ "Bar" ] // not stuff from the lhs of assignment - [] + [] member public this.``Dot.AfterOperator.Bug69159``() = AssertAutoCompleteContains [ "let x1 = [|0..1..10|]." ] @@ -3198,7 +3123,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Length" ] // should contain (array) [ "abs" ] // should not contain (top-level) - [] + [] member public this.``Residues1``() = AssertCtrlSpaceCompleteContains [ "System . Int32 . M" ] @@ -3206,7 +3131,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "MaxValue"; "MinValue" ] // should contain [ "MailboxProcessor"; "Map" ] // should not contain (top-level) - [] + [] member public this.``Residues2``() = AssertCtrlSpaceCompleteContains [ "let x = 42" @@ -3215,7 +3140,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // should contain (Int32) [ "CLIEventAttribute"; "Checked"; "Choice" ] // should not contain (top-level) - [] + [] member public this.``Residues3``() = AssertCtrlSpaceCompleteContains [ "let x = 42" @@ -3224,7 +3149,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // should contain (Int32) [ "CLIEventAttribute"; "Checked"; "Choice" ] // should not contain (top-level) - [] + [] member public this.``Residues4``() = AssertCtrlSpaceCompleteContains [ "let x = 42" @@ -3233,7 +3158,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // should contain (Int32) [ "CLIEventAttribute"; "Checked"; "Choice" ] // should not contain (top-level) - [] + [] member public this.``CtrlSpaceInWhiteSpace.Bug133112``() = AssertCtrlSpaceCompleteContains [ """ @@ -3246,7 +3171,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "AbstractClassAttribute" ] // should contain (top-level) [ "A"; "B" ] // should not contain (Foo) - [] + [] member public this.``Residues5``() = AssertCtrlSpaceCompleteContains [ "let x = 42" @@ -3254,7 +3179,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ". " // marker [ "CompareTo" ] // should contain (Int32) [ "CLIEventAttribute"; "Checked"; "Choice" ] // should not contain (top-level) - [] + [] member public this.``CompletionInDifferentEnvs1``() = AssertCtrlSpaceCompleteContains ["let f1 num =" @@ -3265,7 +3190,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["completeword"] // should contain [""] - [] + [] member public this.``CompletionInDifferentEnvs2``() = AssertCtrlSpaceCompleteContains ["let aaa = 1" @@ -3276,7 +3201,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["aaa"; "aab"] ["aac"] - [] + [] member public this.``CompletionInDifferentEnvs3``() = AssertCtrlSpaceCompleteContains ["let mb1 = new MailboxProcessor>(fun inbox -> async { let! msg = inbox.Receive()" @@ -3285,7 +3210,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["msg"] [] - [] + [] member public this.``CompletionInDifferentEnvs4``() = AssertCtrlSpaceCompleteContains ["async {" @@ -3305,7 +3230,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["b"] ["i"] - [] + [] member public this.``CompletionForAndBang_BaseLine0``() = AssertCtrlSpaceCompleteContains ["type Builder() =" @@ -3320,7 +3245,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["xxx3"] [] - [] + [] member public this.``CompletionForAndBang_BaseLine1``() = AssertCtrlSpaceCompleteContains ["type Builder() =" @@ -3337,7 +3262,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["xxx1"; "xxx2"; "xxx3"] [] - [] + [] member public this.``CompletionForAndBang_BaseLine2``() = /// Without closing '}' AssertCtrlSpaceCompleteContains @@ -3354,7 +3279,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["yyy1"; "yyy2"; "yyy3"] [] - [] + [] member public this.``CompletionForAndBang_BaseLine3``() = /// Without closing ')' AssertCtrlSpaceCompleteContains @@ -3371,7 +3296,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["zzz1"; "zzz2"; "zzz3"] [] - [] + [] member public this.``CompletionForAndBang_BaseLine4``() = AssertCtrlSpaceCompleteContains ["type Builder() =" @@ -3386,7 +3311,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["zzz1"; "zzz3"] [] - [] + [] member public this.``CompletionForAndBang_Test_MergeSources_Bind_Return0``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3404,7 +3329,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["xxx3"; "xxx4"] [] - [] + [] member public this.``CompletionForAndBang_Test_MergeSources_Bind_Return1``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3424,7 +3349,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["xxx1"; "xxx2"; "xxx3"; "xxx4"] [] - [] + [] member public this.``CompletionForAndBang_Test_MergeSources_Bind_Return2``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3443,7 +3368,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["yyy1"; "yyy2"; "yyy3"; "yyy4"] [] - [] + [] member public this.``CompletionForAndBang_Test_MergeSources_Bind_Return3``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3462,7 +3387,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["zzz1"; "zzz2"; "zzz3"; "zzz4"] [] - [] + [] member public this.``CompletionForAndBang_Test_MergeSources_Bind_Return4``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3480,7 +3405,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["zzz1"; "zzz3"; "zzz4"] [] - [] + [] member public this.``CompletionForAndBang_Test_Bind2Return0``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3496,7 +3421,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["xxx3"; "xxx4"] [] - [] + [] member public this.``CompletionForAndBang_Test_Bind2Return1``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3514,7 +3439,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["xxx1"; "xxx2"; "xxx3"; "xxx4"] [] - [] + [] member public this.``CompletionForAndBang_Test_Bind2Return2``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3531,7 +3456,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["yyy1"; "yyy2"; "yyy3"; "yyy4"] [] - [] + [] member public this.``CompletionForAndBang_Test_Bind2Return3``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3548,7 +3473,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["zzz1"; "zzz2"; "zzz3"; "zzz4"] [] - [] + [] member public this.``CompletionForAndBang_Test_Bind2Return4``() = AssertCtrlSpaceCompleteContainsWithOtherFlags "/langversion:preview" @@ -3565,7 +3490,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] (**) - [] + [] member public this.``Bug229433.AfterMismatchedParensCauseWeirdParseTreeAndExceptionDuringTypecheck``() = AssertAutoCompleteContains [ """ type T() = @@ -3588,7 +3513,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Bar"; "X" ] [] - [] + [] member public this.``Bug130733.LongIdSet.CtrlSpace``() = AssertCtrlSpaceCompleteContains [ """ type C() = @@ -3600,7 +3525,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.LongIdSet.Dot``() = AssertAutoCompleteContains [ """ type C() = @@ -3612,7 +3537,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.ExprDotSet.CtrlSpace``() = AssertCtrlSpaceCompleteContains [ """ type C() = @@ -3624,7 +3549,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.ExprDotSet.Dot``() = AssertAutoCompleteContains [ """ type C() = @@ -3637,7 +3562,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] - [] + [] member public this.``Bug130733.Nested.LongIdSet.CtrlSpace``() = AssertCtrlSpaceCompleteContains [ """ type C() = @@ -3650,7 +3575,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.Nested.LongIdSet.Dot``() = AssertAutoCompleteContains [ """ type C() = @@ -3663,7 +3588,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.Nested.ExprDotSet.CtrlSpace``() = AssertCtrlSpaceCompleteContains [ """ type C() = @@ -3676,7 +3601,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.Nested.ExprDotSet.Dot``() = AssertAutoCompleteContains [ """ type C() = @@ -3689,7 +3614,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug130733.NamedIndexedPropertyGet.Dot``() = AssertAutoCompleteContains [ """ let str = "foo" @@ -3698,7 +3623,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // char [] - [] + [] member public this.``Bug130733.NamedIndexedPropertyGet.CtrlSpace``() = AssertCtrlSpaceCompleteContains [ """ let str = "foo" @@ -3707,7 +3632,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // char [] - [] + [] member public this.``Bug230533.NamedIndexedPropertySet.CtrlSpace.Case1``() = AssertCtrlSpaceCompleteContains [ """ type Foo() = @@ -3721,7 +3646,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "MutableInstanceIndexer" ] [] - [] + [] member public this.``Bug230533.NamedIndexedPropertySet.CtrlSpace.Case2``() = AssertCtrlSpaceCompleteContains [ """ type Foo() = @@ -3737,7 +3662,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "MutableInstanceIndexer" ] [] - [] + [] member public this.``Bug230533.ExprDotSet.CtrlSpace.Case1``() = AssertCtrlSpaceCompleteContains [ """ type C() = @@ -3750,7 +3675,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Bug230533.ExprDotSet.CtrlSpace.Case2``() = AssertCtrlSpaceCompleteContains [ """ type C() = @@ -3763,21 +3688,21 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "XX" ] [] - [] + [] member public this.``Attribute.WhenAttachedToLet.Bug70080``() = this.AutoCompleteBug70080Helper @" open System [] + [] member public this.``Attribute.WhenAttachedToType.Bug70080``() = this.AutoCompleteBug70080Helper(@" open System [] + [] member public this.``Attribute.WhenAttachedToLetInNamespace.Bug70080``() = this.AutoCompleteBug70080Helper @" namespace Foo @@ -3785,7 +3710,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] + [] member public this.``Attribute.WhenAttachedToTypeInNamespace.Bug70080``() = this.AutoCompleteBug70080Helper(@" namespace Foo @@ -3793,7 +3718,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] + [] member public this.``Attribute.WhenAttachedToNothingInNamespace.Bug70080``() = this.AutoCompleteBug70080Helper(@" namespace Foo @@ -3801,7 +3726,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] + [] member public this.``Attribute.WhenAttachedToModuleInNamespace.Bug70080``() = this.AutoCompleteBug70080Helper(@" namespace Foo @@ -3810,7 +3735,7 @@ let x = query { for bbbb in abbbbc(*D0*) do module Foo = let x = 42") - [] + [] member public this.``Attribute.WhenAttachedToModule.Bug70080``() = this.AutoCompleteBug70080Helper(@" open System @@ -3818,7 +3743,7 @@ let x = query { for bbbb in abbbbc(*D0*) do module Foo = let x = 42") - [] + [] member public this.``Identifer.InMatchStatement.Bug72595``() = // in this bug, "match blah with let" caused the lexfilter to go awry, which made things hopeless for the parser, yielding no parse tree and thus no intellisense AssertAutoCompleteContains @@ -3842,7 +3767,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Chars" ] // should contain [ ] // should not contain - [] + [] member public this.``HandleInlineComments1``() = AssertAutoCompleteContains [ "let rrr = System (* boo! *) . Int32 . MaxValue" ] @@ -3850,7 +3775,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Int32"] [ "abs" ] // should not contain (top-level) - [] + [] member public this.``HandleInlineComments2``() = AssertAutoCompleteContains [ "let rrr = System (* boo! *) . Int32 . MaxValue" ] @@ -3858,7 +3783,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "MaxValue" ] // should contain [ "abs" ] // should not contain (top-level) - [] + [] member public this.``OpenNamespaceOrModule.CompletionOnlyContainsNamespaceOrModule.Case1``() = AssertAutoCompleteContains [ "open System." ] @@ -3866,7 +3791,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Collections" ] // should contain (namespace) [ ] // should not contain - [] + [] member public this.``OpenNamespaceOrModule.CompletionOnlyContainsNamespaceOrModule.Case2``() = AssertAutoCompleteContains [ "open Microsoft.FSharp.Collections.Array." ] @@ -3874,7 +3799,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Parallel" ] // should contain (module) [ "map" ] // should not contain (let-bound value) - [] + [] member public this.``BY_DESIGN.CommonScenarioThatBegsTheQuestion.Bug73940``() = AssertAutoCompleteContains [ @" @@ -3887,7 +3812,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ ] // should contain (ideally would be string) [ "Chars" ] // should not contain (documenting the undesirable behavior, that this does not show up) - [] + [] member public this.``BY_DESIGN.ExplicitlyCloseTheParens.Bug73940``() = AssertAutoCompleteContains [ @" @@ -3903,7 +3828,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Chars" ] // should contain (string) [ ] // should not contain - [] + [] member public this.``BY_DESIGN.MismatchedParenthesesAreHardToRecoverFromAndHereIsWhy.Bug73940``() = AssertAutoCompleteContains [ @" @@ -3920,7 +3845,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Chars" ] // should not contain (string) (* - [] + [] member public this.``AutoComplete.Bug72596_A``() = AssertAutoCompleteContains [ "type ClassType() =" @@ -3930,7 +3855,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "foo" ] // should not contain - [] + [] member public this.``AutoComplete.Bug72596_B``() = AssertAutoCompleteContains [ "let f() =" @@ -3940,7 +3865,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "foo" ] // should not contain *) - [] + [] member public this.``Expression.MultiLine.Bug66705``() = AssertAutoCompleteContains [ "let x = 4" @@ -3950,7 +3875,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "ToString" ] // should contain [ ] // should not contain - [] + [] member public this.``Expressions.Computation``() = AssertAutoCompleteContains [ @@ -3962,7 +3887,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Next" ] // should contain [ "GetEnumerator" ] // should not contain - [] + [] member public this.``Identifier.DefineByVal.InFsiFile.Bug882304_1``() = AutoCompleteInInterfaceFileContains [ @@ -3974,7 +3899,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ ] // should contain [ "Equals" ] // should not contain - [] + [] member public this.``NameSpace.InFsiFile.Bug882304_2``() = AutoCompleteInInterfaceFileContains [ @@ -3989,7 +3914,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ] // should contain [ ] // should not contain - [] + [] member public this.``CLIEvents.DefinedInAssemblies.Bug787438``() = AssertAutoCompleteContains [ "let mb = new MailboxProcessor(fun _ -> ())" @@ -3998,7 +3923,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Error" ] // should contain [ "add_Error"; "remove_Error" ] // should not contain - [] + [] member public this.CLIEventsWithByRefArgs() = AssertAutoCompleteContains [ "type MyDelegate = delegate of obj * string byref -> unit" @@ -4009,7 +3934,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "add_myEvent"; "remove_myEvent" ] // should contain [ "myEvent" ] // should not contain - [] + [] member public this.``Identifier.AfterParenthesis.Bug835276``() = AssertAutoCompleteContains [ "let f ( s : string ) =" @@ -4021,7 +3946,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Length" ] // should contain [ ] // should not contain - [] + [] member public this.``Identifier.AfterParenthesis.Bug6484_1``() = AssertAutoCompleteContains [ "for x in 1..10 do" @@ -4030,7 +3955,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // should contain (a method on the 'int' type) [ ] // should not contain - [] + [] member public this.``Identifier.AfterParenthesis.Bug6484_2``() = AssertAutoCompleteContains [ "for x = 1 to 10 do" @@ -4039,7 +3964,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "CompareTo" ] // should contain (a method on the 'int' type) [ ] // should not contain - [] + [] member public this.``Type.Indexers.Bug4898_1``() = AssertAutoCompleteContains [ @@ -4052,7 +3977,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "ToString" ] // should contain [ "Value" ] // should not contain - [] + [] member public this.``Type.Indexers.Bug4898_2``() = AssertAutoCompleteContains [ @@ -4070,7 +3995,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "ToString" ] // should contain [ "Chars" ] // should not contain - [] + [] member public this.``Expressions.Sequence``() = AssertAutoCompleteContains [ @@ -4079,7 +4004,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "GetEnumerator" ] // should contain [ ] // should not contain - [] + [] member public this.``LambdaExpression.WithoutClosing.Bug1346``() = AssertAutoCompleteContains [ @@ -4093,7 +4018,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Length" ] // should contain [ ] // should not contain - [] + [] member public this.``LambdaExpression.WithoutClosing.Bug1346c``() = AssertAutoCompleteContains [ @@ -4107,7 +4032,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Length" ] // should contain [ ] // should not contain - [] + [] member public this.``LambdaExpression.WithoutClosing.Bug1346b``() = AssertAutoCompleteContains [ @@ -4122,7 +4047,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Length" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.If_A``() = AssertAutoCompleteContains [ @@ -4132,7 +4057,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.If_C``() = AssertAutoCompleteContains [ @@ -4143,7 +4068,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.Try_A``() = AssertAutoCompleteContains [ @@ -4153,7 +4078,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.Try_B``() = AssertAutoCompleteContains [ @@ -4163,7 +4088,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.Try_C``() = AssertAutoCompleteContains [ @@ -4173,7 +4098,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.Try_D``() = AssertAutoCompleteContains [ @@ -4184,7 +4109,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.Match_A``() = AssertAutoCompleteContains [ @@ -4194,7 +4119,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteStatement.Match_C``() = AssertAutoCompleteContains [ @@ -4205,7 +4130,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [ "Contains" ] // should contain [ ] // should not contain - [] + [] member public this.``IncompleteIfClause.Bug4594``() = AssertCtrlSpaceCompleteContains [ "let Bar(xyz) ="; @@ -4219,7 +4144,7 @@ let x = query { for bbbb in abbbbc(*D0*) do (* dot completions on them *) // Obsolete and CompilerMessage(IsError=true) should not appear. - [] + [] member public this.``ObsoleteAndOCamlCompatDontAppear``() = let code= [ @@ -4287,28 +4212,28 @@ let x = query { for bbbb in abbbbc(*D0*) do // 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') - [] + [] member public this.``Obsolete.TopLevelModule``() = this.AutoCompleteObsoleteTest "level <- O" false [ "None" ] [ "ObsoleteTop"; "Chars" ] - [] + [] member public this.``Obsolete.NestedTypeOrModule``() = this.AutoCompleteObsoleteTest "level <- Module" true [ "Other" ] [ "ObsoleteM"; "ObsoleteT"; "Chars" ] - [] + [] member public this.``Obsolete.CompletionOnObsoleteModule.Bug3992``() = this.AutoCompleteObsoleteTest "level <- Module.ObsoleteM" true [ "A" ] [ "ObsoleteNested"; "Chars" ] - [] + [] member public this.``Obsolete.DoubleNested``() = this.AutoCompleteObsoleteTest "level <- Module.ObsoleteM.ObsoleteNested" true [ "C" ] [ "Chars" ] - [] + [] member public this.``Obsolete.CompletionOnObsoleteType``() = this.AutoCompleteObsoleteTest "level <- Module.ObsoleteT" true [ "B" ] [ "Chars" ] /// BUG: Referencing a nonexistent DLL caused an assert. - [] + [] member public this.``WithNonExistentDll``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -4365,7 +4290,7 @@ let x = query { for bbbb in abbbbc(*D0*) do // This is some tag in the tooltip that also contains the overload name text if descr.Contains("[Signature:") then occurrences - 1 else occurrences - [] + [] member public this.``Duplicates.Bug4103b``() = for args in [ "Test.", "foo", "foo"; @@ -4378,7 +4303,7 @@ let x = query { for bbbb in abbbbc(*D0*) do "TestType.", "Event", "TestType.Event" ] do this.AutoCompleteDuplicatesTest args - [] + [] member public this.``Duplicates.Bug4103c``() = let code = [ @@ -4394,7 +4319,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let occurrences = this.CountMethodOccurrences(descrFunc(), "File.Open") AssertEqualWithMessage(3, occurrences, "Found wrong number of overloads for 'File.Open'.") - [] + [] member public this.``Duplicates.Bug2094``() = let code = [ @@ -4409,7 +4334,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let occurrences = this.CountMethodOccurrences(descrFunc(), "Start") AssertEqualWithMessage(2, occurrences, sprintf "Found wrong number of overloads for 'MailboxProcessor.Start'. Found %A." completions) - [] + [] member public this.``WithinMatchClause.Bug1603``() = let code = [ @@ -4424,11 +4349,11 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"let y = xx.") let completions = AutoCompleteAtCursor file // Should contain something - Assert.AreNotEqual(0,completions.Length) - Assert.IsTrue(completions |> Array.exists (fun (CompletionItem(name,_,_,_,_)) -> name.Contains("AddMilliseconds"))) + Assert.NotEqual(0,completions.Length) + Assert.True(completions |> Array.exists (fun (CompletionItem(name,_,_,_,_)) -> name.Contains("AddMilliseconds"))) // 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() @@ -4462,8 +4387,7 @@ let x = query { for bbbb in abbbbc(*D0*) do gpatcc.AssertExactly(notAA[file2], notAA[file2;file3]) /// FEATURE: References added to the project bring corresponding new .NET and F# items into scope. - [] - [] + [] member public this.``AfterAssemblyReferenceAdded``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -4476,18 +4400,17 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"System.Deployment.Application.") let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions - Assert.AreEqual(0, completions.Length) // Expect none here because reference hasn't been added. + 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.AreNotEqual(0, completions.Length, "Expected some items in the list after adding a reference.") + Assert.NotEqual(0, completions.Length) /// FEATURE: Updating the active project configuration influences the language service - [] - [] + [] member public this.``AfterUpdateProjectConfiguration``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -4505,17 +4428,16 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"System.Deployment.Application.") let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions - Assert.AreEqual(0, completions.Length) // Expect none here because reference hasn't been added. + 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.AreNotEqual(0, completions.Length, "Expected some items in the list after updating configuration.") + Assert.NotEqual(0, completions.Length) /// FEATURE: Updating the active project platform influences the language service - [] - [] + [] member public this.``AfterUpdateProjectPlatform``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -4534,16 +4456,16 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"System.Deployment.Application.") let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions - Assert.AreEqual(0, completions.Length) // Expect none here because reference hasn't been added. + 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.AreNotEqual(0, completions.Length, "Expected some items in the list after updating platform.") + 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() let solution = this.CreateSolution() @@ -4556,16 +4478,16 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"System.Deployment.Application.") let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions - Assert.AreEqual(0, completions.Length) // Expect none here because reference hasn't been added. + 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.AreNotEqual(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.") *) /// In this bug, a bogus flag caused the rest of flag parsing to be ignored. - [] + [] member public this.``FlagsAndSettings.Bug1969``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -4580,30 +4502,29 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"System.Deployment.Application.") let completions = AutoCompleteAtCursor(file) // printf "Completions=%A\n" completions - Assert.AreEqual(0, completions.Length) // Expect none here because reference hasn't been added. + Assert.Equal(0, completions.Length) // Expect none here because reference hasn't been added. // Add an unknown flag followed by the reference to our assembly. let deploymentAssembly = sprintf @"%s\Microsoft.NET\Framework\v4.0.30319\System.Deployment.dll" (System.Environment.GetEnvironmentVariable("windir")) SetOtherFlags(project,"--doo-da -r:" + deploymentAssembly) let completions = AutoCompleteAtCursor(file) // Now, make sure the reference added after the erroneous reference is still honored. - Assert.AreNotEqual(0, completions.Length, "Expected some items in the list after adding a reference.") + Assert.NotEqual(0, completions.Length) ShowErrors(project) /// In this bug there was an exception if the user pressed dot after a long identifier /// that was unknown. - [] - [] + [] member public this.``OfSystemWindows``() = let code = ["let y=new System.Windows."] let (_, _, file) = this.CreateSingleFileProject(code, references = ["System.Windows.Forms"]) MoveCursorToEndOfMarker(file,"System.Windows.") let completions = AutoCompleteAtCursor(file) printfn "Completions=%A" completions - Assert.AreEqual(3, completions.Length) + Assert.Equal(3, completions.Length) /// Tests whether we're correctly showing both type and module when they have the same name - [] + [] member public this.``ShowSetAsModuleAndType``() = let code = ["let s = Set"] let (_, _, file) = this.CreateSingleFileProject(code) @@ -4619,16 +4540,16 @@ let x = query { for bbbb in abbbbc(*D0*) do Assert.Fail("'Set' not found in the completion list") /// FEATURE: The user may type namespace followed by dot and see a completion list containing members of that namespace. - [] + [] member public this.``AtNamespaceDot``() = let code = ["let y=new System.String()"] let (_, _, file) = this.CreateSingleFileProject(code) MoveCursorToEndOfMarker(file,"System.") let completions = AutoCompleteAtCursor(file) - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) /// FEATURE: The user will see appropriate glyphs in the autocompletion list. - [] + [] member public this.``OfSeveralModuleMembers``() = let code = [ @@ -4670,7 +4591,7 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file," Module.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) for completion in completions do match completion with | CompletionItem("A",_,_,_,DeclarationType.EnumMember) -> () @@ -4700,7 +4621,7 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"AbbreviationModule.") let completions = time1 AutoCompleteAtCursor file "Time of second autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) for completion in completions do match completion with | CompletionItem("Int32",_,_,_,_) @@ -4722,7 +4643,7 @@ let x = query { for bbbb in abbbbc(*D0*) do | CompletionItem("TupleTypeAbbreviation",_,_,_,_) -> () | CompletionItem(name,_,_,_,x) -> failwith (sprintf "Unexpected union member %s seen with declaration type %A" name x) - [] + [] member public this.ListFunctions() = let code = [ @@ -4733,7 +4654,7 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"List.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) for completion in completions do match completion with | CompletionItem("Cons",_,_,_,DeclarationType.Method) -> () @@ -4743,7 +4664,7 @@ let x = query { for bbbb in abbbbc(*D0*) do | CompletionItem(_,_,_,_,DeclarationType.Method) -> () | CompletionItem(name,_,_,_,x) -> failwith (sprintf "Unexpected item %s seen with declaration type %A" name x) - [] + [] member public this.``SystemNamespace``() = let code = [ @@ -4753,7 +4674,7 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"System.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) let AssertIsDecl(name,decl,expected) = if decl<>expected then failwith (sprintf "Expected %A for %s but was %A" expected name decl) @@ -4765,7 +4686,7 @@ let x = query { for bbbb in abbbbc(*D0*) do | _ -> () // If there is a compile error that prevents a data tip from resolving then show that data tip. - [] + [] member public this.``MemberInfoCompileErrorsShowInDataTip``() = let code = [ @@ -4779,7 +4700,7 @@ let x = query { for bbbb in abbbbc(*D0*) do use scope = AutoCompleteMemberDataTipsThrowsScope(this.VS, "Simulated compiler error") let completions = time1 CtrlSpaceCompleteAtCursor file "Time of first autocomplete." - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) for completion in completions do let (CompletionItem(_,_,_,descfunc,_)) = completion let desc = descfunc() @@ -4787,7 +4708,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertContains(desc,"Simulated compiler error") // Bunch of crud in empty list. This test asserts that unwanted things don't exist at the top level. - [] + [] member public this.``Editor.WithoutContext.Bug986``() = let code = ["(*mark*)"] let (_,_, file) = this.CreateSingleFileProject(code) @@ -4800,17 +4721,17 @@ let x = query { for bbbb in abbbbc(*D0*) do | CompletionItem("ICorRuntimeHost" as s,_,_,_,_) -> failwith (sprintf "Unexpected item %s at top level." s) | _ -> () - [] + [] member public this.``LetBind.TopLevel.Bug1650``() = let code =["let x = "] let (_,_, file) = this.CreateSingleFileProject(code) let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToEndOfMarker(file,"let x = ") let completions = time1 CtrlSpaceCompleteAtCursor file "Time of first autocomplete." - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) gpatcc.AssertExactly(0,0) - [] + [] member public this.``Identifier.Invalid.Bug876b``() = let code = [ @@ -4822,9 +4743,9 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"x.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." ShowErrors(project) - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) - [] + [] member public this.``Identifier.Invalid.Bug876c``() = let code = [ @@ -4834,9 +4755,9 @@ let x = query { for bbbb in abbbbc(*D0*) do let (_,_, file) = this.CreateSingleFileProject(code, references = ["System"; "System.Drawing"; "System.Windows.Forms"]) MoveCursorToEndOfMarker(file,"x.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) - [] + [] member public this.``EnumValue.Bug2449``() = let code = [ @@ -4849,7 +4770,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." AssertCompListDoesNotContain(completions, "value__") - [] + [] member public this.``EnumValue.Bug4044``() = let code = [ @@ -4866,7 +4787,7 @@ let x = query { for bbbb in abbbbc(*D0*) do /// There was a bug (2584) that IntelliSense should treat 'int' as a type instead of treating it as a function /// However, this is now deprecated behavior. We want the user to use 'System.Int32' and /// we generally prefer information from name resolution (also see 4405) - [] + [] member public this.``PrimTypeAndFunc``() = let code = [ @@ -4883,7 +4804,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertCompListDoesNotContain(completions,"MinValue") /// This is related to Bug1605--since the file couldn't parse there was no information to provide the autocompletion list. - [] + [] member public this.``MatchStatement.Clause.AfterLetBinds.Bug1603``() = let code = [ @@ -4898,7 +4819,7 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"xs -> f xs.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) let mutable count = 0 @@ -4915,10 +4836,10 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertIsDecl(name,decl,DeclarationType.Property) | CompletionItem(name,_,_,_,x) -> () - Assert.AreEqual(2,count) + Assert.Equal(2,count) // This was a bug in which the third level of dotting was ignored. - [] + [] member public this.``ThirdLevelOfDotting``() = let code = [ @@ -4928,7 +4849,7 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"Console.Wr") let completions = time1 CtrlSpaceCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) let AssertIsDecl(name,decl,expected) = if decl<>expected then failwith (sprintf "Expected %A for %s but was %A" expected name decl) @@ -4940,7 +4861,7 @@ let x = query { for bbbb in abbbbc(*D0*) do | CompletionItem(name,_,_,_,x) -> () // Test completions in an incomplete computation expression (case 1: for "let") - [] + [] member public this.``ComputationExpressionLet``() = let code = [ @@ -4953,7 +4874,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." AssertCompListContainsAll(completions, ["Next"]) - [] + [] member public this.``BestMatch.Bug4320a``() = let code = [ " let x = System." ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -4975,7 +4896,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertEqual(Some ("GCCollectionMode", true, true), Match "GCC" (Some "GC")) AssertEqual(Some ("GCCollectionMode", false, false), Match "GCCZ" (Some "GC")) - [] + [] member public this.``BestMatch.Bug4320b``() = let code = [ " let x = List." ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -4987,7 +4908,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertEqual(Some ("empty", false, true), Match "e") AssertEqual(Some ("empty", true, true), Match "em") - [] + [] member public this.``BestMatch.Bug5131``() = let code = [ "System.Environment." ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -4998,7 +4919,7 @@ let x = query { for bbbb in abbbbc(*D0*) do // isPrefix=true means it will be selected, instead of just outlined AssertEqual(Some ("OSVersion", true, true), Match "o") - [] + [] member public this.``COMPILED.DefineNotPropagatedToIncrementalBuilder``() = use _guard = this.UsingNewVS() @@ -5026,10 +4947,10 @@ let x = query { for bbbb in abbbbc(*D0*) do let completionItems = AutoCompleteAtCursor(file) |> Array.map (fun (CompletionItem(name, _, _, _, _)) -> name) - Assert.AreEqual(1, completionItems.Length, "Expected 1 item in the list") - Assert.AreEqual("x", completionItems.[0], "Expected 'x' in the list") + Assert.Equal(1, completionItems.Length) + Assert.Equal("x", completionItems.[0]) - [] + [] 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 @@ -5048,17 +4969,16 @@ let x = query { for bbbb in abbbbc(*D0*) do MoveCursorToEndOfMarker(file,"x.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) this.CloseSolution(solution) let project,solution = OpenExistingProject(this.VS, dir, projName) let file = List.item 0 (GetOpenFiles(project)) MoveCursorToEndOfMarker(file,"x.") let completions = time1 AutoCompleteAtCursor file "Time of first autocomplete." // printf "Completions=%A\n" completions - Assert.IsTrue(completions.Length>0) + Assert.True(completions.Length>0) - [] - [] + [] member this.``BadCompletionAfterQuicklyTyping.Bug72561``() = let code = [ " " ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -5079,8 +4999,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertCompListDoesNotContainAny(completions, ["AbstractClassAttribute"]) gpatcc.AssertExactly(0,0) - [] - [] + [] member this.``BadCompletionAfterQuicklyTyping.Bug72561.Noteworthy.NowWorks``() = let code = [ "123 " ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -5102,8 +5021,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertCompListDoesNotContainAny(completions, ["AbstractClassAttribute"]) gpatcc.AssertExactly(0,0) - [] - [] + [] member this.``BadCompletionAfterQuicklyTyping.Bug130733.NowWorks``() = let code = [ "let someCall(x) = null" "let xe = someCall(System.IO.StringReader() "] @@ -5167,7 +5085,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let completions = CtrlSpaceCompleteAtCursor(file) AssertEqual(0,completions.Length) - [] + [] member this.``Expression.WithoutPreDefinedMethods``() = this.VerifyCtrlSpaceListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -5175,7 +5093,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*HERE*)", list = ["FSharpDelegateEvent"; "PrivateMethod"; "PrivateType"]) - [] + [] member this.``Expression.WithPreDefinedMethods``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -5193,7 +5111,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["PrivateField"; "PrivateMethod"; "PrivateType"]) // Regression for bug 2116 -- Consider making selected item in completion list case-insensitive - [] + [] member this.``CaseInsensitive``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -5210,7 +5128,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*Marker1*)", list = ["Xyzzy"; "xYzzy"; "xyZzy"; "xyzZy"; "xyzzY"]) - [] + [] member this.``Attributes.CanSeeOpenNamespaces.Bug268290.Case1``() = AssertCtrlSpaceCompleteContains [""" @@ -5222,7 +5140,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["AttributeUsage"] [] - [] + [] member this.``Selection``() = AssertCtrlSpaceCompleteContains [""" @@ -5234,7 +5152,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] // Regression test for 1653 -- Both the F# exception and the .NET exception representing it are shown in completion lists - [] + [] member this.``NoDupException.Postive``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -5242,7 +5160,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*MarkerException*)", list = ["MatchFailureException"]) - [] + [] member this.``DotNetException.Negative``() = this.VerifyCtrlSpaceListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -5251,7 +5169,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["MatchFailure"]) // Regression for bug 921 -- intellisense case-insensitive? - [] + [] member this.``CaseInsensitive.MapMethod``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -5261,8 +5179,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["map"]) //Regression for bug 69644 69654 Fsharp: no completion for an identifier when 'use'd inside an 'async' block - [] - [] + [] member this.``InAsyncAndUseBlock``() = this.VerifyCompListContainAllAtStartOfMarker( fileContents = """ @@ -5281,7 +5198,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*Marker1*)", list = ["reader"]) - [] + [] member this.``WithoutOpenNamespace``() = AssertCtrlSpaceCompleteContains [""" @@ -5293,7 +5210,7 @@ let x = query { for bbbb in abbbbc(*D0*) do [] // should ["Single"] // should not - [] + [] member this.``PrivateVisible``() = AssertCtrlSpaceCompleteContains [""" @@ -5315,7 +5232,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["fieldPrivate";"MethodPrivate";"TypePrivate"] [] - [] + [] member this.``InternalVisible``() = AssertCtrlSpaceCompleteContains [""" @@ -5336,8 +5253,7 @@ let x = query { for bbbb in abbbbc(*D0*) do ["fieldInternal";"MethodInternal";"TypeInternal"] // should [] // should not - [] - [] + [] // Verify that we display the correct list of Unit of Measure (Names) in the autocomplete window. // This also ensures that no UoM are accidentally added or removed. member public this.``UnitMeasure.UnitNames``() = @@ -5349,8 +5265,7 @@ let x = query { for bbbb in abbbbc(*D0*) do "ohm"; "pascal"; "second"; "siemens"; "sievert"; "tesla"; "volt"; "watt"; "weber";] // should contain; exact match [ ] // should not contain - [] - [] + [] // Verify that we display the correct list of Unit of Measure (Symbols) in the autocomplete window. // This also ensures that no UoM are accidentally added or removed. member public this.``UnitMeasure.UnitSymbols``() = @@ -5371,9 +5286,7 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertCompListContainsAll(completions, contained) gpatcc.AssertExactly(0,0) - [] - [] - [] + [] // Custom operators appear in Intellisense list after entering a valid query operator // on the previous line and invoking Intellisense manually // Including in a nested query @@ -5391,9 +5304,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "do ma", contained = [ "maxBy"; "maxByNullable"; ]) - [] - [] - [] + [] // Custom operators appear in Intellisense list after entering a valid query operator // on the previous line and invoking Intellisense manually // Including in a nested query @@ -5409,7 +5320,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "gro", contained = [ "groupBy"; "groupJoin"; "groupValBy";]) - [] + [] member this.``Namespace.System``() = this.VerifyDotCompListContainAllAtEndOfMarker( fileContents = """ @@ -5422,7 +5333,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "open System", list = [ "IO"; "Collections" ]) - [] + [] member this.``Identifier.String.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5434,7 +5345,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*usage*)", list = ["Chars"; "ToString"; "Length"; "GetHashCode"]) - [] + [] member this.``Identifier.String.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -5448,7 +5359,7 @@ let x = query { for bbbb in abbbbc(*D0*) do // Verify add_* methods show up for non-standard events. These are events // where the associated delegate type does not return "void" - [] + [] member this.``Event.NonStandard.PrefixMethods``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """System.AppDomain.CurrentDomain(*usage*)""", @@ -5457,28 +5368,28 @@ let x = query { for bbbb in abbbbc(*D0*) do // Verify the events do show up. An error is generated when they are used asking the user to use add_* and remove_* instead. // That is, they are legitimate name resolutions but do not pass type checking. - [] + [] member this.``Event.NonStandard.VerifyLegitimateNameShowUp``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "System.AppDomain.CurrentDomain(*usage*)", marker = "(*usage*)", list = ["AssemblyResolve"; "ReflectionOnlyAssemblyResolve"; "ResourceResolve"; "TypeResolve" ]) - [] + [] member this.``Array``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "let arr = [| for i in 1..10 -> i |](*Mexparray*)", marker = "(*Mexparray*)", list = ["Clone"; "IsFixedSize"]) - [] + [] member this.``List``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "let lst = [ for i in 1..10 -> i](*Mexplist*)", marker = "(*Mexplist*)", list = ["Head"; "Tail"]) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5490,7 +5401,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["Clone"]) // should contain method on array (result of M call) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test2``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5505,7 +5416,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["Clone"]) // should contain method on array (result of M call) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test3``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5520,7 +5431,7 @@ let x = query { for bbbb in abbbbc(*D0*) do - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test4``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5533,7 +5444,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["InterfaceMethods"]) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test5``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5545,7 +5456,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["GetEnumerator"]) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test6``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5557,7 +5468,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["AddHandler"]) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test7``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5569,7 +5480,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["Assembly"]) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test8``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5582,7 +5493,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["CompareTo"]) - [] + [] member public this.``ExpressionDotting.Regression.Bug187799.Test9``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5594,11 +5505,8 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*marker*)", list = ["CompareTo"]) - [] - [] - [] // This test case checks that autocomplete on the provided Type DOES NOT show System.Object members - [] + [] member this.``TypeProvider.EditorHideMethodsAttribute.Type.DoesnotContain``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -5608,10 +5516,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["Equals";"GetHashCode"], addtlRefAssy = [PathRelativeToTestAssembly(@"EditorHideMethodsAttribute.dll")]) - [] - [] - [] - [] + [] // This test case checks if autocomplete on the provided Type shows only the Event1 elements member this.``TypeProvider.EditorHideMethodsAttribute.Type.Contains``() = this.VerifyDotCompListContainAllAtStartOfMarker( @@ -5622,10 +5527,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["Event1"], addtlRefAssy = [PathRelativeToTestAssembly(@"EditorHideMethodsAttribute.dll")]) - [] - [] - [] - [] + [] // This test case checks if autocomplete on the provided Type shows the instance method IM1 member this.``TypeProvider.EditorHideMethodsAttribute.InstanceMethod.Contains``() = this.VerifyDotCompListContainAllAtStartOfMarker( @@ -5636,9 +5538,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["IM1"], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] // This test case checks that nested types show up only statically and not on instances member this.``TypeProvider.TypeContainsNestedType``() = // should have it here @@ -5657,10 +5557,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["SomeNestedType"], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] // This test case checks if autocomplete on the provided Event shows only the AddHandler/RemoveHandler elements member this.``TypeProvider.EditorHideMethodsAttribute.Event.Contain``() = this.VerifyDotCompListContainAllAtStartOfMarker( @@ -5671,9 +5568,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["AddHandler";"RemoveHandler"], addtlRefAssy = [PathRelativeToTestAssembly(@"EditorHideMethodsAttribute.dll")]) - [] - [] - [] + [] // This test case checks if autocomplete on the provided Method shows no elements // You can see this as a "negative case" (to check that the usage of the attribute on a method is harmless) member this.``TypeProvider.EditorHideMethodsAttribute.Method.Contain``() = @@ -5683,10 +5578,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*Marker*)", addtlRefAssy = [PathRelativeToTestAssembly(@"EditorHideMethodsAttribute.dll")]) - [] - [] - [] - [] + [] // This test case checks if autocomplete on the provided Property (the type of which is not synthetic) shows the usual elements... like GetType() // 1. I think it does not make sense to use this attribute on a synthetic property unless it's type is also synthetic (already covered) // 2. You can see this as a "negative case" (to check that the usage of the attribute is harmless) @@ -5698,7 +5590,7 @@ let x = query { for bbbb in abbbbc(*D0*) do list = ["GetType"; "Equals"], // just a couple of System.Object methods: we expect them to be there! addtlRefAssy = [PathRelativeToTestAssembly(@"EditorHideMethodsAttribute.dll")]) - [] + [] member this.CompListInDiffFileTypes() = let fileContents = """ val x:int = 1 @@ -5718,7 +5610,7 @@ let x = query { for bbbb in abbbbc(*D0*) do let completions = DotCompletionAtStartOfMarker file "(*MarkerInsideSourceFile*)" AssertCompListContainsAll(completions, ["CompareTo"; "Equals"]) - [] + [] member this.ConstrainedTypes() = let fileContents = """ type Pet() = @@ -5748,35 +5640,35 @@ let x = query { for bbbb in abbbbc(*D0*) do let completions = DotCompletionAtStartOfMarker file "(*Mconstrainedtoint*)" AssertCompListContainsAll(completions, ["ToString"]) - [] + [] member this.``Literal.Float``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "let myfloat = (42.0)(*Mconstantfloat*)", marker = "(*Mconstantfloat*)", list = ["GetType"; "ToString"]) - [] + [] member this.``Literal.String``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """let name = "foo"(*Mconstantstring*)""", marker = "(*Mconstantstring*)", list = ["Chars"; "Clone"]) - [] + [] member this.``Literal.Int``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "let typeint = (10)(*Mint*)", marker = "(*Mint*)", list = ["GetType";"ToString"]) - [] + [] member this.``Identifier.InLambdaExpression``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "let funcLambdaExp = fun (x:int)-> x(*MarkerinLambdaExp*)", marker = "(*MarkerinLambdaExp*)", list = ["ToString"; "Equals"]) - [] + [] member this.``Identifier.InClass``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5785,7 +5677,7 @@ let x = query { for bbbb in abbbbc(*D0*) do marker = "(*MarkerLetBindinClass*)", list = ["ToString"; "Equals"]) - [] + [] member this.``Identifier.InNestedLetBind``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = " @@ -5796,7 +5688,7 @@ let funcNestedLetBinding (x:int) = marker = "(*MarkerNestedLetBind*)", list = ["ToString"; "Equals"]) - [] + [] member this.``Identifier.InModule``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = " @@ -5806,7 +5698,7 @@ module ModuleLetBindIn = marker = "(*MarkerLetBindinModule*)", list = ["ToString"; "Equals"]) - [] + [] member this.``Identifier.InMatchStatement``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = " @@ -5819,7 +5711,7 @@ match x(*MarkerMatchStatement*) with marker = "(*MarkerMatchStatement*)", list = ["ToString"; "Equals"]) - [] + [] member this.``Identifier.InMatchClause``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = " @@ -5834,7 +5726,7 @@ let rec f l = marker = "(*MarkerMatchClause*)", list = ["Add";"Date"]) - [] + [] member this.``Expression.ListItem``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5844,7 +5736,7 @@ let rec f l = marker = "(*MarkerListItem*)", list = ["CompareTo"; "ToString"]) - [] + [] member this.``Expression.FunctionParameter``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5854,7 +5746,7 @@ let rec f l = marker = "(*MarkerParameter*)", list = ["CompareTo"; "ToString"]) - [] + [] member this.``Expression.Function``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5864,7 +5756,7 @@ let rec f l = marker = "(*MarkerFunction*)", list = ["CompareTo"; "ToString"]) - [] + [] member this.``Expression.RecordPattern``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5876,7 +5768,7 @@ let rec f l = marker = "(*MarkerRecordPattern*)", list = ["Value"; "ToString"]) - [] + [] member this.``Expression.2DArray``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5886,7 +5778,7 @@ let rec f l = marker = "(*Marker2DArray*)", list = ["ToString"]) - [] + [] member this.``Expression.LetBind``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5897,7 +5789,7 @@ let rec f l = marker = "(*MarkerContext1*)", list = ["CompareTo";"ToString"]) - [] + [] member this.``Expression.WhileLoop``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5908,14 +5800,14 @@ let rec f l = marker = "(*MarkerContext3*)", list = ["CompareTo";"ToString"]) - [] + [] member this.``Expression.List``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """[1;2](*MarkerList*) """, marker = "(*MarkerList*)", list = ["Head"; "Item"]) - [] + [] member this.``Expression.Nested.InLetBind``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5926,7 +5818,7 @@ let rec f l = marker = "(*MarkerNested1*)", list = ["Chars";"Length"]) - [] + [] member this.``Expression.Nested.InWhileLoop``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5937,7 +5829,7 @@ let rec f l = marker = "(*MarkerNested2*)", list = ["Chars";"Length"]) - [] + [] member this.``Expression.ArrayItem.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5947,7 +5839,7 @@ let rec f l = marker = "(*MarkerArrayIndexer*)", list = ["Chars";"Split"]) - [] + [] member this.``Expression.ArrayItem.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -5957,7 +5849,7 @@ let rec f l = marker = "(*MarkerArrayIndexer*)", list = ["IsReadOnly";"Rank"]) - [] + [] member this.``ObjInstance.InheritedClass.MethodsDefInBase``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5972,7 +5864,7 @@ let rec f l = marker = "(*Mderived*)", list = ["Name"; "dog"]) - [] + [] member this.``ObjInstance.AnonymousClass.MethodsDefInInterface``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -5993,7 +5885,7 @@ let rec f l = marker = "(*Mexpnewtype*)", list = ["DoStuff"; "DoStuff2"]) - [] + [] member this.``SimpleTypes.SystemTime``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6002,7 +5894,7 @@ let rec f l = marker = "(*Mstruct*)", list = ["AddDays"; "Date"]) - [] + [] member this.``SimpleTypes.Record``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6012,7 +5904,7 @@ let rec f l = marker = "(*Mrecord*)", list = ["DateOfBirth"; "Name"]) - [] + [] member this.``SimpleTypes.Enum``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6027,7 +5919,7 @@ let rec f l = marker = "(*Menum*)", list = ["GetType"; "ToString"]) - [] + [] member this.``SimpleTypes.DisUnion``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6043,7 +5935,7 @@ let rec f l = marker = "(*Mdiscriminatedunion*)", list = ["GetType"; "ToString"]) - [] + [] member this.``InheritedClass.BaseClassPrivateMethod.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -6069,7 +5961,7 @@ let rec f l = marker = "(*MUnShowPrivate*)", list = ["MethodPrivate";"fieldPrivate"]) - [] + [] member this.``InheritedClass.BaseClassPublicMethodAndProperty``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6095,14 +5987,14 @@ let rec f l = marker = "(*MShowPublic*)", list = ["MethodPublic";"fieldPublic"]) - [] + [] member this.``Visibility.InternalNestedClass.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """System.Console(*Marker1*)""", marker = "(*Marker1*)", list = ["ControlCDelegateData"]) - [] + [] member this.``Visibility.PrivateIdentifierInDiffModule.Negative``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6116,7 +6008,7 @@ let rec f l = Module1(*Marker1*) """, marker = "(*Marker1*)") - [] + [] member this.``Visibility.PrivateIdentifierInDiffClass.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -6133,7 +6025,7 @@ let rec f l = marker = "(*MarkerOutType*)", list = ["fieldPrivate";"MethodPrivate"]) - [] + [] member this.``Visibility.PrivateFieldInSameClass``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6150,7 +6042,7 @@ let rec f l = marker = "(*MarkerFieldInType*)", list = ["PrivateField"]) - [] + [] member this.``Visibility.PrivateMethodInSameClass``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6167,7 +6059,7 @@ let rec f l = marker = "(*MarkerMethodInType*)", list = ["PrivateMethod"]) -// [] +// [] member this.``VariableIdentifier.AsParameter``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6178,7 +6070,7 @@ let rec f l = marker = "(*Maftervariable1*)", list = ["Tag"]) - [] + [] member this.``VariableIdentifier.InMeasure.DefineInDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6202,7 +6094,7 @@ let rec f l = marker = "(*Maftervariable2*)", list = []) - [] + [] member this.``VariableIdentifier.MethodsInheritFromBase``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6221,7 +6113,7 @@ let rec f l = marker = "(*Maftervariable3*)", list = ["Name";"Speak"]) - [] + [] member this.``VariableIdentifier.AsParameter.DefineInDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6245,7 +6137,7 @@ let rec f l = marker = "(*Maftervariable4*)", list = ["DuType"]) - [] + [] member this.``VariableIdentifier.SystemNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6269,7 +6161,7 @@ let rec f l = marker = "(*Maftervariable5*)", list = ["BinaryReader";"Stream";"Directory"]) - [] + [] member this.``LongIdent.AsAttribute``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6279,7 +6171,7 @@ let rec f l = marker = "(*Mattribute*)", list = ["Obsolete"]) - [] + [] member this.``ImportStatement.System.ImportDirectly``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6288,7 +6180,7 @@ let rec f l = marker = "(*Mimportstatement1*)", list = ["Collections"]) - [] + [] member this.``ImportStatement.System.ImportAsIdentifier``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6297,7 +6189,7 @@ let rec f l = marker = "(*Mimportstatement2*)", list = ["IO"]) - [] + [] member this.``LongIdent.PatternMatch.AsVariable.DefFromDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6317,7 +6209,7 @@ let rec f l = marker = "(*Mpatternmatch1*)", list = ["Direction";"ToString"]) - [] + [] member this.``LongIdent.PatternMatch.AsConstantValue.DefFromDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6337,7 +6229,7 @@ let rec f l = marker = "(*Mpatternmatch2*)", list = ["longident"]) - [] + [] member this.``LongIdent.PInvoke.AsReturnType``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6358,7 +6250,7 @@ let rec f l = marker = "(*Mpinvokereturntype*)", list = ["Boolean";"Int32"]) - [] + [] member this.``LongIdent.PInvoke.AsAttribute``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6379,7 +6271,7 @@ let rec f l = marker = "(*Mpinvokeattribute*)", list = ["SomeAttrib"]) - [] + [] member this.``LongIdent.PInvoke.AsParameterType``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6392,7 +6284,7 @@ let rec f l = marker = "(*Mpinvokeparametertype*)", list = ["Boolean";"Int32"]) - [] + [] member this.``LongIdent.Record.AsField``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6405,7 +6297,7 @@ let rec f l = marker = "(*Mrecord*)", list = ["person"]) - [] + [] member this.``LongIdent.DiscUnion.AsTypeParameter.DefInDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6426,7 +6318,7 @@ let rec f l = marker = "(*Mtypeparameter1*)", list = ["Dog";"DuType"]) - [] + [] member this.``LongIdent.AnonymousFunction.AsTypeParameter.DefFromDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6447,7 +6339,7 @@ let rec f l = marker = "(*Mtypeparameter2*)", list = ["Tag"]) - [] + [] member this.``LongIdent.UnitMeasure.AsTypeParameter.DefFromDiffNamespace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6468,7 +6360,7 @@ let rec f l = marker = "(*Mtypeparameter3*)", list = []) - [] + [] member this.``RedefinedIdentifier.DiffScope.InScope.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6480,7 +6372,7 @@ let rec f l = marker = "(*MarkerShowLastOneWhenInScope*)", list = ["DayOfWeek"]) - [] + [] member this.``RedefinedIdentifier.DiffScope.InScope.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -6492,7 +6384,7 @@ let rec f l = marker = "(*MarkerShowLastOneWhenInScope*)", list = ["Chars"]) - [] + [] member this.``RedefinedIdentifier.DiffScope.OutScope.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6504,7 +6396,7 @@ let rec f l = marker = "(*MarkerShowLastOneWhenOutscoped*)", list = ["Chars"]) - [] + [] member this.``ObjInstance.ExtensionMethods.WithoutDef.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -6514,7 +6406,7 @@ let rec f l = marker = "(*MWithoutReference*)", list = ["NextDice";"DiceValue"]) - [] + [] member this.``Class.DefInDiffNameSpace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6546,7 +6438,7 @@ let rec f l = marker = "(*MarkerType*)" , list = ["TestType"]) - [] + [] member this.``Class.DefInDiffNameSpace.WithAttributes.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -6578,7 +6470,7 @@ let rec f l = marker = "(*MarkerType*)", list = ["ObsoleteType";"CompilerMessageType"]) - [] + [] member this.``Method.DefInDiffNameSpace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6611,7 +6503,7 @@ let rec f l = marker = "(*MarkerMethod*)", list = ["TestMethod"; "VisibleMethod";"VisibleMethod2"]) - [] + [] member this.``Method.DefInDiffNameSpace.WithAttributes.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -6642,7 +6534,7 @@ let rec f l = marker = "(*MarkerMethod*)", list = ["ObsoleteMethod";"CompilerMessageMethod";"HiddenMethod"]) - [] + [] member this.``ObjInstance.ExtensionMethods.WithDef.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6657,7 +6549,7 @@ let rec f l = marker = "(*MWithReference*)", list = ["NextDice";"DiceValue"]) - [] + [] member this.``Keywords.If``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6665,13 +6557,13 @@ let rec f l = () """, marker ="(*MarkerKeywordIf*)") - [] + [] member this.``Keywords.Let``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """let(*MarkerKeywordLet*) a = 1""", marker = "(*MarkerKeywordLet*)") - [] + [] member this.``Keywords.Match``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6679,31 +6571,31 @@ let rec f l = | pattern -> exp""", marker = "(*MarkerKeywordMatch*)") - [] + [] member this.``MacroDirectives.nowarn``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """#nowarn(*MarkerPreProcessNowarn*)""", marker = "(*MarkerPreProcessNowarn*)") - [] + [] member this.``MacroDirectives.light``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """#light(*MarkerPreProcessLight*)""", marker = "(*MarkerPreProcessLight*)") - [] + [] member this.``MacroDirectives.define``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """#define(*MarkerPreProcessDefine*)""", marker = "(*MarkerPreProcessDefine*)") - [] + [] member this.``MacroDirectives.PreProcessDefine``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """#define Foo(*MarkerPreProcessDefineConst*)""", marker = "(*MarkerPreProcessDefineConst*)") - [] + [] member this.``Identifier.InClass.WithoutDef``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6711,7 +6603,7 @@ let rec f l = val mutable x(*MarkerValue*) : string""", marker = "(*MarkerValue*)") - [] + [] member this.``Identifier.InDiscUnion.WithoutDef``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6719,31 +6611,31 @@ let rec f l = |Tag(*MarkerDU*) of int""", marker = "(*MarkerDU*)") - [] + [] member this.``Identifier.InRecord.WithoutDef``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """type Rec = { X(*MarkerRec*) : int }""", marker = "(*MarkerRec*)") - [] + [] member this.``Identifier.AsNamespace``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """namespace Namespace1(*MarkerNamespace*)""", marker = "(*MarkerNamespace*)") - [] + [] member this.``Identifier.AsModule``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """module Module1(*MarkerModule*)""", marker = "(*MarkerModule*)") - [] + [] member this.``Identifier.WithoutDef``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ abcd(*MarkerUndefinedIdentifier*) """, marker = "(*MarkerUndefinedIdentifier*)") - [] + [] member this.``Identifier.InMatch.UnderScore``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6754,7 +6646,7 @@ let rec f l = |_(*MarkerIdentifierIsUnderScore*) -> 0 """, marker = "(*MarkerIdentifierIsUnderScore*)") - [] + [] member this.MemberSelf() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6762,7 +6654,7 @@ let rec f l = member this(*Mmemberself*)""", marker = "(*Mmemberself*)") - [] + [] member this.``Expression.InComment``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6770,14 +6662,14 @@ let rec f l = //open IO = System(*Mcomment*)""", marker = "(*Mcomment*)") - [] + [] member this.``Expression.InString``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """let x = "System.Console(*Minstring*)" """, marker = "(*Minstring*)") // Regression test for 1067 -- Completion lists don't work after generic arguments - for generic functions and for static members of generic types - [] + [] member this.``Regression1067.InstanceOfGenericType``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6800,7 +6692,7 @@ let rec f l = marker = "(*Marker2*)", list = ["P"; "Q"]) - [] + [] member this.``Regression1067.ClassUsingGenericTypeAsAttribute``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6823,7 +6715,7 @@ let rec f l = marker = "(*Marker4*)", list = ["Assembly"; "FullName"; "GUID"]) - [] + [] member this.NoInfiniteLoopInProperties() = let fileContents = """ open System.Windows.Forms @@ -6837,7 +6729,7 @@ let rec f l = AssertCompListDoesNotContainAny(completions, ["Nodes"]) // Regression for bug 3225 -- Invalid intellisense when inside of a quotation - [] + [] member this.``Regression3225.Identifier.InQuotation``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6847,7 +6739,7 @@ let rec f l = list = ["Chars"; "Length"]) // Regression for bug 1911 -- No completion list of expr in match statement - [] + [] member this.``Regression1911.Expression.InMatchStatement``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6860,8 +6752,7 @@ let rec f l = // Bug 3627 - Completion lists should be filtered in many contexts // This blocks six testcases and is slated for Dev11, so these will be disabled for some time. - [] - [] + [] member this.AfterTypeParameter() = let fileContents = """ type Type1 = Tag of string(*MarkerDUTypeParam*) @@ -6890,7 +6781,7 @@ let rec f l = let completions = DotCompletionAtStartOfMarker file "(*MarkerParamTypeof*)" AssertCompListIsEmpty(completions) - [] + [] member this.``Identifier.AsClassName.InInitial``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6898,33 +6789,32 @@ let rec f l = val field: int""", marker = "(*MarkerType*)") - [] + [] member this.``Identifier.AsFunctionName.InInitial``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """let f2(*MarkerFunctionIdentifier*) x = x+1 """, marker = "(*MarkerFunctionIdentifier*)") - [] + [] member this.``Identifier.AsParameter.InInitial``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ let f3 x(*MarkerParam*) = x+1""", marker = "(*MarkerParam*)") - [] + [] member this.``Identifier.AsFunctionName.UsingFunKeyword``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """fun f4(*MarkerFunctionDeclaration*) x -> x+1""", marker = "(*MarkerFunctionDeclaration*)") - [] + [] member public this.``Identifier.EqualityConstraint.Bug65730``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """let g3<'a when 'a : equality> (x:'a) = x(*Marker*)""", marker = "(*Marker*)", list = ["Equals"; "GetHashCode"]) // equality constraint should make these show up - [] - [] + [] member this.``Identifier.InFunctionMatch``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6933,7 +6823,7 @@ let rec f l = | 2 -> printfn "2" """, marker = "(*MarkerFunctionMatch*)") - [] + [] member this.``Identifier.This``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6941,7 +6831,7 @@ let rec f l = member this(*MarkerMemberThis*).Foo () = 3""", marker = "(*MarkerMemberThis*)") - [] + [] member this.``Identifier.AsProperty``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -6949,7 +6839,7 @@ let rec f l = member this.Foo(*MarkerMemberThisProperty*) = 1""", marker = "(*MarkerMemberThisProperty*)") - [] + [] member this.``ExpressionPropertyAssignment.Bug217051``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6960,7 +6850,7 @@ let rec f l = marker = "(*Marker*)", list = ["Prop"]) - [] + [] member this.``ExpressionProperty.Bug234687``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -6971,8 +6861,7 @@ let rec f l = marker = "(*Marker*)", list = ["CodeBase"]) // expect instance properties of Assembly, not static Assembly methods - [] - [] + [] member this.NotShowAttribute() = let fileContents = """ open System @@ -6995,8 +6884,7 @@ let rec f l = let completions = DotCompletionAtStartOfMarker file "(*Mattribute2*)" AssertCompListIsEmpty(completions) - [] - [] + [] member this.NotShowPInvokeSignature() = let fileContents = """ //open System @@ -7035,7 +6923,7 @@ let rec f l = let completions = DotCompletionAtStartOfMarker file "(*Mparameterlist*)" AssertCompListIsEmpty(completions) - [] + [] member this.``Basic.Completion.UnfinishedLet``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7046,8 +6934,7 @@ let rec f l = marker = "(*Marker*)", list = ["CompareTo"]) - [] - [] + [] member this.``ShortFormSeqExpr.Bug229610``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7061,7 +6948,7 @@ let rec f l = list = ["Value"]) //Regression test for bug 69159 Fsharp: dot completion is mission for an array - [] + [] member this.``Array.InitialUsing..``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """let x1 = [| 0.0 .. 0.1 .. 10.0 |](*Marker*)""", @@ -7069,8 +6956,7 @@ let rec f l = list = ["Length";"Clone";"ToString"]) //Regression test for bug 65740 Fsharp: dot completion is mission after a '#' statement - [] - [] + [] member this.``Identifier.In#Statement``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7086,7 +6972,7 @@ let rec f l = //This test is about CompletionList which should be moved to completionList, it's too special to refactor. //Regression test for bug 72595 typing quickly yields wrong intellisense - [] + [] member this.``BadCompletionAfterQuicklyTyping``() = let code = [ " " ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -7105,7 +6991,7 @@ let rec f l = AssertCompListContainsAll(completions, ["Length"]) AssertCompListDoesNotContainAny(completions, ["AbstractClassAttribute"]) - [] + [] member this.``SelfParameter.InDoKeywordScope``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7115,7 +7001,7 @@ let rec f l = marker = "(*Marker*)", list = ["ToString"]) - [] + [] member this.``SelfParameter.InDoKeywordScope.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7125,7 +7011,7 @@ let rec f l = marker = "(*Marker*)", list = ["Value";"Contents"]) - [] + [] member this.``ReOpenNameSpace.StaticProperties``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7141,7 +7027,7 @@ let rec f l = marker = "(*Marker1*)", list = ["Prop";"Event"]) - [] + [] member this.``ReOpenNameSpace.EnumTypes``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7158,7 +7044,7 @@ let rec f l = marker = "(*Marker2*)", list = ["Foo"]) - [] + [] member this.``ReOpenNameSpace.SystemLibrary``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7171,7 +7057,7 @@ let rec f l = marker = "(*Marker3*)", list = ["Open"]) - [] + [] member this.``ReOpenNameSpace.FsharpQuotation``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7183,7 +7069,7 @@ let rec f l = marker = "(*Marker4*)", list = ["Value"]) - [] + [] member this.``ReOpenNameSpace.MailboxProcessor``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7195,7 +7081,7 @@ let rec f l = marker = "(*Marker6*)", list = ["Start"]) - [] + [] member this.``ReopenNamespace.Module``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7209,7 +7095,7 @@ let rec f l = marker = "(*Marker7*)", list = ["foo"]) - [] + [] member this.``Expression.InLetScope``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7224,7 +7110,7 @@ let rec f l = marker = "(*Marker1*)", list = ["IsFixedSize";"Initialize"]) - [] + [] member this.``Expression.InFunScope.FirstParameter``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7238,7 +7124,7 @@ let rec f l = marker = "(*Marker2*)", list = ["CompareTo"]) - [] + [] member this.``Expression.InFunScope.SecParameter``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7253,7 +7139,7 @@ let rec f l = marker = "(*Marker3*)", list = ["GetType";"ToString"]) - [] + [] member this.``Expression.InMatchWhenClause``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7269,7 +7155,7 @@ let rec f l = list = ["CompareTo";"ToString"]) //Regression test for bug 3223 in PS: No intellisense at point - [] + [] member this.``Identifier.InActivePattern.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7288,7 +7174,7 @@ let rec f l = marker = "(*Marker*)", list = ["Attributes";"CallingConvention";"ContainsGenericParameters"]) - [] + [] member this.``Identifier.InActivePattern.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7308,7 +7194,7 @@ let rec f l = list = ["Head";"ToInt"]) //Regression test of bug 2296:No completion lists on the direct results of a method call - [] + [] member this.``Regression2296.DirectResultsOfMethodCall``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7327,7 +7213,7 @@ let rec f l = marker = "(*Marker1*)", list = ["Attributes";"CallingConvention";"IsFamily"]) - [] + [] member this.``Regression2296.DirectResultsOfMethodCall.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7346,7 +7232,7 @@ let rec f l = marker = "(*Marker1*)", list = ["value__"]) - [] + [] member this.``Regression2296.Identifier.String.Reflection01``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7369,7 +7255,7 @@ let rec f l = marker = "(*Marker2*)", list = ["CompareTo";"GetType";"ToString"]) - [] + [] member this.``Regression2296.Identifier.String.Reflection01.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7392,7 +7278,7 @@ let rec f l = marker = "(*Marker2*)", list = ["value__"]) - [] + [] member this.``Regression2296.Identifier.String.Reflection02``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7416,7 +7302,7 @@ let rec f l = marker = "(*Marker3*)", list = ["CompareTo";"GetType";"ToString"]) - [] + [] member this.``Regression2296.Identifier.String.Reflection02.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7437,7 +7323,7 @@ let rec f l = marker = "(*Marker3*)", list = ["value__"]) - [] + [] member this.``Regression2296.System.StaticMethod.Reflection``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7462,7 +7348,7 @@ let rec f l = marker = "(*Marker4*)", list = ["CompareTo";"GetType";"ToString"]) - [] + [] member this.``Regression2296.System.StaticMethod.Reflection.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7487,7 +7373,7 @@ let rec f l = marker = "(*Marker4*)", list = ["value__"]) - [] + [] member this.``Seq.NearTheEndOfFile``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7501,8 +7387,7 @@ let rec f l = list = ["cache";"find"]) //Regression test of bug 3879: intellisense glitch for computation expression - [] - [] + [] member this.``ComputationExpression.WithClosingBrace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7520,8 +7405,7 @@ let rec f l = marker = "(*Marker*)", list = ["AsyncGetResponse";"GetResponseAsync";"ToString"]) - [] - [] + [] member this.``ComputationExpression.WithoutClosingBrace``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7540,7 +7424,7 @@ let rec f l = list = ["AsyncGetResponse";"GetResponseAsync";"ToString"]) //Regression Test of 4405:intellisense has wrong type for identifier, using most recently bound of same name rather than the one in scope? - [] + [] member this.``Regression4405.Identifier.ReBound``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7552,14 +7436,14 @@ let rec f l = list = ["Chars";"StartsWith"]) //Regression test for FSharp1.0:4702 - [] + [] member this.``Regression4702.SystemWord``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = "System(*Marker*)", marker = "(*Marker*)", list = ["Console";"Byte";"ArgumentException"]) - [] + [] member this.``TypeAbbreviation.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7569,7 +7453,7 @@ let rec f l = marker = "(*Marker1*)", list = ["int16";"int32";"int64"]) - [] + [] member this.``TypeAbbreviation.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7580,7 +7464,7 @@ let rec f l = list = ["Int16";"Int32";"Int64"]) //Regression test of bug 3754:tupe forwarder bug? intellisense bug? - [] + [] member this.``Regression3754.TypeOfListForward.Positive``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7604,7 +7488,7 @@ let rec f l = marker = "(*Marker*)", list = ["append";"choose";"isEmpty"]) - [] + [] member this.``Regression3754.TypeOfListForward.Negative``() = this.VerifyDotCompListDoesNotContainAnyAtStartOfMarker( fileContents = """ @@ -7628,8 +7512,7 @@ let rec f l = marker = "Marker", list = [""]) - [] - [] + [] member this.``NonApplicableExtensionMembersDoNotAppear.Bug40379``() = let code = [ "open System.Xml.Linq" @@ -7657,7 +7540,7 @@ let rec f l = let completions = AutoCompleteAtCursor file AssertCompListContainsAll(completions, ["Ancestors"; "AncestorsAndSelf"]) - [] + [] member this.``Visibility.InternalMethods.DefInSameAssembly``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7677,8 +7560,7 @@ let rec f l = marker = "(*MarkerSameAssemb*)", list = ["fieldInternal";"MethodInternal"]) - [] - [] + [] member this.``QueryExpression.DotCompletionSmokeTest1``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7689,8 +7571,7 @@ let rec f l = list = ["Chars";"Length"], addtlRefAssy=standard40AssemblyRefs) - [] - [] + [] member this.``QueryExpression.DotCompletionSmokeTest2``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7700,8 +7581,7 @@ let rec f l = list = ["Chars"; "Length"], addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member this.``QueryExpression.DotCompletionSmokeTest0``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7712,8 +7592,7 @@ let rec f l = addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member this.``QueryExpression.DotCompletionSmokeTest3``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7724,8 +7603,7 @@ let rec f l = addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member this.``QueryExpression.DotCompletionSystematic1``() = for customOperation in ["select";"sortBy";"where"] do let fileContentsList = @@ -7783,8 +7661,7 @@ let rec f l = list = ["Chars";"Length"], addtlRefAssy=standard40AssemblyRefs) - [] - [] + [] member public this.``QueryExpression.InsideJoin.Bug204147``() = this.VerifyDotCompListContainAllAtStartOfMarker( fileContents = """ @@ -7842,9 +7719,7 @@ let rec f l = let completions = DotCompletionAtStartOfMarker file2 marker AssertCompListContainsAll(completions, list) - [] - [] - [] + [] // Intellisense still appears on arguments when the operator is used in error member public this.``Query.HasErrors.Bug196230``() = this.AssertDotCompletionListInQuery( @@ -7862,10 +7737,8 @@ let rec f l = marker = "(*Marker*)", list = ["ProductID";"ProductName"] ) - [] - [] // Intellisense still appears on arguments when the operator is used in error - [] + [] member public this.``Query.HasErrors2``() = this.AssertDotCompletionListInQuery( fileContents = """ @@ -7879,9 +7752,7 @@ let rec f l = marker = "(*Marker*)", list = ["ProductID";"ProductName"] ) - [] - [] - [] + [] // Shadowed variables have correct Intellisense member public this.``Query.ShadowedVariables``() = this.AssertDotCompletionListInQuery( @@ -7897,9 +7768,7 @@ let rec f l = marker = "(*Marker*)", list = ["Category";"ProductName"] ) - [] - [] - [] + [] // Intellisense works correctly in a nested query member public this.``Query.InNestedQuery``() = let fileContents = """ @@ -7917,9 +7786,7 @@ let rec f l = this.VerifyDotCompListContainAllAtStartOfMarker(fileContents, "(*Marker2*)", ["Equals";"CompareTo"], queryAssemblyRefs ) - [] - [] - [] + [] // Intellisense works correctly in a nested expression within a lamda member public this.``Query.NestedExpressionWithinLamda``() = let fileContents = """ @@ -7935,7 +7802,7 @@ let rec f l = this.VerifyDotCompListContainAllAtStartOfMarker(fileContents, "(*Marker*)", ["Chars";"Length"], queryAssemblyRefs ) - [] + [] member this.``Verify no completion on dot after module definition``() = this.VerifyDotCompListIsEmptyAtStartOfMarker( fileContents = """ @@ -7945,7 +7812,7 @@ let rec f l = let bar = 1""", marker = "(*Marker*)") - [] + [] member this.``Verify no completion after module definition``() = this.VerifyCtrlSpaceCompListIsEmptyAtEndOfMarker( fileContents = """ @@ -7955,7 +7822,7 @@ let rec f l = let bar = 1""", marker = "module BasicTest ") - [] + [] member this.``Verify no completion in hash directives``() = this.VerifyCtrlSpaceCompListIsEmptyAtEndOfMarker( fileContents = """ @@ -7965,7 +7832,7 @@ let rec f l = let bar = 1""", marker = "(*Marker*)") - [] + [] member public this.``ExpressionDotting.Regression.Bug3709``() = this.VerifyCtrlSpaceListContainAllAtStartOfMarker( fileContents = """ @@ -7975,7 +7842,6 @@ let rec f l = list = ["EndsWith"]) // Context project system -[] 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 51a8e3f0856..b5cc13f4501 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorList.fs @@ -4,7 +4,7 @@ namespace Tests.LanguageService.ErrorList open System open System.IO -open NUnit.Framework +open Xunit open Microsoft.VisualStudio.FSharp open Salsa.Salsa open Salsa.VsOpsUtils @@ -13,14 +13,6 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -[] -type public AssemblyResolverTestFixture () = - - [] - member public _.Init () = AssemblyResolver.addResolver () - -[] -[] type UsingMSBuild() as this = inherit LanguageServiceBaseTests() @@ -55,7 +47,7 @@ type UsingMSBuild() as this = let assertContains (errors : list) text = let ok = errors |> List.exists (fun err -> err.Message = text) - Assert.IsTrue(ok, sprintf "Error list should contain '%s' 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") @@ -66,14 +58,7 @@ type UsingMSBuild() as this = |> normalizeCR let expected = expected |> String.concat Environment.NewLine |> normalizeCR - let message = - sprintf """ -=[ expected ]============ -%s -=[ actual ]============== -%s -=========================""" expected actual - Assert.AreEqual(expected, actual, message) + Assert.Equal(expected, actual) //verify the error list Count member private this.VerifyErrorListCountAtOpenProject(fileContents : string, num : int) = @@ -99,7 +84,7 @@ type UsingMSBuild() as this = TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let warnList = GetWarnings(project) - Assert.AreEqual(expectedNum,warnList.Length) + Assert.Equal(expectedNum,warnList.Length) //verify no the error list member private this.VerifyNoErrorListAtOpenProject(fileContents : string, ?addtlRefAssy : string list) = @@ -110,7 +95,7 @@ type UsingMSBuild() as this = for error in errorList do printfn "%A" error.Severity printf "%s\n" (error.ToString()) - Assert.IsTrue(errorList.IsEmpty) + Assert.True(errorList.IsEmpty) //Verify the error list contained the expected string member private this.VerifyErrorListContainedExpectedString(fileContents : string, expectedStr : string, ?addtlRefAssy : string list) = @@ -132,8 +117,7 @@ type UsingMSBuild() as this = else failwithf "The error list number is not the expected %d" num - [] - [] + [] member public this.``OverloadsAndExtensionMethodsForGenericTypes``() = let fileContent = """ @@ -153,13 +137,13 @@ let g (t : T) = t.Count() this.VerifyNoErrorListAtOpenProject(fileContent) - [] + [] member public this.``ErrorsInScriptFile``() = let (solution, project, file) = this.CreateSingleFileProject("", fileKind = SourceFileKind.FSX) let checkErrors expected = let l = List.length (GetErrors project) - Assert.AreEqual(expected, l, "Unexpected number of errors in error list") + Assert.Equal(expected, l) TakeCoffeeBreak(this.VS) checkErrors 0 @@ -179,8 +163,7 @@ let g (t : T) = t.Count() TakeCoffeeBreak(this.VS) checkErrors 0 - [] - [] + [] member public this.``LineDirective``() = use _guard = this.UsingNewVS() let fileContents = """ @@ -193,12 +176,12 @@ let g (t : T) = t.Count() let file = OpenFile(project, "File1.fs") let _ = OpenFile(project,"File2.fs") - Assert.IsFalse(Build(project).BuildSucceeded) + Assert.False(Build(project).BuildSucceeded) this.VerifyCountAtSpecifiedFile(project,1) VerifyErrorListContainedExpectedStr("The value or constructor 'y' is not defined",project) - [] + [] member public this.``InvalidConstructorOverload``() = let content = """ type X private() = @@ -213,8 +196,7 @@ let g (t : T) = t.Count() CheckErrorList content (assertExpectedErrorMessages expectedMessages) - [] - [] + [] member public this.``Query.InvalidJoinRelation.GroupJoin``() = let content = """ let x = query { @@ -226,12 +208,11 @@ let x = query { fun errors -> match errors with | [err] -> - Assert.AreEqual("Invalid join relation in 'groupJoin'. Expected 'expr expr', where is =, =?, ?= or ?=?.", err.Message) + Assert.Equal("Invalid join relation in 'groupJoin'. Expected 'expr expr', where is =, =?, ?= or ?=?.", err.Message) | errs -> Assert.Fail("Unexpected content of error list") - [] - [] + [] member public this.``Query.NonOpenedNullableModule.Join``() = let content = """ let t = @@ -244,12 +225,11 @@ let t = fun errors -> match errors with | [err] -> - Assert.AreEqual("The operator '?=?' cannot be resolved. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.", err.Message) + Assert.Equal("The operator '?=?' cannot be resolved. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.", err.Message) | errs -> Assert.Fail("Unexpected content of error list") - [] - [] + [] member public this.``Query.NonOpenedNullableModule.GroupJoin``() = let content = """ let t = @@ -262,13 +242,12 @@ let t = fun errors -> match errors with | [err] -> - Assert.AreEqual("The operator '?=?' cannot be resolved. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.", err.Message) + Assert.Equal("The operator '?=?' cannot be resolved. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'.", err.Message) | errs -> Assert.Fail("Unexpected content of error list") - [] - [] + [] member public this.``Query.InvalidJoinRelation.Join``() = let content = """ let x = @@ -282,11 +261,11 @@ let x = fun errors -> match errors with | [err] -> - Assert.AreEqual("Invalid join relation in 'join'. Expected 'expr expr', where is =, =?, ?= or ?=?.", err.Message) + Assert.Equal("Invalid join relation in 'join'. Expected 'expr expr', where is =, =?, ?= or ?=?.", err.Message) | errs -> Assert.Fail("Unexpected content of error list") - [] + [] member public this.``InvalidMethodOverload``() = let content = """ System.Console.WriteLine(null) @@ -294,7 +273,7 @@ let x = let expectedMessages = [ "A unique overload for method 'WriteLine' could not be determined based on type information prior to this program point. A type annotation may be needed.\u001d\u001dKnown type of argument: 'a0 when 'a0: null\u001d\u001dCandidates:\u001d - System.Console.WriteLine(buffer: char array) : unit\u001d - System.Console.WriteLine(format: string, [] arg: obj array) : unit\u001d - System.Console.WriteLine(value: obj) : unit\u001d - System.Console.WriteLine(value: string) : unit" ] CheckErrorList content (assertExpectedErrorMessages expectedMessages) - [] + [] member public this.``InvalidMethodOverload2``() = let content = """ type A<'T>() = @@ -309,7 +288,7 @@ b.Do(1, 1) let expectedMessages = [ "A unique overload for method 'Do' could not be determined based on type information prior to this program point. A type annotation may be needed.\u001d\u001dKnown types of arguments: int * int\u001d\u001dCandidates:\u001d - member A.Do: a: int * b: 'T -> unit\u001d - member A.Do: a: int * b: int -> unit" ] CheckErrorList content (assertExpectedErrorMessages expectedMessages) - [] + [] member public this.``NoErrorInErrList``() = use _guard = this.UsingNewVS() let fileContents1 = """ @@ -343,7 +322,7 @@ b.Do(1, 1) TakeCoffeeBreak(this.VS) this.VerifyCountAtSpecifiedFile(project,0) - [] + [] member public this.``NoLevel4Warning``() = use _guard = this.UsingNewVS() let fileContents = """ @@ -361,14 +340,14 @@ b.Do(1, 1) this.VerifyCountAtSpecifiedFile(project,0) - [] + [] //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) - [] + [] member public this.``TestWrongKeywordInInterfaceImplementation``() = let fileContent = """ @@ -382,14 +361,11 @@ type staticInInterface = CheckErrorList fileContent (function | err1 :: _ -> - Assert.IsTrue(err1.Message.Contains("No static abstract member was found that corresponds to this override")) + Assert.True(err1.Message.Contains("No static abstract member was found that corresponds to this override")) | x -> Assert.Fail(sprintf "Unexpected errors: %A" x)) - [] - [] - [] - [] + [] member public this.``TypeProvider.MultipleErrors`` () = let tpRef = PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll") let checkList n = @@ -402,57 +378,51 @@ type staticInInterface = for err in errorList do printfn "Severity: %A, Message: %s" err.Severity err.Message - Assert.IsTrue(List.length errorList = n, "Unexpected size of error list") + Assert.True(List.length errorList = n, "Unexpected size of error list") let uniqueErrors = errorList |> Seq.map (fun m -> m.Message, m.Severity) |> set - Assert.IsTrue(uniqueErrors.Count = n, "List should not contain duplicate errors") + Assert.True(uniqueErrors.Count = n, "List should not contain duplicate errors") for x = 0 to (n - 1) do let expectedName = sprintf "The type provider 'DummyProviderForLanguageServiceTesting.TypeProviderThatThrowsErrors' reported an error: Error %d" x - Assert.IsTrue(Set.contains (expectedName, Microsoft.VisualStudio.FSharp.LanguageService.Severity.Error) uniqueErrors) + Assert.True(Set.contains (expectedName, Microsoft.VisualStudio.FSharp.LanguageService.Severity.Error) uniqueErrors) for i = 1 to 10 do checkList i - [] - [] + [] member public this.``Records.ErrorList.IncorrectBindings1``() = for code in [ "{_}"; "{_ = }"] do printfn "checking %s" code CheckErrorList code <| fun errs -> printfn "%A" errs - Assert.IsTrue((List.length errs) = 2) + Assert.True((List.length errs) = 2) assertContains errs "Field bindings must have the form 'id = expr;'" assertContains errs "'_' cannot be used as field name" - [] - [] + [] member public this.``Records.ErrorList.IncorrectBindings2``() = CheckErrorList "{_ = 1}" <| function - | [err] -> Assert.AreEqual("'_' cannot be used as field name", err.Message) + | [err] -> Assert.Equal("'_' cannot be used as field name", err.Message) | x -> printfn "%A" x; Assert.Fail("unexpected content of error list") - [] - [] + [] member public this.``Records.ErrorList.IncorrectBindings3``() = CheckErrorList "{a = 1; _; _ = 1}" <| fun errs -> - Assert.IsTrue((List.length errs) = 3) + Assert.True((List.length errs) = 3) let groupedErrs = errs |> Seq.groupBy (fun e -> e.Message) |> Seq.toList - Assert.IsTrue((List.length groupedErrs) = 2) + Assert.True((List.length groupedErrs) = 2) for (msg, e) in groupedErrs do - if msg = "'_' cannot be used as field name" then Assert.AreEqual(2, Seq.length e) - elif msg = "Field bindings must have the form 'id = expr;'" then Assert.AreEqual(1, Seq.length e) + if msg = "'_' cannot be used as field name" then Assert.Equal(2, Seq.length e) + elif msg = "Field bindings must have the form 'id = expr;'" then Assert.Equal(1, Seq.length e) else Assert.Fail (sprintf "Unexpected message %s" msg) - [] - [] - [] - [] + [] //This test case Verify the Error List shows the correct error message when the static parameter type is invalid //Intent: We want to make sure that both errors coming from the TP and the compilation of things specific to type provider are properly flagged in the error list. member public this.``TypeProvider.StaticParameters.IncorrectType `` () = @@ -463,10 +433,7 @@ type staticInInterface = this.VerifyErrorListContainedExpectedString(fileContent,expectedStr, addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test case Verify the Error List shows the correct error message when applying invalid static parameter to the provided type member public this.``TypeProvider.StaticParameters.Incorrect `` () = @@ -477,10 +444,7 @@ type staticInInterface = this.VerifyErrorListContainedExpectedString(fileContent,expectedStr, addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test case Verify that Error List shows the correct error message when Type Provider that takes two static parameter is given only one static parameter. member public this.``TypeProvider.StaticParameters.IncorrectNumberOfParameter `` () = @@ -491,9 +455,7 @@ type staticInInterface = this.VerifyErrorListContainedExpectedString(fileContent,expectedStr, addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] member public this.``TypeProvider.ProhibitedMethods`` () = let cases = [ @@ -509,9 +471,7 @@ type staticInInterface = addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")] ) - [] - [] - [] + [] //This test case verify that the Error list count is one in the Error list item when given invalid static parameter that raises an error. member public this.``TypeProvider.StaticParameters.ErrorListItem `` () = @@ -520,10 +480,7 @@ type staticInInterface = type foo = N1.T< const "Hello World",2>""", num = 1) - [] - [] - [] - [] + [] //This test case Verify that there is No Error list count in the Error list item when the file content is correct. member public this.``TypeProvider.StaticParameters.NoErrorListCount `` () = @@ -533,7 +490,7 @@ type staticInInterface = addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] + [] member public this.``NoError.FlagsAndSettings.TargetOptionsRespected``() = let fileContent = """ [] @@ -544,10 +501,9 @@ type staticInInterface = TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let errorList = GetErrors(project) - Assert.IsTrue(errorList.IsEmpty) + Assert.True(errorList.IsEmpty) - [] - [] + [] member public this.``UnicodeCharacters``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -558,12 +514,12 @@ type staticInInterface = let file = OpenFile(project,"新規baProgram.fsi") let file = OpenFile(project,"新規bcrogram.fs") - Assert.IsFalse(Build(project).BuildSucceeded) - Assert.IsTrue(GetErrors(project) + Assert.False(Build(project).BuildSucceeded) + Assert.True(GetErrors(project) |> List.exists(fun error -> (error.ToString().Contains("新規baProgram")))) // In this bug, particular warns were still present after nowarn - [] + [] member public this.``NoWarn.Bug5424``() = let fileContent = """ #nowarn "67" // this type test or downcast will always hold @@ -576,7 +532,7 @@ type staticInInterface = this.VerifyNoErrorListAtOpenProject(fileContent) /// FEATURE: Errors in flags are sent in Error list. - [] + [] member public this.``FlagsAndSettings.ErrorsInFlagsDisplayed``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -587,7 +543,7 @@ type staticInInterface = TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. VerifyErrorListContainedExpectedStr("nonexistent",project) - [] + [] member public this.``BackgroundComplier``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -614,7 +570,7 @@ type staticInInterface = """, num = 2) - [] + [] member public this.``CompilerErrorsInErrList1``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -624,7 +580,7 @@ type staticInInterface = let a = NoVal""", num = 1 ) - // [] disabled for F#8, legacy service, covered in FCS tests instead + // [] disabled for F#8, legacy service, covered in FCS tests instead member public this.``CompilerErrorsInErrList4``() = this.VerifyNoErrorListAtOpenProject( fileContents = """ @@ -644,7 +600,7 @@ type staticInInterface = let _fsyacc_gotos = [| 0us; 1us; 2us|] """ ) - [] + [] member public this.``CompilerErrorsInErrList5``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -653,7 +609,7 @@ type staticInInterface = let x = 0 """, num = 1) - [] + [] member public this.``CompilerErrorsInErrList6``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -666,7 +622,7 @@ type staticInInterface = | B = 0N """, num = 2) - [] + [] member public this.``CompilerErrorsInErrList7``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -697,14 +653,14 @@ type staticInInterface = let foo = 1 """, num = 5) - [] + [] member public this.``CompilerErrorsInErrList8``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ type EnumInt8s = | A1 = - 10y """ , num = 1 ) - [] + [] member public this.``CompilerErrorsInErrList9``() = use _guard = this.UsingNewVS() let fileContents1 = """ @@ -732,7 +688,7 @@ type staticInInterface = Build(project) |> ignore this.VerifyCountAtSpecifiedFile(project,1) - [] + [] member public this.``CompilerErrorsInErrList10``() = let fileContents = """ namespace Errorlist @@ -744,26 +700,26 @@ type staticInInterface = this.VerifyCountAtSpecifiedFile(project,1) - [] + [] member public this.``DoubleClickErrorListItem``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ let x = x """, num = 1) - [] + [] member public this.``FixingCodeAfterBuildRemovesErrors01``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ let x = 4 + "x" """, num = 2) - [] + [] member public this.``FixingCodeAfterBuildRemovesErrors02``() = this.VerifyNoErrorListAtOpenProject( fileContents = "let x = 4" ) - [] + [] member public this.``IncompleteExpression``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -775,7 +731,7 @@ type staticInInterface = List.map (fun x -> x + 1) """ , num = 2) - [] + [] member public this.``IntellisenseRequest``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -783,7 +739,7 @@ type staticInInterface = member a.B(*Marker*) : int = "1" """, num = 1) - [] + [] member public this.``TypeChecking1``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -800,7 +756,7 @@ type staticInInterface = x.Next <- Some x """, num = 1) - [] + [] member public this.``TypeChecking2``() = this.VerifyErrorListContainedExpectedString( fileContents = """ @@ -817,7 +773,7 @@ type staticInInterface = x.Next <- Some x """, expectedStr = "Foo.Thread option") - [] + [] member public this.``TypeChecking3``() = this.VerifyErrorListCountAtOpenProject( fileContents = """ @@ -833,7 +789,7 @@ type staticInInterface = x.Next <- Some 1 """, num = 1) - [] + [] member public this.``TypeChecking4``() = this.VerifyErrorListContainedExpectedString( fileContents = """ @@ -883,7 +839,7 @@ type staticInInterface = AssertContains(tooltip,"string") *) - [] + [] member public this.``Warning.ConsistentWithLanguageService``() = let fileContent = """ open System @@ -892,9 +848,9 @@ type staticInInterface = let (_, project, file) = this.CreateSingleFileProject(fileContent, fileKind = SourceFileKind.FSX) TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let warnList = GetWarnings(project) - Assert.AreEqual(20,warnList.Length) + Assert.Equal(20,warnList.Length) - [] + [] member public this.``Warning.ConsistentWithLanguageService.Comment``() = let fileContent = """ open System @@ -903,10 +859,9 @@ type staticInInterface = let (_, project, file) = this.CreateSingleFileProject(fileContent, fileKind = SourceFileKind.FSX) TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. let warnList = GetWarnings(project) - Assert.AreEqual(0,warnList.Length) + Assert.Equal(0,warnList.Length) - [] - [] + [] member public this.``Errorlist.WorkwithoutNowarning``() = let fileContent = """ type Fruit (shelfLife : int) as x = @@ -915,12 +870,11 @@ type staticInInterface = """ let (_, project, file) = this.CreateSingleFileProject(fileContent) - Assert.IsTrue(Build(project).BuildSucceeded) + Assert.True(Build(project).BuildSucceeded) TakeCoffeeBreak(this.VS) let warnList = GetErrors(project) - Assert.AreEqual(1,warnList.Length) + Assert.Equal(1,warnList.Length) // Context project system -[] 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 9b3b00bfa3c..e38c503c17d 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ErrorRecovery.fs @@ -4,7 +4,7 @@ namespace Tests.LanguageService.ErrorRecovery open System open System.IO -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa @@ -12,8 +12,6 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -[] -[] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -25,14 +23,13 @@ type UsingMSBuild() = [ for i = 0 to errorList.Length - 1 do yield errorList.[i].Message] - Assert.IsTrue(errorList + Assert.True(errorList |> GetErrorMessages |> Seq.exists (fun errorMessage -> errorMessage.Contains(expectedStr))) // Not a recovery case, but make sure we get a squiggle at the unfinished Main() - [] - [] + [] member public this.``ErrorRecovery.Bug4538_3``() = let fileContent = """ type MyType() = @@ -43,8 +40,7 @@ type UsingMSBuild() = this.VerifyErrorListContainedExpectedString(fileContent,expectedStr) // Not a recovery case, but make sure we get a squiggle at the unfinished Main() - [] - [] + [] member public this.``ErrorRecovery.Bug4538_4``() = let fileContent = """ type MyType() = @@ -54,8 +50,7 @@ type UsingMSBuild() = let expectedStr = "The block following this 'use' is unfinished. Every code block is an expression and must have a result. 'use' cannot be the final code element in a block. Consider giving this block an explicit result." this.VerifyErrorListContainedExpectedString(fileContent,expectedStr) - [] - [] + [] member public this.``ErrorRecovery.Bug4881_1``() = let code = ["let s = \"\"" @@ -70,8 +65,7 @@ type UsingMSBuild() = let completions = AutoCompleteAtCursor file AssertCompListContains(completions,"Split") - [] - [] + [] member public this.``ErrorRecovery.Bug4881_2``() = let code = ["let s = \"\"" @@ -87,8 +81,7 @@ type UsingMSBuild() = let completions = AutoCompleteAtCursor file AssertCompListContains(completions,"Split") - [] - [] + [] member public this.``ErrorRecovery.Bug4881_3``() = let code = ["let s = \"\"" @@ -105,8 +98,7 @@ type UsingMSBuild() = AssertCompListContains(completions,"Split") - [] - [] + [] member public this.``ErrorRecovery.Bug4881_4``() = let code = ["let s = \"\"" @@ -122,8 +114,7 @@ type UsingMSBuild() = // This case was fixed while investigating 4538. - [] - [] + [] member public this.``ErrorRecovery.NotFixing4538_1``() = let code = ["type MyType() = " @@ -139,8 +130,7 @@ type UsingMSBuild() = AssertCompListContains(completions,"MyType") // This case was fixed while investigating 4538. - [] - [] + [] member public this.``ErrorRecovery.NotFixing4538_2``() = let code = ["type MyType() = " @@ -156,8 +146,7 @@ type UsingMSBuild() = AssertCompListContains(completions,"MyType") // This case was fixed while investigating 4538. - [] - [] + [] member public this.``ErrorRecovery.NotFixing4538_3``() = let code = ["type MyType() = " @@ -171,8 +160,7 @@ type UsingMSBuild() = let completions = CtrlSpaceCompleteAtCursor file AssertCompListContains(completions,"MyType") - [] - [] + [] member public this.``ErrorRecovery.Bug4538_1``() = let code = ["type MyType() = " @@ -187,8 +175,7 @@ type UsingMSBuild() = let completions = CtrlSpaceCompleteAtCursor file AssertCompListContains(completions,"MyType") - [] - [] + [] member public this.``ErrorRecovery.Bug4538_2``() = let code = ["type MyType() = " @@ -207,8 +194,7 @@ type UsingMSBuild() = - [] - [] + [] member public this.``ErrorRecovery.Bug4538_5``() = let code = ["type MyType() = " @@ -224,8 +210,7 @@ type UsingMSBuild() = AssertCompListContains(completions,"MyType") - [] - [] + [] member public this.``ErrorRecovery.Bug4594_1``() = let code = ["let Bar(xyz) =" @@ -241,7 +226,7 @@ type UsingMSBuild() = /// In this bug, the Module. at the very end of the file was treated as if it were in the scope /// of Module rather than right after it. This check just makes sure we can see a data tip because /// Module is available. - [] + [] member public this.``ErrorRecovery.5878_1``() = Helper.AssertMemberDataTipContainsInOrder ( @@ -268,6 +253,5 @@ type UsingMSBuild() = // Context project system -[] type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) \ No newline at end of file diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs index 96911faaa3b..a86a6ad5126 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs @@ -2,7 +2,7 @@ namespace Tests.LanguageService.General -open NUnit.Framework +open Xunit open System open System.IO open System.Reflection @@ -21,10 +21,9 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -[][] module IFSharpSource_DEPRECATED = - [] + [] let MultipleSourceIsDirtyCallsChangeTimestamps() = let recolorizeWholeFile() = () let recolorizeLine (_line:int) = () @@ -42,8 +41,8 @@ module IFSharpSource_DEPRECATED = let secondDirtyTime = source.DirtyTime let lastTickCount = System.Environment.TickCount - Assert.AreEqual(originalChangeCount + 1, secondChangeCount) - Assert.AreNotEqual(secondDirtyTime, originalDirtyTime) + 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 @@ -52,13 +51,12 @@ module IFSharpSource_DEPRECATED = let thirdChangeCount = source.ChangeCount let thirdDirtyTime = source.DirtyTime - Assert.AreEqual(secondChangeCount + 1, thirdChangeCount) - Assert.AreNotEqual(thirdDirtyTime, secondDirtyTime) + Assert.Equal(secondChangeCount + 1, thirdChangeCount) + Assert.NotEqual(thirdDirtyTime, secondDirtyTime) -[][] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -104,7 +102,7 @@ type UsingMSBuild() = n ) 0 - [] + [] member public this.``ReconcileErrors.Test1``() = let (_solution, project, file) = this.CreateSingleFileProject(["erroneous"]) Build project |> ignore @@ -112,7 +110,7 @@ type UsingMSBuild() = () /// FEATURE: (Project System only) Adding a file outside the project directory creates a link - [] + [] member public this.``ProjectSystem.FilesOutsideProjectDirectoryBecomeLinkedFiles``() = use _guard = this.UsingNewVS() if OutOfConeFilesAreAddedAsLinks(this.VS) then @@ -127,7 +125,7 @@ type UsingMSBuild() = let projFileText = System.IO.File.ReadAllText(ProjectFile(project)) AssertMatchesRegex '<' @"\s*\s*link.fs" projFileText - [] + [] member public this.``Lexer.CommentsLexing.Bug1548``() = let scan = new FSharpScanner_DEPRECATED(fun source -> let fileName = "test.fs" @@ -195,7 +193,7 @@ type UsingMSBuild() = // This was a bug in ReplaceAllText (subsequent calls to SetMarker would fail) - [] + [] member public this.``Salsa.ReplaceAllText``() = let code = ["#light"; @@ -225,7 +223,7 @@ type UsingMSBuild() = // Make sure that possible overloads (and other related errors) are shown in the error list - [] + [] member public this.``ErrorLogging.Bug5144``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -242,13 +240,13 @@ type UsingMSBuild() = "p.Plot(sin, 0., 0.)"]) let build = time1 Build project "Time to build project" - Assert.IsTrue(not build.BuildSucceeded, "Expected build to fail") + 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"]) - [] + [] member public this.``ExhaustivelyScrutinize.ThisOnceAsserted``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -258,7 +256,7 @@ type UsingMSBuild() = """ else [],"" """ ] ) - [] + [] member public this.``ExhaustivelyScrutinize.ThisOnceAssertedToo``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -268,7 +266,7 @@ type UsingMSBuild() = " member _.CompareTo(v:obj) = 1" ] ) - [] + [] member public this.``ExhaustivelyScrutinize.ThisOnceAssertedThree``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -278,7 +276,7 @@ type UsingMSBuild() = " with get() = x.Data" " and set(v) = x.Data <- v" ] ) - [] + [] member public this.``ExhaustivelyScrutinize.ThisOnceAssertedFour``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -286,12 +284,11 @@ type UsingMSBuild() = "let z=4" ] ) - [] + [] member public this.``ExhaustivelyScrutinize.ThisOnceAssertedFive``() = Helper.ExhaustivelyScrutinize(this.TestRunner, [ """CSV.File<@"File1.txt">.[0].""" ]) // <@ is one token, wanted < @"... - [] - [] + [] member public this.``ExhaustivelyScrutinize.Bug2277``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -305,8 +302,7 @@ type UsingMSBuild() = "let pp= plot(Area(xs,ys))" ] ) - [] - [] + [] member public this.``ExhaustivelyScrutinize.Bug2283``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -322,7 +318,7 @@ type UsingMSBuild() = /// Verifies that token info returns correct trigger classes /// - this is used in MPF for triggering various intellisense features - [] + [] member public this.``TokenInfo.TriggerClasses``() = let important = [ // Member select for dot completions @@ -340,7 +336,7 @@ type UsingMSBuild() = let info = TestExpose.TokenInfo tok AssertEqual(expected, info) - [] + [] member public this.``MatchingBraces.VerifyMatches``() = let content = [| @@ -383,15 +379,15 @@ type UsingMSBuild() = let (endRow, endCol) = getPos endMarker let checkTextSpan (actual : TextSpan) expectedRow expectedCol = - Assert.IsTrue(actual.iStartLine = actual.iEndLine, "Start and end of the span should be on the same line") - Assert.AreEqual(expectedRow, actual.iStartLine, "Unexpected row") - Assert.AreEqual(expectedCol, actual.iStartIndex, "Unexpected column") - Assert.IsTrue(actual.iEndIndex = (actual.iStartIndex + expectedSpanLen), sprintf "Span should have length == %d" expectedSpanLen) + Assert.True(actual.iStartLine = actual.iEndLine, "Start and end of the span should be on the same line") + Assert.Equal(expectedRow, actual.iStartLine) + Assert.Equal(expectedCol, actual.iStartIndex) + Assert.True(actual.iEndIndex = (actual.iStartIndex + expectedSpanLen), sprintf "Span should have length == %d" expectedSpanLen) let checkBracesForPosition row col = setPos row col let braces = GetMatchingBracesForPositionAtCursor(file) - Assert.AreEqual(1, braces.Length, "One result expected") + Assert.Equal(1, braces.Length) let (lbrace, rbrace) = braces.[0] checkTextSpan lbrace startRow startCol @@ -412,7 +408,6 @@ type UsingMSBuild() = // Context project system -[] 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 5b3a685b1ea..8c2d8613c7c 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.GotoDefinition.fs @@ -4,7 +4,7 @@ namespace Tests.LanguageService.GotoDefinition open System open System.IO -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa @@ -15,9 +15,8 @@ open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.EditorServices +open Xunit -[] -[] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -37,11 +36,11 @@ type UsingMSBuild() = let (_, _, file) = this.CreateSingleFileProject(fileContents, ?references = extraRefs) MoveCursorToStartOfMarker (file, marker) let result = GotoDefinitionAtCursor file - Assert.IsTrue(result.Success, "result.Success") + Assert.True(result.Success, "result.Success") let actualPos = (result.Span.iStartLine, result.Span.iStartIndex) let line = GetLineNumber file (result.Span.iStartLine + 1) printfn "Actual line:%s, actual pos:%A" line actualPos - Assert.AreEqual(pos, actualPos, "pos") + Assert.Equal(pos, actualPos) //GoToDefinitionFail Helper Function member private this.VerifyGoToDefnFailAtStartOfMarker(fileContents : string, marker :string,?addtlRefAssy : string list) = @@ -84,7 +83,7 @@ type UsingMSBuild() = file result - [] + [] member this.``Operators.TopLevel``() = this.VerifyGotoDefnSuccessForNonIdentifierAtStartOfMarker( fileContents = """ @@ -95,7 +94,7 @@ type UsingMSBuild() = pos=(1,21) ) - [] + [] member this.``Operators.Member``() = this.VerifyGotoDefnSuccessForNonIdentifierAtStartOfMarker( fileContents = """ @@ -108,7 +107,7 @@ type UsingMSBuild() = pos=(3,35) ) - [] + [] member public this.``Value``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -123,7 +122,7 @@ type UsingMSBuild() = marker = "valueX (*GotoValDef*)", definitionCode = "let valueX = Beta(1.0M, ())(*GotoTypeDef*)") - [] + [] member public this.``DisUnionMember``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -138,7 +137,7 @@ type UsingMSBuild() = marker = "Beta(1.0M, ())(*GotoTypeDef*)", definitionCode = "| Beta of decimal * unit") - [] + [] member public this.``PrimitiveType``() = this.VerifyGoToDefnFailAtStartOfMarker( fileContents = """ @@ -146,7 +145,7 @@ type UsingMSBuild() = let bi = 123456I""", marker = "123456I") - [] + [] member public this.``OnTypeDefinition``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -157,7 +156,7 @@ type UsingMSBuild() = marker = "One (*Marker1*)", definitionCode = "type One (*Marker1*) = One") - [] + [] member public this.``Parameter``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -168,13 +167,10 @@ type UsingMSBuild() = marker = "One (*Marker2*)", definitionCode = "type One (*Marker1*) = One") - [] - [] - [] // This test case check the GotoDefinition (i.e. the TypeProviderDefinitionLocation Attribute) - [] // We expect the correct FilePath, Line and Column on provided: Type, Event, Method, and Property // TODO: add a case for a provided Field + [] member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute``() = use _guard = this.UsingNewVS() // Note that the verification helped method is custom because we *do* care about the column as well, @@ -207,8 +203,8 @@ type UsingMSBuild() = let column' = column - 2 match result.ToOption() with - | Some(span,_) -> Assert.AreEqual(column',span.iStartIndex, "The cursor landed on the incorrect column!") - | None -> Assert.Fail <| sprintf "Expected to find the definition at column '%d' but GotoDefn failed." column' + | Some(span,_) -> Assert.Equal(column',span.iStartIndex) + | None -> failwithf "Expected to find the definition at column '%d' but GotoDefn failed." column' // Basic scenario on a provided Type let ``Type.BasicScenario``() = @@ -293,19 +289,19 @@ type UsingMSBuild() = ``Event.BasicScenario``() - [] + [] member public this.``GotoDefinition.NoSourceCodeAvailable``() = this.VerifyGoToDefnFailAtStartOfMarker ( fileContents = "System.String.Format(\"\")", marker = "ormat", f = (fun (_, result) -> - Assert.IsFalse(result.Success) - Assert.IsTrue(result.ErrorDescription.Contains("Source code is not available")) + Assert.False(result.Success) + Assert.True(result.ErrorDescription.Contains("Source code is not available")) ) ) - [] + [] member public this.``GotoDefinition.NoIdentifierAtLocation``() = let useCases = [ @@ -319,12 +315,12 @@ type UsingMSBuild() = fileContents = source, marker = marker, f = (fun (_, result) -> - Assert.IsFalse(result.Success) - Assert.IsTrue(result.ErrorDescription.Contains("Cursor is not on identifier")) + Assert.False(result.Success) + Assert.True(result.ErrorDescription.Contains("Cursor is not on identifier")) ) ) - [] + [] member public this.``GotoDefinition.ProvidedTypeNoDefinitionLocationAttribute``() = this.VerifyGoToDefnFailAtStartOfMarker @@ -333,12 +329,11 @@ type UsingMSBuild() = type T = N1.T<"", 1> """, marker = "T<", - f = (fun (_, result) -> Assert.IsFalse(result.Success) ), + f = (fun (_, result) -> Assert.False(result.Success) ), addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")] ) - [] - [] + [] member public this.``GotoDefinition.ProvidedMemberNoDefinitionLocationAttribute``() = let useCases = [ @@ -359,15 +354,13 @@ type UsingMSBuild() = fileContents = source, marker = marker, f = (fun (_, result) -> - Assert.IsFalse(result.Success) + Assert.False(result.Success) let expectedText = sprintf "provided member '%s'" name - Assert.IsTrue(result.ErrorDescription.Contains(expectedText)) + Assert.True(result.ErrorDescription.Contains(expectedText)) ), addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")] ) - [] - [] - [] + [] // This test case is when the TypeProviderDefinitionLocationAttribute filepath doesn't exist for TypeProvider Type member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute.Type.FileDoesnotExist``() = this.VerifyGoToDefnFailAtStartOfMarker( @@ -379,10 +372,7 @@ type UsingMSBuild() = marker = "T(*GotoValDef*)", addtlRefAssy = [PathRelativeToTestAssembly(@"DefinitionLocationAttributeFileDoesnotExist.dll")]) - [] - [] - [] - [] + [] //This test case is when the TypeProviderDefinitionLocationAttribute Line doesn't exist for TypeProvider Type member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute.Type.LineDoesnotExist``() = this.VerifyGoToDefnFailAtStartOfMarker( @@ -394,9 +384,7 @@ type UsingMSBuild() = marker = "T(*GotoValDef*)", addtlRefAssy = [PathRelativeToTestAssembly(@"DefinitionLocationAttributeLineDoesnotExist.dll")]) - [] - [] - [] + [] // This test case is when the TypeProviderDefinitionLocationAttribute filepath doesn't exist for TypeProvider Constructor member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute.Constructor.FileDoesnotExist``() = this.VerifyGoToDefnFailAtStartOfMarker( @@ -410,9 +398,7 @@ type UsingMSBuild() = - [] - [] - [] + [] //This test case is when the TypeProviderDefinitionLocationAttribute filepath doesn't exist for TypeProvider Method member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute.Method.FileDoesnotExist``() = this.VerifyGoToDefnFailAtStartOfMarker( @@ -424,9 +410,7 @@ type UsingMSBuild() = marker = "M(*GotoValDef*)", addtlRefAssy = [PathRelativeToTestAssembly(@"DefinitionLocationAttributeFileDoesnotExist.dll")]) - [] - [] - [] + [] // This test case is when the TypeProviderDefinitionLocationAttribute filepath doesn't exist for TypeProvider Property member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute.Property.FileDoesnotExist``() = this.VerifyGoToDefnFailAtStartOfMarker( @@ -438,9 +422,7 @@ type UsingMSBuild() = marker = "StaticProp(*GotoValDef*)", addtlRefAssy = [PathRelativeToTestAssembly(@"DefinitionLocationAttributeFileDoesnotExist.dll")]) - [] - [] - [] + [] //This test case is when the TypeProviderDefinitionLocationAttribute filepath doesn't exist for TypeProvider Event member public this.``GotoDefinition.TypeProvider.DefinitionLocationAttribute.Event.FileDoesnotExist``() = this.VerifyGoToDefnFailAtStartOfMarker( @@ -453,7 +435,7 @@ type UsingMSBuild() = marker = "Event1(*GotoValDef*)", addtlRefAssy = [PathRelativeToTestAssembly(@"DefinitionLocationAttributeFileDoesnotExist.dll")]) - [] + [] member public this.``ModuleDefinition``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -464,7 +446,7 @@ type UsingMSBuild() = marker = "Foo (*MarkerModuleDefinition*)", definitionCode = "module Foo (*MarkerModuleDefinition*) =") - [] + [] member public this.``Record.Field.Definition``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -481,7 +463,7 @@ type UsingMSBuild() = marker = "myX (*MarkerXFieldDefinition*)", definitionCode = "{ myX (*MarkerXFieldDefinition*) : int") - [] + [] member public this.``Record.Field.Usage``() = this.VerifyGoToDefnSuccessAtStartOfMarker( fileContents = """ @@ -508,14 +490,14 @@ type UsingMSBuild() = member internal this.GotoDefinitionCheckResultAgainst (exp : (string * string * string) option)(file : OpenFile)(act : GotoDefnResult) : unit = match (exp, act.ToOption()) with | (Some (toFind, expLine, expFile), Some (span, actFile)) -> printfn "%s" "Result received, as expected; checking." - Assert.AreEqual (expFile, actFile) + Assert.Equal (expFile, actFile) printfn "%s" "Filename matches expected." MoveCursorTo(file, span.iStartLine + 1, span.iStartIndex + 1) // adjust & move to the identifier match GetIdentifierAtCursor file with // REVIEW: actually check that we're on the leftmost character of the identifier | None -> Assert.Fail("No identifier at cursor!") - | Some (id, _) -> Assert.AreEqual (toFind, id) // are we on the identifier we expect? + | Some (id, _) -> Assert.Equal (toFind, id) // are we on the identifier we expect? printfn "%s" "Identifier at cursor matches expected." - Assert.AreEqual (expLine.Trim (), (span.iStartLine |> (+) 1 |> GetLineNumber file).Trim ()) // ignore initial- / final-whitespace-introduced noise; adjust for difference in index numbers + Assert.Equal (expLine.Trim (), (span.iStartLine |> (+) 1 |> GetLineNumber file).Trim ()) // ignore initial- / final-whitespace-introduced noise; adjust for difference in index numbers printfn "%s" "Line at cursor matches expected." | (None, None) -> printfn "%s" "No result received, as expected." // sometimes we may expect GotoDefinition to fail, e.g., when the cursor isn't placed on a valid position (i.e., over an identifier, and, maybe, a constant if we decide to support that) | (Some _, None) -> Assert.Fail("No result received, but one was expected!") // distinguish this and the following case to give insight in case of failure @@ -528,11 +510,11 @@ type UsingMSBuild() = member internal this.GotoDefinitionCheckResultAgainstAnotherFile (proj : OpenProject)(exp : (string * string) option)(act : GotoDefnResult) : unit = match (exp, act.ToOption()) with | (Some (toFind, expFile), Some (span, actFile)) -> printfn "%s" "Result received, as expected; checking." - Assert.AreEqual (expFile, Path.GetFileName actFile) + Assert.Equal (expFile, Path.GetFileName actFile) printfn "%s" "Filename matches expected." let file = OpenFile (proj, actFile) let line = span.iStartLine |> ((+) 1) |> GetLineNumber file // need to adjust line number here - Assert.AreEqual (toFind, line.Substring (span.iStartIndex, toFind.Length)) + Assert.Equal (toFind, line.Substring (span.iStartIndex, toFind.Length)) printfn "%s" "Identifier at cursor matches expected." | (None, None) -> printfn "%s" "No result received, as expected." // sometimes we may expect GotoDefinition to fail, e.g., when the cursor isn't placed on a valid position (i.e., over an identifier, and, maybe, a constant if we decide to support that) | (Some _, None) -> Assert.Fail("No result received, but one was expected!") // distinguish this and the following case to give insight in case of failure @@ -542,7 +524,7 @@ type UsingMSBuild() = member this.GotoDefinitionTestWithSimpleFile (startLoc : string)(exp : (string * string) option) : unit = this.SolutionGotoDefinitionTestWithSimpleFile startLoc exp - [] + [] member this.``GotoDefinition.OverloadResolution``() = let lines = [ "type D() =" @@ -559,7 +541,7 @@ type UsingMSBuild() = "d.ToString$4$(\"aaa\") " ] this.GotoDefinitionTestWithMarkup lines - [] + [] member this.``GotoDefinition.OverloadResolutionForProperties``() = let lines = [ "type D() =" " member this.#1##2#Foo" @@ -577,7 +559,7 @@ type UsingMSBuild() = ] this.GotoDefinitionTestWithMarkup lines - [] + [] member this.``GotoDefinition.OverloadResolutionWithOverrides``() = let lines = [ "[]" @@ -596,7 +578,7 @@ type UsingMSBuild() = ] this.GotoDefinitionTestWithMarkup lines - [] + [] member this.``GotoDefinition.OverloadResolutionStatics``() = let lines = [ "type T =" @@ -608,7 +590,7 @@ type UsingMSBuild() = ] this.GotoDefinitionTestWithMarkup lines - [] + [] member this.``GotoDefinition.Constructors``() = let lines = [ "type #1a##1b##1c##1d#B() =" @@ -677,12 +659,12 @@ type UsingMSBuild() = MoveCursorTo(file, line, col) let res = GotoDefinitionAtCursor file match res.ToOption() with - | None -> Assert.IsFalse(targets.ContainsKey(marker), sprintf "%s: definition not found " marker) + | None -> Assert.False(targets.ContainsKey(marker), sprintf "%s: definition not found " marker) | Some (span,text) -> match targets.TryGetValue(marker) with | false, _ -> Assert.Fail(sprintf "%s: unexpected definition found" marker) | true, (line1, col1) -> - Assert.IsTrue(span.iStartIndex = col1 && span.iStartLine = line1, + 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 ) @@ -890,7 +872,7 @@ type UsingMSBuild() = // ensure that we've found the correct position (i.e., these must be unique // in any given test source file) - [] + [] member this.``GotoDefinition.InheritedMembers``() = let lines = [ "[]" @@ -910,299 +892,298 @@ type UsingMSBuild() = /// let #x = () in $x - [] + [] member public this.``GotoDefinition.InsideClass.Bug3176`` () = this.GotoDefinitionTestWithSimpleFile "id77 (*loc-77*)" (Some("val id77 (*loc-77*) : int", "id77")) /// let #x = () in $x - [] + [] member public this.``GotoDefinition.Simple.Binding.TrivialLetRHS`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-1*)" (Some("let x = () (*loc-2*)", "x")) /// let #x = () in x$ - [] + [] member public this.``GotoDefinition.Simple.Binding.TrivialLetRHSToRight`` () = this.GotoDefinitionTestWithSimpleFile " (*loc-1*)" (Some("let x = () (*loc-2*)", "x")) /// let $x = () in x - [] + [] member public this.``GotoDefinition.Simple.Binding.TrivialLetLHS`` () = this.GotoDefinitionTestWithSimpleFile "x = () (*loc-2*)" (Some("let x = () (*loc-2*)", "x")) /// let x = () in let #x = () in $x - [] + [] member public this.``GotoDefinition.Simple.Binding.NestedLetWithSameNameRHS`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-4*)" (Some("let x = () (*loc-3*)", "x")) /// let x = () in let $x = () in x - [] + [] member public this.``GotoDefinition.Simple.Binding.NestedLetWithSameNameLHSInner`` () = this.GotoDefinitionTestWithSimpleFile "x = () (*loc-3*)" (Some("let x = () (*loc-3*)", "x")) /// let $x = () in let x = () in x - [] + [] member public this.``GotoDefinition.Simple.Binding.NestedLetWithSameNameLHSOuter`` () = this.GotoDefinitionTestWithSimpleFile "x = () (*loc-5*)" (Some("let x = () (*loc-5*)", "x")) /// let #x = () in let x = $x in () - [] + [] member public this.``GotoDefinition.Simple.Binding.NestedLetWithXIsX`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-6*)" (Some("let x = () (*loc-7*)", "x")) /// let x = () in let rec #x = fun y -> $x y in () - [] + [] member public this.``GotoDefinition.Simple.Binding.NestedLetWithXRec`` () = this.GotoDefinitionTestWithSimpleFile "x y (*loc-8*)" (Some("let rec x = (*loc-9*)", "x")) /// let x = () in let rec x = fun #y -> x $y in () - [] + [] member public this.``GotoDefinition.Simple.Binding.NestedLetWithXRecParam`` () = this.GotoDefinitionTestWithSimpleFile "y (*loc-8*)" (Some("fun y -> (*loc-10*)", "y")) /// let #(+) x _ = x in 2 $+ 3 - [] - [] + [] member public this.``GotoDefinition.Simple.Binding.Operator`` () = this.GotoDefinitionTestWithSimpleFile "+ 3 (*loc-11*)" (Some("let (+) x _ = x (*loc-2*)", "+")) /// type #Zero = /// let f (_ : $Zero) = 0 - [] + [] member public this.``GotoDefinition.Simple.Datatype.NullType`` () = this.GotoDefinitionTestWithSimpleFile "Zero) : 'a = failwith \"hi\" (*loc-14*)" (Some("type Zero = (*loc-13*)", "Zero")) /// type One = $One - [] + [] member public this.``GotoDefinition.Simple.Datatype.UnitTypeConsDef`` () = this.GotoDefinitionTestWithSimpleFile "One (*loc-15*)" (Some("One (*loc-15*)", "One")) /// type $One = One - [] + [] member public this.``GotoDefinition.Simple.Datatype.UnitTypeTypenameDef`` () = this.GotoDefinitionTestWithSimpleFile "One = (*loc-16*)" (Some("type One = (*loc-16*)", "One")) /// type One = #One /// let f (_ : One) = $One - [] + [] member public this.``GotoDefinition.Simple.Datatype.UnitTypeCons`` () = this.GotoDefinitionTestWithSimpleFile "One (*loc-18*)" (Some("One (*loc-15*)", "One")) /// type #One = One /// let f (_ : $One) = One - [] + [] member public this.``GotoDefinition.Simple.Datatype.UnitTypeTypename`` () = this.GotoDefinitionTestWithSimpleFile "One) = (*loc-17*)" (Some("type One = (*loc-16*)", "One")) /// type $Nat = Suc of Nat | Zro - [] + [] member public this.``GotoDefinition.Simple.Datatype.NatTypeTypenameDef`` () = this.GotoDefinitionTestWithSimpleFile "Nat = (*loc-19*)" (Some("type Nat = (*loc-19*)", "Nat")) /// type #Nat = Suc of $Nat | Zro - [] + [] member public this.``GotoDefinition.Simple.Datatype.NatTypeConsArg`` () = this.GotoDefinitionTestWithSimpleFile "Nat (*loc-20*)" (Some("type Nat = (*loc-19*)", "Nat")) /// type Nat = Suc of Nat | #Zro /// fun m -> match m with | $Zro -> () | _ -> () - [] + [] member public this.``GotoDefinition.Simple.Datatype.NatPatZro`` () = this.GotoDefinitionTestWithSimpleFile "Zro -> (*loc-24*)" (Some("| Zro (*loc-21*)", "Zro")) /// type Nat = $Suc of Nat | Zro /// fun m -> match m with | Zro -> () | $Suc _ -> () - [] + [] member public this.``GotoDefinition.Simple.Datatype.NatPatSuc`` () = this.GotoDefinitionTestWithSimpleFile "Suc m -> (*loc-25*)" (Some("| Suc of Nat (*loc-20*)", "Suc")) /// let rec plus m n = match m with | Zro -> n | Suc #m -> Suc (plus $m n) - [] + [] member public this.``GotoDefinition.Simple.Datatype.NatPatSucVarUse`` () = this.GotoDefinitionTestWithSimpleFile "m n) (*loc-26*)" (Some("| Suc m -> (*loc-25*)", "m")) /// let rec plus m n = match m with | Zro -> n | Suc #m -> Suc (plus $m n) - [] + [] member public this.``GotoDefinition.Simple.Datatype.NatPatSucOuterVarUse`` () = this.GotoDefinitionTestWithSimpleFile "n) (*loc-26*)" (Some("let rec plus m n = (*loc-23*)", "n")) /// type $MyRec = { myX : int ; myY : int } - [] + [] member public this.``GotoDefinition.Simple.Datatype.RecordTypenameDef`` () = this.GotoDefinitionTestWithSimpleFile "MyRec = (*loc-27*)" (Some("type MyRec = (*loc-27*)", "MyRec")) /// type MyRec = { $myX : int ; myY : int } - [] + [] member public this.``GotoDefinition.Simple.Datatype.RecordField1Def`` () = this.GotoDefinitionTestWithSimpleFile "myX : int (*loc-28*)" (Some("{ myX : int (*loc-28*)", "myX")) /// type MyRec = { myX : int ; $myY : int } - [] + [] member public this.``GotoDefinition.Simple.Datatype.RecordField2Def`` () = this.GotoDefinitionTestWithSimpleFile "myY : int (*loc-29*)" (Some("myY : int (*loc-29*)", "myY")) /// type MyRec = { #myX : int ; myY : int } /// let rDefault = { $myX = 2 ; myY = 3 } - [] + [] member public this.``GotoDefinition.Simple.Datatype.RecordField1Use`` () = this.GotoDefinitionTestWithSimpleFile "myX = 2 (*loc-30*)" (Some("{ myX : int (*loc-28*)", "myX")) /// type MyRec = { myX : int ; #myY : int } /// let rDefault = { myX = 2 ; $myY = 3 } - [] + [] member public this.``GotoDefinition.Simple.Datatype.RecordField2Use`` () = this.GotoDefinitionTestWithSimpleFile "myY = 3 (*loc-31*)" (Some("myY : int (*loc-29*)", "myY")) /// type MyRec = { #myX : int ; myY : int } /// let rDefault = { myX = 2 ; myY = 3 } /// let _ = { rDefault with $myX = 7 } - [] + [] member public this.``GotoDefinition.Simple.Datatype.RecordField1UseInWith`` () = this.GotoDefinitionTestWithSimpleFile "myX = 7 } (*loc-32*)" (Some("{ myX : int (*loc-28*)", "myX")) /// let a = () in let id (x : '$a) : 'a = x - [] + [] member public this.``GotoDefinition.Simple.Polymorph.Leftmost`` () = this.GotoDefinitionTestWithSimpleFile "a) (*loc-33*)" (Some("let id (x : 'a) (*loc-33*)", "'a")) /// let a = () in let id (x : 'a) : '$a = x - [] + [] member public this.``GotoDefinition.Simple.Polymorph.NotLeftmost`` () = this.GotoDefinitionTestWithSimpleFile "a = x (*loc-34*)" (Some("let id (x : 'a) (*loc-33*)", "'a")) /// let foo = () in let f (_ as $foo) = foo in () - [] + [] member public this.``GotoDefinition.Simple.Tricky.AsPatLHS`` () = this.GotoDefinitionTestWithSimpleFile "foo) = (*loc-35*)" (Some("let f (_ as foo) = (*loc-35*)", "foo")) /// let foo = () in let f (_ as #foo) = $foo in () - [] + [] member public this.``GotoDefinition.Simple.Tricky.AsPatRHS`` () = this.GotoDefinitionTestWithSimpleFile "foo (*loc-36*)" (Some("let f (_ as foo) = (*loc-35*)", "foo")) /// fun $x x -> x - [] + [] member public this.``GotoDefinition.Simple.Tricky.LambdaMultBind1`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-37*)" (Some("fun x (*loc-37*)", "x")) /// fun x $x -> x - [] + [] member public this.``GotoDefinition.Simple.Tricky.LambdaMultBind2`` () = this.GotoDefinitionTestWithSimpleFile "x -> (*loc-38*)" (Some("x -> (*loc-38*)", "x")) /// fun x $x -> x - [] + [] member public this.``GotoDefinition.Simple.Tricky.LambdaMultBindBody`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-39*)" (Some("x -> (*loc-38*)", "x")) /// let f = () in let $f = function f -> f in () - [] + [] member public this.``GotoDefinition.Simple.Tricky.LotsOfFsFunc`` () = this.GotoDefinitionTestWithSimpleFile "f = (*loc-41*)" (Some("let f = (*loc-41*)", "f")) /// let f = () in let f = function $f -> f in () - [] + [] member public this.``GotoDefinition.Simple.Tricky.LotsOfFsPat`` () = this.GotoDefinitionTestWithSimpleFile "f -> (*loc-42*)" (Some("function f -> (*loc-42*)", "f")) /// let f = () in let f = function #f -> $f in () - [] + [] member public this.``GotoDefinition.Simple.Tricky.LotsOfFsUse`` () = this.GotoDefinitionTestWithSimpleFile "f (*loc-43*)" (Some("function f -> (*loc-42*)", "f")) /// let f x = match x with | Suc $x | x -> x - [] + [] member public this.``GotoDefinition.Simple.Tricky.OrPatLeft`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-44*)" (Some("| Suc x (*loc-44*)", "x")) /// let f x = match x with | Suc x | $x -> x - [] + [] member public this.``GotoDefinition.Simple.Tricky.OrPatRight`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-45*)" (Some("| Suc x (*loc-44*)", "x")) // NOTE: or-patterns bind at first occurrence of the variable /// let f x = match x with | Suc #y & z -> $y - [] + [] member public this.``GotoDefinition.Simple.Tricky.AndPat`` () = this.GotoDefinitionTestWithSimpleFile "y (*loc-46*)" (Some("| Suc y & z -> (*loc-47*)", "y")) /// let f xs = match xs with | #x :: xs -> $x - [] + [] member public this.``GotoDefinition.Simple.Tricky.ConsPat`` () = this.GotoDefinitionTestWithSimpleFile "x (*loc-48*)" (Some("| x :: xs -> (*loc-49*)", "x")) /// let f p = match p with (#y, z) -> $y - [] + [] member public this.``GotoDefinition.Simple.Tricky.PairPat`` () = this.GotoDefinitionTestWithSimpleFile "y (*loc-50*)" (Some("| (y : int, z) -> (*loc-51*)", "y")) /// fun xs -> match xs with x :: #xs when $xs <> [] -> x :: xs - [] + [] member public this.``GotoDefinition.Simple.Tricky.ConsPatWhenClauseInWhen`` () = this.GotoDefinitionTestWithSimpleFile "xs <> [] -> (*loc-52*)" (Some("| x :: xs (*loc-54*)", "xs")) /// fun xs -> match xs with #x :: xs when xs <> [] -> $x :: xs - [] + [] member public this.``GotoDefinition.Simple.Tricky.ConsPatWhenClauseInWhenRhsX`` () = this.GotoDefinitionTestWithSimpleFile "x :: xs (*loc-53*)" (Some("| x :: xs (*loc-54*)", "x")) /// fun xs -> match xs with x :: #xs when xs <> [] -> x :: $xs - [] + [] member public this.``GotoDefinition.Simple.Tricky.ConsPatWhenClauseInWhenRhsXs`` () = this.GotoDefinitionTestWithSimpleFile "xs (*loc-53*)" (Some("| x :: xs (*loc-54*)", "xs")) /// let x = "$x" - [] + [] member public this.``GotoDefinition.Simple.Tricky.InStringFails`` () = this.GotoDefinitionTestWithSimpleFile "x(*loc-72*)" None /// let x = "hello /// $x /// " - [] + [] member public this.``GotoDefinition.Simple.Tricky.InMultiLineStringFails`` () = this.GotoDefinitionTestWithSimpleFile "x(*loc-73*)" None - [] + [] member public this.``GotoDefinition.Simple.Tricky.QuotedKeyword`` () = this.GotoDefinitionTestWithSimpleFile "let`` = (*loc-74*)" (Some("let rec ``let`` = (*loc-74*)", "``let``")) /// module $Too = let foo = () - [] + [] member public this.``GotoDefinition.Simple.Module.DefModname`` () = this.GotoDefinitionTestWithSimpleFile "Too = (*loc-55*)" (Some("module Too = (*loc-55*)", "Too")) /// module Too = $foo = () - [] + [] member public this.``GotoDefinition.Simple.Module.DefMember`` () = this.GotoDefinitionTestWithSimpleFile "foo = 0 (*loc-56*)" (Some("let foo = 0 (*loc-56*)", "foo")) /// module #Too = foo = () /// module Bar = open $Too - [] + [] member public this.``GotoDefinition.Simple.Module.Open`` () = this.GotoDefinitionTestWithSimpleFile "Too (*loc-57*)" (Some("module Too = (*loc-55*)", "Too")) /// module #Too = foo = () /// $Too.foo - [] + [] member public this.``GotoDefinition.Simple.Module.QualifiedModule`` () = this.GotoDefinitionTestWithSimpleFile "Too.foo (*loc-58*)" (Some("module Too = (*loc-55*)", "Too")) /// module Too = #foo = () /// Too.$foo - [] + [] member public this.``GotoDefinition.Simple.Module.QualifiedMember`` () = this.GotoDefinitionTestWithSimpleFile "foo (*loc-58*)" (Some("let foo = 0 (*loc-56*)", "foo")) /// type Parity = Even | Odd /// let (|$Even|Odd|) x = if x % 0 = 0 then Even else Odd - [] + [] member public this.``GotoDefinition.Simple.ActivePat.ConsDefLHS`` () = this.GotoDefinitionTestWithSimpleFile "Even|Odd|) x = (*loc-59*)" (Some("let (|Even|Odd|) x = (*loc-59*)", "|Even|Odd|")) /// type Parity = Even | Odd /// let (|#Even|Odd|) x = if x % 0 = 0 then $Even else Odd - [] + [] member public this.``GotoDefinition.Simple.ActivePat.ConsDefRhs`` () = this.GotoDefinitionTestWithSimpleFile "Even (*loc-60*)" (Some("let (|Even|Odd|) x = (*loc-59*)", "|Even|Odd|")) @@ -1212,17 +1193,16 @@ type UsingMSBuild() = /// match x with /// | $Even -> 1 /// | Odd -> 0 - [] + [] member public this.``GotoDefinition.Simple.ActivePat.PatUse`` () = this.GotoDefinitionTestWithSimpleFile "Even -> 1 (*loc-61*)" (Some("let (|Even|Odd|) x = (*loc-59*)", "|Even|Odd|")) /// let patval = (|Even|Odd|) (*loc-61b*) - [] + [] member public this.``GotoDefinition.Simple.ActivePat.PatUseValue`` () = this.GotoDefinitionTestWithSimpleFile "en|Odd|) (*loc-61b*)" (Some("let (|Even|Odd|) x = (*loc-59*)", "|Even|Odd|")) - [] - [] + [] member public this.``GotoDefinition.Library.InitialTest`` () = this.GotoDefinitionTestWithLib "map (*loc-1*)" (Some("map", "lis.fs")) @@ -1230,32 +1210,32 @@ type UsingMSBuild() = /// type #Class$ () = /// member c.Method () = () - [] + [] member public this.``GotoDefinition.ObjectOriented.ClassNameDef`` () = this.GotoDefinitionTestWithSimpleFile " () = (*loc-62*)" (Some("type Class () = (*loc-62*)", "Class")) /// type Class () = /// member c.#Method$ () = () - [] + [] member public this.``GotoDefinition.ObjectOriented.ILMethodDef`` () = this.GotoDefinitionTestWithSimpleFile " () = () (*loc-63*)" (Some("member c.Method () = () (*loc-63*)", "c.Method")) /// type Class () = /// member #c$.Method () = () - [] + [] member public this.``GotoDefinition.ObjectOriented.ThisDef`` () = this.GotoDefinitionTestWithSimpleFile ".Method () = () (*loc-63*)" (Some("member c.Method () = () (*loc-63*)", "c")) /// type Class () = /// static member #Foo$ () = () - [] + [] member public this.``GotoDefinition.ObjectOriented.StaticMethodDef`` () = this.GotoDefinitionTestWithSimpleFile " () = () (*loc-64*)" (Some("static member Foo () = () (*loc-64*)", "Foo")) /// type #Class () = /// member Method () = () /// let c = Class$ () - [] + [] member public this.``GotoDefinition.ObjectOriented.ConstructorUse`` () = this.GotoDefinitionTestWithSimpleFile " () (*loc-65*)" (Some("type Class () = (*loc-62*)", "Class")) @@ -1263,27 +1243,27 @@ type UsingMSBuild() = /// member #Method () = () /// let c = Class () /// c.Method$ () - [] + [] member public this.``GotoDefinition.ObjectOriented.MethodInvocation`` () = this.GotoDefinitionTestWithSimpleFile " () (*loc-66*)" (Some("member c.Method () = () (*loc-63*)", "c.Method")) /// type Class () = /// static member #Foo () = () /// Class.Foo$ () - [] + [] member public this.``GotoDefinition.ObjectOriented.StaticMethodInvocation`` () = this.GotoDefinitionTestWithSimpleFile " () (*loc-67*)" (Some("static member Foo () = () (*loc-64*)", "Foo")) /// type Class () = /// member c.Method# () = c.Method$ () - [] + [] member public this.``GotoDefinition.ObjectOriented.MethodSelfInvocation`` () = this.GotoDefinitionTestWithSimpleFile " () (*loc-68*)" (Some("member c.Method () = c.Method () (*loc-68*)", "c.Method")) /// type Class () = /// member c.Method1 () = c.Method2$ () /// member #c.Method2 () = c.Method1 () - [] + [] member public this.``GotoDefinition.ObjectOriented.MethodToMethodForward`` () = this.GotoDefinitionTestWithSimpleFile " () (*loc-69*)" (Some("member c.Method2 () = c.Method1 () (*loc-70*)", "c.Method2")) @@ -1293,7 +1273,7 @@ type UsingMSBuild() = /// member c.Method () = /// let #c = Class () /// c$.Method () - [] + [] member public this.``GotoDefinition.ObjectOriented.ShadowThis`` () = this.GotoDefinitionTestWithSimpleFile ".Method () (*loc-71*)" (Some("let c = Class ()", "c")) @@ -1303,11 +1283,11 @@ type UsingMSBuild() = /// member c.Method () = /// let c = Class () /// c.Method$ () - [] + [] member public this.``GotoDefinition.ObjectOriented.ShadowThisMethodInvocation`` () = this.GotoDefinitionTestWithSimpleFile " () (*loc-71*)" (Some("member c.Method () = () (*loc-63*)", "c.Method")) - [] + [] member this.``GotoDefinition.ObjectOriented.StructConstructor`` () = let lines = [ "#light" @@ -1350,7 +1330,7 @@ type UsingMSBuild() = match (QuickParse.GetCompleteIdentifierIsland tolerate s n, exp) with | (Some (s1, _, _), Some s2) -> printfn "%s" "Received result, as expected." - Assert.AreEqual (s1, s2) + Assert.Equal (s1, s2) | (None, None) -> printfn "%s" "Received no result, as expected." | (Some _, None) -> @@ -1358,53 +1338,53 @@ type UsingMSBuild() = | (None, Some _) -> Assert.Fail("Expected result, but didn't receive one!") - [] + [] member public this.``GetCompleteIdTest.TrivialBefore`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let $ThisIsAnIdentifier = ()" (Some "ThisIsAnIdentifier") - [] + [] member public this.``GetCompleteIdTest.TrivialMiddle`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let This$IsAnIdentifier = ()" (Some "ThisIsAnIdentifier") - [] + [] member public this.``GetCompleteIdTest.TrivialEnd`` () = this.GetCompleteIdTest true "let ThisIsAnIdentifier$ = ()" (Some "ThisIsAnIdentifier") this.GetCompleteIdTest false "let ThisIsAnIdentifier$ = ()" None - [] + [] member public this.``GetCompleteIdTest.GetsUpToDot1`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let ThisIsAnIdentifier = Te$st.Moo.Foo.bar" (Some "Test") - [] + [] member public this.``GetCompleteIdTest.GetsUpToDot2`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let ThisIsAnIdentifier = Test.Mo$o.Foo.bar" (Some "Test.Moo") - [] + [] member public this.``GetCompleteIdTest.GetsUpToDot3`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let ThisIsAnIdentifier = Test.Moo.Fo$o.bar" (Some "Test.Moo.Foo") - [] + [] member public this.``GetCompleteIdTest.GetsUpToDot4`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let ThisIsAnIdentifier = Test.Moo.Foo.ba$r" (Some "Test.Moo.Foo.bar") - [] + [] member public this.``GetCompleteIdTest.GetsUpToDot5`` () = this.GetCompleteIdTest true "let ThisIsAnIdentifier = Test.Moo.Foo.bar$" (Some "Test.Moo.Foo.bar") this.GetCompleteIdTest false "let ThisIsAnIdentifier = Test.Moo.Foo.bar$" None - [] + [] member public this.``GetCompleteIdTest.GetOperator`` () = for tolerate in [true;false] do this.GetCompleteIdTest tolerate "let ThisIsAnIdentifier = 3 +$ 4" None - [] + [] member public this.``Identifier.IsConstructor.Bug2516``() = let fileContents = """ module GotoDefinition @@ -1413,7 +1393,7 @@ type UsingMSBuild() = let definitionCode = "type One(*Mark1*) = One" this.VerifyGoToDefnSuccessAtStartOfMarker(fileContents,"(*Mark1*)",definitionCode) - [] + [] member public this.``Identifier.IsTypeName.Bug2516``() = let fileContents = """ module GotoDefinition @@ -1422,7 +1402,7 @@ type UsingMSBuild() = let definitionCode = "type One(*Mark1*) = One" this.VerifyGoToDefnSuccessAtStartOfMarker(fileContents,"(*Mark2*)",definitionCode) - [] + [] member public this.``ModuleName.OnDefinitionSite.Bug2517``() = let fileContents = """ namespace GotoDefinition @@ -1432,7 +1412,7 @@ type UsingMSBuild() = this.VerifyGoToDefnSuccessAtStartOfMarker(fileContents,"(*Mark*)",definitionCode) /// GotoDef on abbreviation - [] + [] member public this.``GotoDefinition.Abbreviation.Bug193064``() = let fileContents = """ type X = int @@ -1442,7 +1422,7 @@ type UsingMSBuild() = /// Verify the GotoDefinition on UoM yield does NOT jump out error dialog, /// will do nothing in automation lab machine or GTD SI.fs on dev machine with enlistment. - [] + [] member public this.``GotoDefinition.UnitOfMeasure.Bug193064``() = let fileContents = """ open Microsoft.FSharp.Data.UnitSystems.SI @@ -1451,6 +1431,5 @@ type UsingMSBuild() = // Context project system -[] 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 06c9bc76a62..99422f89e91 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.NavigationBar.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.NavigationBar.fs @@ -3,7 +3,7 @@ namespace Tests.LanguageService.NavigationBar open System -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa @@ -11,9 +11,6 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -[] -[] -[] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -100,6 +97,5 @@ type UsingMSBuild() = // Context project system -[] 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 4ccfee95276..de36960f819 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.ParameterInfo.fs @@ -3,7 +3,7 @@ namespace Tests.LanguageService.ParameterInfo open System -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa @@ -16,8 +16,6 @@ module ParamInfoStandardSettings = let standard40AssemblyRefs = [| "System"; "System.Core"; "System.Numerics" |] let queryAssemblyRefs = [ "System.Xml.Linq"; "System.Core" ] -[] -[] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -28,7 +26,7 @@ type UsingMSBuild() = yield display ] ] let AssertEmptyMethodGroup(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option) = - Assert.IsTrue(resultMethodGroup.IsNone, "Expected an empty method group") + 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 @@ -38,10 +36,10 @@ type UsingMSBuild() = AssertNotContains(description,expectNotToBeThere) let AssertMethodGroup(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option, expectedParamNamesSet:string list list) = - Assert.IsTrue(resultMethodGroup.IsSome, "Expected a method group") + Assert.True(resultMethodGroup.IsSome, "Expected a method group") let resultMethodGroup = resultMethodGroup.Value - Assert.AreEqual(expectedParamNamesSet.Length, resultMethodGroup.GetCount()) - Assert.IsTrue(resultMethodGroup + Assert.Equal(expectedParamNamesSet.Length, resultMethodGroup.GetCount()) + Assert.True(resultMethodGroup |> GetParamDisplays |> Seq.forall (fun paramDisplays -> expectedParamNamesSet |> List.exists (fun expectedParamNames -> @@ -50,9 +48,9 @@ type UsingMSBuild() = paramDisplay.Contains(expectedParamName))))) let AssertMethodGroupContain(resultMethodGroup:Microsoft.VisualStudio.FSharp.LanguageService.MethodListForAMethodTip_DEPRECATED option, expectedParamNames:string list) = - Assert.IsTrue(resultMethodGroup.IsSome, "Expected a method group") + Assert.True(resultMethodGroup.IsSome, "Expected a method group") let resultMethodGroup = resultMethodGroup.Value - Assert.IsTrue(resultMethodGroup + Assert.True(resultMethodGroup |> GetParamDisplays |> Seq.exists (fun paramDisplays -> expectedParamNames.Length = paramDisplays.Length && @@ -84,48 +82,48 @@ type UsingMSBuild() = //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) = let methodstr = this.GetMethodListForAMethodTip(fileContents,marker,?addtlRefAssy=addtlRefAssy) - Assert.IsTrue(methodstr.IsSome, "Expected a method group") + Assert.True(methodstr.IsSome, "Expected a method group") let methodstr = methodstr.Value let paramDisplays = [ for i = 0 to methodstr.GetParameterCount(index) - 1 do let (name,display,description) = methodstr.GetParameterInfo(index,i) yield display] - Assert.IsTrue((expectedParams, paramDisplays) ||> List.forall2 (fun expectedParam paramDisplay -> paramDisplay.Contains(expectedParam))) + Assert.True((expectedParams, paramDisplays) ||> List.forall2 (fun expectedParam paramDisplay -> paramDisplay.Contains(expectedParam))) //Verify there is at least one parameterInfo member private this.VerifyHasParameterInfo(fileContents : string, marker : string) = let methodstr = this.GetMethodListForAMethodTip(fileContents,marker) - Assert.IsTrue(methodstr.IsSome, "Expected a method group") + Assert.True(methodstr.IsSome, "Expected a method group") let methodstr = methodstr.Value - Assert.IsTrue (methodstr.GetCount() > 0) + Assert.True (methodstr.GetCount() > 0) //Verify return content after the colon member private this.VerifyFirstParameterInfoColonContent(fileContents : string, marker : string, expectedStr : string, ?addtlRefAssy : string list) = let methodstr = this.GetMethodListForAMethodTip(fileContents,marker,?addtlRefAssy=addtlRefAssy) - Assert.IsTrue(methodstr.IsSome, "Expected a method group") + Assert.True(methodstr.IsSome, "Expected a method group") let methodstr = methodstr.Value - Assert.AreEqual(expectedStr, methodstr.GetReturnTypeText(0)) // Expecting a method info like X(a:int,b:int) : int [used to be X(a:int,b:int) -> int] + Assert.Equal(expectedStr, methodstr.GetReturnTypeText(0)) // Expecting a method info like X(a:int,b:int) : int [used to be X(a:int,b:int) -> int] member private this.VerifyParameterCount(fileContents : string, marker : string, expectedCount: int) = let methodstr = this.GetMethodListForAMethodTip(fileContents,marker) - Assert.IsTrue(methodstr.IsSome, "Expected a method group") + Assert.True(methodstr.IsSome, "Expected a method group") let methodstr = methodstr.Value - Assert.AreEqual(0, methodstr.GetParameterCount(expectedCount)) + Assert.Equal(0, methodstr.GetParameterCount(expectedCount)) - [] + [] member public this.``Regression.OnConstructor.881644``() = let fileContent = """new System.IO.StreamReader((*Mark*)""" let methodstr = this.GetMethodListForAMethodTip(fileContent,"(*Mark*)") - Assert.IsTrue(methodstr.IsSome, "Expected a method group") + Assert.True(methodstr.IsSome, "Expected a method group") let methodstr = methodstr.Value if not (methodstr.GetDescription(0).Contains("#ctor")) then failwith "Expected parameter info to contain #ctor" - [] + [] member public this.``Regression.InsideWorkflow.6437``() = let fileContent = """ open System.IO @@ -134,13 +132,13 @@ type UsingMSBuild() = let! buffer = file.AsyncRead((*Mark*)0) return 0 }""" let methodstr = this.GetMethodListForAMethodTip(fileContent,"(*Mark*)") - Assert.IsTrue(methodstr.IsSome, "Expected a method group") + Assert.True(methodstr.IsSome, "Expected a method group") let methodstr = methodstr.Value if not (methodstr.GetDescription(0).Contains("AsyncRead")) then failwith "Expected parameter info to contain AsyncRead" - [] + [] member public this.``Regression.MethodInfo.WithColon.Bug4518_1``() = let fileContent = """ type T() = @@ -149,7 +147,7 @@ type UsingMSBuild() = ((new T()).X((*Mark*)""" this.VerifyFirstParameterInfoColonContent(fileContent,"(*Mark*)",": int") - [] + [] member public this.``Regression.MethodInfo.WithColon.Bug4518_2``() = let fileContent = """ type IFoo = interface @@ -159,7 +157,7 @@ type UsingMSBuild() = i.f((*Mark*)""" this.VerifyFirstParameterInfoColonContent(fileContent,"(*Mark*)",": int") - [] + [] member public this.``Regression.MethodInfo.WithColon.Bug4518_3``() = let fileContent = """ type M() = @@ -168,7 +166,7 @@ type UsingMSBuild() = m.f((*Mark*)""" this.VerifyFirstParameterInfoColonContent(fileContent,"(*Mark*)",": unit") - [] + [] member public this.``Regression.MethodInfo.WithColon.Bug4518_4``() = let fileContent = """ type T() = @@ -177,14 +175,14 @@ type UsingMSBuild() = t.Foo((*Mark*)""" this.VerifyFirstParameterInfoColonContent(fileContent,"(*Mark*)",": string") - [] + [] member public this.``Regression.MethodInfo.WithColon.Bug4518_5``() = let fileContent = """ let f x y = x + y f((*Mark*)""" this.VerifyFirstParameterInfoColonContent(fileContent,"(*Mark*)",": (int -> int) ") - [] + [] member public this.``Regression.StaticVsInstance.Bug3626.Case1``() = let fileContent = """ type Foo() = @@ -193,7 +191,7 @@ type UsingMSBuild() = let z = Foo.Bar((*Mark*))""" this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark*)",[["staticReturnsInt"]]) - [] + [] member public this.``Regression.StaticVsInstance.Bug3626.Case2``() = let fileContent = """ type Foo() = @@ -203,21 +201,21 @@ type UsingMSBuild() = let y = Hoo.Bar((*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark*)",[["instanceReturnsString"]]) - [] + [] member public this.``Regression.MethodInfo.Bug808310``() = let fileContent = """System.Console.WriteLine((*Mark*)""" let methodGroup = this.GetMethodListForAMethodTip(fileContent,"(*Mark*)") - Assert.IsTrue(methodGroup.IsSome, "Expected a method group") + Assert.True(methodGroup.IsSome, "Expected a method group") let methodGroup = methodGroup.Value let description = methodGroup.GetDescription(0) // Make sure that System.Console.WriteLine is not mentioned anywhere exception in the XML comment signature let xmlCommentIndex = description.IndexOf("System.Console.WriteLine]") let noBracket = description.IndexOf("System.Console.WriteLine") - Assert.IsTrue(noBracket>=0) - Assert.AreEqual(noBracket, xmlCommentIndex) + Assert.True(noBracket>=0) + Assert.Equal(noBracket, xmlCommentIndex) - [] + [] member public this.``NoArguments``() = // we want to see e.g. // g() : int @@ -240,20 +238,19 @@ type UsingMSBuild() = this.VerifyParameterCount(fileContents,"(*3*)", 0) this.VerifyParameterCount(fileContents,"(*4*)", 0) - [] + [] member public this.``Single.Constructor1``() = let fileContent = """new System.DateTime((*Mark*)""" this.VerifyHasParameterInfo(fileContent, "(*Mark*)") - [] + [] member public this.``Single.Constructor2``() = let fileContent = """ open System new DateTime((*Mark*)""" this.VerifyHasParameterInfo(fileContent, "(*Mark*)") - [] - [] + [] member public this.``Single.DotNet.StaticMethod``() = let code = ["#light" @@ -266,26 +263,26 @@ type UsingMSBuild() = AssertMethodGroup(methodGroup, [["objA"; "objB"]]) gpatcc.AssertExactly(0,0) - [] + [] member public this.``Regression.NoParameterInfo.100I.Bug5038``() = let fileContent = """100I((*Mark*)""" this.VerifyNoParameterInfoAtStartOfMarker(fileContent,"(*Mark*)") - [] + [] member public this.``Single.DotNet.InstanceMethod``() = let fileContent = """ let s = "Hello" s.Substring((*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark*)",[["startIndex"]; ["startIndex"; "length"]]) - [] + [] member public this.``Single.BasicFSharpFunction``() = let fileContent = """ let foo(x) = 1 foo((*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark*)",[["'a"]]) - // [] disabled for F#8, legacy service, covered in FCS tests instead + // [] disabled for F#8, legacy service, covered in FCS tests instead member public this.``Single.DiscriminatedUnion.Construction``() = let fileContent = """ type MyDU = @@ -305,7 +302,7 @@ type UsingMSBuild() = this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark3*)",[["``Long Name`` : int"; "string"]]) this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark4*)",[["int"]]) - // [] disabled for F#8, legacy service, covered in FCS tests instead + // [] disabled for F#8, legacy service, covered in FCS tests instead member public this.``Single.Exception.Construction``() = let fileContent = """ exception E1 of int * string @@ -321,10 +318,7 @@ type UsingMSBuild() = this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark2*)",[["V1: int"; "string"; "V3: bool" ]]) this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Mark3*)",[["``Long Name`` : int"; "string" ]]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo on a provided type that exposes one (static) method that takes one argument works normally. member public this.``TypeProvider.StaticMethodWithOneParam`` () = let fileContent = """ @@ -333,10 +327,7 @@ type UsingMSBuild() = this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Marker*)",[["arg1"]], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo on a provided type that exposes a (static) method that takes >1 arguments works normally. member public this.``TypeProvider.StaticMethodWithMoreParam`` () = let fileContent = """ @@ -345,12 +336,9 @@ type UsingMSBuild() = this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Marker*)",[["arg1";"arg2"]], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] //This test case verify the TypeProvider static method return type or colon content of the method //This test verifies that ParamInfo on a provided type that exposes one (static) method that takes one argument - [] //and returns something works correctly (more precisely, it checks that the return type is 'int') member public this.``TypeProvider.StaticMethodColonContent`` () = let fileContent = """ @@ -360,10 +348,7 @@ type UsingMSBuild() = addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo on a provided type that exposes a Constructor that takes no argument works normally. member public this.``TypeProvider.ConstructorWithNoParam`` () = let fileContent = """ @@ -372,10 +357,7 @@ type UsingMSBuild() = this.VerifyParameterInfoOverloadMethodIndex(fileContent,"(*Marker*)",0,[], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo on a provided type that exposes a Constructor that takes one argument works normally. member public this.``TypeProvider.ConstructorWithOneParam`` () = let fileContent = """ @@ -384,10 +366,7 @@ type UsingMSBuild() = this.VerifyParameterInfoOverloadMethodIndex(fileContent,"(*Marker*)",1,["arg1"], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo on a provided type that exposes a Constructor that takes >1 argument works normally. member public this.``TypeProvider.ConstructorWithMoreParam`` () = let fileContent = """ @@ -396,10 +375,7 @@ type UsingMSBuild() = this.VerifyParameterInfoOverloadMethodIndex(fileContent,"(*Marker*)",2,["arg1";"arg2"], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo on a provided type that exposes a static parameter that takes >1 argument works normally. member public this.``TypeProvider.Type.WhenOpeningBracket`` () = let fileContent = """ @@ -408,10 +384,7 @@ type UsingMSBuild() = this.VerifyParameterInfoAtStartOfMarker(fileContent,"(*Marker*)",[["Param1";"ParamIgnored"]], addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that after closing bracket ">" the ParamInfo isn't showing on a provided type that exposes a static parameter that takes >1 argument works normally. //This is a regression test for Bug DevDiv:181000 member public this.``TypeProvider.Type.AfterCloseBracket`` () = @@ -421,10 +394,7 @@ type UsingMSBuild() = this.VerifyNoParameterInfoAtStartOfMarker(fileContent,"(*Marker*)", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo is showing after delimiter "," on a provided type that exposes a static parameter that takes >1 argument works normally. member public this.``TypeProvider.Type.AfterDelimiter`` () = let fileContent = """ @@ -434,8 +404,7 @@ type UsingMSBuild() = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``Single.InMatchClause``() = let v461 = Version(4,6,1) let fileContent = """ @@ -534,23 +503,22 @@ type UsingMSBuild() = let methodGroup = GetParameterInfoAtCursor file if (methReq = []) then - Assert.IsTrue(methodGroup.IsNone, "Expected no method group") + Assert.True(methodGroup.IsNone, "Expected no method group") else AssertMethodGroup(methodGroup, methReq) // Test on .NET functions with no parameter - [] + [] member public this.``Single.DotNet.NoParameters`` () = this.TestSystematicParameterInfo("x.ToUpperInvariant(", [ [] ]) // Test on .NET function with one parameter - [] + [] member public this.``Single.DotNet.OneParameter`` () = this.TestSystematicParameterInfo("System.DateTime.Today.AddYears(", [ ["value: int"] ] ) // Test appearance of PI on second parameter of .NET function - [] - [] + [] member public this.``Single.DotNet.OnSecondParameter`` () = this.TestSystematicParameterInfo("loc-1*),", [ ["format"; "args"]; ["format"; "arg0"]; @@ -558,8 +526,7 @@ type UsingMSBuild() = ["format"; "arg0"; "arg1"]; ["format"; "arg0"; "arg1"; "arg2"] ] ) // Test on .NET functions with parameter array - [] - [] + [] member public this.``Single.DotNet.ParameterArray`` () = this.TestSystematicParameterInfo("loc-2*),", [ ["format"; "args"]; ["format"; "arg0"]; @@ -567,69 +534,63 @@ type UsingMSBuild() = ["format"; "arg0"; "arg1"]; ["format"; "arg0"; "arg1"; "arg2"] ] ) // Test on .NET indexers - [] - [] + [] member public this.``Single.DotNet.IndexerParameter`` () = this.TestSystematicParameterInfo("alist.[", [ ["index: int"] ] ) // Test on .NET parameters passed with 'out' keyword (byref) - [] - [] + [] member public this.``Single.DotNet.ParameterByReference`` () = this.TestSystematicParameterInfo("Int32.TryParse(s,", [ ["s: string"; "result: int byref"]; ["s"; "style"; "provider"; "result"] ] ) // Test on reference type and value type parameters (e.g. string & DateTime) - [] + [] member public this.``Single.DotNet.RefTypeValueType`` () = this.TestSystematicParameterInfo("loc-3*)Emp(", [ []; ["name: string"; "dob: System.DateTime"]; ["name: string"; "salary: float"; "dob: System.DateTime"] ] ) // Test PI does not pop up at point of definition/declaration - [] - [] + [] member public this.``Single.Locations.PointOfDefinition`` () = this.TestSystematicParameterInfo("loc-4*)new(", [ ] ) this.TestSystematicParameterInfo("member ConvertToInt32 (", [ ] ) this.TestSystematicParameterInfo("member this.IncreaseBy(", [ ] ) // Test PI does not pop up on whitespace after type annotation - [] - [] + [] member public this.``Single.Locations.AfterTypeAnnotation`` () = this.TestSystematicParameterInfo("(*loc-5*)", [], true) // Test PI does not pop up after non-parameterized properties - [] + [] member public this.``Single.Locations.AfterProperties`` () = this.TestSystematicParameterInfo("System.DateTime.Today", []) //this.TestSystematicParameterInfo("(*loc-8*)", [], true) // Test PI does not pop up after non-function values - [] + [] member public this.``Single.Locations.AfterValues`` () = this.TestSystematicParameterInfo("(*loc-8*)", [], true) // Test PI does not pop up after non-parameterized properties and after values - [] - [] + [] member public this.``Single.Locations.EndOfFile`` () = this.TestSystematicParameterInfo("System.Console.ReadLine(", [ [] ]) // Test PI pop up on parameter list for attributes - [] - [] + [] member public this.``Single.OnAttributes`` () = this.TestSystematicParameterInfo("(*loc-6*)", [ []; [ "check: bool" ] ], true) // Test PI when quoted identifiers are used as parameter - [] + [] member public this.``Single.QuotedIdentifier`` () = this.TestSystematicParameterInfo("(*loc-7*)", [ []; [ "maxValue" ]; [ "minValue"; "maxValue" ] ], true) // Test PI with parameters of custom type - [] + [] member public this.``Single.RecordAndUnionType`` () = this.TestSystematicParameterInfo("(*loc-9*)", [ [ "Fruit"; "KeyValuePair" ] ], true) @@ -643,65 +604,55 @@ type UsingMSBuild() = MoveCursorToEndOfMarker(file, testLine) let methodGroup = GetParameterInfoAtCursor file if (methReq = []) then - Assert.IsTrue(methodGroup.IsNone, "expected no method group") + Assert.True(methodGroup.IsNone, "expected no method group") else AssertMethodGroup(methodGroup, methReq) - [] + [] member public this.``Single.Generics.Typeof``() = this.TestGenericParameterInfo("typeof(", []) - [] - [] + [] member public this.``Single.Generics.MathAbs``() = let sevenTimes l = [ l; l; l; l; l; l; l ] this.TestGenericParameterInfo("Math.Abs(", sevenTimes ["value"]) - [] - [] + [] member public this.``Single.Generics.ExchangeInt``() = let sevenTimes l = [ l; l; l; l; l; l; l ] this.TestGenericParameterInfo("Interlocked.Exchange(", sevenTimes ["location1"; "value"]) - [] - [] + [] member public this.``Single.Generics.Exchange``() = let sevenTimes l = [ l; l; l; l; l; l; l ] this.TestGenericParameterInfo("Interlocked.Exchange(", sevenTimes ["location1"; "value"]) - [] - [] + [] member public this.``Single.Generics.ExchangeUnder``() = let sevenTimes l = [ l; l; l; l; l; l; l ] this.TestGenericParameterInfo("Interlocked.Exchange<_> (", sevenTimes ["location1"; "value"]) - [] - [] + [] member public this.``Single.Generics.Dictionary``() = this.TestGenericParameterInfo("System.Collections.Generic.Dictionary<_, option>(", [ []; ["capacity"]; ["comparer"]; ["capacity"; "comparer"]; ["dictionary"]; ["dictionary"; "comparer"] ]) - [] - [] + [] member public this.``Single.Generics.List``() = this.TestGenericParameterInfo("new System.Collections.Generic.List< _ > ( ", [ []; ["capacity"]; ["collection"] ]) - [] - [] + [] member public this.``Single.Generics.ListInt``() = this.TestGenericParameterInfo("System.Collections.Generic.List(", [ []; ["capacity"]; ["collection"] ]) - [] - [] + [] member public this.``Single.Generics.EventHandler``() = this.TestGenericParameterInfo("new System.EventHandler( ", [ [""] ]) // function arg doesn't have a name - [] - [] + [] member public this.``Single.Generics.EventHandlerEventArgs``() = this.TestGenericParameterInfo("System.EventHandler(", [ [""] ]) // function arg doesn't have a name - [] - [] + [] member public this.``Single.Generics.EventHandlerEventArgsNew``() = this.TestGenericParameterInfo("new System.EventHandler ( ", [ [""] ]) // function arg doesn't have a name @@ -727,7 +678,7 @@ type UsingMSBuild() = let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToEndOfMarker(file, cursorPrefix) let info = GetParameterInfoAtCursor file - Assert.IsTrue(info.IsNone, "expected no parameter info") + Assert.True(info.IsNone, "expected no parameter info") gpatcc.AssertExactly(0,0) member public this.TestParameterInfoLocation (testLine, expectedPos, ?addtlRefAssy : string list) = @@ -740,7 +691,7 @@ type UsingMSBuild() = let (_, _, file) = this.CreateSingleFileProject(code, ?references = addtlRefAssy) MoveCursorToEndOfMarker(file, cursorPrefix) let info = GetParameterInfoAtCursor file - Assert.IsTrue(info.IsSome, "expected parameter info") + Assert.True(info.IsSome, "expected parameter info") let info = info.Value AssertEqual(expectedPos, info.GetColumnOfStartOfLongId()) @@ -748,83 +699,72 @@ type UsingMSBuild() = // There are more comments below that explain particular tricky cases - [] + [] member public this.``Single.Locations.Simple``() = this.TestParameterInfoLocation("let a = System.Math.Sin($", 8) - [] + [] member public this.``Single.Locations.LineWithSpaces``() = this.TestParameterInfoLocation("let r =\n"+ " System.Math.Abs($0)", 3) // on the beginning of "System", not line! - [] + [] member public this.``Single.Locations.FullCall``() = this.TestParameterInfoLocation("System.Math.Abs($0)", 0) - [] + [] member public this.``Single.Locations.SpacesAfterParen``() = this.TestParameterInfoLocation("let a = Math.Sign( $-10 )", 8) - [] + [] member public this.``Single.Locations.WithNamespace``() = this.TestParameterInfoLocation("let a = System.Threading.Interlocked.Exchange($", 8) - [] + [] member public this.``ParameterInfo.Locations.WithoutNamespace``() = this.TestParameterInfoLocation("let a = Interlocked.Exchange($", 8) - [] - [] + [] member public this.``Single.Locations.WithGenericArgs``() = this.TestParameterInfoLocation("Interlocked.Exchange($", 0) - [] + [] member public this.``Single.Locations.FunctionWithSpace``() = this.TestParameterInfoLocation("let a = sin 0$.0", 8) - [] + [] member public this.``Single.Locations.MethodCallWithoutParens``() = this.TestParameterInfoLocation("let n = Math.Sin 1$0.0", 8) - [] + [] member public this.``Single.Locations.GenericCtorWithNamespace``() = this.TestParameterInfoLocation("let _ = new System.Collections.Generic.Dictionary<_, _>($)", 12) // on the beginning of "System" (not on "new") - [] + [] member public this.``Single.Locations.GenericCtor``() = this.TestParameterInfoLocation("let _ = new Dictionary<_, _>($)", 12) // on the beginning of "System" (not on "new") - [] - [] - [] - [] + [] //This test verifies that ParamInfo location on a provided type with namespace that exposes static parameter that takes >1 argument works normally. member public this.``TypeProvider.Type.ParameterInfoLocation.WithNamespace`` () = this.TestParameterInfoLocation("type boo = N1.T<$",11, addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] //This test verifies that ParamInfo location on a provided type without the namespace that exposes static parameter that takes >1 argument works normally. member public this.``TypeProvider.Type.ParameterInfoLocation.WithOutNamespace`` () = this.TestParameterInfoLocation("open N1 \n"+"type boo = T<$", expectedPos = 11, addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] //This test verifies that no ParamInfo in a string 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 string member public this.``TypeProvider.Type.Negative.InString`` () = this.TestParameterInfoNegative("type boo = \"N1.T<$\"", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] //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 public this.``TypeProvider.Type.Negative.InComment`` () = @@ -837,35 +777,35 @@ type UsingMSBuild() = // we *must* look at the previous line to find the location where NameRes info ends // so in these cases we can find the identifier and location of tooltip is beginning of it // (but in general, we don't search for it) - [] + [] member public this.``Single.Locations.Multiline.IdentOnPrevLineWithGenerics``() = this.TestParameterInfoLocation("let d = Dictionary<_, option< int >> \n" + " ( $ )", 8) // on the "D" (line untestable) - [] + [] member public this.``Single.Locations.Multiline.IdentOnPrevLine``() = this.TestParameterInfoLocation("do Console.WriteLine\n" + " ($\"Multiline\")", 3) - [] + [] member public this.``Single.Locations.Multiline.IdentOnPrevPrevLine``() = this.TestParameterInfoLocation("do Console.WriteLine\n" + " ( \n" + " $ \"Multiline\")", 3) - [] + [] member public this.``Single.Locations.GenericCtorWithoutNew``() = this.TestParameterInfoLocation("let d = System.Collections.Generic.Dictionary<_, option< int >> ( $ )", 8) // on "S" - standard - [] + [] member public this.``Single.Locations.Multiline.GenericTyargsOnTheSameLine``() = this.TestParameterInfoLocation("let dict3 = System.Collections.Generic.Dictionary<_, \n" + " option< int>>( $ )", 12) // on "S" (beginning of "System") - [] + [] member public this.``Single.Locations.Multiline.LongIdentSplit``() = this.TestParameterInfoLocation("let ll = new System.Collections.\n" + " Generic.List< _ > ($)", 13) // on "S" (beginning of "System") - [] + [] member public this.``Single.Locations.OperatorTrick3``() = this.TestParameterInfoLocation ("let mutable n = null\n" + @@ -874,32 +814,31 @@ type UsingMSBuild() = // A several cases that are tricky and we don't want to show anything // in the following cases, we may return a location of an operator (its ambiguous), but we don't want to show info about it! - [] + [] member public this.``Single.Negative.OperatorTrick1``() = this.TestParameterInfoNegative ("let fooo = 0\n" + " >($ 1 )") // this may be end of a generic args specification - [] + [] member public this.``Single.Negative.OperatorTrick2``() = this.TestParameterInfoNegative ("let fooo = 0\n" + " <($ 1 )") /// No intellisense in comments/strings! - [] + [] member public this.``Single.InString``() = this.TestParameterInfoNegative ("let s = \"System.Console.WriteLine($)\"") /// No intellisense in comments/strings! - [] + [] member public this.``Single.InComment``() = this.TestParameterInfoNegative ("// System.Console.WriteLine($)") - [] - [] + [] member this.``Regression.LocationOfParams.AfterQuicklyTyping.Bug91373``() = let code = [ "let f x = x " "let f1 y = y " @@ -917,14 +856,13 @@ type UsingMSBuild() = "let z = f(f1( " ] ) MoveCursorToEndOfMarker(file, "f1(") let info = GetParameterInfoAtCursor file // this will fall back to using the name environment, which is stale, but sufficient to look up the call to 'f1' - Assert.IsTrue(info.IsSome, "expected parameter info") + Assert.True(info.IsSome, "expected parameter info") let info = info.Value AssertEqual("f1", info.GetName(0)) // note about (5,0): service.fs adds three lines of empty text 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 AssertEqual([|(2,10);(2,12);(2,13);(3,0)|], info.GetParameterLocations()) - [] - [] + [] member this.``LocationOfParams.AfterQuicklyTyping.CallConstructor``() = let code = [ "type Foo() = class end" ] let (_, _, file) = this.CreateSingleFileProject(code) @@ -940,7 +878,7 @@ type UsingMSBuild() = MoveCursorToEndOfMarker(file, "new Foo(") // Note: no TakeCoffeeBreak(this.VS) let info = GetParameterInfoAtCursor file // this will fall back to using the name environment, which is stale, but sufficient to look up the call to 'f1' - Assert.IsTrue(info.IsSome, "expected parameter info") + Assert.True(info.IsSome, "expected parameter info") let info = info.Value AssertEqual("Foo", info.GetName(0)) // note about (4,0): service.fs adds three lines of empty text 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 @@ -950,7 +888,7 @@ 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``() = let solution = CreateSolution(this.VS) let project = CreateProject(solution,"testproject") @@ -974,7 +912,7 @@ We really need to rewrite some code paths here to use the real parse tree rather AssertEqual([|(1,14);(1,21);(1,21);(4,0)|], info.GetParameterLocations()) *) - [] + [] member public this.``ParameterInfo.NamesOfParams``() = let testLines = [ "type Foo =" @@ -985,7 +923,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let (_, _, file) = this.CreateSingleFileProject(testLines) MoveCursorToStartOfMarker(file, "0") let info = GetParameterInfoAtCursor file - Assert.IsTrue(info.IsSome, "expected parameter info") + Assert.True(info.IsSome, "expected parameter info") let info = info.Value let names = info.GetParameterNames() AssertEqual([| null; null; "d"; "e"; "c" |], names) @@ -1019,7 +957,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let (_, _, file) = this.CreateSingleFileProject(testLines, references = references) MoveCursorToEndOfMarker(file, cursorPrefix) let info = GetParameterInfoAtCursor file - Assert.IsTrue(info.IsSome, "expected parameter info") + Assert.True(info.IsSome, "expected parameter info") let info = info.Value AssertEqual(expectedLocs, info.GetParameterLocations()) @@ -1040,17 +978,17 @@ We really need to rewrite some code paths here to use the real parse tree rather let (_, _, file) = this.CreateSingleFileProject(testLines, references = references) MoveCursorToEndOfMarker(file, cursorPrefix) let info = GetParameterInfoAtCursor file - Assert.IsTrue(info.IsNone, "expected no parameter info for this particular test, though it would be nice if this has started to work") + Assert.True(info.IsNone, "expected no parameter info for this particular test, though it would be nice if this has started to work") - [] + [] member public this.``LocationOfParams.Case1``() = this.TestParameterInfoLocationOfParams("""^System.Console.WriteLine^(^"hel$lo"^)""") - [] + [] member public this.``LocationOfParams.Case2``() = this.TestParameterInfoLocationOfParams("""^System.Console.WriteLine^ (^ "hel$lo {0}" ,^ "Brian" ^)""") - [] + [] member public this.``LocationOfParams.Case3``() = this.TestParameterInfoLocationOfParams( """^System.Console.WriteLine^ @@ -1058,11 +996,11 @@ We really need to rewrite some code paths here to use the real parse tree rather "hel$lo {0}" ,^ "Brian" ^) """) - [] + [] member public this.``LocationOfParams.Case4``() = this.TestParameterInfoLocationOfParams("""^System.Console.WriteLine^ (^ "hello {0}" ,^ ("tuples","don't $ confuse it") ^)""") - [] + [] member public this.``ParameterInfo.LocationOfParams.Bug112688``() = let testLines = [ "let f x y = ()" @@ -1078,7 +1016,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let info = GetParameterInfoAtCursor file () - [] + [] member public this.``ParameterInfo.LocationOfParams.Bug112340``() = let testLines = [ """let a = typeof] - [] + [] member public this.``Regression.LocationOfParams.Bug91479``() = this.TestParameterInfoLocationOfParams("""let z = fun x -> x + ^System.Int16.Parse^(^$ """, markAtEOF=true) - [] + [] member public this.``LocationOfParams.Attributes.Bug230393``() = this.TestParameterInfoLocationOfParams(""" let paramTest((strA : string),(strB : string)) = @@ -1105,30 +1042,30 @@ We really need to rewrite some code paths here to use the real parse tree rather type RMB """) - [] + [] member public this.``LocationOfParams.InfixOperators.Case1``() = // infix operators like '+' do not give their own param info this.TestParameterInfoLocationOfParams("""^System.Console.WriteLine^(^"" + "$"^)""") - [] + [] member public this.``LocationOfParams.InfixOperators.Case2``() = // infix operators like '+' do give param info when used as prefix ops this.TestParameterInfoLocationOfParams("""System.Console.WriteLine((^+^)(^$3^)(4))""") - [] + [] member public this.``LocationOfParams.GenericMethodExplicitTypeArgs()``() = this.TestParameterInfoLocationOfParams(""" type T<'a> = static member M(x:int, y:string) = x + y.Length let x = ^T.M^(^1,^ $"test"^) """) - [] + [] member public this.``LocationOfParams.InsideAMemberOfAType``() = this.TestParameterInfoLocationOfParams(""" type Widget(z) = member x.a = (1 <> ^System.Int32.Parse^(^"$"^)) """) - [] + [] member public this.``LocationOfParams.InsidePropertyGettersAndSetters.Case1``() = this.TestParameterInfoLocationOfParams(""" type Widget(z) = @@ -1138,7 +1075,7 @@ We really need to rewrite some code paths here to use the real parse tree rather member x.P2 with get() = System.Int32.Parse("") member x.P2 with set(z) = System.Int32.Parse("") |> ignore """) - [] + [] member public this.``LocationOfParams.InsidePropertyGettersAndSetters.Case2``() = this.TestParameterInfoLocationOfParams(""" type Widget(z) = @@ -1148,7 +1085,7 @@ We really need to rewrite some code paths here to use the real parse tree rather member x.P2 with get() = System.Int32.Parse("") member x.P2 with set(z) = System.Int32.Parse("") |> ignore """) - [] + [] member public this.``LocationOfParams.InsidePropertyGettersAndSetters.Case3``() = this.TestParameterInfoLocationOfParams(""" type Widget(z) = @@ -1158,7 +1095,7 @@ We really need to rewrite some code paths here to use the real parse tree rather member x.P2 with get() = ^System.Int32.Parse^(^"$"^) member x.P2 with set(z) = System.Int32.Parse("") |> ignore """) - [] + [] member public this.``LocationOfParams.InsidePropertyGettersAndSetters.Case4``() = this.TestParameterInfoLocationOfParams(""" type Widget(z) = @@ -1168,48 +1105,46 @@ We really need to rewrite some code paths here to use the real parse tree rather member x.P2 with get() = System.Int32.Parse("") member x.P2 with set(z) = ^System.Int32.Parse^(^"$"^) |> ignore """) - [] + [] member public this.``LocationOfParams.InsideObjectExpression``() = this.TestParameterInfoLocationOfParams(""" let _ = { new ^System.Object^(^$^) with member _.GetHashCode() = 2}""") - [] + [] member public this.``LocationOfParams.Nested1``() = this.TestParameterInfoLocationOfParams("""System.Console.WriteLine("hello {0}" , ^sin^ (^4$2.0 ^) )""") - [] + [] member public this.``LocationOfParams.MatchGuard``() = this.TestParameterInfoLocationOfParams("""match [1] with | [x] when ^box^(^$x^) <> null -> ()""") - [] + [] member public this.``LocationOfParams.Nested2``() = this.TestParameterInfoLocationOfParams("""System.Console.WriteLine("hello {0}" , ^sin^ 4^$2.0^ )""") - [] + [] member public this.``LocationOfParams.Generics1``() = this.TestParameterInfoLocationOfParams(""" let f<'T,'U>(x:'T, y:'U) = (y,x) let r = ^f^(^4$2,^""^)""") - [] + [] member public this.``LocationOfParams.Generics2``() = this.TestParameterInfoLocationOfParams("""let x = ^System.Collections.Generic.Dictionary^(^42,^n$ull^)""") - [] + [] member public this.``LocationOfParams.Unions1``() = this.TestParameterInfoLocationOfParams(""" type MyDU = | FOO of int * string let r = ^FOO^(^42,^"$"^) """) - [] - [] + [] member public this.``LocationOfParams.EvenWhenOverloadResolutionFails.Case1``() = this.TestParameterInfoLocationOfParams("""let a = new ^System.IO.FileStream^(^$^)""") - [] - [] + [] member public this.``LocationOfParams.EvenWhenOverloadResolutionFails.Case2``() = this.TestParameterInfoLocationOfParams(""" open System.Collections.Generic @@ -1217,8 +1152,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let l = List([||]) ^l.Aggregate^(^$^) // was once a bug""") - [] - [] + [] member public this.``LocationOfParams.BY_DESIGN.WayThatMismatchedParensFailOver.Case1``() = // when only one 'statement' after the mismatched parens after a comma, the comma swallows it and it becomes a badly-indented // continuation of the expression from the previous line @@ -1229,8 +1163,7 @@ We really need to rewrite some code paths here to use the real parse tree rather ^c.M^(^1,^2,^3,^ $ c.M(1,2,3,4)""", markAtEOF=true) - [] - [] + [] member public this.``LocationOfParams.BY_DESIGN.WayThatMismatchedParensFailOver.Case2``() = // when multiple 'statements' after the mismatched parens after a comma, the parser sees a single argument to the method that // is a statement sequence, e.g. a bunch of discarded expressions. That is, @@ -1253,18 +1186,17 @@ We really need to rewrite some code paths here to use the real parse tree rather c.M(1,2,3,4) c.M(1,2,3,4)""", markAtEOF=true) - [] + [] member public this.``LocationOfParams.Tuples.Bug91360.Case1``() = this.TestParameterInfoLocationOfParams(""" ^System.Console.WriteLine^(^ (4$2,43) ^) // oops""") - [] + [] member public this.``LocationOfParams.Tuples.Bug91360.Case2``() = this.TestParameterInfoLocationOfParams(""" ^System.Console.WriteLine^(^ $(42,43) ^) // oops""") - [] - [] + [] member public this.``LocationOfParams.Tuples.Bug123219``() = this.TestParameterInfoLocationOfParams(""" type Expr = | Num of int @@ -1274,14 +1206,14 @@ We really need to rewrite some code paths here to use the real parse tree rather ^x.M1^(^(1,$ """, markAtEOF=true) - [] + [] member public this.``LocationOfParams.UnmatchedParens.Bug91609.OtherCases.Open``() = this.TestParameterInfoLocationOfParams(""" let arr = Array.create 4 1 arr.[1] <- ^System.Int32.Parse^(^$ open^ System""") - [] + [] member public this.``LocationOfParams.UnmatchedParens.Bug91609.OtherCases.Module``() = this.TestParameterInfoLocationOfParams(""" let arr = Array.create 4 1 @@ -1289,7 +1221,7 @@ We really need to rewrite some code paths here to use the real parse tree rather ^module Foo = let x = 42""") - [] + [] member public this.``LocationOfParams.UnmatchedParens.Bug91609.OtherCases.Namespace``() = this.TestParameterInfoLocationOfParams(""" namespace Foo @@ -1298,7 +1230,7 @@ We really need to rewrite some code paths here to use the real parse tree rather arr.[1] <- ^System.Int32.Parse^(^$ namespace^ Other""") - [] + [] member this.``LocationOfParams.InheritsClause.Bug192134``() = this.TestParameterInfoLocationOfParams(""" type B(x : int) = @@ -1306,7 +1238,7 @@ We really need to rewrite some code paths here to use the real parse tree rather type A() = inherit ^B^(^1$,^2^)""") - [] + [] member public this.``LocationOfParams.ThisOnceAsserted``() = this.TestNoParameterInfo(""" module CSVTypeProvider @@ -1325,7 +1257,7 @@ We really need to rewrite some code paths here to use the real parse tree rather match types |> Array.tryFind (fun ty -> ty.Name = typeName^) with _ -> ()""") - [] + [] member public this.``LocationOfParams.ThisOnceAssertedToo``() = this.TestNoParameterInfo(""" let readString() = @@ -1337,7 +1269,7 @@ We really need to rewrite some code paths here to use the real parse tree rather while true do ($) """) - [] + [] member public this.``LocationOfParams.UnmatchedParensBeforeModuleKeyword.Bug245850.Case2a``() = this.TestParameterInfoLocationOfParams(""" module Repro = @@ -1391,92 +1323,84 @@ We really need to rewrite some code paths here to use the real parse tree rather this.TestParameterInfoLocationOfParams (allText, markAtEOF=needMarkAtEnd, ?additionalReferenceAssemblies=additionalReferenceAssemblies) ) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Basic``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ 42 ^>""", additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.BasicNamed``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ ParamIgnored=42 ^>""", additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Prefix0``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ $ """, // missing all params, just have < markAtEnd = true, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Prefix1``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ 42 """, // missing > markAtEnd = true, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Prefix1Named``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ ParamIgnored=42 """, // missing > markAtEnd = true, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Prefix2``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ """, // missing last param markAtEnd = true, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Prefix2Named1``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ ParamIgnored= """, // missing last param after name with equals markAtEnd = true, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Prefix2Named2``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ ParamIgnored """, // missing last param after name sans equals markAtEnd = true, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] + [] member public this.``LocationOfParams.TypeProviders.Negative1``() = this.TestNoParameterInfo(""" type D = ^System.Collections.Generic.Dictionary^<^ in$t, int ^>""") - [] + [] member public this.``LocationOfParams.TypeProviders.Negative2``() = this.TestNoParameterInfo(""" type D = ^System.Collections.Generic.List^<^ in$t ^>""") - [] + [] member public this.``LocationOfParams.TypeProviders.Negative3``() = this.TestNoParameterInfo(""" let i = 42 let b = ^i^<^ 4$2""") - [] + [] member public this.``LocationOfParams.TypeProviders.Negative4.Bug181000``() = this.TestNoParameterInfo(""" type U = ^N1.T^<^ "foo",^ 42 ^>$ """, // when the caret is right of the '>', we should not report any param info additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] + [] member public this.``LocationOfParams.TypeProviders.BasicWithinExpr``() = this.TestNoParameterInfo(""" let f() = @@ -1484,8 +1408,7 @@ We really need to rewrite some code paths here to use the real parse tree rather r """, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.BasicWithinExpr.DoesNotInterfereWithOuterFunction``() = this.TestParameterInfoLocationOfParams(""" let f() = @@ -1493,36 +1416,31 @@ We really need to rewrite some code paths here to use the real parse tree rather r """, additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Bug199744.ExcessCommasShouldNotAssertAndShouldGiveInfo.Case1``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ 42,^ ,^ ^>""", additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Bug199744.ExcessCommasShouldNotAssertAndShouldGiveInfo.Case2``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ "fo$o",^ ,^ ^>""", additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.Bug199744.ExcessCommasShouldNotAssertAndShouldGiveInfo.Case3``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" type U = ^N1.T^<^ ,^$ ^>""", additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``LocationOfParams.TypeProviders.StaticParametersAtConstructorCallSite``() = this.TestParameterInfoLocationOfParamsWithVariousSurroundingContexts(""" let x = new ^N1.T^<^ "fo$o",^ 42 ^>()""", additionalReferenceAssemblies = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] + [] member public this.``TypeProvider.FormatOfNamesOfSystemTypes``() = let code = ["""type TTT = N1.T< "foo", ParamIgnored=42 > """] let references = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")] @@ -1530,7 +1448,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let gpatcc = GlobalParseAndTypeCheckCounter.StartNew(this.VS) MoveCursorToEndOfMarker(file,"foo") let methodGroup = GetParameterInfoAtCursor file - Assert.IsTrue(methodGroup.IsSome, "expected parameter info") + Assert.True(methodGroup.IsSome, "expected parameter info") let methodGroup = methodGroup.Value let actualDisplays = [ for i = 0 to methodGroup.GetCount() - 1 do @@ -1541,7 +1459,7 @@ We really need to rewrite some code paths here to use the real parse tree rather AssertEqual(expected, actualDisplays) gpatcc.AssertExactly(0,0) - [] + [] member public this.``ParameterNamesInFunctionsDefinedByLetBindings``() = let useCases = [ @@ -1583,13 +1501,13 @@ We really need to rewrite some code paths here to use the real parse tree rather MoveCursorToEndOfMarker(file, marker) let methodGroup = GetParameterInfoAtCursor file - Assert.IsTrue(methodGroup.IsSome, "expected parameter info") + Assert.True(methodGroup.IsSome, "expected parameter info") let methodGroup = methodGroup.Value - Assert.AreEqual(1, methodGroup.GetCount(), "Only one function expected") + Assert.Equal(1, methodGroup.GetCount()) let expectedParamsCount = List.length expectedParams - Assert.AreEqual(expectedParamsCount, methodGroup.GetParameterCount(0), sprintf "%d parameters expected" expectedParamsCount) + Assert.Equal(expectedParamsCount, methodGroup.GetParameterCount(0)) let actualParams = [ for i = 0 to (expectedParamsCount - 1) do yield methodGroup.GetParameterInfo(0, i) ] let ok = @@ -1600,15 +1518,15 @@ We really need to rewrite some code paths here to use the real parse tree rather printfn "==Parameters don't match==" printfn "Expected parameters %A" expectedParams printfn "Actual parameters %A" actualParams - Assert.Fail() + failwith "Parameters don't match" (* Tests for multi-parameterinfos ------------------------------------------------------------------ *) - [] + [] member public this.``ParameterInfo.ArgumentsWithParamsArrayAttribute``() = let content = """let _ = System.String.Format("",(*MARK*))""" let methodTip = this.GetMethodListForAMethodTip(content, "(*MARK*)") - Assert.IsTrue(methodTip.IsSome, "expected parameter info") + Assert.True(methodTip.IsSome, "expected parameter info") let methodTip = methodTip.Value let overloadWithTwoParamsOpt = @@ -1627,16 +1545,16 @@ We really need to rewrite some code paths here to use the real parse tree rather ) |> Seq.tryFind(fun (i, _) -> i = 2) match overloadWithTwoParamsOpt with - | Some(_, [_;(_name, display, _description)]) -> Assert.IsTrue(display.Contains("[] args")) + | Some(_, [_;(_name, display, _description)]) -> Assert.True(display.Contains("[] args")) | x -> Assert.Fail(sprintf "Expected overload not found, current result %A" x) (* DotNet functions for multi-parameterinfo tests -------------------------------------------------- *) - [] + [] member public this.``Multi.DotNet.StaticMethod``() = let fileContents = """System.Console.WriteLine("Today is {0:dd MMM yyyy}",(*Mark*)System.DateTime.Today)""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["string";"obj"]) - [] + [] member public this.``Multi.DotNet.StaticMethod.WithinClassMember``() = let fileContents = """ type Widget(z) = @@ -1646,18 +1564,17 @@ We really need to rewrite some code paths here to use the real parse tree rather 45""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["string";"System.Globalization.NumberStyles"]) - [] - [] + [] member public this.``Multi.DotNet.StaticMethod.WithinLambda``() = let fileContents = """let z = fun x -> x + System.Int16.Parse("",(*Mark*)""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["string";"System.Globalization.NumberStyles"]) - [] + [] member public this.``Multi.DotNet.StaticMethod.WithinLambda2``() = let fileContents = "let _ = fun file -> new System.IO.FileInfo((*Mark*)" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["string"]]) - [] + [] member public this.``Multi.DotNet.InstanceMethod``() = let fileContents = """ let s = "Hello" @@ -1665,18 +1582,17 @@ We really need to rewrite some code paths here to use the real parse tree rather this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["int";"int"]) (* Common functions for multi-parameterinfo tests -------------------------------------------------- *) - [] - [] + [] member public this.``Multi.DotNet.Constructor``() = let fileContents = "let _ = new System.DateTime(2010,12,(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["int";"int";"int"]) - [] + [] member public this.``Multi.Constructor.WithinObjectExpression``() = let fileContents = "let _ = { new System.Object((*Mark*)) with member _.GetHashCode() = 2}" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",[]) - [] + [] member public this.``Multi.Function.InTheClassMember``() = let fileContents = """ type Foo() = @@ -1687,14 +1603,14 @@ We really need to rewrite some code paths here to use the real parse tree rather member this.A(a : string, b:int) = ()""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int";"int"]]) - [] + [] member public this.``Multi.ParamAsTupleType``() = let fileContents = """ let tuple((a : int, b : int), c : int) = a * b + c let result = tuple((1, 2)(*Mark*), 3)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int * int";"int"]]) - [] + [] member public this.``Multi.ParamAsCurryType``() = let fileContents = """ let multi (x : float) (y : float) = 0 @@ -1702,7 +1618,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let rtnValue = sum(multi (1.0(*Mark*)) 3.0, 5)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["float"]]) - [] + [] member public this.``Multi.MethodInMatchCause``() = let fileContents = """ let rec f l = @@ -1711,8 +1627,7 @@ We really need to rewrite some code paths here to use the real parse tree rather | x :: xs -> f xs""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["string";"obj"]) - [] - [] + [] member public this.``Regression.Multi.IndexerProperty.Bug93945``() = let fileContents = """ type Year2(year : int) = @@ -1729,8 +1644,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let randomDay = O'seven.[12,(*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int";"int"]]) - [] - [] + [] member public this.``Regression.Multi.ExplicitAnnotate.Bug93188``() = let fileContents = """ type LiveAnimalAttribute(a : int, b: string) = @@ -1740,7 +1654,7 @@ We really need to rewrite some code paths here to use the real parse tree rather type Wombat() = class end""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int";"string"]]) - [] + [] member public this.``Multi.Function.WithRecordType``() = let fileContents = """ type Vector = @@ -1749,7 +1663,7 @@ We really need to rewrite some code paths here to use the real parse tree rather foo(12, { X = 10.0; Y = (*Mark*)20.0; Z = 30.0 })""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int";"Vector"]]) - [] + [] member public this.``Multi.Function.AsParameter``() = let fileContents = """ let isLessThanZero x = (x < 0) @@ -1761,15 +1675,14 @@ We really need to rewrite some code paths here to use the real parse tree rather let _ = Option.get(containsNegativeNumbers [6; 20; (*Mark*)8; 45; 5])""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int list"]]) - [] - [] + [] member public this.``Multi.Function.WithOptionType``() = let fileContents = """ let foo( a : int option, b : string ref) = 0 let _ = foo(Some(12),(*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int option";"string ref"]]) - [] + [] member public this.``Multi.Function.WithOptionType2``() = let fileContents = """ let multi (x : float) (y : float) = x * y @@ -1778,8 +1691,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let rtnOption = options(Some(sum(1, 3)), (*Mark*)Some(multi 3.1 5.0)) """ this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int option";"float option"]]) - [] - [] + [] member public this.``Multi.Function.WithRefType``() = let fileContents = """ let foo( a : int ref, b : string ref) = 0 @@ -1788,12 +1700,12 @@ We really need to rewrite some code paths here to use the real parse tree rather (* Overload list/Adjust method's param for multi-parameterinfo tests ------------------------------ *) - [] + [] member public this.``Multi.OverloadMethod.OrderedParameters``() = let fileContents = "new System.DateTime(2000,12,(*Mark*)" this.VerifyParameterInfoOverloadMethodIndex(fileContents,"(*Mark*)",3(*The fourth method*),["int";"int";"int"]) - [] + [] member public this.``Multi.Overload.WithSameParameterCount``() = let fileContents = """ type Foo() = @@ -1803,7 +1715,7 @@ We really need to rewrite some code paths here to use the real parse tree rather foo.A1(1,1,(*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int";"int";"string";"bool"];["int";"string";"int";"bool"]]) - [] + [] member public this.``ExtensionMethod.Overloads``() = let fileContents = """ module MyCode = @@ -1819,8 +1731,7 @@ We really need to rewrite some code paths here to use the real parse tree rather foo.Method((*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["string"];["int"]]) - [] - [] + [] member public this.``ExtensionProperty.Overloads``() = let fileContents = """ module MyCode = @@ -1838,68 +1749,66 @@ We really need to rewrite some code paths here to use the real parse tree rather (* Generic functions for multi-parameterinfo tests ------------------------------------------------ *) - [] + [] member public this.``Multi.Generic.ExchangeInt``() = let fileContents = "System.Threading.Interlocked.Exchange(123,(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["byref";"int"]) - [] + [] member public this.``Multi.Generic.Exchange.``() = let fileContents = "System.Threading.Interlocked.Exchange(12.0,(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["byref";"float"]) - [] + [] member public this.``Multi.Generic.ExchangeUnder``() = let fileContents = "System.Threading.Interlocked.Exchange<_> (obj,(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["byref";"obj"]) - [] + [] member public this.``Multi.Generic.Dictionary``() = let fileContents = "System.Collections.Generic.Dictionary<_, option>(12,(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["int";"System.Collections.Generic.IEqualityComparer"]) - [] - [] + [] member public this.``Multi.Generic.HashSet``() = let fileContents = "System.Collections.Generic.HashSet({ 1 ..12 },(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["Seq<'a>";"System.Collections.Generic.IEqualityComparer<'a>"]) - [] - [] + [] member public this.``Multi.Generic.SortedList``() = let fileContents = "System.Collections.Generic.SortedList<_,option> (12,(*Mark*)" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["int";"System.Collections.Generic.IComparer<'TKey>"]) (* No Param Info Shown for multi-parameterinfo tests ---------------------------------------------- *) - [] + [] member public this.``ParameterInfo.Multi.NoParameterInfo.InComments``() = let fileContents = "//let _ = System.Object((*Mark*))" this.VerifyNoParameterInfoAtStartOfMarker(fileContents,"(*Mark*)") - [] + [] member public this.``Multi.NoParameterInfo.InComments2``() = let fileContents = """(*System.Console.WriteLine((*Mark*)"Test on Fsharp style comments.")*)""" this.VerifyNoParameterInfoAtStartOfMarker(fileContents,"(*Mark*)") - [] + [] member public this.``Multi.NoParameterInfo.OnFunctionDeclaration``() = let fileContents = "let Foo(x : int, (*Mark*)b : string) = ()" this.VerifyNoParameterInfoAtStartOfMarker(fileContents,"(*Mark*)") - [] + [] member public this.``Multi.NoParameterInfo.WithinString``() = let fileContents = """let s = "new System.DateTime(2000,12(*Mark*)" """ this.VerifyNoParameterInfoAtStartOfMarker(fileContents,"(*Mark*)") - [] + [] member public this.``Multi.NoParameterInfo.OnProperty``() = let fileContents = """ let s = "Hello" let _ = s.Length(*Mark*)""" this.VerifyNoParameterInfoAtStartOfMarker(fileContents,"(*Mark*)") - [] + [] member public this.``Multi.NoParameterInfo.OnValues``() = let fileContents = """ type Foo = class @@ -1911,13 +1820,13 @@ We really need to rewrite some code paths here to use the real parse tree rather (* Regression tests/negative tests for multi-parameterinfos --------------------------------------- *) // To be added when the bugs are fixed... - [] + [] //[] member public this.``Regression.ParameterWithOperators.Bug90832``() = let fileContents = """System.Console.WriteLine("This(*Mark*) is a" + " bug.")""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["string"]) - [] + [] member public this.``Regression.OptionalArguments.Bug4042``() = let fileContents = """ module ParameterInfo @@ -1932,7 +1841,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let tt = TT((*Mark*)""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["int";"int"]]) - [] + [] //[] member public this.``Regression.ParameterFirstTypeOpenParen.Bug90798``() = let fileContents = """ @@ -1942,7 +1851,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let p = 10""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["'Arg -> Async<'T>"]]) - [] + [] // regression test for bug 3878: no parameter info triggered by "(" member public this.``Regression.NoParameterInfoTriggeredByOpenBrace.Bug3878``() = let fileContents = """ @@ -1954,7 +1863,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let y = 1""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",[""]) - [] + [] // regression test for bug 4495 : Should alway sort method lists in order of argument count member public this.``Regression.MethodSortedByArgumentCount.Bug4495.Case1``() = let fileContents = """ @@ -1964,7 +1873,7 @@ We really need to rewrite some code paths here to use the real parse tree rather let m = a1.GetType("System.Decimal").GetConstructor((*Mark*)null)""" this.VerifyParameterInfoOverloadMethodIndex(fileContents,"(*Mark*)",0,["System.Type array"]) - [] + [] member public this.``Regression.MethodSortedByArgumentCount.Bug4495.Case2``() = let fileContents = """ module ParameterInfo @@ -1976,8 +1885,7 @@ We really need to rewrite some code paths here to use the real parse tree rather "System.Type array"; "System.Reflection.ParameterModifier array"]) - [] - [] + [] member public this.``BasicBehavior.WithReference``() = let fileContents = """ open System.ServiceModel @@ -1991,22 +1899,20 @@ We really need to rewrite some code paths here to use the real parse tree rather let expected = ["System.Type";"System.Uri []"] AssertMethodGroupContain(methodstr,expected) - [] + [] member public this.``BasicBehavior.CommonFunction``() = let fileContents = """ let f(x) = 1 f((*Mark*))""" this.VerifyParameterInfoAtStartOfMarker(fileContents,"(*Mark*)",[["'a"]]) - [] + [] member public this.``BasicBehavior.DotNet.Static``() = let fileContents = """System.String.Format((*Mark*)""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Mark*)",["string";"obj array"]) (*------------------------------------------IDE Query automation start -------------------------------------------------*) - [] - [] - [] + [] // ParamInfo works normally for calls as query operator arguments // works fine In nested queries member public this.``Query.InNestedQuery``() = @@ -2025,11 +1931,9 @@ We really need to rewrite some code paths here to use the real parse tree rather this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Marker1*)",["obj"],queryAssemblyRefs) this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Marker2*)",["string";"obj array"],queryAssemblyRefs) - [] - [] + [] // ParamInfo works normally for calls as query operator arguments // ParamInfo Still works when an error exists - [] member public this.``Query.WithErrors``() = let fileContents = """ let tuples = [ (1, 8, 9); (56, 45, 3)] @@ -2041,10 +1945,8 @@ We really need to rewrite some code paths here to use the real parse tree rather }""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Marker*)",["obj"],queryAssemblyRefs) - [] - [] + [] // ParamInfo works normally for calls as query operator arguments - [] member public this.``Query.OperatorWithParentheses``() = let fileContents = """ type Product() = @@ -2070,8 +1972,7 @@ We really need to rewrite some code paths here to use the real parse tree rather this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Marker1*)",[],queryAssemblyRefs) this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Marker2*)",[],queryAssemblyRefs) - [] - [] + [] // ParamInfo works normally for calls as query operator arguments // ParamInfo Still works when there is an optional argument member public this.``Query.OptionalArgumentsInQuery``() = @@ -2094,11 +1995,9 @@ We really need to rewrite some code paths here to use the real parse tree rather }""" this.VerifyParameterInfoContainedAtStartOfMarker(fileContents,"(*Marker*)",["int";"int"],queryAssemblyRefs) - [] - [] + [] // ParamInfo works normally for calls as query operator arguments // ParamInfo Still works when there are overload methods with the same param count - [] member public this.``Query.OverloadMethod.InQuery``() = let fileContents = """ let numbers = [ 1;2; 8; 9; 15; 23; 3; 42; 4;0; 55;] @@ -2118,6 +2017,5 @@ We really need to rewrite some code paths here to use the real parse tree rather // Context project system -[] type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs index 1d62dd3c399..1df4a6a6413 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs @@ -3,21 +3,20 @@ namespace Tests.LanguageService.QuickInfo open System -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem +open Xunit [] module QuickInfoStandardSettings = let standard40AssemblyRefs = [ "System"; "System.Core"; "System.Numerics" ] let queryAssemblyRefs = [ "System.Xml.Linq"; "System.Core" ] -[] -[] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -41,8 +40,8 @@ type UsingMSBuild() = let checkTooltip expected ((tooltip, span : TextSpan), (row, col)) = AssertContains(tooltip, expected) // cursor should be inside the span - Assert.IsTrue(row = (span.iStartLine + 1) && row = (span.iEndLine + 1), "Cursor should be one the same line with the tooltip span") - Assert.IsTrue(col >= span.iStartIndex && col <= span.iEndIndex, "Cursor should be located inside the span") + Assert.True(row = (span.iStartLine + 1) && row = (span.iEndLine + 1), "Cursor should be one the same line with the tooltip span") + Assert.True(col >= span.iStartIndex && col <= span.iEndIndex, "Cursor should be located inside the span") // (* Tests for QuickInfos ---------------------------------------------------------------- *) @@ -118,7 +117,7 @@ type UsingMSBuild() = let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" AssertContainsInOrder(tooltip, expectedExactOrder) - [] + [] member public this.``NestedTypesOrder``() = this.VerifyOrderOfNestedTypesInQuickInfo( source = "type t = System.Runtime.CompilerServices.RuntimeHelpers(*M*)", @@ -126,7 +125,7 @@ type UsingMSBuild() = expectedExactOrder = ["GetHashCode"; "GetObjectValue"] ) - [] + [] member public this.``Operators.TopLevel``() = let source = """ /// tooltip for operator @@ -137,10 +136,10 @@ type UsingMSBuild() = code = source, marker = "== \"\"", atStart = true, - f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.IsTrue(text.Contains "tooltip for operator")) + f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.True(text.Contains "tooltip for operator")) ) - [] + [] member public this.``Operators.Member``() = let source = """ type U = U @@ -153,10 +152,10 @@ type UsingMSBuild() = code = source, marker = "++ U", atStart = true, - f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.IsTrue(text.Contains "tooltip for operator")) + f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.True(text.Contains "tooltip for operator")) ) - [] + [] member public this.``QuickInfo.HiddenMember``() = // Tooltips showed hidden members - #50 let source = """ @@ -174,10 +173,10 @@ type UsingMSBuild() = code = source, marker = "ypeU =", atStart = true, - f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.IsFalse(text.Contains "member _Print")) + f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.False(text.Contains "member _Print")) ) - [] + [] member public this.``QuickInfo.ObsoleteMember``() = // Tooltips showed obsolete members - #50 let source = """ @@ -193,11 +192,10 @@ type UsingMSBuild() = code = source, marker = "ypeU =", atStart = true, - f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.IsFalse(text.Contains "member Print1")) + f = (fun ((text, _), _) -> printfn "actual %s" text; Assert.False(text.Contains "member Print1")) ) - [] - [] + [] member public this.``QuickInfo.HideBaseClassMembersTP``() = let fileContents = "type foo = HiddenMembersInBaseClass.HiddenBaseMembersTP(*Marker*)" @@ -207,7 +205,7 @@ type UsingMSBuild() = expected = "type HiddenBaseMembersTP =\n inherit TPBaseTy", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] + [] member public this.``QuickInfo.OverridenMethods``() = let source = """ type A() = @@ -231,10 +229,10 @@ type UsingMSBuild() = code = source, marker = marker, atStart = false, - f = (fun ((text : string, _), _) -> printfn "expected %s, actual %s" expected text; Assert.IsTrue (text.Contains(expected))) + f = (fun ((text : string, _), _) -> printfn "expected %s, actual %s" expected text; Assert.True (text.Contains(expected))) ) - [] + [] member public this.``QuickInfoForQuotedIdentifiers``() = let source = """ /// The fff function @@ -246,7 +244,7 @@ type UsingMSBuild() = for i = 1 to (identifier.Length - 1) do let marker = "+ " + (identifier.Substring(0, i)) this.CheckTooltip (source, marker, false, checkTooltip "gg gg") - [] + [] member public this.``QuickInfoSingleCharQuotedIdentifier``() = let source = """ let ``x`` = 10 @@ -254,7 +252,7 @@ type UsingMSBuild() = """ this.CheckTooltip(source, "x``|>", true, checkTooltip "x") - [] + [] member public this.QuickInfoForTypesWithHiddenRepresentation() = let source = """ let x = Async.AsBeginEnd @@ -277,9 +275,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.CheckTooltip(source, "Asyn", false, checkTooltip expectedTooltip) - [] - [] - [] + [] member public this.``TypeProviders.NestedTypesOrder``() = let code = "type t = N1.TypeWithNestedTypes(*M*)" let tpReference = PathRelativeToTestAssembly( @"DummyProviderForLanguageServiceTesting.dll") @@ -290,7 +286,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") extraRefs = [tpReference] ) - [] + [] member public this.``GetterSetterInsideInterfaceImpl.ThisOnceAsserted``() = let fileContent =""" type IFoo = @@ -304,7 +300,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtStartOfMarker(fileContent, "id", "Operators.id") //regression test for bug 3184 -- intellisense should normalize to ¡°int[]¡± so that [] is not mistaken for list. - [] + [] member public this.IntArrayQuickInfo() = let fileContents = """ @@ -315,7 +311,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtStartOfMarker (fileContents, "y(*MInt[]*)", "int array") //Verify no quickinfo -- link name string have - [] + [] member public this.LinkNameStringQuickInfo() = let fileContents = """ @@ -326,11 +322,8 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtStartOfMarker (fileContents, "\"x\"(*Marker1*)", "") this.AssertQuickInfoContainsAtStartOfMarker (fileContents, "\"y\"(*Marker2*)", "") - [] - [] - [] + [] //This is to test the correct TypeProvider Type message is shown or not in the TypeProviderXmlDocAttribute - [] member public this.``TypeProvider.XmlDocAttribute.Type.Comment``() = let fileContents = """ @@ -339,10 +332,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtStartOfMarker (fileContents, "T(*Marker*)", "This is a synthetic type created by me!", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithAdequateComment.dll")]) - [] - [] - [] - [] + [] //This is to test for long message in the TypeProviderXmlDocAttribute for TypeProvider Type member public this.``TypeProvider.XmlDocAttribute.Type.WithLongComment``() = @@ -353,10 +343,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic type created by me!. Which is used to test the tool tip of the typeprovider type to check if it shows the right message or not.", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLongComment.dll")]) - [] - [] - [] - [] + [] //This is to test when the message is null in the TypeProviderXmlDocAttribute for TypeProvider Type member public this.``TypeProvider.XmlDocAttribute.Type.WithNullComment``() = @@ -367,10 +354,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "type T =\n new: unit -> T\n static member M: unit -> int []\n static member StaticProp: decimal\n member Event1: EventHandler", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithNullComment.dll")]) - [] - [] - [] - [] + [] //This is to test when there is empty message from the TypeProviderXmlDocAttribute for TypeProvider Type member public this.``TypeProvider.XmlDocAttribute.Type.WithEmptyComment``() = @@ -382,10 +366,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithEmptyComment.dll")]) - [] - [] - [] - [] + [] //This is to test the multi-language in the TypeProviderXmlDocAttribute for TypeProvider Type member public this.``TypeProvider.XmlDocAttribute.Type.LocalizedComment``() = @@ -396,11 +377,8 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic type Localized! ኤፍ ሻርፕ", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLocalizedComment.dll")]) - [] - [] - [] + [] //This is to test the correct TypeProvider Constructor message is shown or not in the TypeProviderXmlDocAttribute - [] member public this.``TypeProvider.XmlDocAttribute.Constructor.Comment``() = let fileContents = """ @@ -409,10 +387,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtStartOfMarker (fileContents, "T(*Marker*)", "This is a synthetic .ctor created by me for N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithAdequateComment.dll")]) - [] - [] - [] - [] + [] //This is to test for long message in the TypeProviderXmlDocAttribute for TypeProvider Constructor member public this.``TypeProvider.XmlDocAttribute.Constructor.WithLongComment``() = @@ -423,10 +398,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic .ctor created by me for N.T. Which is used to test the tool tip of the typeprovider Constructor to check if it shows the right message or not.", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLongComment.dll")]) - [] - [] - [] - [] + [] //This is to test when the message is null in the TypeProviderXmlDocAttribute for TypeProvider Constructor member public this.``TypeProvider.XmlDocAttribute.Constructor.WithNullComment``() = @@ -437,10 +409,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "N.T() : N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithNullComment.dll")]) - [] - [] - [] - [] + [] //This is to test when there is empty message from the TypeProviderXmlDocAttribute for TypeProvider Constructor member public this.``TypeProvider.XmlDocAttribute.Constructor.WithEmptyComment``() = @@ -451,10 +420,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "N.T() : N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithEmptyComment.dll")]) - [] - [] - [] - [] + [] //This is to test the multi-language in the TypeProviderXmlDocAttribute for TypeProvider Constructor member public this.``TypeProvider.XmlDocAttribute.Constructor.LocalizedComment``() = @@ -466,10 +432,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLocalizedComment.dll")]) - [] - [] - [] - [] + [] //This is to test the correct TypeProvider event message is shown or not in the TypeProviderXmlDocAttribute member public this.``TypeProvider.XmlDocAttribute.Event.Comment``() = @@ -481,10 +444,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *event* created by me for N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithAdequateComment.dll")]) - [] - [] - [] - [] + [] //This is to test the multi-language in the TypeProviderXmlDocAttribute for TypeProvider Event member public this.``TypeProvider.XmlDocAttribute.Event.LocalizedComment``() = @@ -496,8 +456,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *event* Localized! ኤፍ ሻርፕ for N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLocalizedComment.dll")]) - [] - [] + [] //This is to test the multi-language in the TypeProviderXmlDocAttribute for TypeProvider Event member public this.``TypeProvider.ParamsAttributeTest``() = @@ -506,10 +465,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtEndOfMarker (fileContents, "Spl", "[] separator") - [] - [] - [] - [] + [] //This is to test for long message in the TypeProviderXmlDocAttribute for TypeProvider Event member public this.``TypeProvider.XmlDocAttribute.Event.WithLongComment``() = @@ -521,10 +477,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *event* created by me for N.T. Which is used to test the tool tip of the typeprovider Event to check if it shows the right message or not.!", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLongComment.dll")]) - [] - [] - [] - [] + [] //This is to test when the message is null in the TypeProviderXmlDocAttribute for TypeProvider Event member public this.``TypeProvider.XmlDocAttribute.Event.WithNullComment``() = @@ -536,10 +489,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "member N.T.Event1: IEvent", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithNullComment.dll")]) - [] - [] - [] - [] + [] //This is to test when there is empty message from the TypeProviderXmlDocAttribute for TypeProvider Event member public this.``TypeProvider.XmlDocAttribute.Event.WithEmptyComment``() = @@ -552,10 +502,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithEmptyComment.dll")]) - [] - [] - [] - [] + [] //This is to test the correct TypeProvider Method message is shown or not in the TypeProviderXmlDocAttribute member public this.``TypeProvider.XmlDocAttribute.Method.Comment``() = @@ -566,10 +513,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *method* created by me!!", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithAdequateComment.dll")]) - [] - [] - [] - [] + [] //This is to test the multi-language in the TypeProviderXmlDocAttribute for TypeProvider Method member public this.``TypeProvider.XmlDocAttribute.Method.LocalizedComment``() = @@ -580,10 +524,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *method* Localized! ኤፍ ሻርፕ", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLocalizedComment.dll")]) - [] - [] - [] - [] + [] //This is to test for long message in the TypeProviderXmlDocAttribute for TypeProvider Method member public this.``TypeProvider.XmlDocAttribute.Method.WithLongComment``() = @@ -594,10 +535,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *method* created by me!!. Which is used to test the tool tip of the typeprovider Method to check if it shows the right message or not.!", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLongComment.dll")]) - [] - [] - [] - [] + [] //This is to test when the message is null in the TypeProviderXmlDocAttribute for TypeProvider Method member public this.``TypeProvider.XmlDocAttribute.Method.WithNullComment``() = @@ -608,10 +546,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "N.T.M() : int array", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithNullComment.dll")]) - [] - [] - [] - [] + [] //This is to test when there is empty message from the TypeProviderXmlDocAttribute for TypeProvider Method member public this.``TypeProvider.XmlDocAttribute.Method.WithEmptyComment``() = @@ -623,10 +558,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithEmptyComment.dll")]) - [] - [] - [] - [] + [] //This is to test the correct TypeProvider Property message is shown or not in the TypeProviderXmlDocAttribute member public this.``TypeProvider.XmlDocAttribute.Property.Comment``() = @@ -637,10 +569,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *property* created by me for N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithAdequateComment.dll")]) - [] - [] - [] - [] + [] //This is to test the multi-language in the TypeProviderXmlDocAttribute for TypeProvider Property member public this.``TypeProvider.XmlDocAttribute.Property.LocalizedComment``() = @@ -651,10 +580,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *property* Localized! ኤፍ ሻርፕ for N.T", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLocalizedComment.dll")]) - [] - [] - [] - [] + [] //This is to test for long message in the TypeProviderXmlDocAttribute for TypeProvider Property member public this.``TypeProvider.XmlDocAttribute.Property.WithLongComment``() = @@ -665,10 +591,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "This is a synthetic *property* created by me for N.T. Which is used to test the tool tip of the typeprovider Property to check if it shows the right message or not.!", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithLongComment.dll")]) - [] - [] - [] - [] + [] //This is to test when the message is null in the TypeProviderXmlDocAttribute for TypeProvider Property member public this.``TypeProvider.XmlDocAttribute.Property.WithNullComment``() = @@ -679,10 +602,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "property N.T.StaticProp: decimal", addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithNullComment.dll")]) - [] - [] - [] - [] + [] //This is to test when there is empty message from the TypeProviderXmlDocAttribute for TypeProvider Property member public this.``TypeProvider.XmlDocAttribute.Property.WithEmptyComment``() = @@ -694,10 +614,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") addtlRefAssy = [PathRelativeToTestAssembly( @"XmlDocAttributeWithEmptyComment.dll")]) - [] - [] - [] - [] + [] //This test case Verify that when Hover over foo the correct quickinfo is displayed for TypeProvider static parameter //Dummy Type Provider exposes a parametric type (N1.T) that takes 2 static params (string * int) member public this.``TypeProvider.StaticParameters.Correct``() = @@ -711,9 +628,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") expected = "type foo = N1.T", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] //This test case Verify that when Hover over foo the correct quickinfo is displayed //Dummy Type Provider exposes a parametric type (N1.T) that takes 2 static params (string * int) //As you can see this is "Negative Case" to check that when given invalid static Parameter quickinfo shows "type foo = obj" @@ -728,9 +643,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") expected = "type foo", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] + [] //This test case Verify that when Hover over foo the XmlComment is shown in quickinfo //Dummy Type Provider exposes a parametric type (N1.T) that takes 2 static params (string * int) member public this.``TypeProvider.StaticParameters.XmlComment``() = @@ -745,10 +658,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") expected = "XMLComment", addtlRefAssy = [PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] member public this.``TypeProvider.StaticParameters.QuickInfo.OnTheErasedType``() = let fileContents = """type TTT = Samples.FSharp.RegexTypeProvider.RegexTyped< @"(?^\d{3})-(?\d{3}-\d{7}$)">""" this.AssertQuickInfoContainsAtStartOfMarker( @@ -757,10 +667,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") expected = "type TTT = Samples.FSharp.RegexTypeProvider.RegexTyped<...>\nFull name: File1.TTT", addtlRefAssy = ["System"; PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) - [] - [] - [] - [] + [] member public this.``TypeProvider.StaticParameters.QuickInfo.OnNestedErasedTypeProperty``() = let fileContents = """ type T = Samples.FSharp.RegexTypeProvider.RegexTyped< @"(?^\d{3})-(?\d{3}-\d{7}$)"> @@ -774,7 +681,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") addtlRefAssy = ["System"; PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll")]) // Regression for 2948 - [] + [] member public this.TypeRecordQuickInfo() = let fileContents = """namespace NS @@ -783,7 +690,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.InfoInDeclarationTestQuickInfoImplWithTrim fileContents "Re(*MarkerRecord*)" expectedQuickinfoTypeRecord - [] + [] member public this.``QuickInfo.LetBindingsInTypes``() = let code = """ @@ -793,7 +700,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.AssertQuickInfoContainsAtEndOfMarker(code, "let ff", "val fff: n: int -> int") // Regression for 2494 - [] + [] member public this.TypeConstructorQuickInfo() = let fileContents = """ @@ -827,7 +734,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.InfoInDeclarationTestQuickInfoImplWithTrim fileContents "pq(*MarkerVal*)" expectedquickinfoVal this.InfoInDeclarationTestQuickInfoImplWithTrim fileContents "singleton(*MarkerLastLine*)" expectedquickinfoLastLine - [] + [] member public this.NamedDUFieldQuickInfo() = let fileContents = """ @@ -851,60 +758,60 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") this.InfoInDeclarationTestQuickInfoImplWithTrim fileContents "Case3(*MarkerCase3*)" expectedquickinfoCase3 this.InfoInDeclarationTestQuickInfoImplWithTrim fileContents "NamedExn(*MarkerException*)" expectedquickinfoException - [] + [] member public this.``EnsureNoAssertFromBadParserRangeOnAttribute``() = let fileContents = """ [] Types foo = int""" this.AssertQuickInfoContainsAtEndOfMarker (fileContents, "ype", "") // just want to ensure there is no assertion fired by the parse tree walker - [] + [] member public this.``ShiftKeyDown``() = ShiftKeyDown(this.VS) this.AssertQuickInfoContainsAtEndOfMarker ("""#light""","#ligh","") - [] + [] member public this.``ActivePatterns.Declaration``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let ( |One|Two| ) x = One(x+1)""","ne|Tw","int -> Choice") - [] + [] member public this.``ActivePatterns.Result``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let ( |One|Two| ) x = One(x+1)""","= On","active pattern result One: int -> Choice") - [] + [] member public this.``ActivePatterns.Value``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let ( |One|Two| ) x = One(x+1) let patval = (|One|Two|) // use""","= (|On","int -> Choice") - [] + [] member public this.``Regression.InDeclaration.Bug3176a``() = this.AssertQuickInfoContainsAtEndOfMarker ("""type T<'a> = { aaaa : 'a; bbbb : int } ""","aa","aaaa") - [] + [] member public this.``Regression.InDeclaration.Bug3176c``() = this.AssertQuickInfoContainsAtEndOfMarker ("""type C = val aaaa: int""","aa","aaaa") - [] + [] member public this.``Regression.InDeclaration.Bug3176d``() = this.AssertQuickInfoContainsAtEndOfMarker ("""type DU<'a> = | DULabel of 'a""","DULab","DULabel") - [] + [] member public this.``Regression.Generic.3773a``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let rec M2<'a>(a:'a) = M2(a)""","let rec M","val M2: a: 'a -> obj") // Before this fix, if the user hovered over 'cccccc' they would see 'Yield' - [] + [] member public this.``Regression.ComputationExpressionMemberAppearingInQuickInfo``() = this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker """ @@ -921,7 +828,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") // they would see a quickinfo for any available function named get or set. // The tests below define a get function with 'let' and then test to make sure that // this isn't the get seen in the tool tip. - [] + [] member public this.``Regression.AccessorMutator.Bug4903a``() = this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker """namespace CountChocula @@ -932,7 +839,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") and set(value:int) : unit = ()""" "with g" "string" - [] + [] member public this.``Regression.AccessorMutator.Bug4903d``() = this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker """namespace CountChocula @@ -943,7 +850,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") and set(value:int) : unit = ()""" "AMetho" "string" - [] + [] member public this.``Regression.AccessorMutator.Bug4903b``() = this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker """namespace CountChocula @@ -954,7 +861,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") and set(value:int) : unit = ()""" "and s" "seq" - [] + [] member public this.``Regression.AccessorMutator.Bug4903c``() = this.AssertQuickInfoContainsAtEndOfMarker ("""namespace CountChocula @@ -966,7 +873,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") "let g","string") - [] + [] member public this.``ParamsArrayArgument.OnType``() = this.AssertQuickInfoContainsAtEndOfMarker (""" @@ -975,7 +882,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") let r = A.Foo(42)""" , "type A","[] a:" ) - [] + [] member public this.``ParamsArrayArgument.OnMethod``() = this.AssertQuickInfoContainsAtEndOfMarker (""" @@ -984,7 +891,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") let r = A.Foo(42)""" , "A.Foo","[] a:" ) - [] + [] member public this.``Regression.AccessorMutator.Bug4903e``() = this.AssertQuickInfoContainsAtEndOfMarker ("""namespace CountChocula @@ -995,7 +902,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") and set(value:int) : unit = ()""" , "member source.Pr","Prop" ) - [] + [] member public this.``Regression.AccessorMutator.Bug4903f``() = this.AssertQuickInfoContainsAtEndOfMarker ("""namespace CountChocula @@ -1006,7 +913,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") and set(value:int) : unit = ()""" , "member source.Pr","int" ) - [] + [] member public this.``Regression.AccessorMutator.Bug4903g``() = this.AssertQuickInfoContainsAtEndOfMarker ("""namespace CountChocula @@ -1017,13 +924,13 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") and set(value:int) : unit = ()""" , "member sou","source" ) - [] + [] member public this.``Regression.RecursiveDefinition.Generic.3773b``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let rec M1<'a>(a:'a) = M1(0)""","let rec M","val M1: a: int -> 'a") //regression test for bug Dev11:138110 - "F# language service hover tip for ITypeProvider does now show Invalidate event" - [] + [] member public this.``Regression.ImportedEvent.138110``() = let fileContents = """ open Microsoft.FSharp.Core.CompilerServices @@ -1036,17 +943,17 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate - [] + [] member public this.``Declaration.CyclicalDeclarationDoesNotCrash``() = this.AssertQuickInfoContainsAtEndOfMarker ("""type (*1*)A = int * (*2*)A ""","(*2*)","type A") - [] + [] member public this.``JustAfterIdentifier``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let f x = x + 1 ""","let f","int") - [] + [] member public this.``FrameworkClass``() = let fileContent = """let l = new System.Collections.Generic.List()""" let marker = "Generic.List" @@ -1057,14 +964,14 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent marker "get_Count" this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent marker "set_Count" - [] + [] member public this.``FrameworkClassNoMethodImpl``() = this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker """let l = new System.Collections.Generic.LinkedList()""" "Generic.LinkedList" "System.Collections.ICollection.ISynchronized" // Bug 5092: A framework class contained a private method impl // Disabled due to issue #11752 --- https://github.com/dotnet/fsharp/issues/11752 - //[] + //[] member public this.``Regression.ModulesFromExternalLibrariesBug5785``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1084,7 +991,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate SetConfigurationAndPlatform(projectLib, "Debug|AnyCPU") // we must set config/platform when building with ProjectReferences AddProjectReference(project, projectLib) let br = BuildTarget(projectLib, "Build") // build the dependent library - Assert.IsTrue(br.BuildSucceeded, "build should succeed") + Assert.True(br.BuildSucceeded, "build should succeed") let file = OpenFile(project,"App.fs") TakeCoffeeBreak(this.VS) // Wait for the background compiler to catch up. @@ -1109,13 +1016,13 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate /// Even though we don't show squiggles, some types will still be known. For example, System.String. - [] + [] member public this.``OrphanFs.BaselineIntellisenseStillWorks``() = this.AssertQuickInfoContainsAtEndOfMarker ("""let astring = "Hello" ""","let astr","string") /// FEATURE: User may hover over a type or identifier and get basic information about it in a tooltip. - [] + [] member public this.``Basic``() = let fileContent = """type (*bob*)Bob() = let x = 1""" @@ -1123,7 +1030,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,marker,"Bob =") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,marker,"Bob =") - [] + [] member public this.``ModuleDefinition.ModuleNoNewLines``() = let fileContent = """module XXX type t = C3 @@ -1137,7 +1044,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"YY","module YYY\n\nfrom XXX") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"ZZ","module ZZZ\n\nfrom XXX\n\nDoc") - [] + [] member public this.``IdentifierWithTick``() = let code = ["#light" @@ -1154,14 +1061,13 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate let tooltip = GetQuickInfoAtCursor file AssertContains(tooltip,"val x': string") - [] + [] member public this.``NegativeTest.CharLiteralNotConfusedWithIdentifierWithTick``() = let fileContent = """let x = 1" let y = 'x' """ this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"'x","") // no tooltips for char literals - [] - [] + [] member public this.``QueryExpression.QuickInfoSmokeTest1``() = let fileContent = """let q = query { for x in ["1"] do select x }""" this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"selec","custom operation: select", addtlRefAssy=standard40AssemblyRefs) @@ -1169,8 +1075,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"selec","Calls" , addtlRefAssy=standard40AssemblyRefs) this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"selec","Linq.QueryBuilder.Select" , addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member public this.``QueryExpression.QuickInfoSmokeTest2``() = let fileContent = """let q = query { for x in ["1"] do join y in ["2"] on (x = y); select (x,y) }""" this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"joi","custom operation: join" , addtlRefAssy=standard40AssemblyRefs ) @@ -1178,8 +1083,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"joi","Calls" , addtlRefAssy=standard40AssemblyRefs ) this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"joi","Linq.QueryBuilder.Join" , addtlRefAssy=standard40AssemblyRefs ) - [] - [] + [] member public this.``QueryExpression.QuickInfoSmokeTest3``() = let fileContent = """let q = query { for x in ["1"] do groupJoin y in ["2"] on (x = y) into g; select (x,g) }""" this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"groupJoin","custom operation: groupJoin" , addtlRefAssy=standard40AssemblyRefs ) @@ -1189,7 +1093,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate /// Hovering over a literal string should not show data tips for variable names that appear in the string - [] + [] member public this.``StringLiteralWithIdentifierLookALikes.Bug2360_A``() = let fileContent = """let y = 1 let f x = "x" @@ -1197,13 +1101,13 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "f x = \"" "val" /// Hovering over a literal string should not show data tips for variable names that appear in the string - [] + [] member public this.``Regression.StringLiteralWithIdentifierLookALikes.Bug2360_B``() = let fileContent = """let y = 1""" this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"let ","int") /// FEATURE: Intellisense information from types in earlier files in the project is available in subsequent files. - [] + [] member public this.``AcrossMultipleFiles``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1231,7 +1135,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate AssertContains(tooltip,"File1.Bob") /// FEATURE: Linked files work - [] + [] member public this.``AcrossLinkedFiles``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1258,7 +1162,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate printf "Second-%s\n" tooltip AssertContains(tooltip,"Link.Bob") - [] + [] member public this.``TauStarter``() = let code = ["#light" @@ -1278,12 +1182,12 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate MoveCursorToEndOfMarker(file,"(*Scenario021*)") let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" printf "First-%s\n" tooltip - Assert.IsTrue(tooltip.Contains("Bob =")) + Assert.True(tooltip.Contains("Bob =")) MoveCursorToEndOfMarker(file,"(*Scenario022*)") let tooltip = time1 GetQuickInfoAtCursor file "Time of first tooltip" printf "First-%s\n" tooltip - Assert.IsTrue(tooltip.Contains("Alice =")) + Assert.True(tooltip.Contains("Alice =")) member private this.QuickInfoResolutionTest lines queries = let code = [ yield "#light" @@ -1299,7 +1203,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate MoveCursorToEndOfMarker(file,marker) let tooltip = time1 GetQuickInfoAtCursor file "Time for tooltip" printf "QuickInfo at marker '%s' is '%s', expect '%s'\n" marker tooltip expectedText - Assert.IsTrue(tooltip.Contains(expectedText)) + Assert.True(tooltip.Contains(expectedText)) member public this.GetLongPathsTestCases() = ["let test0 = System.Console.In" @@ -1331,12 +1235,12 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("type Test0e = System.Collections.Generic.","KeyNotFoundException","Generic.KeyNotFoundException"); // note resolves to type ] - [] + [] member public this.``LongPaths``() = let text,cases = this.GetLongPathsTestCases() this.QuickInfoResolutionTest text cases - [] + [] member public this.``Global.LongPaths``() = let text,cases = this.GetLongPathsTestCases() let replace (s:string) = s.Replace("System", "global.System") @@ -1348,7 +1252,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.QuickInfoResolutionTest text cases - [] + [] member public this.``TypeAndModuleReferences``() = this.QuickInfoResolutionTest ["let test1 = List.length" @@ -1364,7 +1268,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("let test3 = (\"1\").","Length" ,"String.Length"); ("let test3b = (id \"1\").","Length" ,"String.Length") ] - [] + [] member public this.``ModuleNameAndMisc``() = this.QuickInfoResolutionTest ["module (*test3q*)MM3 =" @@ -1377,7 +1281,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("let test4 = ","lock" ,"lock"); ("let (*test5*) ","ffff" ,"ffff") ] - [] + [] member public this.``MemberIdentifiers``() = this.QuickInfoResolutionTest ["type TestType() =" @@ -1393,7 +1297,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("member (*test7*) xx.","QQQQ" ,"float"); ("let test8 = (TestType()).", "PPPP" , "PPPP") ] - [] + [] member public this.``IdentifiersForFields``() = this.QuickInfoResolutionTest ["type TestType9 = { XXX : int }" @@ -1403,7 +1307,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate [("type TestType9 = { ", "XXX" , "XXX: int"); ("let test11 = { ", "XXX" , "XXX");] - [] + [] member public this.``IdentifiersForUnionCases``() = this.QuickInfoResolutionTest ["type TestType10 = Case1 | Case2 of int" @@ -1415,7 +1319,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("let test12 = (", "Case1" , "union case TestType10.Case1"); ("let test12 = (Case1,", "Case2" , "union case TestType10.Case2");] - [] + [] member public this.``IdentifiersInAttributes``() = this.QuickInfoResolutionTest ["[<(*test13*)System.CLSCompliant(true)>]" @@ -1429,7 +1333,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("[<(*test13*)System.", "CLSCompliant" , "CLSCompliantAttribute"); ("[<(*test14*)", "CLSCompliant" , "CLSCompliantAttribute");] - [] + [] member public this.``ArgumentAndPropertyNames``() = this.QuickInfoResolutionTest ["type R = { mutable AAA : int }" @@ -1450,12 +1354,12 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ("let test16 = new System.Reflection.AssemblyName(", "assemblyName", "argument assemblyName")] /// Quickinfo was throwing an exception when the mouse was over the end of a line. - [] + [] member public this.``AtEndOfLine``() = let fileContent = """#light""" this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "#light" "Bug:" - [] + [] member public this.``Regression.FieldRepeatedInToolTip.Bug3538``() = this.AssertIdentifierInToolTipExactlyOnce """#light @@ -1466,7 +1370,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate val mutable x : int""" "LayoutKind.Expl" "Explicit" - [] + [] member public this.``Regression.FieldRepeatedInToolTip.Bug3818``() = this.AssertIdentifierInToolTipExactlyOnce """#light @@ -1475,7 +1379,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate do ()""" "Inherite" "Inherited" // Get the tooltip at "Inherite" & Verify that it contains the 'Inherited' field exactly once - [] + [] member public this.``MethodAndPropTooltip``() = let fileContent = """#light open System @@ -1485,7 +1389,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertIdentifierInToolTipExactlyOnce fileContent "Console.Cle" "Clear" this.AssertIdentifierInToolTipExactlyOnce fileContent "Console.Back" "BackgroundColor" - [] + [] member public this.``Regression.StaticVsInstance.Bug3626``() = let fileContent = """ type Foo() = @@ -1501,7 +1405,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*string*) Hoo.Ba","Foo.Bar") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*string*) Hoo.Ba","-> string") - [] + [] member public this.``Class.OnlyClassInfo``() = let fileContent = """type TT(x : int, ?y : int) = class end""" @@ -1509,7 +1413,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"type T","type TT") this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "type T" "---" - //KnownFail: [] + //KnownFail: [] member public this.``Async.AsyncToolTips``() = let fileContent = """let a = async { @@ -1521,7 +1425,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"asy","AsyncBuilder") this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "asy" "---" - [] + [] member public this.``Regression.Exceptions.Bug3723``() = let fileContent = """exception E3E of int * int exception E4E of (int * int) @@ -1533,7 +1437,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate // E5E is an alias - should contain name of the aliased exception this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"exception E5","E4E") - [] + [] member public this.``Regression.Classes.Bug4066``() = let fileContent = """type Foo() as this = do this |> ignore @@ -1550,7 +1454,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"Bar() = thi","this") this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "Bar() = thi" "ref" - [] + [] member public this.``Regression.Classes.Bug2362``() = let fileContent = """let append mm nn = fun ac -> mm (nn ac)""" this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"let appen","mm: ('a -> 'b) -> nn: ('c -> 'a) -> ac: 'c -> 'b") @@ -1558,14 +1462,14 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"let append m","'a -> 'b") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"let append mm n","'c -> 'a") - [] + [] member public this.``Regression.ModuleAlias.Bug3790a``() = let fileContent = """module ``Some`` = Microsoft.FSharp.Collections.List module None = Microsoft.FSharp.Collections.List""" this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "module ``So" "Option" this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "module No" "Option" - [] + [] member public this.``Regression.ModuleAlias.Bug3790b``() = let code = [ "#light" @@ -1578,14 +1482,14 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate let tooltip = GetQuickInfoAtCursor file AssertNotContains(tooltip, "Option") - [] + [] member public this.``Regression.ActivePatterns.Bug4100a``() = let fileContent = """let (|Lazy|) x = x match 0 with | Lazy y -> ()""" // Test quickinfo in place where the declaration is used this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "with | Laz" "'?" // e.g. "Lazy: '?3107 -> '?3107", "Lazy: 'a -> 'a" will be fine - [] + [] member public this.``Regression.ActivePatterns.Bug4100b``() = let fileContent = """let Some (a:int) = a match None with @@ -1601,7 +1505,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate // This shouldn't find the function returning string but a pattern returning int this.VerifyQuickInfoDoesNotContainAnyAtEndOfMarker fileContent "| NSom" "int -> string" - [] + [] member public this.``Regression.ActivePatterns.Bug4103``() = let fileContent = """let (|Lazy|) x = x match 0 with | Lazy y -> ()""" @@ -1611,7 +1515,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate // This test checks that we don't show any tooltips for operators // (which is currently not supported, but it used to collide with support for active patterns) - [] + [] member public this.``Regression.NoTooltipForOperators.Bug4567``() = let fileContent = """let ( |+| ) a b = a + b let n = 1 |+| 2 @@ -1622,7 +1526,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"true |","") // Check to see that two distinct projects can be present - [] + [] member public this.``AcrossTwoProjects``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1643,16 +1547,16 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate MoveCursorToEndOfMarker(file1,"type (*bob*)Bob") let tooltip = time1 GetQuickInfoAtCursor file1 "Time of file1 tooltip" printf "Tooltip for file1:\n%s\n" tooltip - Assert.IsTrue(tooltip.Contains("Bob1 =")) + Assert.True(tooltip.Contains("Bob1 =")) // Check Bob2 MoveCursorToEndOfMarker(file2,"type (*bob*)Bob") let tooltip = time1 GetQuickInfoAtCursor file2 "Time of file2 tooltip" printf "Tooltip for file2:\n%s\n" tooltip - Assert.IsTrue(tooltip.Contains("Bob2 =")) + Assert.True(tooltip.Contains("Bob2 =")) // In this bug, relative paths with .. in them weren't working. - [] + [] member public this.``BugInRelativePaths``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1680,7 +1584,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate AssertContains(tooltip,"File1.Bob") // QuickInfo over a type that references types in an unreferenced assembly works. - [] + [] member public this.``MissingDependencyReferences.QuickInfo.Bug5409``() = let code = ["#light" @@ -1697,7 +1601,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate /// The fix--at the point in time it was fixed--was to modify the parser to send a limited number /// of additional EOF tokens to allow the recovery code to proceed up the change of productions /// in the grammar. - [] + [] member public this.``Regression.Bug1605``() = let fileContent = """let rec f l = match l with @@ -1706,7 +1610,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate // This string doesn't matter except that it should prove there is some datatip present. this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"| [] -> str","string") - [] + [] member public this.``Regression.Bug4642``() = let fileContent = """ "AA".Chars """ this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"\"AA\".Ch","int -> char") @@ -1724,11 +1628,10 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate let descr = descrFunc() AssertContainsInOrder(descr,rhsContainsOrder) | None -> - Console.WriteLine("Could not find completion name '{0}'", completionName) ShowErrors(project) - Assert.Fail() + failwith $"Could not find completion name '{completionName}'" - [] + [] //``CompletiongListItem.DocCommentsOnMembers`` and with //Regression 5856 member public this.``Regression.MemberDefinition.DocComments.Bug5856_1``() = this.AssertMemberDataTipContainsInOrder @@ -1755,7 +1658,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_2``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1779,7 +1682,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_3``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1803,7 +1706,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_4``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1829,7 +1732,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_5``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1852,7 +1755,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_6``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1875,7 +1778,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_7``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1899,7 +1802,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_8``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1922,7 +1825,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_9``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1945,7 +1848,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_10``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1964,7 +1867,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_13``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -1983,7 +1886,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_14``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2002,7 +1905,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ] ) - [] + [] member public this.``Regression.MemberDefinition.DocComments.Bug5856_15``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2021,7 +1924,7 @@ let f (tp:ITypeProvider(*$$$*)) = tp.Invalidate ) - [] + [] member public this.``Regression.ExtensionMethods.DocComments.Bug6028``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2042,7 +1945,7 @@ query." ] ) - [] + [] member public this.``Regression.OnMscorlibMethodInScript.Bug6489``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2064,7 +1967,7 @@ query." /// BUG: intellisense on "self" parameter in implicit ctor classes is wrong - [] + [] member public this.``Regression.CompListItemInfo.Bug5694``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2085,7 +1988,7 @@ query." /// Bug 4592: Check that ctors are displayed from C# classes, i.e. the "new" lines below. - [] + [] member public this.``Regression.Class.Printing.CSharp.Classes.Only.Bug4592``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2103,7 +2006,7 @@ query." " member NextDouble: unit -> float"] ) - [] + [] member public this.``GenericDotNetMethodShowsComment``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2119,7 +2022,7 @@ query." ) /// Bug 4624: Check the order in which members are printed, C# classes - [] + [] member public this.``Regression.Class.Printing.CSharp.Classes.Bug4624``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2143,7 +2046,7 @@ query." ]) /// Bug 4624: Check the order in which members are printed, F# classes - [] + [] member public this.``Regression.Class.Printing.FSharp.Classes.Bug4624``() = this.AssertMemberDataTipContainsInOrder ((*code *) @@ -2191,7 +2094,7 @@ query." ]) (*------------------------------------------IDE automation starts here -------------------------------------------------*) - [] + [] member public this.``Automation.Regression.AccessibilityOnTypeMembers.Bug4168``() = let fileContent = """module Test type internal Foo2(*Marker*) () = @@ -2203,7 +2106,7 @@ query." private new(x:int,y:int,z:int) = new Foo2()""" this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker*)", "type internal Foo2") - [] + [] member public this.``Automation.Regression.AccessorsAndMutators.Bug4276``() = let fileContent = """type TestType1(*Marker1*)( x : int , y : int ) = let mutable x = x @@ -2242,14 +2145,13 @@ query." this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker2*)" "get_Length" this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker2*)" "set_Length" - [] - [] + [] member public this.``Automation.AutoOpenMyNamespace``() = let fileContent ="""namespace System.Numerics type t = BigInteger(*Marker1*)""" this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "r(*Marker1*)", "type BigInteger") - [] + [] member public this.``Automation.Regression.BeforeAndAfterIdentifier.Bug4371``() = let fileContent = """module Test let f arg1 (arg2, arg3, arg4) arg5 = 42 @@ -2262,7 +2164,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2*)", "property System.Console.BufferWidth: int") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*Marker3*)","Full name: Test.printer") - [] + [] member public this.``Automation.Regression.ConstructorWithSameNameAsType.Bug2739``() = let fileContent = """namespace AA module AA = @@ -2272,7 +2174,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker1*)", "AA.AA: AA") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2*)", "BB.BB: string") - [] + [] member public this.``Automation.Regression.EventImplementation.Bug5471``() = let fileContent = """namespace regressiontest open System @@ -2327,7 +2229,7 @@ query." AssertContains(tooltip, "override CommandReference.CanExecuteChanged: IEvent") AssertContains(tooltip, "regressiontest.CommandReference.CanExecuteChanged") - [] + [] member public this.``Automation.ExtensionMethod``() = let fileContent ="""namespace TestQuickinfo @@ -2446,7 +2348,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker42*)", "FSStruct.ExtensionProperty: string") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker42*)", "fs struct extension property") - [] + [] member public this.``Automation.Regression.GenericFunction.Bug2868``() = let fileContent ="""module Test // Hovering over a generic function (generic argument decorated with [] attribute yields a bad tooltip @@ -2457,8 +2359,7 @@ query." this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker*)" "Exception" this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker*)" "thrown" - [] - [] + [] member public this.``Automation.IdentifierHaveDiffMeanings``() = let fileContent ="""namespace NS module float(*Marker1_1*) = @@ -2524,14 +2425,14 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker6_2*)", "member ValType.Value : int with set") this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker6_2*)" "Microsoft.FSharp.Core.ExtraTopLevelOperators.set" - [] + [] member public this.``Automation.Regression.ModuleIdentifier.Bug2937``() = let fileContent ="""module XXX(*Marker*) type t = C3""" this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker*)", "module XXX") this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker*)" "\n" - [] + [] member public this.``Automation.Regression.NamesArgument.Bug3818``() = let fileContent ="""module m [] @@ -2539,8 +2440,7 @@ query." end""" this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker1*)", "property System.AttributeUsageAttribute.AllowMultiple: bool") - [] - [] + [] member public this.``Automation.OnUnitsOfMeasure``() = let fileContent ="""namespace TestQuickinfo @@ -2580,7 +2480,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker22*)", "from Microsoft.FSharp.Collections") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker22*)", "Functional programming operators related to the Set<_> type.") - [] + [] member public this.``Automation.OverRiddenMembers``() = let fileContent ="""namespace QuickinfoGeneric @@ -2602,7 +2502,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker11*)", "override ByteOutputSink.WriteChar: c: char -> unit") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker12*)", "override ByteOutputSink.WriteString: s: string -> unit") - [] + [] member public this.``Automation.Regression.QuotedIdentifier.Bug3790``() = let fileContent ="""module Test module ``Some``(*Marker1*) = Microsoft.FSharp.Collections.List @@ -2612,8 +2512,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "``(*Marker2*)", "module List") this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "``(*Marker2*)" "Option.Some" - [] - [] + [] member public this.``Automation.Setter``() = let fileContent ="""type T() = member this.XX @@ -2653,7 +2552,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker4*)", "T2.Foo: a: 'a * b: 'b -> string") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker5*)", "val foo: int -> int -> int") - [] + [] member public this.``Automation.Regression.TupleException.Bug3723``() = let fileContent ="""namespace TestQuickinfo exception E3(*Marker1*) of int * int @@ -2665,7 +2564,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2*)", "Full name: TestQuickinfo.E4") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker3*)", "exception E5 = E4") - [] + [] member public this.``Automation.TypeAbbreviations``() = let fileContent ="""namespace NS module TypeAbbreviation = @@ -2716,7 +2615,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker5_1*)", "type AbAttrName = AbstractClassAttribute") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker5_2*)", "type AbAttrName = AbstractClassAttribute") - [] + [] member public this.``Automation.Regression.TypeInferenceScenarios.Bug2362&3538``() = let fileContent ="""module Test.Module1 @@ -2751,7 +2650,7 @@ query." this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*Marker7*)","type A =") this.AssertQuickInfoContainsAtEndOfMarker(fileContent,"(*Marker7*)","val mutable x: int") - [] + [] member public this.``Automation.Regression.TypemoduleConstructorLastLine.Bug2494``() = let fileContent ="""namespace NS open System @@ -2777,7 +2676,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*MarkerVal*)", "val pq: PriorityQueue<'a,'b>") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*MarkerLastLine*)", "val singleton: k: 'a -> a: 'b -> PriorityQueue<'a,'b>") - [] + [] member public this.``Automation.WhereQuickInfoShouldNotShowUp``() = let fileContent ="""namespace Test @@ -2825,7 +2724,7 @@ query." this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker7*)" "bigint" this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker8*)" "myString" - [] + [] member public this.``Automation.Regression.XmlDocComments.Bug3157``() = let fileContent ="""namespace TestQuickinfo module XmlComment = @@ -2839,7 +2738,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker*)", "Full name: TestQuickinfo.XmlComment.func") this.VerifyQuickInfoDoesNotContainAnyAtStartOfMarker fileContent "(*Marker*)" "XmlComment K" - [] + [] member public this.``Automation.Regression.XmlDocCommentsOnExtensionMembers.Bug138112``() = let fileContent ="""module Module1 = type T() = @@ -2862,8 +2761,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker2*)", "XmlComment M2") this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Marker3*)", "XmlComment M3") - [] - [] + [] member public this.XmlDocCommentsForArguments() = let fileContent = """ type bar() = @@ -3059,7 +2957,7 @@ query." AssertContains(tooltip, expectedTip) - [] + [] member public this.``Automation.XDelegateDUStructfromOwnCode``() = let fileContent ="""module Test @@ -3099,7 +2997,7 @@ query." ("(*Marker4*)", "Gets and sets X")] this.VerifyUsingFsTestLib fileContent queries false - [] + [] member public this.``Automation.StructDelegateDUfromOwnCode``() = let fileContent ="""module Test @@ -3141,7 +3039,7 @@ query." ] this.VerifyUsingFsTestLib fileContent queries false - [] + [] member public this.``Automation.TupleRecordClassfromOwnCode``() = let fileContent ="""module Test @@ -3237,9 +3135,7 @@ query." gpatcc.AssertExactly(0,0) - [] - [] - [] + [] // QuickInfo still works on valid operators in a query with errors elsewhere in it member public this.``Query.WithError1.Bug196137``() = let fileContent =""" @@ -3255,10 +3151,8 @@ query." }""" this.AssertQuickInfoInQuery (fileContent, "(*Mark*)", "Product.ProductName: string") - [] - [] + [] // QuickInfo still works on valid operators in a query with errors elsewhere in it - [] member public this.``Query.WithError2``() = let fileContent =""" open DataSource @@ -3271,8 +3165,7 @@ query." }""" this.AssertQuickInfoInQuery (fileContent, "(*Mark*)", "custom operation: minBy ('Value)") - [] - [] + [] // QuickInfo works in a large query (using many operators) member public this.``Query.WithinLargeQuery``() = let fileContent =""" @@ -3303,9 +3196,7 @@ query." this.AssertQuickInfoInQuery (fileContent, "(*Mark3*)", "custom operation: where (bool)") this.AssertQuickInfoInQuery (fileContent, "(*Mark4*)", "custom operation: distinct") - [] - [] - [] + [] // Arguments to query operators have correct QuickInfo // quickinfo should be correct including when the operator is causing an error member public this.``Query.ArgumentToQuery.OperatorError``() = @@ -3319,9 +3210,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "n.GetType()", "val n: int",queryAssemblyRefs) this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "Type()", "System.Object.GetType() : System.Type",queryAssemblyRefs) - [] - [] - [] + [] // Arguments to query operators have correct QuickInfo // quickinfo should be correct In a nested query member public this.``Query.ArgumentToQuery.InNestedQuery``() = @@ -3342,10 +3231,8 @@ query." this.AssertQuickInfoInQuery (fileContent, "(*Mark3*)", "custom operation: groupValBy ('Value) ('Key)") this.AssertQuickInfoInQuery (fileContent, "(*Mark4*)", "custom operation: select ('Result)") - [] - [] + [] // A computation expression with its own custom operators has correct QuickInfo displayed - [] member public this.``Query.ComputationExpression.Method``() = let fileContent =""" open System.Collections.Generic @@ -3387,8 +3274,7 @@ query." this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Mark1*)", "member WorkflowBuilder.Combine: f: 'b0 * g: 'c1 -> 'c1",queryAssemblyRefs) this.AssertQuickInfoContainsAtStartOfMarker (fileContent, "(*Mark2*)", "member WorkflowBuilder.Zero: unit -> unit",queryAssemblyRefs) - [] - [] + [] // A computation expression with its own custom operators has correct QuickInfo displayed member public this.``Query.ComputationExpression.CustomOp``() = let fileContent =""" @@ -3424,6 +3310,5 @@ query." // Context project system -[] type UsingProjectSystem() = inherit UsingMSBuild(VsOpts = LanguageServiceExtension.ProjectSystemTestFlavour) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickParse.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickParse.fs index 4f2297a74e4..40efc4655a8 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickParse.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickParse.fs @@ -3,13 +3,9 @@ namespace Tests.LanguageService open System -open NUnit.Framework +open Xunit open FSharp.Compiler.EditorServices -[] -[] -[] -[] type QuickParse() = let CheckIsland(tolerateJustAfter:bool, s : string, p : int, expected) = @@ -17,9 +13,9 @@ type QuickParse() = match QuickParse.GetCompleteIdentifierIsland tolerateJustAfter s p with | Some (s, col, _) -> Some (s, col) | None -> None - Assert.AreEqual(expected, actual) + Assert.Equal(expected, actual) - [] + [] member public qp.CheckGetPartialLongName() = let CheckAt(line, index, expected) = let actual = QuickParse.GetPartialLongNameEx(line, index) @@ -53,118 +49,118 @@ type QuickParse() = Check("let y=SomeModule . ", (["SomeModule"], "", Some 18)) - [] + [] member public qp.CheckIsland0() = CheckIsland(true, "", -1, None) - [] + [] member public qp.CheckIsland1() = CheckIsland(false, "", -1, None) - [] + [] member public qp.CheckIsland2() = CheckIsland(true, "", 0, None) - [] + [] member public qp.CheckIsland3() = CheckIsland(false, "", 0, None) - [] + [] member public qp.CheckIsland4() = CheckIsland(true, null, 0, None) - [] + [] member public qp.CheckIsland5() = CheckIsland(false, null, 0, None) - [] + [] member public qp.CheckIsland6() = CheckIsland(false, "identifier", 0, Some("identifier",10)) - [] + [] member public qp.CheckIsland7() = CheckIsland(false, "identifier", 8, Some("identifier",10)) - [] + [] member public qp.CheckIsland8() = CheckIsland(true, "identifier", 0, Some("identifier",10)) - [] + [] member public qp.CheckIsland9() = CheckIsland(true, "identifier", 8, Some("identifier",10)) // A place where tolerateJustAfter matters - [] + [] member public qp.CheckIsland10() = CheckIsland(false, "identifier", 10, None) - [] + [] member public qp.CheckIsland11() = CheckIsland(true, "identifier", 10, Some("identifier",10)) // Index which overflows the line - [] + [] member public qp.CheckIsland12() = CheckIsland(true, "identifier", 11, None) - [] + [] member public qp.CheckIsland13() = CheckIsland(false, "identifier", 11, None) // Match active pattern identifiers - [] + [] member public qp.CheckIsland14() = CheckIsland(false, "|Identifier|", 0, Some("|Identifier|",12)) - [] + [] member public qp.CheckIsland15() = CheckIsland(true, "|Identifier|", 0, Some("|Identifier|",12)) - [] + [] member public qp.CheckIsland16() = CheckIsland(false, "|Identifier|", 12, None) - [] + [] member public qp.CheckIsland17() = CheckIsland(true, "|Identifier|", 12, Some("|Identifier|",12)) - [] + [] member public qp.CheckIsland18() = CheckIsland(false, "|Identifier|", 13, None) - [] + [] member public qp.CheckIsland19() = CheckIsland(true, "|Identifier|", 13, None) // ``Quoted`` identifiers - [] + [] member public qp.CheckIsland20() = CheckIsland(false, "``Space Man``", 0, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland21() = CheckIsland(true, "``Space Man``", 0, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland22() = CheckIsland(false, "``Space Man``", 10, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland23() = CheckIsland(true, "``Space Man``", 10, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland24() = CheckIsland(false, "``Space Man``", 11, Some("``Space Man``",13)) - // [] + // [] // member public qp.CheckIsland25() = CheckIsland(true, "``Space Man``", 11, Some("Man",11)) // This is probably not what the user wanted. Not enforcing this test. - [] + [] member public qp.CheckIsland26() = CheckIsland(false, "``Space Man``", 12, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland27() = CheckIsland(true, "``Space Man``", 12, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland28() = CheckIsland(false, "``Space Man``", 13, None) - [] + [] member public qp.CheckIsland29() = CheckIsland(true, "``Space Man``", 13, Some("``Space Man``",13)) - [] + [] member public qp.CheckIsland30() = CheckIsland(false, "``Space Man``", 14, None) - [] + [] member public qp.CheckIsland31() = CheckIsland(true, "``Space Man``", 14, None) - [] + [] member public qp.CheckIsland32() = CheckIsland(true, "``msft-prices.csv``", 14, Some("``msft-prices.csv``",19)) // handle extracting islands from arrays - [] + [] member public qp.CheckIsland33() = CheckIsland(true, "[|abc;def|]", 2, Some("abc",5)) - [] + [] member public qp.CheckIsland34() = CheckIsland(true, "[|abc;def|]", 4, Some("abc",5)) - [] + [] member public qp.CheckIsland35() = CheckIsland(true, "[|abc;def|]", 5, Some("abc",5)) - [] + [] member public qp.CheckIsland36() = CheckIsland(true, "[|abc;def|]", 6, Some("def",9)) - [] + [] member public qp.CheckIsland37() = CheckIsland(true, "[|abc;def|]", 8, Some("def",9)) - [] + [] member public qp.CheckIsland38() = CheckIsland(true, "[|abc;def|]", 9, Some("def",9)) - [] + [] member public qp.CheckIsland39() = CheckIsland(false, "identifier(*boo*)", 0, Some("identifier",10)) - [] + [] member public qp.CheckIsland40() = CheckIsland(true, "identifier(*boo*)", 0, Some("identifier",10)) - [] + [] member public qp.CheckIsland41() = CheckIsland(false, "identifier(*boo*)", 10, None) - [] + [] member public qp.CheckIsland42() = CheckIsland(true, "identifier(*boo*)", 10, Some("identifier",10)) - [] + [] member public qp.CheckIsland43() = CheckIsland(false, "identifier(*boo*)", 11, None) - [] + [] member public qp.CheckIsland44() = CheckIsland(true, "identifier(*boo*)", 11, None) - [] + [] member public qp.CheckIsland45() = CheckIsland(false, "``Space Man (*boo*)``", 13, Some("``Space Man (*boo*)``",21)) - [] + [] member public qp.CheckIsland46() = CheckIsland(true, "``Space Man (*boo*)``", 13, Some("``Space Man (*boo*)``",21)) - [] + [] member public qp.CheckIsland47() = CheckIsland(false, "(*boo*)identifier", 11, Some("identifier",17)) - [] + [] member public qp.CheckIsland48() = CheckIsland(true, "(*boo*)identifier", 11, Some("identifier",17)) - [] + [] member public qp.CheckIsland49() = CheckIsland(false, "identifier(*(* *)boo*)", 0, Some("identifier",10)) - [] + [] member public qp.CheckIsland50() = CheckIsland(true, "identifier(*(* *)boo*)", 0, Some("identifier",10)) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs index 8a563a879dc..852758363c5 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs @@ -5,7 +5,7 @@ namespace Tests.LanguageService.Script open System open System.IO open System.Reflection -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa @@ -13,8 +13,6 @@ open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -[] -[] type UsingMSBuild() as this = inherit LanguageServiceBaseTests() @@ -59,7 +57,7 @@ type UsingMSBuild() as this = [ for i = 0 to errorList.Length - 1 do yield errorList.[i].Message] - Assert.IsTrue(errorList + Assert.True(errorList |> GetErrorMessages |> Seq.exists (fun errorMessage -> errorMessage.Contains(expectedStr))) @@ -92,7 +90,7 @@ type UsingMSBuild() as this = match squiggleOption with | None -> Assert.Fail("Expected a squiggle but none was seen.") | Some(severity,message) -> - Assert.IsTrue((severity=expectedSeverity), sprintf "Expected %s but saw %s: %s" nameOfExpected nameOfNotExpected message) + Assert.True((severity=expectedSeverity), sprintf "Expected %s but saw %s: %s" nameOfExpected nameOfNotExpected message) assertf(message,containing) AssertSquiggle Microsoft.VisualStudio.FSharp.LanguageService.Severity.Error "Error" "Warning" AssertContains, AssertSquiggle Microsoft.VisualStudio.FSharp.LanguageService.Severity.Warning "Warning" "Error" AssertContains, @@ -133,27 +131,26 @@ type UsingMSBuild() as this = AssertNotContains(tooltip, notexpected) /// There was a problem with Salsa that caused squiggles not to be shown for .fsx files. - [] + [] member public this.``Fsx.Squiggles.ShowInFsxFiles``() = let fileContent = """open Thing1.Thing2""" this.VerifyFSXErrorListContainedExpectedString(fileContent,"Thing1") /// Regression test for FSharp1.0:4861 - #r to nonexistent file causes the first line to be squiggled /// There was a problem with Salsa that caused squiggles not to be shown for .fsx files. - [] + [] member public this.``Fsx.Hash.RProperSquiggleForNonExistentFile``() = let fileContent = """#r "NonExistent" """ this.VerifyFSXErrorListContainedExpectedString(fileContent,"was not found or is invalid") /// Nonexistent hash. There was a problem with Salsa that caused squiggles not to be shown for .fsx files. - [] + [] member public this.``Fsx.Hash.RDoesNotExist.Bug3325``() = let fileContent = """#r "ThisDLLDoesNotExist" """ this.VerifyFSXErrorListContainedExpectedString(fileContent,"'ThisDLLDoesNotExist' was not found or is invalid") // There was a spurious error message on the first line. - [] - [] + [] member public this.``Fsx.ExactlyOneError.Bug4861``() = let code = ["#light" // First line is important in this repro @@ -162,7 +159,7 @@ type UsingMSBuild() as this = let (project, _) = createSingleFileFsxFromLines code AssertExactlyCountErrorSeenContaining(project, "Nonexistent", 1) // ...and not an error on the first line. - [] + [] member public this.``Fsx.InvalidHashLoad.ShouldBeASquiggle.Bug3012``() = let fileContent = """ #light @@ -171,8 +168,7 @@ type UsingMSBuild() as this = this.VerifyFSXErrorListContainedExpectedString(fileContent,"Bar.fs") // Transitive to existing property. - [] - [] + [] member public this.``Fsx.ScriptClosure.TransitiveLoad1``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -196,8 +192,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // Transitive to nonexisting property. - [] - [] + [] member public this.``Fsx.ScriptClosure.TransitiveLoad2``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -219,8 +214,7 @@ type UsingMSBuild() as this = AssertExactlyOneErrorSeenContaining(project, "NonExistingProperty") /// FEATURE: Typing a #r into a file will cause it to be recognized by intellisense. - [] - [] + [] member public this.``Fsx.HashR.AddedIn``() = let code = ["#light" @@ -240,7 +234,7 @@ type UsingMSBuild() as this = gpatcc.AssertExactly(notAA[file],notAA[file], true (* expectCreate, because dependent DLL set changed *)) // FEATURE: Adding a #load to a file will cause types from that file to be visible in intellisense - [] + [] member public this.``Fsx.HashLoad.Added``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -271,7 +265,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // FEATURE: Removing a #load to a file will cause types from that file to no longer be visible in intellisense - [] + [] member public this.``Fsx.HashLoad.Removed``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -301,7 +295,7 @@ type UsingMSBuild() as this = TakeCoffeeBreak(this.VS) VerifyErrorListContainedExpectedStr("MyNamespace",project) - [] + [] member public this.``Fsx.HashLoad.Conditionals``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -330,14 +324,13 @@ type UsingMSBuild() as this = MoveCursorToEndOfMarker(fsx, "InDifferentFS.") let completion = AutoCompleteAtCursor fsx let completion = completion |> Array.map (fun (CompletionItem(name, _, _, _, _)) -> name) |> set - Assert.AreEqual(Set.count completion, 2, "Expected 2 elements in the completion list") - Assert.IsTrue(completion.Contains "x", "Completion list should contain x because INTERACTIVE is defined") - Assert.IsTrue(completion.Contains "B", "Completion list should contain B because DEBUG is not defined") + Assert.Equal(Set.count completion, 2) + Assert.True(completion.Contains "x", "Completion list should contain x because INTERACTIVE is defined") + Assert.True(completion.Contains "B", "Completion list should contain B because DEBUG is not defined") /// FEATURE: Removing a #r into a file will cause it to no longer be seen by intellisense. - [] - [] + [] member public this.``Fsx.HashR.Removed``() = let code = ["#light" @@ -362,8 +355,7 @@ type UsingMSBuild() as this = // Corecursive load to existing property. - [] - [] + [] member public this.``Fsx.NoError.ScriptClosure.TransitiveLoad3``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -387,8 +379,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // #load of .fsi is respected (for non-hidden property) - [] - [] + [] member public this.``Fsx.NoError.ScriptClosure.TransitiveLoad9``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -416,8 +407,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // #load of .fsi is respected at second #load level (for non-hidden property) - [] - [] + [] member public this.``Fsx.NoError.ScriptClosure.TransitiveLoad10``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -448,8 +438,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // #load of .fsi is respected when dispersed between two #load levels (for non-hidden property) - [] - [] + [] member public this.``Fsx.NoError.ScriptClosure.TransitiveLoad11``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -480,8 +469,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // #load of .fsi is respected when dispersed between two #load levels (the other way) (for non-hidden property) - [] - [] + [] member public this.``Fsx.NoError.ScriptClosure.TransitiveLoad12``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -512,8 +500,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // #nowarn seen in closed .fsx is global to the closure - [] - [] + [] member public this.``Fsx.NoError.ScriptClosure.TransitiveLoad16``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -534,7 +521,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) /// FEATURE: #r in .fsx to a .dll name works. - [] + [] member public this.``Fsx.NoError.HashR.DllWithNoPath``() = let fileContent = """ #light @@ -543,7 +530,7 @@ type UsingMSBuild() as this = this.VerifyFSXNoErrorList(fileContent) - [] + [] // 'System' is in the default set. Make sure we can still resolve it. member public this.``Fsx.NoError.HashR.BugDefaultReferenceFileIsAlsoResolved``() = let fileContent = """ @@ -552,8 +539,7 @@ type UsingMSBuild() as this = """ this.VerifyFSXNoErrorList(fileContent) - [] - [] + [] member public this.``Fsx.NoError.HashR.DoubleReference``() = let fileContent = """ #light @@ -562,8 +548,7 @@ type UsingMSBuild() as this = """ this.VerifyFSXNoErrorList(fileContent) - [] - [] + [] // 'CustomMarshalers' is loaded from the GAC _and_ it is available on XP and above. member public this.``Fsx.NoError.HashR.ResolveFromGAC``() = let fileContent = """ @@ -572,17 +557,14 @@ type UsingMSBuild() as this = """ this.VerifyFSXNoErrorList(fileContent) - [] - [] + [] member public this.``Fsx.NoError.HashR.ResolveFromFullyQualifiedPath``() = let fullyqualifiepathtoddll = System.IO.Path.Combine( System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), "System.configuration.dll" ) let code = ["#light";"#r @\"" + fullyqualifiepathtoddll + "\""] let (project, _) = createSingleFileFsxFromLines code AssertNoErrorsOrWarnings(project) - [] - [] - [] + [] member public this.``Fsx.NoError.HashR.RelativePath1``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -618,8 +600,7 @@ type UsingMSBuild() as this = let ans = GetSquiggleAtCursor(script1) AssertNoSquiggle(ans) - [] - [] + [] member public this.``Fsx.NoError.HashR.RelativePath2``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -656,7 +637,7 @@ type UsingMSBuild() as this = AssertNoSquiggle(ans) /// FEATURE: #load in an .fsx file will include that file in the 'build' of the .fsx. - [] + [] member public this.``Fsx.NoError.HashLoad.Simple``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -678,8 +659,7 @@ type UsingMSBuild() as this = AssertNoErrorsOrWarnings(project) // In this bug the #loaded file contains a level-4 warning (copy to avoid mutation). This warning was reported at the #load in file2.fsx but shouldn't have been.s - [] - [] + [] member public this.``Fsx.NoWarn.OnLoadedFile.Bug4837``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -699,8 +679,7 @@ type UsingMSBuild() as this = /// FEATURE: .fsx files have automatic imports of certain system assemblies. //There is a test bug here. The actual scenario works. Need to revisit. - [] - [] + [] member public this.``Fsx.NoError.AutomaticImportsForFsxFiles``() = let fileContent = """ #light @@ -717,8 +696,7 @@ type UsingMSBuild() as this = this.VerifyFSXNoErrorList(fileContent) // Corecursive load to nonexisting property. - [] - [] + [] member public this.``Fsx.ExactlyOneError.ScriptClosure.TransitiveLoad4``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -741,8 +719,7 @@ type UsingMSBuild() as this = AssertExactlyOneErrorSeenContaining(project, "NonExistingProperty") // #load of .fsi is respected - [] - [] + [] member public this.``Fsx.ExactlyOneError.ScriptClosure.TransitiveLoad5``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -770,8 +747,7 @@ type UsingMSBuild() as this = AssertExactlyOneErrorSeenContaining(project, "HiddenProperty") // #load of .fsi is respected at second #load level - [] - [] + [] member public this.``Fsx.ExactlyOneError.ScriptClosure.TransitiveLoad6``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -802,8 +778,7 @@ type UsingMSBuild() as this = AssertExactlyOneErrorSeenContaining(project, "HiddenProperty") // #load of .fsi is respected when dispersed between two #load levels - [] - [] + [] member public this.``Fsx.ExactlyOneError.ScriptClosure.TransitiveLoad7``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -834,8 +809,7 @@ type UsingMSBuild() as this = AssertExactlyOneErrorSeenContaining(project, "HiddenProperty") // #load of .fsi is respected when dispersed between two #load levels (the other way) - [] - [] + [] member public this.``Fsx.ExactlyOneError.ScriptClosure.TransitiveLoad8``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -866,8 +840,7 @@ type UsingMSBuild() as this = AssertExactlyOneErrorSeenContaining(project, "HiddenProperty") // Bug seen during development: A #load in an .fs would be followed. - [] - [] + [] member public this.``Fsx.ExactlyOneError.ScriptClosure.TransitiveLoad15``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -890,7 +863,7 @@ type UsingMSBuild() as this = TakeCoffeeBreak(this.VS) AssertExactlyOneErrorSeenContaining(project, "Namespace") - [] + [] member public this.``Fsx.Bug4311HoverOverReferenceInFirstLine``() = let fileContent = """#r "PresentationFramework.dll" @@ -899,7 +872,7 @@ type UsingMSBuild() as this = this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile fileContent marker "PresentationFramework.dll" this.AssertQuickInfoNotContainsAtEndOfMarkerInFsxFile fileContent marker "multiple results" - [] + [] member public this.``Fsx.QuickInfo.Bug4979``() = let code = ["System.ConsoleModifiers.Shift |> ignore " @@ -925,7 +898,7 @@ type UsingMSBuild() as this = // they may be metadata-only assemblies. // // "Reference Assemblies" was only introduced in 3.5sp1, so not all 2.0 F# boxes will have it, so only run on 4.0 - [] + [] member public this.``Fsx.Bug5073``() = let fileContent = """#r "System" """ let marker = "#r \"System" @@ -933,35 +906,32 @@ type UsingMSBuild() as this = this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile fileContent marker ".NET Framework" /// FEATURE: Hovering over a resolved #r file will show a data tip with the fully qualified path to that file. - [] + [] member public this.``Fsx.HashR_QuickInfo.ShowFilenameOfResolvedAssembly``() = this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile """#r "System.Transactions" """ // Pick anything that isn't in the standard set of assemblies. "#r \"System.Tra" "System.Transactions.dll" - [] + [] member public this.``Fsx.HashR_QuickInfo.BugDefaultReferenceFileIsAlsoResolved``() = this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile """#r "System" """ // 'System' is in the default set. Make sure we can still resolve it. "#r \"Syst" "System.dll" - [] - [] + [] member public this.``Fsx.HashR_QuickInfo.DoubleReference``() = let fileContent = """#r "System" // Mark1 #r "System" // Mark2 """ // The same reference repeated twice. this.AssertQuickInfoContainsAtStartOfMarkerInFsxFile fileContent "tem\" // Mark1" "System.dll" this.AssertQuickInfoContainsAtStartOfMarkerInFsxFile fileContent "tem\" // Mark2" "System.dll" - [] - [] + [] member public this.``Fsx.HashR_QuickInfo.ResolveFromGAC``() = this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile """#r "CustomMarshalers" """ // 'mscorcfg' is loaded from the GAC _and_ it is available on XP and above. "#r \"Custo" ".NET Framework" - [] - [] + [] member public this.``Fsx.HashR_QuickInfo.ResolveFromFullyQualifiedPath``() = let fullyqualifiepathtoddll = System.IO.Path.Combine( System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), "System.configuration.dll" ) // Can be any fully qualified path to an assembly let expectedtooltip = System.Reflection.Assembly.ReflectionOnlyLoadFrom(fullyqualifiepathtoddll).FullName @@ -970,7 +940,7 @@ type UsingMSBuild() as this = this.AssertQuickInfoContainsAtEndOfMarkerInFsxFile fileContent marker expectedtooltip //this.AssertQuickInfoNotContainsAtEndOfMarkerInFsxFile fileContent marker ".dll" - [] + [] member public this.``Fsx.InvalidHashReference.ShouldBeASquiggle.Bug3012``() = let code = ["#light" @@ -979,11 +949,10 @@ type UsingMSBuild() as this = MoveCursorToEndOfMarker(file,"#r \"Ba") let squiggle = GetSquiggleAtCursor(file) TakeCoffeeBreak(this.VS) - Assert.IsTrue(snd squiggle.Value |> fun str -> str.Contains("Bar.dll")) + Assert.True(snd squiggle.Value |> fun str -> str.Contains("Bar.dll")) // Bug seen during development: The unresolved reference error would x-ray through to the root. - [] - [] + [] member public this.``Fsx.ScriptClosure.TransitiveLoad14``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1016,23 +985,23 @@ type UsingMSBuild() as this = | Some(sev,msg) -> AssertEqual(Microsoft.VisualStudio.FSharp.LanguageService.Severity.Error, sev) AssertContains(msg, expectedStr) - | _ -> Assert.Fail() + | _ -> failwith "" /// FEATURE: #r, #I, #load are all errors when running under the language service - [] + [] member public this.``Fsx.HashDirectivesAreErrors.InNonScriptFiles.Case1``() = this.TestFsxHashDirectivesAreErrors("#r \"Joe", "may only be used in F# script files") - [] + [] member public this.``Fsx.HashDirectivesAreErrors.InNonScriptFiles.Case2``() = this.TestFsxHashDirectivesAreErrors("#I \"", "may only be used in F# script files") - [] + [] member public this.``Fsx.HashDirectivesAreErrors.InNonScriptFiles.Case3``() = this.TestFsxHashDirectivesAreErrors("#load \"Doo", "may only be used in F# script files") /// FEATURE: #reference against a non-assembly .EXE gives a reasonable error message - //[] + //[] member public this.``Fsx.HashReferenceAgainstNonAssemblyExe``() = let windows = System.Environment.GetEnvironmentVariable("windir") let code = @@ -1048,8 +1017,7 @@ type UsingMSBuild() as this = (* ---------------------------------------------------------------------------------- *) // FEATURE: A #loaded file is squiggled with an error if there are errors in that file. - [] - [] + [] member public this.``Fsx.HashLoadedFileWithErrors.Bug3149``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1074,8 +1042,7 @@ type UsingMSBuild() as this = // FEATURE: A #loaded file is squiggled with a warning if there are warning that file. - [] - [] + [] member public this.``Fsx.HashLoadedFileWithWarnings.Bug3149``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1098,8 +1065,7 @@ type UsingMSBuild() as this = AssertSquiggleIsWarningContaining(ans, "WarningHere") // Bug: #load should report the first error message from a file - [] - [] + [] member public this.``Fsx.HashLoadedFileWithErrors.Bug3652``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1125,7 +1091,7 @@ type UsingMSBuild() as this = AssertSquiggleIsErrorNotContaining(ans, "foo") // In this bug the .fsx project directory was wrong so it couldn't reference a relative file. - [] + [] member public this.``Fsx.ScriptCanReferenceBinDirectoryOutput.Bug3151``() = use _guard = this.UsingNewVS() let stopWatch = new System.Diagnostics.Stopwatch() @@ -1155,8 +1121,7 @@ type UsingMSBuild() as this = /// In this bug, multiple references to mscorlib .dll were causing problem in load closure - [] - [] + [] member public this.``Fsx.BugAllowExplicitReferenceToMsCorlib``() = let code = ["#r \"mscorlib\"" @@ -1169,8 +1134,7 @@ type UsingMSBuild() as this = AssertCompListContains(completions,"CommandLineArgs") /// FEATURE: There is a global fsi module that should be in scope for script files. - [] - [] + [] member public this.``Fsx.Bug2530FsiObject``() = let code = ["#light" @@ -1183,8 +1147,7 @@ type UsingMSBuild() as this = AssertCompListContains(completions,"CommandLineArgs") // Ensure that the script closure algorithm gets the right order of hash directives - [] - [] + [] member public this.``Fsx.ScriptClosure.SurfaceOrderOfHashes``() = let code = ["#r \"System.Runtime.Remoting\"" @@ -1199,12 +1162,12 @@ type UsingMSBuild() as this = AssertArrayContainsPartialMatchOf(fas.OtherOptions, "System.Runtime.Remoting.dll") AssertArrayContainsPartialMatchOf(fas.OtherOptions, "System.Transactions.dll") AssertArrayContainsPartialMatchOf(fas.OtherOptions, "FSharp.Compiler.Interactive.Settings.dll") - Assert.AreEqual(Path.Combine(projectFolder,"File1.fsx"), fas.SourceFiles.[0]) - Assert.AreEqual(1, fas.SourceFiles.Length) + Assert.Equal(Path.Combine(projectFolder,"File1.fsx"), fas.SourceFiles.[0]) + Assert.Equal(1, fas.SourceFiles.Length) /// FEATURE: #reference against a strong name should work. - [] + [] member public this.``Fsx.HashReferenceAgainstStrongName``() = let code = ["#light" @@ -1217,7 +1180,7 @@ type UsingMSBuild() as this = /// Try out some bogus file names in #r, #I and #load. - [] + [] member public this.``Fsx.InvalidMetaCommandFilenames``() = let code = [ @@ -1236,7 +1199,7 @@ type UsingMSBuild() as this = TakeCoffeeBreak(this.VS) // This used to assert /// FEATURE: .fsx files have INTERACTIVE #defined - [] + [] member public this.``Fsx.INTERACTIVEIsDefinedInFsxFiles``() = let code = [ @@ -1249,9 +1212,7 @@ type UsingMSBuild() as this = AssertEqual(TokenType.Identifier ,GetTokenTypeAtCursor(file)) // Ensure that basic compile of an .fsx works - [] - [] - [] + [] member public this.``Fsx.CompileFsx_1``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1260,14 +1221,12 @@ type UsingMSBuild() as this = let file1 = AddFileFromTextEx(project,"Script.fsx","Script.fsx",BuildAction.Compile, ["printfn \"Hello world\""]) let build = time1 Build project "Time to build project" - Assert.IsTrue(build.BuildSucceeded, "Expected build to succeed") + 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. - [] - [] - [] + [] member public this.``Fsx.CompileFsx_2``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1285,12 +1244,10 @@ type UsingMSBuild() as this = let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.IsTrue(build.BuildSucceeded, "Expected build to succeed") + Assert.True(build.BuildSucceeded, "Expected build to succeed") // Compile a script which #loads a source file. The build can't succeed without - [] - [] - [] + [] member public this.``Fsx.CompileFsx_3``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1308,12 +1265,10 @@ type UsingMSBuild() as this = let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.IsTrue(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``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1325,13 +1280,10 @@ type UsingMSBuild() as this = let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.IsTrue(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``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1357,13 +1309,11 @@ type UsingMSBuild() as this = for line in lines do printfn "%s" line () if not(SupportsOutputWindowPane(this.VS)) then - Assert.IsTrue(build.BuildSucceeded, "Expected build to succeed") + 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() let solution = this.CreateSolution() @@ -1388,13 +1338,11 @@ type UsingMSBuild() as this = let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.IsTrue(build.BuildSucceeded, "Expected build to succeed") + 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``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1419,14 +1367,12 @@ type UsingMSBuild() as this = let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line () - Assert.IsTrue(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``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1441,13 +1387,11 @@ type UsingMSBuild() as this = 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.IsTrue(not(build.BuildSucceeded), "Expected build to fail") + Assert.True(not(build.BuildSucceeded), "Expected build to fail") // #r references should be respected. - [] - [] - [] + [] member public this.``Fsx.CompileFsx_8``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1462,13 +1406,11 @@ type UsingMSBuild() as this = let lines = GetOutputWindowPaneLines(this.VS) for line in lines do printfn "%s" line - Assert.IsTrue(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``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -1486,11 +1428,11 @@ type UsingMSBuild() as this = printfn "%s" line AssertNotContains(line,"error MSB") // Microsoft.FSharp.Targets(135,9): error MSB6006: "fsc.exe" exited with code -532462766. - Assert.IsTrue(not(build.BuildSucceeded), "Expected build to fail") + Assert.True(not(build.BuildSucceeded), "Expected build to fail") /// There was a problem in which synthetic tokens like #load were causing asserts - [] + [] member public this.``Fsx.SyntheticTokens``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -1503,7 +1445,7 @@ type UsingMSBuild() as this = ) /// There was a problem where an unclosed reference picked up the text of the reference on the next line. - [] + [] member public this.``Fsx.ShouldBeAbleToReference30Assemblies.Bug2050``() = let code = ["#light" @@ -1516,7 +1458,7 @@ type UsingMSBuild() as this = AssertCompListContains(completions,"Linq") /// There was a problem where an unclosed reference picked up the text of the reference on the next line. - [] + [] member public this.``Fsx.UnclosedHashReference.Case1``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -1524,7 +1466,7 @@ type UsingMSBuild() as this = "#reference \"" // Unclosed "#reference \"Hello There\""] ) - [] + [] member public this.``Fsx.UnclosedHashReference.Case2``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -1534,7 +1476,7 @@ type UsingMSBuild() as this = ) /// There was a problem where an unclosed reference picked up the text of the reference on the next line. - [] + [] member public this.``Fsx.UnclosedHashLoad``() = Helper.ExhaustivelyScrutinize( this.TestRunner, @@ -1543,9 +1485,7 @@ type UsingMSBuild() as this = "#load \"Hello There\""] ) - [] - [] - [] + [] member public this.``TypeProvider.UnitsOfMeasure.SmokeTest1``() = let code = ["open Microsoft.FSharp.Data.UnitSystems.SI.UnitNames" @@ -1565,22 +1505,22 @@ type UsingMSBuild() as this = use _guard = this.UsingNewVS() let providerAssemblyName = PathRelativeToTestAssembly(@"DummyProviderForLanguageServiceTesting.dll") let providerAssembly = System.Reflection.Assembly.LoadFrom providerAssemblyName - Assert.IsNotNull(providerAssembly, "provider assembly should not be null") + Assert.NotNull(providerAssembly) let providerCounters = providerAssembly.GetType("DummyProviderForLanguageServiceTesting.GlobalCounters") - Assert.IsNotNull(providerCounters, "provider counters module should not be null") + Assert.NotNull(providerCounters) let totalCreationsMeth = providerCounters.GetMethod("GetTotalCreations") - Assert.IsNotNull(totalCreationsMeth, "totalCreationsMeth should not be null") + Assert.NotNull(totalCreationsMeth) let totalDisposalsMeth = providerCounters.GetMethod("GetTotalDisposals") - Assert.IsNotNull(totalDisposalsMeth, "totalDisposalsMeth should not be null") + Assert.NotNull(totalDisposalsMeth) let checkConfigsMeth = providerCounters.GetMethod("CheckAllConfigsDisposed") - Assert.IsNotNull(checkConfigsMeth, "checkConfigsMeth should not be null") + Assert.NotNull(checkConfigsMeth) let providerCounters2 = providerAssembly.GetType("ProviderImplementation.ProvidedTypes.GlobalCountersForInvalidation") - Assert.IsNotNull(providerCounters2, "provider counters #2 module should not be null") + Assert.NotNull(providerCounters2) let totalInvalidationHandlersAddedMeth = providerCounters2.GetMethod("GetInvalidationHandlersAdded") - Assert.IsNotNull(totalInvalidationHandlersAddedMeth, "totalInvalidationHandlersAddedMeth should not be null") + Assert.NotNull(totalInvalidationHandlersAddedMeth) let totalInvalidationHandlersRemovedMeth = providerCounters2.GetMethod("GetInvalidationHandlersRemoved") - Assert.IsNotNull(totalInvalidationHandlersRemovedMeth, "totalInvalidationHandlersRemovedMeth should not be null") + Assert.NotNull(totalInvalidationHandlersRemovedMeth) let totalCreations() = totalCreationsMeth.Invoke(null, [| |]) :?> int let totalDisposals() = totalDisposalsMeth.Invoke(null, [| |]) :?> int @@ -1598,8 +1538,8 @@ type UsingMSBuild() as this = let countInvalidationHandlersAdded() = totalInvalidationHandlersAdded() - startInvalidationHandlersAdded let countInvalidationHandlersRemoved() = totalInvalidationHandlersRemoved() - startInvalidationHandlersRemoved - Assert.IsTrue(startCreations >= startDisposals, "Check0") - Assert.IsTrue(startInvalidationHandlersAdded >= startInvalidationHandlersRemoved, "Check0") + Assert.True(startCreations >= startDisposals, "Check0") + Assert.True(startInvalidationHandlersAdded >= startInvalidationHandlersRemoved, "Check0") for i in 1 .. 50 do let solution = this.CreateSolution() let project = CreateProject(solution,"testproject" + string (i % 20)) @@ -1624,17 +1564,17 @@ type UsingMSBuild() as this = let d = countDisposals() // Creations should always be greater or equal to disposals - Assert.IsTrue(c >= d, "Check2, countCreations() >= countDisposals(), iteration " + string i + ", countCreations() = " + string c + ", countDisposals() = " + string d) + Assert.True(c >= d, "Check2, countCreations() >= countDisposals(), iteration " + string i + ", countCreations() = " + string c + ", countDisposals() = " + string d) // Creations can run ahead of iterations if the background checker resurrects the builder for a project // even after we've moved on from it. - Assert.IsTrue((c >= i), "Check3, countCreations() >= i, iteration " + string i + ", countCreations() = " + string c) + Assert.True((c >= i), "Check3, countCreations() >= i, iteration " + string i + ", countCreations() = " + string c) 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 - Assert.IsTrue(c >= d + 3, "Check4a, c >= countDisposals() + 3, iteration " + string i + ", i = " + string i + ", countDisposals() = " + string d) + 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... @@ -1644,31 +1584,30 @@ type UsingMSBuild() as this = let d = countDisposals() // Creations should be equal to disposals after a `ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients` - Assert.IsTrue((c = d), "Check4b, countCreations() = countDisposals(), iteration " + string i) - Assert.IsTrue((countInvalidationHandlersAdded() = countInvalidationHandlersRemoved()), "Check4b2, all invalidation handlers removed, iteration " + string i) + 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.IsTrue(c >= 50, "Check5, at end, countCreations() >= 50") + Assert.True(c >= 50, "Check5, at end, countCreations() >= 50") ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients(this.VS) let c = countCreations() let d = countDisposals() // Creations should be equal to disposals after a `ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients` - Assert.IsTrue((c = d), "Check6b, at end, countCreations() = countDisposals() after explicit clearing") - Assert.IsTrue((countInvalidationHandlersAdded() = countInvalidationHandlersRemoved()), "Check6b2, at end, all invalidation handlers removed after explicit clearing") + Assert.True((c = d), "Check6b, at end, countCreations() = countDisposals() after explicit clearing") + Assert.True((countInvalidationHandlersAdded() = countInvalidationHandlersRemoved()), "Check6b2, at end, all invalidation handlers removed after explicit clearing") checkConfigsDisposed() - [] + [] member public this.``TypeProvider.Disposal.SmokeTest1``() = this.TypeProviderDisposalSmokeTest(true) - [] + [] member public this.``TypeProvider.Disposal.SmokeTest2``() = this.TypeProviderDisposalSmokeTest(false) // Context project system -[] 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 76c6d663df2..530260a0d5f 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.TimeStamp.fs @@ -4,15 +4,13 @@ namespace Tests.LanguageService.TimeStamp open System open System.IO -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa open UnitTests.TestLib.Utils open UnitTests.TestLib.LanguageService -[] -[] type UsingMSBuild() = inherit LanguageServiceBaseTests() @@ -46,7 +44,7 @@ type UsingMSBuild() = // 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. // Disabled due to issue #11752 --- https://github.com/dotnet/fsharp/issues/11752 - //[] + //[] member public this.``Regression.NoError.Timestamps.Bug3368b``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -88,8 +86,7 @@ type UsingMSBuild() = AssertNoErrorsOrWarnings(project2) // this is key, project2 remembers what used to be on disk, does not fail due to missing assembly // In this bug, the referenced project output didn't exist yet. Building dependee should cause update in dependent - [] - [] + [] member public this.``Regression.NoContainedString.Timestamps.Bug3368a``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -121,7 +118,7 @@ type UsingMSBuild() = AssertNoErrorSeenContaining(project2, "project1") // FEATURE: OnIdle() will reprocess open dirty files, even if those file do not currently have editor focus - // [] TODO This test does not work because the unit tests do not cover product code that implements this feature + // [] TODO This test does not work because the unit tests do not cover product code that implements this feature member public this.``Timestamps.Bug3368c``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -147,7 +144,7 @@ type UsingMSBuild() = TakeCoffeeBreak(this.VS) let errs = GetErrors(project2) - Assert.IsTrue(List.length errs > 0, "There should be errors (unresolved reference)") + Assert.True(List.length errs > 0, "There should be errors (unresolved reference)") // switch focus to a different file (to turn off 'focus' idle processing for file2) let file1 = OpenFile(project1,"File1.fs") @@ -156,7 +153,7 @@ type UsingMSBuild() = printfn "building dependent project..." Build project1 |> ignore let errs = GetErrors(project2) - Assert.IsTrue(List.length errs > 0, "There should be errors (unresolved reference)") + 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(), // but unit tests do not call this FSharp.LanguageService.Base code; TakeCoffeeBreak(this.VS) just simulates @@ -165,8 +162,7 @@ type UsingMSBuild() = AssertNoErrorsOrWarnings(project2) // FEATURE: When a referenced assembly's timestamp changes the reference is reread. - [] - [] + [] member public this.``Timestamps.ReferenceAssemblyChangeAbsolute``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -194,7 +190,7 @@ type UsingMSBuild() = SwitchToFile this.VS file2 MoveCursorToEndOfMarker(file2,"File1.File1.") let completions = AutoCompleteAtCursor(file2) - Assert.AreEqual(0, completions.Length) + Assert.Equal(0, completions.Length) // Now modify project1's file and rebuild. ReplaceFileInMemory file1 @@ -208,12 +204,11 @@ type UsingMSBuild() = MoveCursorToEndOfMarker(file2,"File1.File1.") TakeCoffeeBreak(this.VS) // Give enough time to catch up let completions = AutoCompleteAtCursor(file2) - Assert.AreNotEqual(0, completions.Length) + Assert.NotEqual(0, completions.Length) printfn "Completions=%A\n" completions // In this bug, relative paths to referenced assemblies weren't seen. - [] - [] + [] member public this.``Timestamps.ReferenceAssemblyChangeRelative``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -249,7 +244,7 @@ type UsingMSBuild() = SwitchToFile this.VS file2 MoveCursorToEndOfMarker(file2,"File1.File1.") let completions = AutoCompleteAtCursor(file2) - Assert.AreEqual(0, completions.Length) + Assert.Equal(0, completions.Length) // Now modify project1's file and rebuild. ReplaceFileInMemory file1 @@ -263,12 +258,11 @@ type UsingMSBuild() = MoveCursorToEndOfMarker(file2,"File1.File1.") TakeCoffeeBreak(this.VS) // Give enough time to catch up let completions = AutoCompleteAtCursor(file2) - Assert.AreNotEqual(0, completions.Length) + Assert.NotEqual(0, completions.Length) printfn "Completions=%A\n" completions // FEATURE: When a referenced project's assembly timestamp changes the reference is reread. - [] - [] + [] member public this.``Timestamps.ProjectReferenceAssemblyChange``() = use _guard = this.UsingNewVS() let solution = this.CreateSolution() @@ -302,7 +296,7 @@ type UsingMSBuild() = SwitchToFile this.VS file2 MoveCursorToEndOfMarker(file2,"File1.File1.") let completions = AutoCompleteAtCursor(file2) - Assert.AreEqual(0, completions.Length) + Assert.Equal(0, completions.Length) // Now modify project1's file and rebuild. ReplaceFileInMemory file1 @@ -316,7 +310,7 @@ type UsingMSBuild() = MoveCursorToEndOfMarker(file2,"File1.File1.") TakeCoffeeBreak(this.VS) // Give enough time to catch up let completions = AutoCompleteAtCursor(file2) - Assert.AreNotEqual(0, completions.Length) + Assert.NotEqual(0, completions.Length) printfn "Completions=%A\n" completions @@ -325,10 +319,9 @@ namespace Tests.LanguageService.TimeStamp open Tests.LanguageService open UnitTests.TestLib.LanguageService open UnitTests.TestLib.ProjectSystem -open NUnit.Framework +open Xunit open Salsa.Salsa // Context project system -[] 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 faf186f8cef..a0cedaf030f 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Configs.fs @@ -8,7 +8,7 @@ open System.Collections.Generic open System.IO open System.Text.RegularExpressions open System.Xml.Linq -open NUnit.Framework +open Xunit // VS namespaces open Microsoft.VisualStudio @@ -23,13 +23,6 @@ open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem -[] -type public AssemblyResolverTestFixture () = - - [] - member public _.Init () = AssemblyResolver.addResolver () - -[][] type Config() = inherit TheTests() @@ -38,7 +31,7 @@ type Config() = static let SaveProject(project : UnitTestingFSharpProjectNode) = project.Save(null, 1, 0u) |> ignore - [] + [] member this.TargetPlatform () = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], this.MSBuildProjectMultiPlatformBoilerplate "Library", @@ -46,32 +39,32 @@ type Config() = ccn((project :> IVsHierarchy), "Debug|x86") project.ComputeSourcesAndFlags() let flags = project.CompilationOptions |> List.ofArray - Assert.IsTrue(List.exists (fun s -> s = "--platform:x86") flags) + Assert.True(List.exists (fun s -> s = "--platform:x86") flags) () )) - [] + [] member this.``Configs.EnsureAtLeastOneConfiguration`` () = this.HelperEnsureAtLeastOne @"" [|"Debug"|] // the goal of the test - when no configs, "Debug" should magically appear [|"x86"|] - [] + [] member this.``Configs.EnsureAtLeastOnePlatform`` () = this.HelperEnsureAtLeastOne @"" [|"Release"|] [|"Any CPU"|] // the goal of the test - when no platforms, "AnyCPU" should magically appear - [] + [] member this.``Configs.EnsureAtLeastOneConfigurationAndPlatform`` () = 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 - [] + [] member this.``Configs.EnsureAtLeastOneConfiguration.Imported`` () = // Take advantage of the fact that we always create projects one directory below TempPath let tmpTargets = Path.Combine(Path.GetTempPath(), "foo.targets") @@ -88,7 +81,7 @@ type Config() = finally File.Delete tmpTargets - [] + [] 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". @@ -106,7 +99,7 @@ type Config() = finally File.Delete tmpTargets - [] + [] member this.``Configs.Renaming`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiConfigBoilerplate ["Debug",""; "Release",""], @@ -122,7 +115,7 @@ type Config() = TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) - [] + [] member this.``Configs.Deleting`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiConfigBoilerplate ["Debug",""; "Release",""], @@ -137,7 +130,7 @@ type Config() = let expectedXDoc = XDocument.Load(new StringReader(TheTests.SimpleFsprojText(["foo.fs"],[],expected))) TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) - [] + [] member this.``Configs.Adding`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiConfigBoilerplate ["Debug",""; "Release",""], @@ -152,7 +145,7 @@ type Config() = let expectedXDoc = XDocument.Load(new StringReader(TheTests.SimpleFsprojText(["foo.fs"],[],expected))) TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) - [] + [] member this.``Configs.AddingBaseless`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiConfigBoilerplate ["Debug",""; "Release",""], @@ -168,7 +161,7 @@ type Config() = TheTests.AssertSimilarXml(expectedXDoc.Root, xDoc.Root) )) - [] + [] member this.``Configs.Platforms.Deleting`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiPlatform ["Any CPU",""; "x86",""], @@ -185,7 +178,7 @@ type Config() = )) - [] + [] member this.``Configs.Platforms.Adding`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiPlatform ["Any CPU",""; "x86",""], @@ -202,7 +195,7 @@ type Config() = )) - [] + [] member this.``Configs.Platforms.AddingBaseless`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], [], this.MSBuildProjectMultiPlatform ["Any CPU",""; "x86",""], diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs index 7aa25427e2d..800411f1bd7 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Miscellaneous.fs @@ -18,13 +18,12 @@ open Microsoft.VisualStudio.FSharp.ProjectSystem open Microsoft.VisualStudio.FSharp.Editor // Internal unittest namespaces -open NUnit.Framework +open Xunit open Salsa open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem -[][] type Miscellaneous() = inherit TheTests() @@ -34,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")) @@ -42,16 +41,16 @@ type Miscellaneous() = System.Threading.Thread.Sleep(1000) )) - [] + [] member public this.``Miscellaneous.CreatePropertiesObject`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) use project = TheTests.CreateProject(projFile) let prop = project.CreatePropertiesObject() - Assert.AreEqual(typeof, prop.GetType()) + Assert.Equal(typeof, prop.GetType()) ) - [] + [] member public this.``Miscellaneous.TestProperties`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) @@ -59,63 +58,63 @@ type Miscellaneous() = let prop = new FSharpProjectNodeProperties(project) prop.AssemblyName <- "a" - Assert.AreEqual("a", prop.AssemblyName) + Assert.Equal("a", prop.AssemblyName) // Output type and output file name prop.OutputType <- OutputType.Exe - Assert.AreEqual(OutputType.Exe, prop.OutputType) - Assert.AreEqual("a.exe", prop.OutputFileName) + Assert.Equal(OutputType.Exe, prop.OutputType) + Assert.Equal("a.exe", prop.OutputFileName) prop.OutputType <- OutputType.Library - Assert.AreEqual(OutputType.Library, prop.OutputType) - Assert.AreEqual("a.dll", prop.OutputFileName) + Assert.Equal(OutputType.Library, prop.OutputType) + Assert.Equal("a.dll", prop.OutputFileName) prop.OutputType <- OutputType.WinExe - Assert.AreEqual(OutputType.WinExe, prop.OutputType) - Assert.AreEqual("a.exe", prop.OutputFileName) + 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) let proj = project.CreateServices(typeof) - Assert.AreEqual(typeof, proj.GetType()) + Assert.Equal(typeof, proj.GetType()) let eproj = project.CreateServices(typeof) - Assert.AreEqual(typeof, eproj.GetType()) + Assert.Equal(typeof, eproj.GetType()) let badservice = project.CreateServices(typeof) - Assert.IsNull(badservice) + Assert.Null(badservice) ) - [] + [] member public this.``Miscellaneous.FSharpFileNode.RelativeFilePath`` () = this.MakeProjectAndDo(["orig1.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "orig1.fs") let files = new List() project.FindNodesOfType(files) - Assert.AreEqual(1, files.Count) + Assert.Equal(1, files.Count) let file = files.[0] let path = file.RelativeFilePath - Assert.AreEqual("orig1.fs", path) + Assert.Equal("orig1.fs", path) )) - [] + [] member public this.``Miscellaneous.FSharpFileNode.CreateServices`` () = this.MakeProjectAndDo(["orig1.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "orig1.fs") let files = new List() project.FindNodesOfType(files) - Assert.AreEqual(1, files.Count) + Assert.Equal(1, files.Count) let file = files.[0] let badservice = file.CreateServices(typeof) - Assert.IsNull(badservice) + Assert.Null(badservice) let eproj = file.CreateServices(typeof) - Assert.AreEqual(typeof, eproj.GetType()) + Assert.Equal(typeof, eproj.GetType()) )) - //[] + //[] member public this.AttemptDragAndDrop() = printfn "starting..." let fsproj = "D:\Depot\staging\Test.fsproj" @@ -159,15 +158,14 @@ type Miscellaneous() = node <- node.NextSibling if node = null then finished <- true - Assert.AreNotEqual(node, null) + 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"], [], this.MSBuildProjectMultiPlatform(["x86",""],"x86"), @@ -184,8 +182,7 @@ type Miscellaneous() = ) ) - [] - [] + [] member public this.``Automation.OutputGroups``() = DoWithTempFile "Test.fsproj" (fun file -> let text = TheTests.FsprojTextWithProjectReferences([],[],[],@" @@ -247,7 +244,7 @@ type Miscellaneous() = AssertEqual expected ogInfos ) - [] + [] member public this.``LoadProject.x86`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], ["System"], this.MSBuildProjectMultiPlatform(["x86",""],"x86"), @@ -262,8 +259,7 @@ type Miscellaneous() = AssertEqual 1 l.Count )) - [] - [] + [] member public this.``BuildAndClean``() = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], this.MSBuildProjectBoilerplate "Library", @@ -291,7 +287,7 @@ type Miscellaneous() = success <- fSuccess <> 0 printfn "Build %s, code %i, phase: %s." (if success then "succeeded" else "failed") fSuccess (if isCleaning then "Cleaning" else "Build") - event.Set() |> Assert.IsTrue + event.Set() |> Assert.True VSConstants.S_OK member this.Tick pfContinue = pfContinue <- 1; VSConstants.S_OK } @@ -301,10 +297,10 @@ type Miscellaneous() = let output = VsMocks.vsOutputWindowPane(ref []) let doBuild target = success <- false - event.Reset() |> Assert.IsTrue + event.Reset() |> Assert.True buildMgrAccessor.BeginDesignTimeBuild() |> ValidateOK // this is not a design-time build, but our mock does all the right initialization of the build manager for us, similar to what the system would do in VS for real buildableCfg.Build(0u, output, target) - event.WaitOne() |> Assert.IsTrue + event.WaitOne() |> Assert.True buildMgrAccessor.EndDesignTimeBuild() |> ValidateOK // this is not a design-time build, but our mock does all the right initialization of the build manager for us, similar to what the system would do in VS for real AssertEqual true success @@ -324,7 +320,7 @@ type Miscellaneous() = )) - //KnownFail: [] + //KnownFail: [] member public this.``ErrorReporting.EmptyModuleReportedAtTheLastLine``() = let (outputWindowPaneErrors : string list ref) = ref [] // output window pane errors let vso = VsMocks.vsOutputWindowPane(outputWindowPaneErrors) @@ -357,17 +353,11 @@ type Miscellaneous() = () )) -#if NUNIT_V2 - [][)>] - member public this.``DebuggingDLLFails``() = this.``DebuggingDLLFailsFunc``() -#else - [] + [] member public this.``DebuggingDLLFails``() = - Assert.That((fun () -> this.``DebuggingDLLFailsFunc``()), NUnit.Framework.Throws.TypeOf(typeof)) -#endif + Assert.Throws((fun () -> this.``DebuggingDLLFailsFunc``())) - [] - [] + [] member public this.``DebuggingEXESucceeds``() = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier(["foo.fs"], [], this.MSBuildProjectBoilerplate "Exe", @@ -376,7 +366,7 @@ type Miscellaneous() = let fooPath = Path.Combine(project.ProjectFolder, "foo.fs") File.AppendAllText(fooPath, "#light") let buildResult = project.Build("Build") - Assert.IsTrue buildResult.IsSuccessful + Assert.True buildResult.IsSuccessful AssertEqual true (File.Exists (Path.Combine(project.ProjectFolder, "bin\\Debug\\Blah.exe"))) let mutable configurationInterface : IVsCfg = null @@ -387,11 +377,11 @@ type Miscellaneous() = config.DebugLaunch(0ul) |> ignore with | :? ClassLibraryCannotBeStartedDirectlyException -> Assert.Fail("Exe should be debuggable") - | _ -> Assert.Fail() // DmiLom: Currently DebugLaunch() swallows most exceptions, in future if we improve DebugLaunch() we will expect it to throw a particular exception here + | _ -> 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" @@ -414,7 +404,7 @@ type Miscellaneous() = checkInProject false "System.dll" ) - //Known Fail: [] + //Known Fail: [] member public this.``PreBuildEvent`` () = this.MakeProjectAndDoWithProjectFile(["foo.fs"], ["System"], "", (fun project projFileName -> @@ -434,10 +424,10 @@ type Miscellaneous() = printfn "Build output:" !outputWindowPaneErrors |> Seq.iter (printfn "%s") let expectedRegex = new Regex("\\s*ProjectExt\\[.fsproj\\]") - Assert.IsTrue(!outputWindowPaneErrors |> List.exists (fun s -> expectedRegex.IsMatch(s)), "did not see expected value in build output") + Assert.True(!outputWindowPaneErrors |> List.exists (fun s -> expectedRegex.IsMatch(s)), "did not see expected value in build output") )) - [] + [] member public this.``BuildMacroValues`` () = let logger (message:string) = System.IO.File.AppendAllText(@"c:\temp\logfile.txt", (message + Environment.NewLine)) @@ -455,23 +445,23 @@ type Miscellaneous() = // Verify Solution values let solutionDir = project.GetBuildMacroValue("SolutionDir") - Assert.IsNotNull (solutionDir, "SolutionDir is NULL") - Assert.IsFalse ( (solutionDir = "*Undefined*"), "SolutionDir not defined") + Assert.NotNull(solutionDir) + Assert.False ( (solutionDir = "*Undefined*"), "SolutionDir not defined") let solutionFileName = project.GetBuildMacroValue("SolutionFileName") - Assert.IsNotNull (solutionFileName, "SolutionFileName is null") - Assert.IsFalse ( (solutionFileName = "*Undefined*"), "SolutionFileName not defined") + Assert.NotNull(solutionFileName) + Assert.False ( (solutionFileName = "*Undefined*"), "SolutionFileName not defined") let solutionName = project.GetBuildMacroValue("SolutionName") - Assert.IsNotNull (solutionName, "SolutionName is null") - Assert.IsFalse ( (solutionName = "*Undefined*"), "SolutionName not defined") + Assert.NotNull(solutionName) + Assert.False ( (solutionName = "*Undefined*"), "SolutionName not defined") let solutionExt = project.GetBuildMacroValue("SolutionExt") - Assert.IsNotNull (solutionExt, "SolutionExt is null") - Assert.IsFalse ( (solutionExt = "*Undefined*"), "SolutionExt not defined") + Assert.NotNull(solutionExt) + Assert.False ( (solutionExt = "*Undefined*"), "SolutionExt not defined") ) - [] + [] member public this.CreateFSharpManifestResourceName () = DoWithTempFile "Test.fsproj" (fun file -> let text = TheTests.FsprojTextWithProjectReferences(["foo.fs";"Bar.resx"; "Bar.de.resx"; "Xyz\Baz.ru.resx"; "Abc.resources"],[],[],"") @@ -491,14 +481,14 @@ type Miscellaneous() = let buildMgr = project.Site.GetService(typeof) :?> IVsSolutionBuildManager let cfgs = Array.create 1 (null : IVsProjectCfg) let hr = buildMgr.FindActiveProjectCfg(System.IntPtr.Zero, System.IntPtr.Zero, project, cfgs) - Assert.AreEqual(VSConstants.S_OK, hr) - Assert.IsNotNull(cfgs.[0]) + Assert.Equal(VSConstants.S_OK, hr) + Assert.NotNull(cfgs.[0]) let mutable cfgName = "" let hr = cfgs.[0].get_CanonicalName(&cfgName) - Assert.AreEqual(VSConstants.S_OK, hr) + Assert.Equal(VSConstants.S_OK, hr) cfgName - [] + [] member this.``MSBuildExtensibility.BrokenCompileDependsOn.WithRecovery`` () = this.MakeProjectAndDoWithProjectFileAndConfigChangeNotifier( ["foo.fs";"bar.fs"], @@ -529,7 +519,7 @@ type Miscellaneous() = project.Reload() // Ensure we are not in 'Foo' config, and thus expect failure let curCfgCanonicalName = this.GetCurrentConfigCanonicalName(project) - Assert.IsFalse(curCfgCanonicalName.StartsWith("Foo"), sprintf "default config should not be 'Foo'! in fact it had canonical name '%s'" curCfgCanonicalName) + Assert.False(curCfgCanonicalName.StartsWith("Foo"), sprintf "default config should not be 'Foo'! in fact it had canonical name '%s'" curCfgCanonicalName) // Now the project system is in a state where ComputeSourcesAndFlags will fail. // Our goal is to at least be able to open individual source files and treat them like 'files outside a project' with regards to intellisense, etc. // Also, if the user does 'Build', he will get an error which will help diagnose the problem. @@ -537,10 +527,10 @@ type Miscellaneous() = let ips = ipps.GetProjectSite() let expected = [| |] // Ideal behavior is [|"foo.fs";"bar.fs"|], and we could choose to improve this in the future. For now we are just happy to now throw/crash. let actual = ips.CompilationSourceFiles - Assert.AreEqual(expected, actual, "project site did not report expected set of source files") + Assert.Equal(expected, actual) ) - [] + [] 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"],[],[],"") @@ -571,7 +561,7 @@ type Miscellaneous() = () ) - [] + [] member public this.TestBuildActionConversions () = let replace (pattern:string) (replacement:string) (input:string) = Regex.Replace(input, pattern, replacement) @@ -582,10 +572,10 @@ type Miscellaneous() = props :?> BuildableNodeProperties let checkNotStandardBuildAction buildAction = - Assert.IsFalse(VSLangProj.prjBuildAction.prjBuildActionNone = buildAction, "Unexpected None match") - Assert.IsFalse(VSLangProj.prjBuildAction.prjBuildActionCompile = buildAction, "Unexpected Compile match") - Assert.IsFalse(VSLangProj.prjBuildAction.prjBuildActionContent = buildAction, "Unexpected Content match") - Assert.IsFalse(VSLangProj.prjBuildAction.prjBuildActionEmbeddedResource = buildAction, "Unexpected EmbeddedResource match") + 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") + Assert.False(VSLangProj.prjBuildAction.prjBuildActionEmbeddedResource = buildAction, "Unexpected EmbeddedResource match") DoWithTempFile "Test.fsproj" (fun file -> let text = @@ -598,32 +588,32 @@ type Miscellaneous() = // test proper behavior from project file let node = getBuildableNodeProps project "Compile.fs" - Assert.IsTrue(node.BuildAction = VSLangProj.prjBuildAction.prjBuildActionCompile, "Compile build action failed") - Assert.IsTrue(node.ItemType = "Compile", "Compile item type failed") + Assert.True(node.BuildAction = VSLangProj.prjBuildAction.prjBuildActionCompile, "Compile build action failed") + Assert.True(node.ItemType = "Compile", "Compile item type failed") let node = getBuildableNodeProps project "None.fs" - Assert.IsTrue(node.BuildAction = VSLangProj.prjBuildAction.prjBuildActionNone, "None build action failed") - Assert.IsTrue(node.ItemType = "None", "None item type failed") + Assert.True(node.BuildAction = VSLangProj.prjBuildAction.prjBuildActionNone, "None build action failed") + Assert.True(node.ItemType = "None", "None item type failed") let node = getBuildableNodeProps project "Resource.fs" checkNotStandardBuildAction node.BuildAction - Assert.IsTrue(node.ItemType = "Resource", "Resource item type failed") + Assert.True(node.ItemType = "Resource", "Resource item type failed") let node = getBuildableNodeProps project "Dude.fs" checkNotStandardBuildAction node.BuildAction - Assert.IsTrue(node.ItemType = "Dude", "Dude item type failed") + Assert.True(node.ItemType = "Dude", "Dude item type failed") // test handling of bogus values node.BuildAction <- enum 100 - Assert.IsTrue(node.BuildAction = VSLangProj.prjBuildAction.prjBuildActionNone, "Bogus build action not mapped to None") + Assert.True(node.BuildAction = VSLangProj.prjBuildAction.prjBuildActionNone, "Bogus build action not mapped to None") node.ItemType <- "Wibble" - Assert.IsTrue(node.ItemType = "None", "Bogus item type not mapped to None") + Assert.True(node.ItemType = "None", "Bogus item type not mapped to None") () ) - [] + [] member this.``WildcardsInProjectFile.ThrowingCase`` () = DoWithTempFile "Test.fsproj"(fun file -> let text = TheTests.FsprojTextWithProjectReferences(["*.fs"],[],[],"") @@ -639,10 +629,10 @@ type Miscellaneous() = exceptionThrown <- true AssertEqual "*.fs" e.ItemSpecification AssertEqual "Compile" e.ItemType - Assert.IsTrue(exceptionThrown) + Assert.True(exceptionThrown) ) - [] + [] member this.``WildcardsInProjectFile.OkCase`` () = DoWithTempFile "Test.fsproj"(fun file -> let text = TheTests.FsprojTextWithProjectReferences(["*.fs"],[],[],"") @@ -659,13 +649,12 @@ type Miscellaneous() = | [ _; fn ] -> // first file is AssemblyAttributes.fs AssertEqual fileName fn | _ -> - sprintf "wring set of compile items %A" items |> Assert.Fail + failwithf "wring set of compile items %A" items () finally project.Close() |> ignore ) -[] type Utilities() = (* Simulation of the code found in Xaml editor that we were crashing. The relevent code is pasted below. @@ -733,24 +722,24 @@ type Utilities() = let CheckPublicKeyToString(bytes,expect) = let actual = KeyToken.ToHexString(bytes) - Assert.AreEqual(expect, actual) + Assert.Equal(expect, actual) SimulateXamlEditorReceivingThroughDTE(actual) - [] + [] 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") - [] + [] member public this.``PublicKeyToken.0a00000000000001``() = CheckPublicKeyToString([|0xauy;0uy;0uy;0uy;0uy;0uy;0uy;1uy|], "0a00000000000001") - [] + [] member public this.``Parse MSBuild property of type Int64`` () = - Assert.AreEqual(123L, ProjectNode.ParsePropertyValueToInt64("123")) - Assert.AreEqual(255L, ProjectNode.ParsePropertyValueToInt64("0xFF")) - Assert.AreEqual(null, ProjectNode.ParsePropertyValueToInt64("")) - Assert.AreEqual(null, ProjectNode.ParsePropertyValueToInt64(null)) + Assert.Equal(123L, ProjectNode.ParsePropertyValueToInt64("123").Value) + Assert.Equal(255L, ProjectNode.ParsePropertyValueToInt64("0xFF").Value) + Assert.Null(ProjectNode.ParsePropertyValueToInt64("")) + Assert.Null(ProjectNode.ParsePropertyValueToInt64(null)) Throws(fun () -> ignore (ProjectNode.ParsePropertyValueToInt64("abc"))) Throws(fun () -> ignore (ProjectNode.ParsePropertyValueToInt64("12333333333333333333333333"))) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.MultiTargeting.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.MultiTargeting.fs index f1b699a428c..1e393f7ceed 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.MultiTargeting.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.MultiTargeting.fs @@ -8,7 +8,7 @@ open System.IO open System.Reflection open System.Text.RegularExpressions open System.Xml.Linq -open NUnit.Framework +open Xunit open Salsa open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers @@ -16,7 +16,6 @@ open UnitTests.TestLib.ProjectSystem open Microsoft.VisualStudio.FSharp.ProjectSystem -[][] type MultiTargeting() = inherit TheTests() @@ -35,7 +34,7 @@ type MultiTargeting() = File.AppendAllText(projFile, TheTests.FsprojTextWithProjectReferencesAndOtherFlags([], [refLibPath], [], null, "", "v4.0")) refLibPath - [] + [] member public this.``Multitargeting.CheckIconForMismatchedAssemblyReference`` () = DoWithTempFile "Test.fsproj" (fun projFile -> let sp, ccn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier40() @@ -43,14 +42,14 @@ type MultiTargeting() = use project = TheTests.CreateProject(projFile, "true", ccn, sp) let l = new List() project.FindNodesOfType(l) - Assert.AreEqual(1, l.Count) - Assert.AreEqual(refLibPath, l.[0].Url) - Assert.AreEqual(refLibPath, l.[0].Caption) + Assert.Equal(1, l.Count) + Assert.Equal(refLibPath, l.[0].Url) + Assert.Equal(refLibPath, l.[0].Caption) let ref = l.[0] - Assert.AreEqual(true, ref.CanShowDefaultIcon()) + Assert.Equal(true, ref.CanShowDefaultIcon()) ) - [] + [] member public this.``Multitargeting.CheckIconForMatchedAssemblyReference20`` () = DoWithTempFile "Test.fsproj" (fun projFile -> let sp, ccn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier20() @@ -58,14 +57,14 @@ type MultiTargeting() = use project = TheTests.CreateProject(projFile, "true", ccn, sp) let l = new List() project.FindNodesOfType(l) - Assert.AreEqual(1, l.Count) - Assert.AreEqual(refLibPath, l.[0].Url) - Assert.AreEqual(refLibPath, l.[0].Caption) + Assert.Equal(1, l.Count) + Assert.Equal(refLibPath, l.[0].Url) + Assert.Equal(refLibPath, l.[0].Caption) let ref = l.[0] - Assert.AreEqual(true, ref.CanShowDefaultIcon()) + Assert.Equal(true, ref.CanShowDefaultIcon()) ) - [] + [] member public this.``Multitargeting.DetermineRuntimeAndSKU`` () = DoWithTempFile "Test.fsproj" (fun projFile -> let sp, ccn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier40() @@ -74,62 +73,62 @@ type MultiTargeting() = let validate (fn : System.Runtime.Versioning.FrameworkName) eR eS = let (runtime, sku) = project.DetermineRuntimeAndSKU(fn.ToString()) - Assert.AreEqual(eR, runtime) - Assert.AreEqual(eS, sku) + Assert.Equal(eR, runtime) + Assert.Equal(eS, sku) 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("") let dirty = LangConfigFile.PatchUpXml(root, "version", "sku") - Assert.IsTrue(dirty) - Assert.IsTrue(root.ToString().Contains("")) + Assert.True(dirty) + Assert.True(root.ToString().Contains("")) - [] + [] member public this.``Multitargeting.AppConfigVersionExistsAddNewSku`` () = let root = XElement.Parse("") let dirty = LangConfigFile.PatchUpXml(root, "version", "sku") - Assert.IsTrue(dirty) - Assert.IsTrue(root.ToString().Contains("")) + Assert.True(dirty) + Assert.True(root.ToString().Contains("")) - [] + [] member public this.``Multitargeting.AppConfigVersionExistsReplaceSku`` () = let root = XElement.Parse("") let dirty = LangConfigFile.PatchUpXml(root, "version", "sku") - Assert.IsTrue(dirty) - Assert.IsTrue(root.ToString().Contains("")) + Assert.True(dirty) + Assert.True(root.ToString().Contains("")) - [] + [] member public this.``Multitargeting.AppConfigVersionExistsRemoveSku`` () = let root = XElement.Parse("") let dirty = LangConfigFile.PatchUpXml(root, "version", null) - Assert.IsTrue(dirty) - Assert.IsTrue(root.ToString().Contains("")) + Assert.True(dirty) + Assert.True(root.ToString().Contains("")) - [] + [] member public this.``Multitargeting.AppConfigVersionReplaceOldRuntime`` () = let root = XElement.Parse("") let dirty = LangConfigFile.PatchUpXml(root, "version", "sku") - Assert.IsTrue(dirty) - Assert.IsTrue(root.ToString().Contains("")) - Assert.IsFalse(root.ToString().Contains("")) + Assert.True(dirty) + Assert.True(root.ToString().Contains("")) + Assert.False(root.ToString().Contains("")) - [] + [] member public this.``Multitargeting.AppConfigVersionReplaceOldRuntimes`` () = let root = XElement.Parse("") let dirty = LangConfigFile.PatchUpXml(root, "version", "sku") - Assert.IsTrue(dirty) - Assert.IsTrue(root.ToString().Contains("")) - Assert.IsFalse(root.ToString().Contains("")) - Assert.IsFalse(root.ToString().Contains("")) + Assert.True(dirty) + Assert.True(root.ToString().Contains("")) + Assert.False(root.ToString().Contains("")) + Assert.False(root.ToString().Contains("")) - [] + [] member public this.``Multitargeting.TestFrameworkNameToVersionString`` () = let validatePair name str = let res = HierarchyNode.GetFrameworkVersionString(name) - Assert.AreEqual(str, res) + Assert.Equal(str, res) validatePair (new System.Runtime.Versioning.FrameworkName(".NETFramework", new System.Version(4,0))) "v4.0" validatePair (new System.Runtime.Versioning.FrameworkName(".NETFramework", new System.Version(4,0,5))) "v4.0.5" @@ -143,7 +142,7 @@ type MultiTargeting() = validatePair (new System.Runtime.Versioning.FrameworkName(".NETFramework", new System.Version(2,0,0,1))) "v2.0" (* - [] + [] member public this.``Multitargeting.AddAppConfigIfRetargetTo40Full`` () = DoWithTempFile "Test.fsproj" (fun projFile -> let sp, ccn = VsMocks.MakeMockServiceProviderAndConfigChangeNotifier20() @@ -157,10 +156,10 @@ type MultiTargeting() = project.FixupAppConfigOnTargetFXChange(fn.ToString(), "4.3.0.0", false) |> ignore let appFile = Path.Combine((Path.GetDirectoryName projFile), "app.config") let appText = System.IO.File.ReadAllText(appFile) - Assert.IsTrue(appText.Contains("")) - //Assert.IsTrue(appText.Contains("")) - //Assert.IsTrue(appText.Contains("")) - //Assert.IsTrue(appText.Contains("")) + Assert.True(appText.Contains("")) + //Assert.True(appText.Contains("")) + //Assert.True(appText.Contains("")) + //Assert.True(appText.Contains("")) () ) *) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs index ac6b083a0cb..993a3590e6c 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.Project.fs @@ -8,11 +8,12 @@ open System.Collections.Generic open System.IO open System.Text.RegularExpressions open System.Xml.Linq -open NUnit.Framework +open Xunit // VS namespaces open Microsoft.VisualStudio open Microsoft.VisualStudio.Shell.Interop +open Microsoft.VisualStudio.FSharp open Microsoft.VisualStudio.FSharp.ProjectSystem // Internal unittest namespaces @@ -22,10 +23,11 @@ open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem -[][] type Project() = inherit TheTests() + do + AssemblyResolver.addResolver () //TODO: look for a way to remove the helper functions static let ANYTREE = Tree("",Nil,Nil) @@ -34,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 +53,7 @@ type Project() = Assert.Fail("Unexpected: New Folder was not enabled") () - [] + [] member public this.``FsprojFileToSolutionExplorer.FileOrderInFsprojIsRespected.Case1``() = let compileItems = ["one.fs"; "two.fs"; "three.fs"] let expect = Tree("References", ANYTREE, @@ -63,7 +65,7 @@ type Project() = // "one" "three" "two" this.``FsprojFileToSolutionExplorer.PositiveTest``(compileItems, "", expect) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileOrderInFsprojIsRespected.Case2``() = let compileItems = [@"A\B\D\foo.fs"; @"A\B\C\bar.fs"] let expect = Tree("References", ANYTREE, @@ -79,7 +81,7 @@ type Project() = // no alphabetization of files or folders this.``FsprojFileToSolutionExplorer.PositiveTest``(compileItems, "", expect) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileOrderInFsprojIsRespected.Case3``() = let compileItems = [@"B\foo.fs"; @"A\bar.fs"] let other = @" @@ -99,7 +101,7 @@ type Project() = // Including folder should not put folder at front of other folders this.``FsprojFileToSolutionExplorer.PositiveTest``(compileItems, other, expect) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileOrderInFsprojIsRespected.Case4``() = let compileItems = [@"foo.fs"; @"A\bar.fs"] let other = @" @@ -119,7 +121,7 @@ type Project() = this.``FsprojFileToSolutionExplorer.PositiveTest``(compileItems, other, expect) - [] + [] member public this.``FsprojFileToSolutionExplorer.LinksIntoFoldersAreRespected``() = let compileItems = [] let other = @" @@ -144,7 +146,7 @@ type Project() = this.``FsprojFileToSolutionExplorer.PositiveTest``(compileItems, other, expect) - [] + [] member public this.``Links.AddLinkToRootWorks``() = let compileItems = [@"Folder\foo.fs"; @"bar.fs"; ] this.MakeProjectAndDoWithProjectFile(compileItems, [], "", (fun project fileName -> @@ -168,7 +170,7 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``Links.AddLinkToSubfolderWorks``() = let compileItems = [@"bar.fs"; @"Folder\foo.fs"; ] this.MakeProjectAndDoWithProjectFile(compileItems, [], "", (fun project fileName -> @@ -190,7 +192,7 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``Links.AddLinkToRootWorksForNonFsFile``() = let compileItems = [@"Folder\foo.fs"; @"bar.fs"; ] this.MakeProjectAndDoWithProjectFile(compileItems, [], "", (fun project fileName -> @@ -214,7 +216,7 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``Removal.ExcludeFileShouldDirtyProjectFileAndBeSeenOnDiskAfterSave``() = let items = MSBuildItems([CompileItem "foo.fs"; CompileItem "bar.fs"]) this.MakeProjectAndDoWithProjectFile([], [], items.ToString(), (fun project fileName -> @@ -235,7 +237,7 @@ type Project() = AssertEqualMsg false (fsprojFileText.Contains(toVerify)) "it was not removed from the .fsproj on disk" )) - [] + [] member public this.``Removal.RemoveReferenceShouldDirtyProjectFileAndBeSeenOnDiskAfterSave``() = let items = MSBuildItems([CompileItem "foo.fs"; CompileItem "bar.fs"]) this.MakeProjectAndDoWithProjectFile([], ["System"], items.ToString(), (fun project fileName -> @@ -256,7 +258,7 @@ type Project() = AssertEqualMsg false (fsprojFileText.Contains(toVerify)) "it was not removed from the .fsproj on disk" )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.MoveUpShouldDirtyProject``() = let items = MSBuildItems([CompileItem "foo.fs"; CompileItem "bar.fs"]) this.MakeProjectAndDoWithProjectFile([], [], items.ToString(), (fun project fileName -> @@ -273,7 +275,7 @@ type Project() = TheTests.AssertSameTree(expect, project.FirstChild) )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.MoveDownShouldDirtyProject``() = let items = MSBuildItems([CompileItem "foo.fs"; CompileItem "bar.fs"]) this.MakeProjectAndDoWithProjectFile([], [], items.ToString(), (fun project fileName -> @@ -299,7 +301,7 @@ type Project() = 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)) - [] + [] member public this.``SpecificVersion.OptionsSavedToFsprojFile``() = let items = MSBuildItems( [CompileItem "foo.fs"] ) this.MakeProjectAndDoWithProjectFile([], ["System"], items.ToString(), (fun project fileName -> @@ -314,12 +316,12 @@ type Project() = let expected = XDocument.Load(new StringReader(@"True")).Root TheTests.AssertSimilarXml(expected, e) let inc = e.Attributes() |> WithAttrName "Include" |> Seq.head - Assert.IsTrue(inc.Value.StartsWith("System, Version", StringComparison.Ordinal), "assembly reference lacks version")) + Assert.True(inc.Value.StartsWith("System, Version", StringComparison.Ordinal), "assembly reference lacks version")) 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.IsTrue(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 @@ -333,7 +335,7 @@ type Project() = f refNode )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileRenaming.RenamingAFileDoesNotChangeOrderInSolutionExplorerOrMSBuild``() = for entity, treeMaker in [this.SampleFileEntity; this.SampleEmptyFolderEntity] do let items = MSBuildItems( [CompileItem "foo.fs"] @ entity ) @@ -390,15 +392,15 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedUpAboveFile``() = this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedUpAbove``(this.SampleFileEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedUpAboveEmptyFolder``() = this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedUpAbove``(this.SampleEmptyFolderEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedUpAboveFolderWithItems``() = this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedUpAbove``(this.SampleFolderWithItemsEntity) @@ -431,15 +433,15 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedDownBelowFile``() = this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedDownBelow``(this.SampleFileEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedDownBelowEmptyFolder``() = this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedDownBelow``(this.SampleEmptyFolderEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedDownBelowFolderWithItems``() = this.``FsprojFileToSolutionExplorer.FileMovement.EntityCanBeMovedDownBelow``(this.SampleFolderWithItemsEntity) @@ -484,15 +486,15 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedUpAboveFile``() = this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedUpAbove``(this.SampleFileEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedUpAboveEmptyFolder``() = this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedUpAbove``(this.SampleEmptyFolderEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedUpAboveFolderWithItems``() = this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedUpAbove``(this.SampleFolderWithItemsEntity) @@ -537,19 +539,19 @@ type Project() = TheTests.HelpfulAssertMatches '<' regexStr fsprojFileText )) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedDownBelowFile``() = this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedDownBelow``(this.SampleFileEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedDownBelowEmptyFolder``() = this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedDownBelow``(this.SampleEmptyFolderEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedDownBelowFolderWithItems``() = this.``FsprojFileToSolutionExplorer.FileMovement.FolderWithItemsCanBeMovedDownBelow``(this.SampleFolderWithItemsEntity) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.NegativeTests.EntityCannotBeMovedAboveReferences``() = for entity in this.SampleEntities do printfn "=========> testing moving %s" (entity.ToString()) @@ -562,7 +564,7 @@ type Project() = let foo = TheTests.FindNodeWithCaption(project, entity.Caption()) TheTests.EnsureMoveUpDisabled(foo) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.NegativeTests.EntityCannotBeMovedUpWhenTopOfFolder``() = for entity in this.SampleEntities |> List.map (fun e -> e.IntoFolder(@"Folder\")) do printfn "=========> testing moving %s" (entity.ToString()) @@ -575,7 +577,7 @@ type Project() = let bar = TheTests.FindNodeWithCaption(project, entity.Caption()) TheTests.EnsureMoveUpDisabled(bar) - [] + [] member public this.``FsprojFileToSolutionExplorer.FileMovement.NegativeTests.EntityCannotBeMovedDownWhenBottomOfFolder``() = for entity in this.SampleEntities |> List.map (fun e -> e.IntoFolder(@"Folder\")) do printfn "=========> testing moving %s" (entity.ToString()) @@ -588,7 +590,7 @@ type Project() = let bar = TheTests.FindNodeWithCaption(project, entity.Caption()) TheTests.EnsureMoveDownDisabled(bar) - [] + [] member public this.``RenameFile.FailureToRenameInRDT.Bug616680.EnsureRevertToKnownConsistentState``() = this.MakeProjectAndDo(["orig1.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "orig1.fs") @@ -615,7 +617,7 @@ type Project() = File.Delete(absFilePath) )) - [] + [] member public this.``RenameFile.FailureToRenameInRDT.Bug616680.EnsureThatFileOrderDidNotChange``() = this.MakeProjectAndDo(["a.fs";"b.fs";"orig1.fs";"c.fs";"d.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "orig1.fs") @@ -646,7 +648,7 @@ type Project() = File.Delete(absFilePath) )) - [] + [] member public this.``RenameFile.VerifyItemIdsRemainsTheSame``() = let name1 = "orig.fs" let name2 = "orig2.fs" @@ -668,7 +670,7 @@ type Project() = File.Delete(absFilePath) )) - [] + [] member public this.``RenameFile.MainlineSuccessCase``() = this.MakeProjectAndDo(["orig1.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "orig1.fs") @@ -694,7 +696,7 @@ type Project() = File.Delete(absFilePath) )) - [] //ref bug https://github.com/dotnet/fsharp/issues/259 + [] //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 -> let absFilePath = Path.Combine(project.ProjectFolder, "Folder1", "nested1.fs") @@ -757,7 +759,7 @@ type Project() = (* Disabled for now - see https://github.com/dotnet/fsharp/pull/3071 - this is testing old project system features - [] + [] member public this.``RenameFile.BuildActionIsResetBasedOnFilenameExtension``() = let GetTextFromBuildAction (action:VSLangProj.prjBuildAction) = match action with @@ -832,8 +834,7 @@ type Project() = *) - [] - [] + [] member public this.``FsprojOutputWindow.ErrorOriginColumnsAreBase1``() = let (outputWindowPaneErrors : string list ref) = ref [] // output window pane errors let vso = VsMocks.vsOutputWindowPane(outputWindowPaneErrors) @@ -856,8 +857,7 @@ type Project() = AssertEqual (List.length errors) 1 ) - [] - [] + [] member public this.``FsprojOutputWindow.HighUnicodeCharactersAreProperlyDisplayed``() = let (outputWindowPaneErrors : string list ref) = ref [] // output window pane errors let vso = VsMocks.vsOutputWindowPane(outputWindowPaneErrors) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.ProjectItems.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.ProjectItems.fs index 3e1e26c8f22..26c25a7edf6 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.ProjectItems.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.ProjectItems.fs @@ -4,20 +4,19 @@ namespace Tests.ProjectSystem open System open System.IO -open NUnit.Framework +open Xunit open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.ProjectSystem open Microsoft.VisualStudio.FSharp.ProjectSystem -[][] type ProjectItems() = inherit TheTests() //TODO: look for a way to remove the helper functions static let ANYTREE = Tree("",Nil,Nil) - [] + [] member public this.``RemoveAssemblyReference.NoIVsTrackProjectDocuments2Events``() = this.MakeProjectAndDo(["file.fs"], ["System.Numerics"],"", (fun project -> let listener = project.Site.GetService(typeof) :?> Salsa.VsMocks.IVsTrackProjectDocuments2Listener @@ -28,7 +27,7 @@ type ProjectItems() = |> Array.exists (fun f -> f.IndexOf("System.Numerics") <> -1) let mutable wasCalled = false - Assert.IsTrue(containsSystemNumerics (), "Project should contains reference to System.Numerics") + Assert.True(containsSystemNumerics (), "Project should contains reference to System.Numerics") let refContainer = project.GetReferenceContainer() let reference = @@ -39,11 +38,11 @@ type ProjectItems() = reference.Remove(false) ) - Assert.IsFalse(wasCalled, "No events from IVsTrackProjectDocuments2 are expected") - Assert.IsFalse(containsSystemNumerics(), "Project should not contains reference to System.Numerics") + Assert.False(wasCalled, "No events from IVsTrackProjectDocuments2 are expected") + Assert.False(containsSystemNumerics(), "Project should not contains reference to System.Numerics") )) - [] + [] member public this.``AddNewItem.ItemAppearsAtBottomOfFsprojFile``() = this.MakeProjectAndDo(["orig.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "a.fs") @@ -58,7 +57,7 @@ type ProjectItems() = File.Delete(absFilePath) )) - [] + [] member public this.``AddNewItem.ToAFolder.ItemAppearsAtBottomOfFolder``() = this.MakeProjectAndDo(["orig.fs"; "Folder\\f1.fs"; "Folder\\f2.fs"; "final.fs"], [], "", (fun project -> let dir = Path.Combine(project.ProjectFolder, "Folder") @@ -75,7 +74,7 @@ type ProjectItems() = File.Delete(absFilePath) )) - [] + [] member public this.``AddNewItemBelow.ItemAppearsInRightSpot``() = this.MakeProjectAndDo(["orig1.fs"; "orig2.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "new.fs") @@ -98,7 +97,7 @@ type ProjectItems() = File.Delete(absFilePath) )) - [] + [] member public this.``AddNewItemAbove.ItemAppearsInRightSpot.Case1``() = this.MakeProjectAndDo(["orig1.fs"; "orig2.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "new.fs") @@ -121,7 +120,7 @@ type ProjectItems() = File.Delete(absFilePath) )) - [] + [] member public this.``AddNewItemAbove.ItemAppearsInRightSpot.Case2``() = this.MakeProjectAndDo(["orig1.fs"; "orig2.fs"], [], "", (fun project -> let absFilePath = Path.Combine(project.ProjectFolder, "new.fs") diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs index f64efebaefe..5d9e702cfe9 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.References.fs @@ -7,7 +7,7 @@ open System.Collections.Generic open System.IO open System.Reflection -open NUnit.Framework +open Xunit open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem @@ -16,7 +16,6 @@ open Microsoft.VisualStudio.FSharp.ProjectSystem open Microsoft.VisualStudio.Shell.Interop open System.Xml.Linq -[][] type References() = inherit TheTests() @@ -41,25 +40,25 @@ type References() = let fooPath = Path.Combine(project.ProjectFolder, "foo.fs") File.AppendAllText(fooPath, "namespace Foo\nmodule Bar =\n let x = 42") let buildResult = project.Build("Build") - Assert.IsTrue buildResult.IsSuccessful + Assert.True buildResult.IsSuccessful let exe = Path.Combine(project.ProjectFolder, "bin\\Debug\\Test.exe") k exe)) - [] + [] member this.``BasicAssemblyReferences1``() = this.MakeProjectAndDo([], ["System"], "", (fun proj -> let systemRef = proj.FirstChild.FirstChild :?> AssemblyReferenceNode - Assert.IsTrue(systemRef.CanShowDefaultIcon()) + Assert.True(systemRef.CanShowDefaultIcon()) )) - [] + [] member this.``BasicAssemblyReferences2``() = this.MakeProjectAndDo([], ["System.Net"], "", (fun proj -> let systemRef = proj.FirstChild.FirstChild :?> AssemblyReferenceNode - Assert.IsTrue(systemRef.CanShowDefaultIcon()) + Assert.True(systemRef.CanShowDefaultIcon()) )) - [] + [] member this.``AddReference.StarredAssemblyName`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) @@ -67,11 +66,11 @@ type References() = let assemblyName = new AssemblyName(typeof.Assembly.FullName) let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_ComPlus, bstrFile = "*" + assemblyName.FullName) let refContainer = GetReferenceContainerNode(project) - refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.IsNotNull + refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.NotNull let l = new List() project.FindNodesOfType(l) - Assert.AreEqual(1, l.Count) - Assert.AreEqual("System.Windows.Forms", l.[0].Caption) + Assert.Equal(1, l.Count) + Assert.Equal("System.Windows.Forms", l.[0].Caption) SaveProject(project) let fsprojFileText = File.ReadAllText(project.FileName) printfn "%s" fsprojFileText @@ -79,34 +78,32 @@ type References() = TheTests.HelpfulAssertMatches '<' expectedFsprojRegex fsprojFileText ) - [] - [] + [] member this.``References.Bug787899.AddDuplicateUnresolved``() = // Let's create a run-of-the-mill project just to have a spare assembly around this.CreateDummyTestProjectBuildItAndDo(fun exe -> - Assert.IsTrue(File.Exists exe, "failed to build exe") + Assert.True(File.Exists exe, "failed to build exe") 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.IsFalse(assemRef.CanShowDefaultIcon(), "reference should be banged out, does not resolve") + Assert.False(assemRef.CanShowDefaultIcon(), "reference should be banged out, does not resolve") // add reference to Test.exe let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_File, bstrFile = exe) let refContainer = GetReferenceContainerNode(project) - refContainer.AddReferenceFromSelectorData(selectorData) |> (fun x -> Assert.IsNotNull(x, "expected AddReference to succeed")) + refContainer.AddReferenceFromSelectorData(selectorData) |> (fun x -> Assert.NotNull(x)) // it should have succeeded (no throw) )) ) - [] - [] + [] member this.``References.Bug787899.AddDuplicateResolved``() = // Let's create a run-of-the-mill project just to have a spare assembly around this.CreateDummyTestProjectBuildItAndDo(fun exe -> - Assert.IsTrue(File.Exists exe, "failed to build exe") + Assert.True(File.Exists exe, "failed to build exe") 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.IsTrue(assemRef.CanShowDefaultIcon(), "reference should not be banged out, does resolve") + Assert.True(assemRef.CanShowDefaultIcon(), "reference should not be banged out, does resolve") // add reference to Test.exe let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_File, bstrFile = exe) let refContainer = GetReferenceContainerNode(project) @@ -114,11 +111,11 @@ type References() = refContainer.AddReferenceFromSelectorData(selectorData) |> ignore Assert.Fail("expected AddReference to Fail") with :? InvalidOperationException as e -> - Assert.AreEqual("A reference to 'Test' (with assembly name 'Test') could not be added. A reference to the component 'Test' with the same assembly name already exists in the project.", e.Message) + Assert.Equal("A reference to 'Test' (with assembly name 'Test') could not be added. A reference to the component 'Test' with the same assembly name already exists in the project.", e.Message) )) ) - [] + [] member this.``ReferenceResolution.Bug4423.LoadedFsProj.Works``() = this.MakeProjectAndDo(["doesNotMatter.fs"], ["mscorlib"; "System"; "System.Core"; "System.Net"], "", "v4.0", (fun project -> let expectedRefInfo = [ "mscorlib", true @@ -136,7 +133,7 @@ type References() = )) - [] + [] member this.``ReferenceResolution.Bug4423.LoadedFsProj.WithExactDuplicates``() = this.MakeProjectAndDo(["doesNotMatter.fs"], ["System"; "System"], "", "v4.0", (fun project -> let expectedRefInfo = [ "System", true // In C#, one will be banged out, whereas @@ -151,7 +148,7 @@ type References() = AssertEqual expectedRefInfo actualRefInfo )) - [] + [] member this.``ReferenceResolution.Bug4423.LoadedFsProj.WithBadDuplicates``() = this.MakeProjectAndDo(["doesNotMatter.fs"], ["System"; "System.dll"], "", "v4.0", (fun project -> let expectedRefInfo = [ "System", false // one will be banged out @@ -166,7 +163,7 @@ type References() = AssertEqual expectedRefInfo actualRefInfo )) - [] + [] member this.``ReferenceResolution.Bug4423.LoadedFsProj.WorksWithFilenames``() = let netDir = currentFrameworkDirectory let ssmw = Path.Combine(netDir, "System.ServiceModel.Web.dll") @@ -182,7 +179,7 @@ type References() = AssertEqual expectedRefInfo actualRefInfo )) - [] + [] member this.``ReferenceResolution.Bug4423.LoadedFsProj.WeirdCases``() = this.MakeProjectAndDo(["doesNotMatter.fs"], ["mscorlib, Version=4.0.0.0"; "System, Version=4.0.0.0"; "System.Core, Version=4.0.0.0"; "System.Net, Version=4.0.0.0"], "", "v4.0", (fun project -> let expectedRefInfo = [ "mscorlib", true @@ -212,14 +209,14 @@ type References() = | _ -> failwith "unexpected" let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = cType, bstrFile = fullPath) let refContainer = GetReferenceContainerNode(project) - refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.IsNotNull + refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.NotNull SaveProject(project) let fsprojFileText = File.ReadAllText(project.FileName) printfn "%s" fsprojFileText TheTests.HelpfulAssertMatches '<' expectedFsprojRegex fsprojFileText )) - [] + [] member this.``ReferenceResolution.Bug4423.FxAssembly.NetTab.AddDuplicate1``() = let netDir = currentFrameworkDirectory try @@ -232,7 +229,7 @@ type References() = 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 [] +// see 5491 [] member this.``ReferenceResolution.Bug4423.FxAssembly.NetTab.AddDuplicate2``() = let netDir = currentFrameworkDirectory try @@ -245,12 +242,11 @@ type References() = with e -> TheTests.HelpfulAssertMatches ' ' "A reference to '.*' could not be added. A reference to the component '.*' already exists in the project." e.Message - [] - [] + [] member this.``ReferenceResolution.Bug4423.NonFxAssembly.BrowseTab.RelativeHintPath.InsideProjectDir``() = // Let's create a run-of-the-mill project just to have a spare assembly around this.CreateDummyTestProjectBuildItAndDo(fun exe -> - Assert.IsTrue(File.Exists exe, "failed to build exe") + Assert.True(File.Exists exe, "failed to build exe") // Now let's create an assembly reference to it and ensure we get expected relative HintPath let expectedFsprojRegex = @"" + @"\s*Test.exe" // in this directory @@ -258,10 +254,10 @@ type References() = this.MakeProjectAndDo(["bar.fs"], [], "", "v4.5", (fun project -> let exeCopy = Path.Combine(project.ProjectFolder, "Test.exe") File.Copy(exe, exeCopy, true) - Assert.IsTrue(File.Exists exeCopy, "failed to build exe") + Assert.True(File.Exists exeCopy, "failed to build exe") let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_File, bstrFile = exeCopy) let refContainer = GetReferenceContainerNode(project) - refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.IsNotNull + refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.NotNull SaveProject(project) let fsprojFileText = File.ReadAllText(project.FileName) printfn "%s" fsprojFileText @@ -269,26 +265,25 @@ type References() = // Finally, ensure that the reference works as expected project.Reload() let assemRef = TheTests.FindNodeWithCaption(project, "Test") :?> AssemblyReferenceNode - Assert.IsTrue(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 let buildResult = project.Build("Build") - Assert.IsTrue buildResult.IsSuccessful + Assert.True buildResult.IsSuccessful )) ) - [] - [] + [] member this.``ReferenceResolution.Bug4423.NonFxAssembly.BrowseTab.RelativeHintPath.OutsideProjectDir``() = this.MakeProjectAndDo(["foo.fs"], [], "", (fun project -> // 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") - Assert.IsTrue buildResult.IsSuccessful + Assert.True buildResult.IsSuccessful let exe = Path.Combine(project.ProjectFolder, "bin\\Debug\\Test.exe") - Assert.IsTrue(File.Exists exe, "failed to build exe") + Assert.True(File.Exists exe, "failed to build exe") // Now let's create an assembly reference to it and ensure we get expected relative HintPath let expectedFsprojRegex = @"" + @"\s*\.\.\\.*?" // the point is, some path start with "..\", since both projects are rooted somewhere in the temp directory (where unit tests create them) @@ -296,7 +291,7 @@ type References() = this.MakeProjectAndDo(["bar.fs"], [], "", "v4.5", (fun project -> let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_File, bstrFile = exe) let refContainer = GetReferenceContainerNode(project) - refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.IsNotNull + refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.NotNull SaveProject(project) let fsprojFileText = File.ReadAllText(project.FileName) printfn "%s" fsprojFileText @@ -304,16 +299,16 @@ type References() = // Finally, ensure that the reference works as expected project.Reload() let assemRef = TheTests.FindNodeWithCaption(project, "Test") :?> AssemblyReferenceNode - Assert.IsTrue(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 let buildResult = project.Build("Build") - Assert.IsTrue buildResult.IsSuccessful + Assert.True buildResult.IsSuccessful )) )) - [] + [] member this.``ReferenceResolution.Bug4423.NotAValidDll.BrowseTab``() = let dirName = Path.GetTempPath() let dll = Path.Combine(dirName, "Foo.dll") @@ -323,7 +318,7 @@ type References() = let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_File, bstrFile = dll) let refContainer = GetReferenceContainerNode(project) try - refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.IsNotNull + refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.NotNull Assert.Fail("this should not have succeeded") with e -> AssertContains e.Message "could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component." @@ -331,14 +326,14 @@ type References() = finally File.Delete(dll) - [] + [] member this.``PathReferences.Existing`` () = DoWithTempFile "Test.fsproj"(fun projFile -> let dirName = Path.GetDirectoryName(projFile) let libDirName = Directory.CreateDirectory(Path.Combine(dirName, "lib")).FullName let codeBase = (new Uri(Assembly.GetExecutingAssembly().EscapedCodeBase)).LocalPath |> Path.GetDirectoryName - let refLibPath = Path.Combine(libDirName, "nunit.framework.dll") - File.Copy(Path.Combine(codeBase, "nunit.framework.dll"), refLibPath) + let refLibPath = Path.Combine(libDirName, "xunit.core.dll") + File.Copy(Path.Combine(codeBase, "xunit.core.dll"), refLibPath) File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [refLibPath], "")) use project = TheTests.CreateProject(projFile) let l = new List() @@ -346,14 +341,14 @@ type References() = AssertEqual 1 l.Count AssertEqual refLibPath l.[0].Url AssertEqual refLibPath l.[0].Caption // when Include is a filename, entirety is caption - Assert.IsNotNull(l.[0].ResolvedAssembly) + Assert.NotNull(l.[0].ResolvedAssembly) let refContainer = let l = new List() project.FindNodesOfType(l) l.[0] let mscorlibPath = (new Uri("".GetType().Assembly.EscapedCodeBase)).LocalPath let selectorData = new VSCOMPONENTSELECTORDATA(``type`` = VSCOMPONENTTYPE.VSCOMPONENTTYPE_ComPlus, bstrFile = mscorlibPath) - refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.IsNotNull + refContainer.AddReferenceFromSelectorData(selectorData) |> Assert.NotNull let l = new List() project.FindNodesOfType(l) AssertEqual 2 l.Count @@ -362,7 +357,7 @@ type References() = AssertEqual "mscorlib" l.[1].Caption ) - [] + [] member this.``PathReferences.Existing.Captions`` () = DoWithTempFile "Test.fsproj"(fun projFile -> File.AppendAllText(projFile, TheTests.FsprojTextWithProjectReferences( @@ -375,12 +370,12 @@ type References() = project.FindNodesOfType(l) AssertEqual 2 l.Count AssertEqual "System.dll" l.[0].Caption - Assert.IsNotNull(l.[0].ResolvedAssembly) + Assert.NotNull(l.[0].ResolvedAssembly) AssertEqual "System.Net.dll" l.[1].Caption - Assert.IsNotNull(l.[1].ResolvedAssembly) + Assert.NotNull(l.[1].ResolvedAssembly) ) - [] + [] member this.``PathReferences.NonExistent`` () = DoWithTempFile "Test.fsproj"(fun projFile -> let refLibPath = @"c:\foo\baz\blahblah.dll" @@ -390,11 +385,11 @@ type References() = project.FindNodesOfType(l) AssertEqual 1 l.Count AssertEqual refLibPath l.[0].Caption - Assert.IsNull(l.[0].ResolvedAssembly) + Assert.Null(l.[0].ResolvedAssembly) ) - [] + [] member this.``FsprojPreferencePage.ProjSupportsPrefReadWrite``() = let testProp = "AssemblyName" let compileItem = [@"foo.fs"] @@ -431,7 +426,7 @@ type References() = // Disabled due to: https://github.com/dotnet/fsharp/issues/1460 // 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 + // [] // Disabled due to: https://github.com/dotnet/fsharp/issues/1460 member this.``AddReference.COM`` () = DoWithTempFile "Test.fsproj" (fun projFile -> File.AppendAllText(projFile, TheTests.SimpleFsprojText([], [], "")) @@ -450,23 +445,23 @@ type References() = let comReference = refContainer.AddReferenceFromSelectorData(selectorData) // check reference node properties - Assert.IsNotNull comReference - Assert.IsTrue(comReference :? ComReferenceNode) + Assert.NotNull comReference + Assert.True(comReference :? ComReferenceNode) let comRef = comReference :?> ComReferenceNode - Assert.AreEqual(1, comRef.MajorVersionNumber) - Assert.AreEqual(0, comRef.MinorVersionNumber) - Assert.AreEqual(guid, comRef.TypeGuid) - Assert.AreEqual("Microsoft Shell Controls And Automation", comRef.Caption) + Assert.Equal(1, comRef.MajorVersionNumber) + Assert.Equal(0, comRef.MinorVersionNumber) + Assert.Equal(guid, comRef.TypeGuid) + Assert.Equal("Microsoft Shell Controls And Automation", comRef.Caption) let sysDirectory = Environment.GetFolderPath(Environment.SpecialFolder.SystemX86) - Assert.IsTrue(String.Compare(Path.Combine(sysDirectory, "shell32.dll"), comRef.InstalledFilePath, StringComparison.OrdinalIgnoreCase) = 0) + Assert.True(String.Compare(Path.Combine(sysDirectory, "shell32.dll"), comRef.InstalledFilePath, StringComparison.OrdinalIgnoreCase) = 0) // check node exists under references let l = new List() project.FindNodesOfType(l) - Assert.AreEqual(1, l.Count) + Assert.Equal(1, l.Count) let referenceNode = l.[0] - Assert.AreSame(comRef, referenceNode) + Assert.Same(comRef, referenceNode) // check saved msbuild item SaveProject(project) @@ -475,13 +470,13 @@ type References() = let xn s = fsproj.Root.GetDefaultNamespace().GetName(s) let comReferencesXml = fsproj.Descendants(xn "COMReference") |> Seq.toList - Assert.AreEqual(1, comReferencesXml |> List.length) + Assert.Equal(1, comReferencesXml |> List.length) let comRefXml = comReferencesXml |> List.head - Assert.AreEqual("Microsoft Shell Controls And Automation", comRefXml.Attribute(XName.Get("Include")).Value) - Assert.AreEqual(guid, Guid(comRefXml.Element(xn "Guid").Value)) - Assert.AreEqual("1", comRefXml.Element(xn "VersionMajor").Value) - Assert.AreEqual("0", comRefXml.Element(xn "VersionMinor").Value) - Assert.AreEqual("0", comRefXml.Element(xn "Lcid").Value) + Assert.Equal("Microsoft Shell Controls And Automation", comRefXml.Attribute(XName.Get("Include")).Value) + Assert.Equal(guid, Guid(comRefXml.Element(xn "Guid").Value)) + Assert.Equal("1", comRefXml.Element(xn "VersionMajor").Value) + Assert.Equal("0", comRefXml.Element(xn "VersionMinor").Value) + Assert.Equal("0", comRefXml.Element(xn "Lcid").Value) ) diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs index 1aad389737d..56aaf84d713 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.RoundTrip.fs @@ -5,14 +5,13 @@ namespace Tests.ProjectSystem open System open System.IO open System.Text.RegularExpressions -open NUnit.Framework +open Xunit open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem open Microsoft.VisualStudio.FSharp.ProjectSystem -[][] type RoundTrip() = inherit TheTests() @@ -43,7 +42,7 @@ type RoundTrip() = Assert.Fail("did not remove empty ItemGroups") )) - [] + [] member public this.``FsprojRoundTrip.Basic.NonemptyFoldersRemoved.Case1``() = this.``FsprojRoundtrip.PositiveTest``( MSBuildItems [CompileItem @"bar.fs" @@ -52,7 +51,7 @@ type RoundTrip() = MSBuildItems [CompileItem @"bar.fs" CompileItem @"Folder\foo.fs"]) - [] + [] member public this.``FsprojRoundTrip.Basic.NonemptyFoldersRemoved.Case2``() = this.``FsprojRoundtrip.PositiveTest``( MSBuildItems [CompileItem @"bar.fs" @@ -65,7 +64,7 @@ type RoundTrip() = CompileItem @"A\B\C\foo.fs" CompileItem @"A\qux.fs"]) - [] + [] member public this.``FsprojRoundTrip.ComplexButLegalCase``() = let items = MSBuildItems [CompileItem @"A\B\foo.fs" CompileItem @"A\bar.fs" @@ -76,7 +75,7 @@ type RoundTrip() = ] this.``FsprojRoundtrip.PositiveTest``(items, items) - [] + [] member public this.``FsprojRoundTrip.EmptyFoldersArePreservedWhenRestIsIdempotent``() = let items = MSBuildItems [CompileItem @"bar.fs" FolderItem @"A\Empty1\" @@ -85,7 +84,7 @@ type RoundTrip() = CompileItem @"A\qux.fs"] this.``FsprojRoundtrip.PositiveTest``(items, items) - [] + [] member public this.``FsprojRoundTrip.EmptyFoldersArePreservedWhenRestIsLegalButNotIdempotent``() = let origItems = [CompileItem @"bar.fs" FolderItem @"A\Empty1\" @@ -100,13 +99,13 @@ type RoundTrip() = CompileItem @"A\qux.fs"] this.``FsprojRoundtrip.PositiveTest``(MSBuildItems origItems, MSBuildItems expectedItems) - [] + [] member public this.``FsprojRoundTrip.Regression.FoldersWithSameName``() = let items = MSBuildItems [CompileItem @"First\Second\bar.fs" CompileItem @"Second\qux.fs"] this.``FsprojRoundtrip.PositiveTest``(items, items) - [] + [] member public this.``FsprojRoundTrip.Regression.FoldersWithSameName2``() = let items = MSBuildItems [CompileItem @"First\First\bar.fs"] this.``FsprojRoundtrip.PositiveTest``(items, items) @@ -128,21 +127,21 @@ type RoundTrip() = () ) - [] + [] member public this.``FsprojRoundTrip.Basic.Invalid.Case1``() = let items = MSBuildItems [CompileItem @"A\B\C\foo.fs" CompileItem @"B\bar.fs" CompileItem @"A\B\D\qux.fs"] // would cause A to be rendered twice this.``Fsproj.NegativeTest`` items - [] + [] member public this.``FsprojRoundTrip.Basic.Invalid.Case2``() = let items = MSBuildItems [CompileItem @"A\foo.fs" CompileItem @"bar.fs" CompileItem @"A\qux.fs"] // would cause A to be rendered twice this.``Fsproj.NegativeTest`` items - // REVIEW NYI: [] + // REVIEW NYI: [] member public this.``FsprojRoundTrip.Basic.Invalid.Case3``() = let items = MSBuildItems [CompileItem @"A\foo.fs" FolderItem @"A\" // must be before anything below it diff --git a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs index d21681de617..b63ec3eed8e 100644 --- a/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs +++ b/vsintegration/tests/UnitTests/LegacyProjectSystem/Tests.ProjectSystem.UpToDate.fs @@ -18,21 +18,16 @@ open Microsoft.VisualStudio.FSharp open Microsoft.VisualStudio.FSharp.ProjectSystem // Internal unittest namespaces -open NUnit.Framework +open Xunit open Salsa open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers open UnitTests.TestLib.ProjectSystem -[][] type UpToDate() = inherit TheTests() - [] - member public _.Init () = AssemblyResolver.addResolver () - - [] - [] + [] member public this.ItemInputs () = this.MakeProjectAndDo(["file1.fs"], [], @" @@ -64,36 +59,35 @@ type UpToDate() = File.AppendAllText(nonePath, "none") File.AppendAllText(embedPath, "some embedded resource") - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) project.Build(configNameDebug, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) // None items should not affect up-to-date (unless captured by well-known items, e.g. App.config) File.SetLastWriteTime(nonePath, DateTime.UtcNow.AddMinutes(5.)) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) for path in [sourcePath; contentPath; resourcePath; embedPath; configPath] do printfn "Testing path %s" path // touch file File.SetLastWriteTime(path, DateTime.UtcNow.AddMinutes(5.)) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.SetLastWriteTime(path, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) // delete file let originalContent = File.ReadAllText(path) File.Delete(path) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.AppendAllText(path, originalContent) File.SetLastWriteTime(path, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) )) - [] - [] + [] member public this.PropertyInputs () = this.MakeProjectAndDo(["file1.fs"], [], @" @@ -117,32 +111,31 @@ type UpToDate() = File.AppendAllText(keyPath, "a key") project.SetConfiguration(config.ConfigCanonicalName); - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) project.Build(configNameDebug, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) for path in [verPath; keyPath] do printfn "Testing path %s" path // touch file File.SetLastWriteTime(path, DateTime.UtcNow.AddMinutes(5.)) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.SetLastWriteTime(path, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) // delete file let originalContent = File.ReadAllText(path) File.Delete(path) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.AppendAllText(path, originalContent) File.SetLastWriteTime(path, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) )) - [] - [] + [] member public this.ProjectFile () = this.MakeProjectAndDoWithProjectFile(["file1.fs"], [], "", (fun project projFileName -> let configNameDebug = ConfigCanonicalName("Debug", "x86") @@ -153,20 +146,19 @@ type UpToDate() = let startTime = DateTime.UtcNow File.AppendAllText(absFilePath, "printfn \"hello\"") - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) project.Build(configNameDebug, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) // touch proj file File.SetLastWriteTime(projFileName, DateTime.UtcNow.AddMinutes(5.)) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.SetLastWriteTime(projFileName, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) )) - [] - [] + [] member public this.References () = let configNameDebug = ConfigCanonicalName("Debug", "x86") let output = VsMocks.vsOutputWindowPane(ref []) @@ -185,9 +177,9 @@ type UpToDate() = let config1 = project1.ConfigProvider.GetProjectConfiguration(configNameDebug) - Assert.IsFalse(config1.IsUpToDate(logger, true)) + Assert.False(config1.IsUpToDate(logger, true)) project1.Build(configNameDebug, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(config1.IsUpToDate(logger, true)) + Assert.True(config1.IsUpToDate(logger, true)) let output1 = Path.Combine(project1.ProjectFolder, "bin\\debug", project1.OutputFileName) @@ -204,24 +196,23 @@ type UpToDate() = let config2 = project2.ConfigProvider.GetProjectConfiguration(configNameDebug) let startTime = DateTime.UtcNow - Assert.IsFalse(config2.IsUpToDate(logger, true)) + Assert.False(config2.IsUpToDate(logger, true)) project2.Build(configNameDebug, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(config2.IsUpToDate(logger, true)) + Assert.True(config2.IsUpToDate(logger, true)) // reference is updated File.SetLastWriteTime(output1, DateTime.UtcNow.AddMinutes(5.)) - Assert.IsFalse(config2.IsUpToDate(logger, true)) + Assert.False(config2.IsUpToDate(logger, true)) File.SetLastWriteTime(output1, startTime) - Assert.IsTrue(config2.IsUpToDate(logger, true)) + Assert.True(config2.IsUpToDate(logger, true)) // reference is missing File.Delete(output1) - Assert.IsFalse(config2.IsUpToDate(logger, true)) + Assert.False(config2.IsUpToDate(logger, true)) ) ) - [] - [] + [] member public this.OutputFiles () = this.MakeProjectAndDo(["file1.fs"], [], @" @@ -249,9 +240,9 @@ type UpToDate() = File.AppendAllText(sourcePath, "printfn \"hello\"") File.AppendAllText(appConfigPath, """""") - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) project.Build(configNameDebug, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) let startTime = DateTime.UtcNow @@ -260,23 +251,22 @@ type UpToDate() = // touch file File.SetLastWriteTime(path, DateTime.UtcNow.AddMinutes(-5.)) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.SetLastWriteTime(path, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) // delete file let originalContent = File.ReadAllBytes(path) File.Delete(path) - Assert.IsFalse(config.IsUpToDate(logger, true)) + Assert.False(config.IsUpToDate(logger, true)) File.WriteAllBytes(path, originalContent) File.SetLastWriteTime(path, startTime) - Assert.IsTrue(config.IsUpToDate(logger, true)) + Assert.True(config.IsUpToDate(logger, true)) )) - [] - [] + [] member public this.ConfigChanges () = this.MakeProjectAndDo(["file1.fs"], [], "", (fun project -> let configNameDebugx86 = ConfigCanonicalName("Debug", "x86") @@ -295,37 +285,37 @@ type UpToDate() = let sourcePath = Path.Combine(project.ProjectFolder, "file1.fs") File.AppendAllText(sourcePath, "printfn \"hello\"") - Assert.IsFalse(debugConfigx86.IsUpToDate(logger, true)) - Assert.IsFalse(releaseConfigx86.IsUpToDate(logger, true)) - Assert.IsFalse(debugConfigAnyCPU.IsUpToDate(logger, true)) - Assert.IsFalse(releaseConfigAnyCPU.IsUpToDate(logger, true)) + Assert.False(debugConfigx86.IsUpToDate(logger, true)) + Assert.False(releaseConfigx86.IsUpToDate(logger, true)) + Assert.False(debugConfigAnyCPU.IsUpToDate(logger, true)) + Assert.False(releaseConfigAnyCPU.IsUpToDate(logger, true)) project.Build(configNameDebugx86, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(debugConfigx86.IsUpToDate(logger, true)) - Assert.IsFalse(releaseConfigx86.IsUpToDate(logger, true)) - Assert.IsFalse(debugConfigAnyCPU.IsUpToDate(logger, true)) - Assert.IsFalse(releaseConfigAnyCPU.IsUpToDate(logger, true)) + Assert.True(debugConfigx86.IsUpToDate(logger, true)) + Assert.False(releaseConfigx86.IsUpToDate(logger, true)) + Assert.False(debugConfigAnyCPU.IsUpToDate(logger, true)) + Assert.False(releaseConfigAnyCPU.IsUpToDate(logger, true)) project.Build(configNameReleasex86, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(debugConfigx86.IsUpToDate(logger, true)) - Assert.IsTrue(releaseConfigx86.IsUpToDate(logger, true)) - Assert.IsFalse(debugConfigAnyCPU.IsUpToDate(logger, true)) - Assert.IsFalse(releaseConfigAnyCPU.IsUpToDate(logger, true)) + Assert.True(debugConfigx86.IsUpToDate(logger, true)) + Assert.True(releaseConfigx86.IsUpToDate(logger, true)) + Assert.False(debugConfigAnyCPU.IsUpToDate(logger, true)) + Assert.False(releaseConfigAnyCPU.IsUpToDate(logger, true)) project.Build(configNameDebugAnyCPU, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(debugConfigx86.IsUpToDate(logger, true)) - Assert.IsTrue(releaseConfigx86.IsUpToDate(logger, true)) - Assert.IsTrue(debugConfigAnyCPU.IsUpToDate(logger, true)) - Assert.IsFalse(releaseConfigAnyCPU.IsUpToDate(logger, true)) + Assert.True(debugConfigx86.IsUpToDate(logger, true)) + Assert.True(releaseConfigx86.IsUpToDate(logger, true)) + Assert.True(debugConfigAnyCPU.IsUpToDate(logger, true)) + Assert.False(releaseConfigAnyCPU.IsUpToDate(logger, true)) project.Build(configNameReleaseAnyCPU, output, "Build", null) |> AssertBuildSuccessful - Assert.IsTrue(debugConfigx86.IsUpToDate(logger, true)) - Assert.IsTrue(releaseConfigx86.IsUpToDate(logger, true)) - Assert.IsTrue(debugConfigAnyCPU.IsUpToDate(logger, true)) - Assert.IsTrue(releaseConfigAnyCPU.IsUpToDate(logger, true)) + Assert.True(debugConfigx86.IsUpToDate(logger, true)) + Assert.True(releaseConfigx86.IsUpToDate(logger, true)) + Assert.True(debugConfigAnyCPU.IsUpToDate(logger, true)) + Assert.True(releaseConfigAnyCPU.IsUpToDate(logger, true)) )) - [] + [] member public this.UTDCheckEnabled () = this.MakeProjectAndDo(["file1.fs"], [], @" @@ -335,10 +325,10 @@ type UpToDate() = let configNameDebug = ConfigCanonicalName("Debug", "x86") let config = project.ConfigProvider.GetProjectConfiguration(configNameDebug) - Assert.IsFalse(config.IsFastUpToDateCheckEnabled()) + Assert.False(config.IsFastUpToDateCheckEnabled()) )) - [] + [] member public this.UTDOptionsFlags () = this.MakeProjectAndDo(["file1.fs"], [], "", (fun project -> let configNameDebugx86 = ConfigCanonicalName("Debug", "x86") @@ -352,8 +342,8 @@ type UpToDate() = let supported = Array.zeroCreate 1 let ready = Array.zeroCreate 1 buildableConfig.QueryStartUpToDateCheck(flag, supported, ready) |> ignore - Assert.IsTrue(supported.[0] = expected) - Assert.IsTrue(ready.[0] = expected) + Assert.True(supported.[0] = expected) + Assert.True(ready.[0] = expected) [ VSConstants.VSUTDCF_DTEEONLY, 1 VSConstants.VSUTDCF_PACKAGE, 0 @@ -362,7 +352,7 @@ type UpToDate() = |> List.iter (fun (flag, expected) -> testFlag flag expected) )) - [] + [] member public this.UTDOptionsFlagsUTDDisabled () = this.MakeProjectAndDo(["file1.fs"], [], @" @@ -380,8 +370,8 @@ type UpToDate() = let supported = Array.zeroCreate 1 let ready = Array.zeroCreate 1 buildableConfig.QueryStartUpToDateCheck(flag, supported, ready) |> ignore - Assert.AreEqual(supported.[0], expected) - Assert.AreEqual(ready.[0], expected) + Assert.Equal(supported.[0], expected) + Assert.Equal(ready.[0], expected) [ VSConstants.VSUTDCF_DTEEONLY, 1 VSConstants.VSUTDCF_PACKAGE, 0 @@ -390,10 +380,9 @@ type UpToDate() = |> List.iter (fun (flag, expected) -> testFlag flag expected) )) -[] type ``UpToDate PreserveNewest`` () = - [] + [] member public this.IsUpToDatePreserveNewest () = let test (input, inputTimestamp) (output, outputTimestamp) = @@ -416,28 +405,28 @@ type ``UpToDate PreserveNewest`` () = let ``no input -> not up-to-date and log`` = let u, logs = test ("readme.md", None) ("leggimi.md", None) - Assert.IsFalse(u) + Assert.False(u) logs |> List.exists (fun s -> s.Contains("readme.md") && s.Contains("can't find expected input")) - |> Assert.IsTrue + |> Assert.True let ``no output -> not up-to-date and log`` = let u, logs = test ("from.txt", Some now) ("to.txt", None) - Assert.IsFalse(u) + Assert.False(u) logs |> List.exists (fun s -> s.Contains("to.txt") && s.Contains("can't find expected output")) - |> Assert.IsTrue + |> Assert.True let ``a newer version of output file is ok`` = let u, logs = test ("before.doc", Some before) ("after.doc", Some now) - Assert.IsTrue(u) + Assert.True(u) logs |> AssertEqual [] let ``stale output file -> not up-to-date and log`` = let u, logs = test ("logo.png", Some now) ("animatedlogo.gif", Some before) - Assert.IsFalse(u) + Assert.False(u) logs |> List.exists (fun s -> s.Contains("animatedlogo.gif") && s.Contains("stale")) - |> Assert.IsTrue + |> Assert.True () diff --git a/vsintegration/tests/UnitTests/TestLib.LanguageService.fs b/vsintegration/tests/UnitTests/TestLib.LanguageService.fs index b4e055b036b..ecc8cc1479f 100644 --- a/vsintegration/tests/UnitTests/TestLib.LanguageService.fs +++ b/vsintegration/tests/UnitTests/TestLib.LanguageService.fs @@ -4,7 +4,7 @@ namespace UnitTests.TestLib.LanguageService open System open System.Reflection -open NUnit.Framework +open Xunit open System.Diagnostics open System.IO open Salsa.Salsa @@ -246,8 +246,6 @@ type internal GlobalParseAndTypeCheckCounter private(initialParseCount:int, init /// various functions that abstract actions over vs. type LanguageServiceBaseTests() = - let _resolver = AssemblyResolver.addResolver () - let mutable defaultSolution : OpenSolution = Unchecked.defaultof<_> let cache = System.Collections.Generic.Dictionary() @@ -261,7 +259,48 @@ type LanguageServiceBaseTests() = // Timings ----------------------------------------------------------------------------- let stopWatch = new Stopwatch() let ResetStopWatch() = stopWatch.Reset(); stopWatch.Start() - + + + let Init() = + 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. + System.Diagnostics.Debug.Assert(false, sprintf "Unexpected: loaded assembly '%s' to not contain '%s' and '%s'" fullname text1 text2) + + // Under .NET 4.0 we don't allow 3.5.0.0 assemblies + let AssertNotBackVersionAssembly(args:AssemblyLoadEventArgs) = + + // 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") + () + AppDomain.CurrentDomain.AssemblyLoad.Add AssertNotBackVersionAssembly + + UIStuff.SetupSynchronizationContext() + + defaultVS <- ops.CreateVisualStudio() + currentVS <- defaultVS + + defaultSolution <- GlobalFunctions.CreateSolution(defaultVS) + cache.Clear() + + do + Init() + + 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) + + ResetStopWatch() + testStopwatch.Reset() + testStopwatch.Start() + () + member internal _.VsOpts with set op = ops <- op @@ -367,50 +406,13 @@ type LanguageServiceBaseTests() = GlobalFunctions.AddAssemblyReference(proj, ref) - /// Called per test run -#if NUNIT_V2 - [] - member this.TestFixtureSetUp() = -#else - [] - member this.Init() = -#endif - 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. - System.Diagnostics.Debug.Assert(false, sprintf "Unexpected: loaded assembly '%s' to not contain '%s' and '%s'" fullname text1 text2) - - // Under .NET 4.0 we don't allow 3.5.0.0 assemblies - let AssertNotBackVersionAssembly(args:AssemblyLoadEventArgs) = - - // 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") - () - AppDomain.CurrentDomain.AssemblyLoad.Add AssertNotBackVersionAssembly - - UIStuff.SetupSynchronizationContext() - - defaultVS <- ops.CreateVisualStudio() - currentVS <- defaultVS + interface IDisposable with + 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" - defaultSolution <- GlobalFunctions.CreateSolution(defaultVS) - cache.Clear() - -#if NUNIT_V2 - [] - member this.Shutdown() = -#else - [] - member this.Cleanup() = -#endif - 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() + GlobalFunctions.Cleanup(defaultVS) + cache.Clear() member this.UsingNewVS() = if box currentVS <> box defaultVS then @@ -423,24 +425,7 @@ type LanguageServiceBaseTests() = GlobalFunctions.Cleanup(currentVS) currentVS <- defaultVS } - - /// Called per test - [] - member this.Setup() = - 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) - - ResetStopWatch() - testStopwatch.Reset() - testStopwatch.Start() - () - /// Called per test - [] member this.TearDown() = diff --git a/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs b/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs index d1e554f4e8c..5f9095ff4d9 100644 --- a/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs +++ b/vsintegration/tests/UnitTests/TestLib.ProjectSystem.fs @@ -25,7 +25,7 @@ open Microsoft.Build.Execution open Microsoft.Build.Framework #nowarn "52" // The value has been copied to ensure the original is not mutated -open NUnit.Framework +open Xunit open UnitTests.TestLib.Utils open UnitTests.TestLib.Utils.Asserts open UnitTests.TestLib.Utils.FilesystemHelpers @@ -76,20 +76,6 @@ type TheTests() = project.FindNodesOfType(l) l.[0] - ///////////////////////////////// - /// Called per test - [] - member this.Setup() = - () - - - [] - member this.TearDown() = - // help find leaks per-test - System.GC.Collect() - System.GC.WaitForPendingFinalizers() - () - ///////////////////////////////// /// helpers static member AssertMatches (r : Regex) (s:string) = diff --git a/vsintegration/tests/UnitTests/TestLib.Salsa.fs b/vsintegration/tests/UnitTests/TestLib.Salsa.fs index c9dcbbb115a..ac3636723eb 100644 --- a/vsintegration/tests/UnitTests/TestLib.Salsa.fs +++ b/vsintegration/tests/UnitTests/TestLib.Salsa.fs @@ -4,7 +4,7 @@ module UnitTests.TestLib.Salsa open System open System.IO -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open System.Text.RegularExpressions @@ -36,7 +36,7 @@ let AssertContainsInOrder(s:string,cs:string list) = containsInOrderFrom 0 cs let AssertContains(value: string, substring: string) = - Assert.That(value, Contains.Substring substring) + Assert.Contains(substring, value) let AssertArrayContainsPartialMatchOf(a:string array,c) = let found = ref false diff --git a/vsintegration/tests/UnitTests/TestLib.Utils.fs b/vsintegration/tests/UnitTests/TestLib.Utils.fs index 3a74b0c0e94..49a5bfdf08a 100644 --- a/vsintegration/tests/UnitTests/TestLib.Utils.fs +++ b/vsintegration/tests/UnitTests/TestLib.Utils.fs @@ -4,7 +4,7 @@ namespace UnitTests.TestLib.Utils open System open System.IO -open NUnit.Framework +open Xunit open Microsoft.VisualStudio module Asserts = @@ -47,7 +47,7 @@ module Asserts = | None -> () let AssertBuildSuccessful (result: Microsoft.VisualStudio.FSharp.ProjectSystem.BuildResult) = - Assert.IsTrue(result.IsSuccessful, "Expected build to succeed") + Assert.True(result.IsSuccessful, "Expected build to succeed") module UIStuff = let SetupSynchronizationContext() = diff --git a/vsintegration/tests/UnitTests/Tests.Build.fs b/vsintegration/tests/UnitTests/Tests.Build.fs index 78e4559d358..6f87164333f 100644 --- a/vsintegration/tests/UnitTests/Tests.Build.fs +++ b/vsintegration/tests/UnitTests/Tests.Build.fs @@ -2,7 +2,7 @@ namespace Tests -open NUnit.Framework +open Xunit open System open System.IO open System.Diagnostics @@ -19,8 +19,7 @@ module HandyExtensions = if not (s.MatchesPattern p) then let up = System.Text.RegularExpressions.Regex.Unescape p let message = sprintf "Expected\n%A\nto match pattern\n%A" s up - printfn "%s" message - Assert.Fail() + failwith message open HandyExtensions type MyLogger(f : string -> unit) = @@ -49,7 +48,6 @@ type FauxHostObject() = interface ITaskHost // no members -[] type Build() = (* Asserts ----------------------------------------------------------------------------- *) let AssertEqual expected actual = @@ -60,16 +58,7 @@ type Build() = let MakeTaskItem (itemSpec : string) = new TaskItem(itemSpec) :> ITaskItem - /// Called per test - [] - member this.Setup() = - () - - [] - member this.TearDown() = - () - - [] + [] member public this.TestCodePage() = let tool = new FSharp.Build.Fsc() printfn "By the way, the registry or app.config tool path is %s" tool.ToolPath @@ -85,7 +74,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestDebugSymbols() = let tool = new FSharp.Build.Fsc() tool.DebugSymbols <- true @@ -100,7 +89,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestDebugType() = let tool = new FSharp.Build.Fsc() tool.DebugType <- "pdbONly" @@ -115,7 +104,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestDefineConstants() = let tool = new FSharp.Build.Fsc() tool.DefineConstants <- [| MakeTaskItem "FOO=3" @@ -132,7 +121,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestDisabledWarnings1() = let tool = new FSharp.Build.Fsc() tool.DisabledWarnings <- "52;109" @@ -147,7 +136,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestDisabledWarnings2() = let tool = new FSharp.Build.Fsc() tool.DisabledWarnings <- ";" // e.g. someone may have $(NoWarn);$(SomeOtherVar) and both vars are empty @@ -161,7 +150,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestWarningsNotAsErrors() = let tool = new FSharp.Build.Fsc() tool.WarningsNotAsErrors <- "52;109" @@ -176,7 +165,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestVersionFile() = let tool = new FSharp.Build.Fsc() tool.VersionFile <- "src/version" @@ -191,7 +180,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestDocumentationFile() = let tool = new FSharp.Build.Fsc() tool.DocumentationFile <- "foo.xml" @@ -206,7 +195,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestGenerateInterfaceFile() = let tool = new FSharp.Build.Fsc() tool.GenerateInterfaceFile <- "foo.fsi" @@ -221,7 +210,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestKeyFile() = let tool = new FSharp.Build.Fsc() tool.KeyFile <- "key.txt" @@ -236,7 +225,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestNoFramework() = let tool = new FSharp.Build.Fsc() tool.NoFramework <- true @@ -251,7 +240,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestOptimize() = let tool = new FSharp.Build.Fsc() tool.Optimize <- false @@ -265,7 +254,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestTailcalls() = let tool = new FSharp.Build.Fsc() tool.Tailcalls <- true @@ -280,7 +269,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestOtherFlags() = let tool = new FSharp.Build.Fsc() tool.OtherFlags <- "--yadda yadda" @@ -296,7 +285,7 @@ type Build() = "yadda") cmd - [] + [] member public this.TestOutputAssembly() = let tool = new FSharp.Build.Fsc() tool.OutputAssembly <- "oUt.dll" @@ -311,7 +300,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestPdbFile() = let tool = new FSharp.Build.Fsc() tool.PdbFile <- "out.pdb" @@ -326,7 +315,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestPlatform1() = let tool = new FSharp.Build.Fsc() tool.Platform <- "x64" @@ -341,7 +330,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestPlatform3() = let tool = new FSharp.Build.Fsc() tool.Platform <- "x86" @@ -356,10 +345,10 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestReferences() = let tool = new FSharp.Build.Fsc() - let dll = "c:\\sd\\staging\\tools\\nunit\\nunit.framework.dll" + let dll = "c:\\sd\\staging\\tools\\xunit\\xunit.core.dll" tool.References <- [| MakeTaskItem dll |] AssertEqual 1 tool.References.Length let cmd = tool.InternalGenerateResponseFileCommands() @@ -372,39 +361,39 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestReferencePath() = let tool = new FSharp.Build.Fsc() - let path = "c:\\sd\\staging\\tools\\nunit\\;c:\\Foo" + let path = "c:\\sd\\staging\\tools\\xunit\\;c:\\Foo" tool.ReferencePath <- path AssertEqual path tool.ReferencePath let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + - "--lib:c:\\sd\\staging\\tools\\nunit\\,c:\\Foo" + Environment.NewLine + + "--lib:c:\\sd\\staging\\tools\\xunit\\,c:\\Foo" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + "--nocopyfsharpcore") cmd - [] + [] member public this.TestReferencePathWithSpaces() = let tool = new FSharp.Build.Fsc() - let path = "c:\\program files;c:\\sd\\staging\\tools\\nunit;c:\\Foo" + let path = "c:\\program files;c:\\sd\\staging\\tools\\xunit;c:\\Foo" tool.ReferencePath <- path AssertEqual path tool.ReferencePath let cmd = tool.InternalGenerateResponseFileCommands() printfn "cmd=\"%s\"" cmd AssertEqual ("--optimize+" + Environment.NewLine + - "--lib:c:\\program files,c:\\sd\\staging\\tools\\nunit,c:\\Foo" + Environment.NewLine + + "--lib:c:\\program files,c:\\sd\\staging\\tools\\xunit,c:\\Foo" + Environment.NewLine + "--fullpaths" + Environment.NewLine + "--flaterrors" + Environment.NewLine + "--highentropyva-" + Environment.NewLine + "--nocopyfsharpcore") cmd - [] + [] member public this.TestResources() = let tool = new FSharp.Build.Fsc() tool.Resources <- [| MakeTaskItem "Foo.resources" |] @@ -419,7 +408,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestSources() = let tool = new FSharp.Build.Fsc() let src = "foo.fs" @@ -438,7 +427,7 @@ type Build() = cmd () - [] + [] member public this.TestTargetType1() = let tool = new FSharp.Build.Fsc() tool.TargetType <- "Library" @@ -453,7 +442,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestTargetType2() = let tool = new FSharp.Build.Fsc() tool.TargetType <- "Winexe" @@ -468,7 +457,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestTargetType3() = let tool = new FSharp.Build.Fsc() tool.TargetType <- "Module" @@ -483,7 +472,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestUtf8Output() = let tool = new FSharp.Build.Fsc() tool.Utf8Output <- true @@ -497,7 +486,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestWin32Res() = let tool = new FSharp.Build.Fsc() tool.Win32ResourceFile <- "foo.res" @@ -511,7 +500,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestWin32Manifest() = let tool = new FSharp.Build.Fsc() tool.Win32ManifestFile <- "foo.manifest" @@ -525,7 +514,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestHighEntropyVA() = let tool = new FSharp.Build.Fsc() tool.HighEntropyVA <- true @@ -538,7 +527,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestSubsystemVersion() = let tool = new FSharp.Build.Fsc() tool.SubsystemVersion <- "6.02" @@ -552,7 +541,7 @@ type Build() = "--nocopyfsharpcore") cmd - [] + [] member public this.TestAllCombo() = let tool = new FSharp.Build.Fsc() tool.CodePage <- "65001" @@ -668,7 +657,7 @@ type Build() = let expectedSources = [| "foo.fs"; "C:\\Program Files\\spaces.fs" |] AssertEqual expectedSources hostObject.Sources - [] + [] member public this.``DisabledWarnings build property``() = let tool = new FSharp.Build.Fsc() tool.DisabledWarnings <- " diff --git a/vsintegration/tests/UnitTests/Tests.InternalCollections.fs b/vsintegration/tests/UnitTests/Tests.InternalCollections.fs index 55a4bb1f34e..835eebcd771 100644 --- a/vsintegration/tests/UnitTests/Tests.InternalCollections.fs +++ b/vsintegration/tests/UnitTests/Tests.InternalCollections.fs @@ -4,11 +4,10 @@ namespace Tests.Compiler.InternalCollections open System open System.IO -open NUnit.Framework +open Xunit open Internal.Utilities.Collections -[] type MruCache = new() = { } @@ -23,23 +22,23 @@ type MruCache = member private rb.NumToStringBox n = box (rb.NumToString n) #if DISABLED_OLD_UNITTESTS - [] + [] member public rb.Basic() = let m = new MruCache(3, (fun (x,y) -> x = y)) let s = m.Get(5) - Assert.IsTrue("Five"=s) + Assert.True("Five"=s) let s = m.Get(6) - Assert.IsTrue("Six"=s) + Assert.True("Six"=s) let s = m.Get(7) - Assert.IsTrue("Seven"=s) + Assert.True("Seven"=s) let s = m.Get(8) - Assert.IsTrue("Eight"=s) + Assert.True("Eight"=s) let (i,s) = Option.get m.MostRecent - Assert.AreEqual(8,i) - Assert.IsTrue("Eight"=s) + Assert.Equal(8,i) + Assert.True("Eight"=s) () - [] + [] member public rb.MostRecentOfEmpty() = let m = new MruCache(3, rb.NumToString, (fun (x,y) -> x = y)) match m.MostRecent with @@ -47,21 +46,21 @@ type MruCache = | None->() - [] + [] member public rb.SetAlternate() = let m = new MruCache(3, rb.NumToString, (fun (x,y) -> x = y)) m.SetAlternate(2,"Banana") let (i,s) = Option.get m.MostRecent - Assert.AreEqual(2,i) - Assert.IsTrue("Banana"=s) + Assert.Equal(2,i) + Assert.True("Banana"=s) member private rb.AddBanana(m:MruCache) = let banana = new obj() m.SetAlternate(2,banana) let s = m.Get(2) - Assert.AreEqual(banana,s) + Assert.Equal(banana,s) - [] + [] member public rb.CacheDepthIsHonored() = let m = new MruCache(3, rb.NumToStringBox, (fun (x,y) -> x = y)) rb.AddBanana(m) // Separate function to keep 'banana' out of registers @@ -70,9 +69,9 @@ type MruCache = let _ = m.Get(5) GC.Collect() let s = m.Get(2) - Assert.IsTrue("Two"=downcast s) + Assert.True("Two"=downcast s) - [] + [] member public rb.SubsumptionIsHonored() = let PairToString (s,n) = rb.NumToString n let AreSameForSubsumption((s1,n1),(s2,n2)) = n1=n2 @@ -80,13 +79,13 @@ type MruCache = let m = new MruCache(3, PairToString, (fun (x,y) -> x = y), areSimilar=AreSameForSubsumption) m.SetAlternate(("x",2),"Banana") let s = m.Get (("x",2)) - Assert.IsTrue("Banana"=s, "Check1") + Assert.True("Banana"=s, "Check1") let s = m.Get (("y",2)) - Assert.IsTrue("Two"=s, "Check2") + Assert.True("Two"=s, "Check2") let s = m.Get (("x",2)) - Assert.IsTrue("Two"=s, "Check3") // Not banana because it was subsumed + Assert.True("Two"=s, "Check3") // Not banana because it was subsumed - [] + [] member public rb.OnDiscardIsHonored() = let AreSameForSubsumption((s1,n1),(s2,n2)) = s1=s2 @@ -95,27 +94,26 @@ type MruCache = let m = new MruCache(compute=fst, areSimilar=(fun (x,y) -> x = y), areSimilar=AreSameForSubsumption, keepStrongly=2, keepMax=2, onDiscard=(fun s -> discarded := s :: !discarded)) m.SetAlternate(("x",1),"Banana") // no discard printfn "discarded = %A" discarded.Value - Assert.IsTrue(discarded.Value = [], "Check1") + Assert.True(discarded.Value = [], "Check1") m.SetAlternate(("x",2),"Apple") // forces discard of x --> Banana printfn "discarded = %A" discarded.Value - Assert.IsTrue(discarded.Value = ["Banana"], "Check2") + Assert.True(discarded.Value = ["Banana"], "Check2") let s = m.Get (("x",3)) printfn "discarded = %A" discarded.Value - Assert.IsTrue(discarded.Value = ["Apple"; "Banana"], "Check3") + Assert.True(discarded.Value = ["Apple"; "Banana"], "Check3") let s = m.Get (("y",4)) printfn "discarded = %A" discarded.Value - Assert.IsTrue(discarded.Value = ["Apple"; "Banana"], "Check4") + Assert.True(discarded.Value = ["Apple"; "Banana"], "Check4") let s = m.Get (("z",5)) // forces discard of x --> Bananas printfn "discarded = %A" discarded.Value - Assert.IsTrue(discarded.Value = ["x"; "Apple";"Banana"], "Check5") + Assert.True(discarded.Value = ["x"; "Apple";"Banana"], "Check5") let s = m.Get (("w",6)) // forces discard of y printfn "discarded = %A" discarded.Value - Assert.IsTrue(discarded.Value = ["y";"x";"Apple";"Banana"], "Check6") + Assert.True(discarded.Value = ["y";"x";"Apple";"Banana"], "Check6") #endif type AccessToken() = class end -[] type AgedLookup() = let mutable hold197 : byte [] = null let mutable hold198 : byte [] = null @@ -127,17 +125,17 @@ type AgedLookup() = let AssertCached(i,o:byte array) = match al.TryPeekKeyValue(atok,i) with - | Some(_,x) -> Assert.IsTrue(obj.ReferenceEquals(o,x), sprintf "Object in cache (%d) does not agree with expectation (%d)" x.[0] i) - | None -> Assert.IsTrue(false, "Object fell out of cache") + | 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) = match al.TryPeekKeyValue(atok,i) with | Some _ -> () - | None -> Assert.IsTrue(false, "Object fell out of cache") + | None -> Assert.True(false, "Object fell out of cache") let AssertNotCached(i) = match al.TryPeekKeyValue(atok,i) with - | Some _ -> Assert.IsTrue(false, "Expected key to have fallen out of cache") + | Some _ -> Assert.True(false, "Expected key to have fallen out of cache") | None -> () let f() = @@ -215,7 +213,7 @@ type AgedLookup() = GC.Collect() - [] member public rb.WeakRef0() = WeakRefTest 0 - [] member public rb.WeakRef1() = WeakRefTest 1 - [] member public rb.WeakRef2() = WeakRefTest 2 - [] member public rb.WeakRef3() = WeakRefTest 3 + [] member public rb.WeakRef0() = WeakRefTest 0 + [] member public rb.WeakRef1() = WeakRefTest 1 + [] member public rb.WeakRef2() = WeakRefTest 2 + [] member public rb.WeakRef3() = WeakRefTest 3 diff --git a/vsintegration/tests/UnitTests/Tests.Powerpack.fs b/vsintegration/tests/UnitTests/Tests.Powerpack.fs deleted file mode 100644 index 7ea87328bc4..00000000000 --- a/vsintegration/tests/UnitTests/Tests.Powerpack.fs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace UnitTests.Tests.PowerPack - -open NUnit.Framework -open System -open System.IO -open System.Diagnostics -open FSharp.Build -open Microsoft.Build.Framework -open Microsoft.Build.Utilities -open UnitTests.TestLib.Utils.FilesystemHelpers - -[] -type FsLexTests() = - - [] - member this.Setup() = () - - [] - member this.TearDown() = () - - [] - member public this.TestCodePage() = - let tool = new FSharp.Build.FsLex() - tool.CodePage <- "65001" - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("--codepage 65001 ", cmd) - - [] - member public this.TestOutputFile() = - let tool = new FSharp.Build.FsLex() - tool.OutputFile <- "result.fs" - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("-o result.fs ", cmd) - - [] - member public this.TestUnicode() = - let tool = new FSharp.Build.FsLex() - tool.Unicode <- true - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("--unicode ", cmd) - - [] - member public this.TestUnicodeNegCase() = - let tool = new FSharp.Build.FsLex() - tool.Unicode <- false - let cmd = tool.InternalGenerateCommandLineCommands() - // Verify Unicode flag not specified - Assert.AreEqual("", cmd) - -[] -type FsYaccTests() = - - [] - member this.Setup() = () - - [] - member this.TearDown() = () - - [] - member public this.TestCodePage() = - let tool = new FSharp.Build.FsYacc() - tool.CodePage <- "65001" - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("--codepage 65001", cmd) - - [] - member public this.TestOutputFile() = - let tool = new FSharp.Build.FsYacc() - tool.OutputFile <- "result.fs" - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("-o result.fs", cmd) - - [] - member public this.TestMLCompatibility() = - let tool = new FSharp.Build.FsYacc() - tool.MLCompatibility <- true - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("--ml-compatibility", cmd) - - [] - member public this.TestMLCompatibilityFalse() = - let tool = new FSharp.Build.FsYacc() - tool.MLCompatibility <- false - let cmd = tool.InternalGenerateCommandLineCommands() - Assert.AreEqual("", cmd) \ No newline at end of file diff --git a/vsintegration/tests/UnitTests/Tests.TaskReporter.fs b/vsintegration/tests/UnitTests/Tests.TaskReporter.fs index fb5e57bb446..d644a6c3237 100644 --- a/vsintegration/tests/UnitTests/Tests.TaskReporter.fs +++ b/vsintegration/tests/UnitTests/Tests.TaskReporter.fs @@ -2,7 +2,7 @@ namespace Tests.LanguageService.ErrorList -open NUnit.Framework +open Xunit open System open System.IO open System.Diagnostics @@ -20,7 +20,6 @@ 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 @@ -94,7 +93,7 @@ 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 - [] + [] member public this.``ErrorList.LanguageServiceErrorsProperlyCoalesced``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -114,7 +113,7 @@ type TaskReporterTests() = - [] + [] member public this.``ErrorList.ProjectSystemErrorsProperlyCoalesced``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -134,7 +133,7 @@ type TaskReporterTests() = () /// Test for multiple identical errors being properly coalesced in the error list (bug 2151) - [] + [] member public this.``ErrorList.ErrorsProperlyCoalesced``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -153,7 +152,7 @@ type TaskReporterTests() = () // modify the span, and check to see if we have two tasks now instead of one - [] + [] member public this.``ErrorList.ProjectSystemErrorsProperlyCoalesced2``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -175,7 +174,7 @@ type TaskReporterTests() = () /// Ensure that text line markers are only created when a task is output to the task list - [] + [] member public this.``ErrorList.TextLineMarkersCreatedOnce``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -212,7 +211,7 @@ type TaskReporterTests() = // both files open // errors in each file, build - no duplicates - [] + [] member public this.``ErrorList.TwoFilesBothOpen``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -238,7 +237,7 @@ type TaskReporterTests() = // file open, one file closed // - error in closed file - [] + [] member public this.``ErrorList.TwoFilesOneOpenErrorInOpen``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -268,7 +267,7 @@ type TaskReporterTests() = () // all files open - build, then fix - no errors left - [] + [] member public this.``ErrorList.TwoFilesCorrectError``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -314,7 +313,7 @@ type TaskReporterTests() = // Make sure a 'typecheck' is treated as a background task - [] + [] member public this.``ErrorList.BackgroundTaskIsClassified``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) @@ -342,7 +341,7 @@ type TaskReporterTests() = // Make sure a 'ilxgen' is treated as a build task - [] + [] member public this.``ErrorList.BuildTaskIsClassified``() = use errorReporter = CreateErrorReporter() let mutable span = new TextSpan(iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 2) diff --git a/vsintegration/tests/UnitTests/Tests.Watson.fs b/vsintegration/tests/UnitTests/Tests.Watson.fs index 35ccf0f4d03..e5c19d5e22d 100644 --- a/vsintegration/tests/UnitTests/Tests.Watson.fs +++ b/vsintegration/tests/UnitTests/Tests.Watson.fs @@ -11,7 +11,7 @@ open FSharp.Compiler.CodeAnalysis open Internal.Utilities.Library open FSharp.Compiler.CompilerConfig open FSharp.Compiler.Driver -open NUnit.Framework +open Xunit open System.IO type Check = @@ -51,122 +51,121 @@ type Check = FileSystem.FileDeleteShim("watson-test.fs") -[] module WatsonTests = - [] + [] let FscOutOfMemory() = Check.FscLevelException("fsc-oom") - [] + [] let FscArgumentNull() = Check.FscLevelException("fsc-an") - [] + [] 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 FscArgumentOutOfRange() = Check.FscLevelException("fsc-aor") - [] + [] let FscDivideByZero() = Check.FscLevelException("fsc-dv0") - [] + [] let FscNotFiniteNumber() = Check.FscLevelException("fsc-nfn") - [] + [] let FscOverflow() = Check.FscLevelException("fsc-oe") - [] + [] let FscArrayTypeMismatch() = Check.FscLevelException("fsc-atmm") - [] + [] let FscBadImageFormat() = Check.FscLevelException("fsc-bif") - [] + [] let FscKeyNotFound() = Check.FscLevelException("fsc-knf") - [] + [] let FscIndexOutOfRange() = Check.FscLevelException("fsc-ior") - [] + [] let FscInvalidCast() = Check.FscLevelException("fsc-ic") - [] + [] let FscInvalidProgram() = Check.FscLevelException("fsc-ip") - [] + [] let FscMemberAccess() = Check.FscLevelException("fsc-ma") - [] + [] let FscNotImplemented() = Check.FscLevelException("fsc-ni") - [] + [] let FscNullReference() = Check.FscLevelException("fsc-nr") - [] + [] let FscOperationCancelled() = Check.FscLevelException("fsc-oc") - //[] + //[] //let FscFailure() = Check.FscLevelException("fsc-fail") - [] + [] let TypeCheckOutOfMemory() = Check.FscLevelException("tc-oom") - [] + [] let TypeCheckArgumentNull() = Check.FscLevelException("tc-an") - [] + [] 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 TypeCheckArgumentOutOfRange() = Check.FscLevelException("tc-aor") - [] + [] let TypeCheckDivideByZero() = Check.FscLevelException("tc-dv0") - [] + [] let TypeCheckNotFiniteNumber() = Check.FscLevelException("tc-nfn") - [] + [] let TypeCheckOverflow() = Check.FscLevelException("tc-oe") - [] + [] let TypeCheckArrayTypeMismatch() = Check.FscLevelException("tc-atmm") - [] + [] let TypeCheckBadImageFormat() = Check.FscLevelException("tc-bif") - [] + [] let TypeCheckKeyNotFound() = Check.FscLevelException("tc-knf") - [] + [] let TypeCheckIndexOutOfRange() = Check.FscLevelException("tc-ior") - [] + [] let TypeCheckInvalidCast() = Check.FscLevelException("tc-ic") - [] + [] let TypeCheckInvalidProgram() = Check.FscLevelException("tc-ip") - [] + [] let TypeCheckMemberAccess() = Check.FscLevelException("tc-ma") - [] + [] let TypeCheckNotImplemented() = Check.FscLevelException("tc-ni") - [] + [] let TypeCheckNullReference() = Check.FscLevelException("tc-nr") - [] + [] let TypeCheckOperationCancelled() = Check.FscLevelException("tc-oc") - [] + [] let TypeCheckFailure() = Check.FscLevelException("tc-fail") diff --git a/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs b/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs index 432d72ec018..b11bdd9ef8c 100644 --- a/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs +++ b/vsintegration/tests/UnitTests/Tests.XmlDocComments.fs @@ -3,13 +3,12 @@ namespace Tests.LanguageService open System -open NUnit.Framework +open Xunit open Salsa.Salsa open Salsa.VsOpsUtils open UnitTests.TestLib.Salsa open UnitTests.TestLib.Utils -[] type XmlDocComments() = inherit UnitTests.TestLib.LanguageService.LanguageServiceBaseTests(VsOpts = InstalledMSBuildTestFlavour()) @@ -58,31 +57,28 @@ type XmlDocComments() = let project2 = CreateProject(solution, "FSClient") let file1 = AddFileFromTextBlob(project1,"File1.fs", fileContent1) AddProjectReference(project2,project1) - Build(project1) |> fun result -> Assert.IsTrue(result.BuildSucceeded) + Build(project1) |> fun result -> Assert.True(result.BuildSucceeded) let file2 = AddFileFromTextBlob(project2,"File2.fs", fileContent2) let file = OpenFile(project2, "File2.fs") MoveCursorToStartOfMarker(file, marker) GetQuickInfoAtCursor file - [] - [] + [] member this.``MalFormedXML.FromXMLDoc``() = let expected = "XML comment" let tooltip = this.TestMalFormedXML("(*Marker1*)") printfn "%A" tooltip AssertContains(trimnewlines tooltip, trimnewlines expected) - [] - [] + [] member this.``MalFormedXML.FromCurrentProject``() = let expected = "'summary'" let tooltip = this.TestMalFormedXML("(*Marker2*)") printfn "%A" tooltip AssertContains(trimnewlines tooltip, trimnewlines expected) - [] - [] + [] member this.``MalFormedXML.NoXMLComment.Bug5858``() = let notexpected = "summary" let notexpected2 = "param name=" @@ -91,8 +87,7 @@ type XmlDocComments() = AssertNotContains(tooltip, notexpected) AssertNotContains(tooltip, notexpected2) - [] - [] + [] member this.Test() = let fileContent = """ //local custom type value diff --git a/vsintegration/tests/UnitTests/UnusedOpensTests.fs b/vsintegration/tests/UnitTests/UnusedOpensTests.fs index e47b38b46e6..b77d7e257ef 100644 --- a/vsintegration/tests/UnitTests/UnusedOpensTests.fs +++ b/vsintegration/tests/UnitTests/UnusedOpensTests.fs @@ -1,17 +1,14 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -[] + module Tests.ServiceAnalysis.UnusedOpens open System -open NUnit.Framework +open Xunit open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.CodeAnalysis open FSharp.Compiler.EditorServices open FSharp.Compiler.Text -/// like "should equal", but validates same-type -let shouldEqual (x: 'a) (y: 'a) = Assert.AreEqual(x, y, sprintf "Expected: %A\nActual: %A" x y) - let private filePath = "C:\\test.fs" let private projectOptions : FSharpProjectOptions = @@ -43,9 +40,9 @@ let (=>) (source: string) (expectedRanges: ((*line*)int * ((*start column*)int * unusedOpenRanges |> List.map (fun x -> x.StartLine, (x.StartColumn, x.EndColumn)) - |> shouldEqual expectedRanges + |> fun actual -> Assert.Equal<(int * (int * int)) list>(expectedRanges, actual) -[] +[] let ``unused open declaration in top level module``() = """ module TopModule @@ -55,7 +52,7 @@ let _ = DateTime.Now """ => [ 4, (5, 14) ] -[] +[] let ``unused open declaration in namespace``() = """ namespace TopNamespace @@ -66,7 +63,7 @@ module Nested = """ => [ 4, (5, 14) ] -[] +[] let ``unused open declaration in nested module``() = """ namespace TopNamespace @@ -77,7 +74,7 @@ module Nested = """ => [ 5, (9, 18) ] -[] +[] let ``unused open declaration due to partially qualified symbol``() = """ module TopModule @@ -87,7 +84,7 @@ let _ = IO.File.Create "" """ => [ 4, (5, 14) ] -[] +[] let ``unused parent open declaration due to partially qualified symbol``() = """ module TopModule @@ -97,7 +94,7 @@ let _ = File.Create "" """ => [ 3, (5, 11) ] -[] +[] let ``open statement duplication in parent module is unused``() = """ module TopModule @@ -108,7 +105,7 @@ module Nested = """ => [ 5, (9, 18) ] -[] +[] let ``open statement duplication in parent module is marked as unused even though it seems to be used in its scope``() = """ module TopModule @@ -120,14 +117,14 @@ let _ = File.Create "" """ => [ 5, (9, 18) ] -[] +[] let ``multiple open declaration in the same line``() = """ open System.IO; let _ = File.Create "";; open System.IO """ => [ 2, (46, 55) ] -[] +[] let ``open a nested module inside another one is not unused``() = """ module Top @@ -139,7 +136,7 @@ module M2 = """ => [] -[] +[] let ``open a nested module inside another one is not unused, complex hierarchy``() = """ module Top = @@ -153,7 +150,7 @@ module Top = """ => [] -[] +[] let ``open a nested module inside another one is not unused, even more complex hierarchy``() = """ module Top = @@ -169,7 +166,7 @@ module Top = """ => [] -[] +[] let ``opening auto open module after it's parent module was opened should be marked as unused``() = """ module NormalModule = @@ -188,7 +185,7 @@ let _ = Class() """ => [ 13, (5, 68) ] -[] +[] let ``opening parent module after one of its auto open module was opened should be marked as unused``() = """ module NormalModule = @@ -207,7 +204,7 @@ let _ = Class() """ => [ 13, (5, 52) ] -[] +[] let ``open declaration is not marked as unused if there is a shortened attribute symbol from it``() = """ open System @@ -216,7 +213,7 @@ type Class() = class end """ => [] -[] +[] let ``open declaration is not marked as unused if an extension property is used``() = """ module Module = @@ -227,7 +224,7 @@ let _ = "a long string".ExtensionProperty """ => [] -[] +[] let ``open declaration is marked as unused if an extension property is not used``() = """ module Module = @@ -238,7 +235,7 @@ let _ = "a long string".Trim() """ => [ 5, (5, 11) ] -[] +[] let ``open declaration is not marked as unused if an extension method is used``() = """ type Class() = class end @@ -251,7 +248,7 @@ let _ = x.ExtensionMethod() """ => [] -[] +[] let ``open declaration is marked as unused if an extension method is not used``() = """ type Class() = class end @@ -263,7 +260,7 @@ let x = Class() """ => [ 6, (5, 11) ] -[] +[] let ``open declaration is not marked as unused if one of its types is used in a constructor signature``() = """ module M = @@ -273,7 +270,7 @@ type Site (x: Class -> unit) = class end """ => [] -[] +[] let ``open declaration is marked as unused if nothing from it is used``() = """ module M = @@ -283,7 +280,7 @@ type Site (x: int -> unit) = class end """ => [ 4, (5, 6) ] -[] +[] let ``static extension method applied to a type results that both namespaces /where the type is declared and where the extension is declared/ is not marked as unused``() = """ module Extensions = @@ -295,7 +292,7 @@ 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``() = """ module Extensions = @@ -307,7 +304,7 @@ let _ = DateTime.ExtensionProperty """ => [] -[] +[] let ``accessing property on a variable should not force the namespace in which the type is declared to be marked as used``() = """ let dt = System.DateTime.Now @@ -317,7 +314,7 @@ module M = """ => [4, (9, 15) ] -[] +[] let ``either of two open declarations are not marked as unused if symbols from both of them are used``() = """ module M1 = @@ -332,7 +329,7 @@ let _ = func2() """ => [] -[] +[] let ``open module with ModuleSuffix attribute value applied is not marked as unused if a symbol declared in it is used``() = """ [] @@ -343,7 +340,7 @@ let _ = func() """ => [] -[] +[] let ``open module all of which symbols are used by qualifier is marked as unused``() = """ module M = @@ -353,7 +350,7 @@ let _ = M.func 1 """ => [4, (5, 6) ] -[] +[] let ``open module is not marked as unused if a symbol defined in it is used in OCaml-style type annotation``() = """ module M = @@ -363,7 +360,7 @@ let func (arg: Class list) = () """ => [] -[] +[] let ``auto open module``() = """ module Top = @@ -375,7 +372,7 @@ let _ = func() """ => [] -[] +[] let ``auto open module with namespace``() = """ namespace Module1Namespace @@ -390,7 +387,7 @@ module Module3 = """ => [] -[] +[] let ``auto open module in the middle of hierarchy``() = """ namespace Ns @@ -404,7 +401,7 @@ module M2 = """ => [] -[] +[] let ``open declaration is not marked as unused if a delegate defined in it is used``() = """ open System @@ -412,7 +409,7 @@ let _ = Func(fun _ -> 1) """ => [] -[] +[] let ``open declaration is not marked as unused if a unit of measure defined in it is used``() = """ module M = @@ -423,7 +420,7 @@ module N = """ => [] -[] +[] let ``open declaration is not marked as unused if an attribute defined in it is applied on an interface member argument``() = """ open System.Runtime.InteropServices @@ -431,7 +428,7 @@ type T = abstract M: [] ?x: int -> unit """ => [] -[] +[] let ``relative module open declaration``() = """ module Top = @@ -443,7 +440,7 @@ let _ = x """ => [] -[] +[] let ``open declaration is used if a symbol defined in it is used in a module top-level do expression``() = """ module Top @@ -453,7 +450,7 @@ File.ReadAllLines "" """ => [] -[] +[] let ``redundant opening a module with ModuleSuffix attribute value is marks as unused``() = """ [] @@ -465,7 +462,7 @@ module M = """ => [ 6, (9, 33) ] -[] +[] let ``redundant opening a module is marks as unused``() = """ module InternalModuleWithSuffix = @@ -476,7 +473,7 @@ module M = """ => [ 5, (9, 33) ] -[] +[] let ``usage of an unqualified union case doesn't make an opening module where it's defined to be marked as unused``() = """ module M = @@ -486,7 +483,7 @@ let _ = Case1 """ => [] -[] +[] let ``usage of qualified union case doesn't make an opening module where it's defined to be marked as unused``() = """ module M = @@ -496,7 +493,7 @@ let _ = DU.Case1 """ => [] -[] +[] let ``type with different DisplayName``() = """ open Microsoft.FSharp.Quotations @@ -504,7 +501,7 @@ let _ = Expr.Coerce (<@@ 1 @@>, typeof) """ => [] -[] +[] let ``auto open module with ModuleSuffix attribute value``() = """ module Top = @@ -517,7 +514,7 @@ module Module1 = """ => [] -[] +[] let ``a type which has more than one DisplayName causes the namespace it's defined in to be not marked as unused``() = """ open System @@ -525,7 +522,7 @@ let _ = IntPtr.Zero """ => [] -[] +[] let ``usage of an operator makes the module it's defined in to be not marked as unused``() = """ module M = @@ -535,7 +532,7 @@ let _ = 1 ++| 2 """ => [] -[] +[] let ``usage of an operator makes the module /with Module suffix/ it's defined in to be not marked as unused``() = """ [] @@ -546,7 +543,7 @@ let _ = 1 ++| 2 """ => [] -[] +[] let ``type used in pattern matching with "as" keyword causes the module in which the type is defined to be not marked as unused``() = """ module M = @@ -558,7 +555,7 @@ let _ = match obj() with """ => [] -[] +[] let ``a function from printf family prevents Printf module from marking as unused``() = """ open Microsoft.FSharp.Core.Printf @@ -567,7 +564,7 @@ let _ = bprintf (StringBuilder()) "%A" 1 """ => [] -[] +[] let ``assembly level attribute prevents namespace in which it's defined to be marked as unused``() = """ open System @@ -576,7 +573,7 @@ open System """ => [] -[] +[] let ``open declaration is not marked as unused if a related type extension is used``() = """ module Module = @@ -586,7 +583,7 @@ module Module = """ => [] -[] +[] let ``open declaration is not marked as unused if a symbol defined in it is used in type do block``() = """ open System.IO.Compression @@ -597,7 +594,7 @@ type OutliningHint() as self = """ => [] -[] +[] let ``should not mark open declaration with global prefix``() = """ module Module = @@ -606,7 +603,7 @@ module Module = """ => [] -[] +[] let ``record fields should be taken into account``() = """ module M1 = @@ -617,7 +614,7 @@ module M2 = """ => [] -[] +[] let ``handle type alias``() = """ module TypeAlias = @@ -628,7 +625,7 @@ module Usage = """ => [] -[] +[] let ``handle override members``() = """ type IInterface = @@ -642,7 +639,7 @@ let f (x: IClass) = (x :> IInterface).Property """ => [] -[] +[] let ``active pattern cases should be taken into account``() = """ module M = @@ -652,7 +649,7 @@ let f (Pattern _) = () """ => [] -[] +[] let ``active patterns applied as a function should be taken into account``() = """ module M = @@ -662,7 +659,7 @@ let _ = (|Pattern|_|) () """ => [] -[] +[] let ``not used active pattern does not make the module in which it's defined to not mark as unused``() = """ module M = @@ -672,7 +669,7 @@ let _ = 1 """ => [ 4, (5, 6) ] -[] +[] let ``type in type parameter constraint should be taken into account``() = """ open System @@ -680,7 +677,7 @@ let f (x: 'a when 'a :> IDisposable) = () """ => [] -[] +[] let ``namespace declaration should never be marked as unused``() = """ namespace Library2 @@ -688,7 +685,7 @@ type T() = class end """ => [] -[] +[] let ``auto open module opened before enclosing one is handled correctly``() = """ module M = @@ -703,7 +700,7 @@ let _ = y """ => [] -[] +[] let ``single relative open declaration opens two independent modules in different parent modules``() = """ module M = @@ -722,7 +719,7 @@ let _ = x """ => [] -[] +[] let ``C# extension methods are taken into account``() = """ open System.Linq @@ -733,7 +730,7 @@ module Test = """ => [] -[] +[] let ``namespace which contains types with C# extension methods is marked as unused if no extension is used``() = """ open System.Linq @@ -743,7 +740,7 @@ module Test = """ => [ 2, (5, 16) ] -[] +[] let ``a type from an auto open module is taken into account``() = """ module M1 = @@ -757,7 +754,7 @@ module M2 = """ => [] -[] +[] let ``unused open declaration in top level rec module``() = """ module rec TopModule @@ -767,7 +764,7 @@ let _ = DateTime.Now """ => [ 4, (5, 14) ] -[] +[] let ``unused open declaration in rec namespace``() = """ namespace rec TopNamespace @@ -778,7 +775,7 @@ module Nested = """ => [ 4, (5, 14) ] -[] +[] let ``unused inner module open declaration in rec module``() = """ module rec TopModule @@ -793,7 +790,7 @@ open Nested """ => [ 10, (5, 11) ] -[] +[] let ``used inner module open declaration in rec module``() = """ module rec TopModule @@ -810,7 +807,7 @@ let _ = f 1 """ => [] -[] +[] let ``used open C# type``() = """ open type System.Console @@ -819,7 +816,7 @@ WriteLine("Hello World") """ => [] -[] +[] let ``unused open C# type``() = """ open type System.Console @@ -828,7 +825,7 @@ printfn "%s" "Hello World" """ => [2, (10, 24)] -[] +[] let ``used open type from module``() = """ module MyModule = @@ -841,7 +838,7 @@ printfn "%A" Thing """ => [] -[] +[] let ``unused open type from module``() = """ module MyModule = diff --git a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj index f99bd68ec58..2a764378864 100644 --- a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj @@ -11,12 +11,12 @@ true true false - nunit + xunit true - + Internal.Utilities.Collections.fsi @@ -68,7 +68,7 @@ {{FSCoreVersion}} $(FSCoreVersion) - + diff --git a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs index f411cfa973e..684ae3a6c84 100644 --- a/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs +++ b/vsintegration/tests/UnitTests/Workspace/WorkspaceTests.fs @@ -19,10 +19,9 @@ open Microsoft.CodeAnalysis.Host.Mef open Microsoft.VisualStudio.LanguageServices open Microsoft.VisualStudio.Shell open VisualFSharp.UnitTests.Editor -open NUnit.Framework +open Xunit open Microsoft.VisualStudio.FSharp.Editor.CancellableTasks -[] module WorkspaceTests = let compileFileAsDll (workspace: Workspace) filePath outputFilePath = @@ -170,15 +169,15 @@ module WorkspaceTests = let doc = getDocument workspace filePath let parseResults, checkResults = doc.GetFSharpParseAndCheckResultsAsync("assertEmptyDocumentDiagnostics") |> CancellableTask.runSynchronouslyWithoutCancellation - Assert.IsEmpty(parseResults.Diagnostics) - Assert.IsEmpty(checkResults.Diagnostics) + 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.IsEmpty(parseResults.Diagnostics) - Assert.IsNotEmpty(checkResults.Diagnostics) + Assert.Empty(parseResults.Diagnostics) + Assert.NotEmpty(checkResults.Diagnostics) type TestFSharpWorkspaceProjectContext(mainProj: Project) = @@ -286,7 +285,7 @@ module WorkspaceTests = // let proj = workspace.CurrentSolution.GetProject(projInfo.Id) // new TestFSharpWorkspaceProjectContext(proj) :> IFSharpWorkspaceProjectContext -// [] +// [] // let ``Script file opened in misc files workspace will get transferred to normal workspace``() = // use workspace = createWorkspace() // use miscFilesWorkspace = createMiscFileWorkspace() @@ -306,25 +305,25 @@ module WorkspaceTests = // let projInfo = createProjectInfoWithFileOnDisk filePath // addProject miscFilesWorkspace projInfo -// Assert.IsTrue(hasDocument miscFilesWorkspace filePath) -// Assert.IsFalse(hasDocument workspace filePath) +// Assert.True(hasDocument miscFilesWorkspace filePath) +// Assert.False(hasDocument workspace filePath) -// Assert.IsFalse(isDocumentOpen miscFilesWorkspace filePath) +// Assert.False(isDocumentOpen miscFilesWorkspace filePath) // openDocument miscFilesWorkspace filePath // // Although we opened the document, it has been transferred to the other workspace. -// Assert.IsFalse(hasDocument miscFilesWorkspace filePath) -// Assert.IsTrue(hasDocument workspace filePath) +// Assert.False(hasDocument miscFilesWorkspace filePath) +// Assert.True(hasDocument workspace filePath) // // Should not be automatically opened when transferred. -// Assert.IsFalse(isDocumentOpen workspace filePath) +// Assert.False(isDocumentOpen workspace filePath) // assertEmptyDocumentDiagnostics workspace filePath // finally // try File.Delete(filePath) with | _ -> () -// [] +// [] // let ``Script file referencing another script should have no diagnostics``() = // use workspace = createWorkspace() // use miscFilesWorkspace = createMiscFileWorkspace() @@ -359,7 +358,7 @@ module WorkspaceTests = // try File.Delete(filePath1) with | _ -> () // try File.Delete(filePath2) with | _ -> () -// [] +// [] // let ``Script file referencing another script will correctly update when the referenced script file changes``() = // use workspace = createWorkspace() // use miscFilesWorkspace = createMiscFileWorkspace() @@ -408,7 +407,7 @@ module WorkspaceTests = // try File.Delete(filePath1) with | _ -> () // try File.Delete(filePath2) with | _ -> () -// [] +// [] // let ``Script file referencing another script will correctly update when the referenced script file changes with opening in reverse order``() = // use workspace = createWorkspace() // use miscFilesWorkspace = createMiscFileWorkspace() @@ -457,7 +456,7 @@ module WorkspaceTests = // try File.Delete(filePath1) with | _ -> () // try File.Delete(filePath2) with | _ -> () -// [] +// [] // let ``Script file referencing a DLL will correctly update when the referenced DLL file changes``() = // use workspace = createWorkspace() // use miscFilesWorkspace = createMiscFileWorkspace() diff --git a/vsintegration/tests/UnitTests/app.runsettings b/vsintegration/tests/UnitTests/app.runsettings deleted file mode 100644 index 009d9b69776..00000000000 --- a/vsintegration/tests/UnitTests/app.runsettings +++ /dev/null @@ -1,8 +0,0 @@ - - - - - 1 - - - diff --git a/vsintegration/tests/UnitTests/xunit.runner.json b/vsintegration/tests/UnitTests/xunit.runner.json new file mode 100644 index 00000000000..dc9bc36c8a8 --- /dev/null +++ b/vsintegration/tests/UnitTests/xunit.runner.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://xunit.net/schema/current/xunit.runner.schema.json", + "shadowCopy": false, + "maxParallelThreads": 1 +} \ No newline at end of file