From d380a0ef9e785467c9b29dd32784ee21e71757f0 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Wed, 18 Jan 2017 16:24:39 +0300 Subject: [PATCH 001/286] substitute 'nameof()` with `Conts()` --- src/fsharp/TypeChecker.fs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 614ca668d8..952e4c3b56 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8271,6 +8271,17 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( | SynExpr.CompExpr (false,_isNotNakedRefCell,comp,_m) -> let bodyOfCompExpr,tpenv = TcComputationOrSequenceExpression cenv env overallTy mFunExpr (Some(expr.Expr,exprty)) tpenv comp TcDelayed cenv overallTy env tpenv mExprAndArg (MakeApplicableExprNoFlex cenv bodyOfCompExpr) (tyOfExpr cenv.g bodyOfCompExpr) ExprAtomicFlag.NonAtomic delayed + | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) when not (isNil idents) -> + match expr with + // `nameof` operator + | ApplicableExpr (_, Expr.App(Expr.Const(Const.String("nameof"), _, _), _, _, _, _), _) -> // no idea really what shape we should match on here, will check in debugger + let argIdent = List.last idents + let r = expr.Range + // generate fake `range` for the constant the `nameof(..)` we are substituting + let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + argIdent.idText.Length + 2)) // `2` are for quotes + TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(argIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed + | _ -> + error (NotAFunction(denv,overallTy,mFunExpr,mArg)) | _ -> error (NotAFunction(denv,overallTy,mFunExpr,mArg)) From 223d3137188d5c184c1be2c7640233183f447181 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Wed, 18 Jan 2017 16:42:58 +0300 Subject: [PATCH 002/286] Implementing basic nameof and typenameof operators Conflicts: src/fsharp/FSComp.txt src/fsharp/FSharp.Core.Unittests/SurfaceArea.Silverlight.2.0.fs src/fsharp/FSharp.Core.Unittests/SurfaceArea.net20.fs src/fsharp/PostInferenceChecks.fs src/fsharp/TastOps.fs src/fsharp/TcGlobals.fs --- src/fsharp/FSComp.txt | 4 +- .../FSharp.Core.Unittests.fsproj | 1 + .../Microsoft.FSharp.Core/NameOfTests.fs | 248 ++++++++++++++++++ .../SurfaceArea.net40.fs | 2 + .../SurfaceArea.portable259.fs | 2 + .../SurfaceArea.portable47.fs | 2 + .../SurfaceArea.portable7.fs | 2 + .../SurfaceArea.portable78.fs | 2 + src/fsharp/FSharp.Core/prim-types.fs | 6 + src/fsharp/FSharp.Core/prim-types.fsi | 9 + src/fsharp/Optimizer.fs | 33 ++- src/fsharp/PostInferenceChecks.fs | 35 ++- src/fsharp/PostInferenceChecks.fsi | 1 + src/fsharp/TastOps.fs | 12 + src/fsharp/TastOps.fsi | 1 + src/fsharp/TcGlobals.fs | 10 + .../NameOf/E_NameOfAdditionExpr.fs | 7 + .../NameOf/E_NameOfAppliedFunction.fs | 8 + .../NameOf/E_NameOfAsAFunction.fs | 7 + .../NameOf/E_NameOfDictLookup.fs | 8 + .../NameOf/E_NameOfIntConst.fs | 7 + .../NameOf/E_NameOfIntegerAppliedFunction.fs | 8 + .../E_NameOfParameterAppliedFunction.fs | 9 + .../E_NameOfPartiallyAppliedFunction.fs | 8 + .../NameOf/E_NameOfStringConst.fs | 7 + .../NameOf/E_NameOfWithPipe.fs | 7 + .../DataExpressions/NameOf/env.lst | 10 + tests/fsharpqa/Source/test.lst | 1 + 28 files changed, 453 insertions(+), 4 deletions(-) create mode 100644 src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 32412f95c2..bb4f3ebfbb 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1332,4 +1332,6 @@ tcTupleStructMismatch,"One tuple type is a struct tuple, the other is a referenc 3211,DefaultParameterValueNotAppropriateForArgument,"The default value does not have the same type as the argument. The DefaultParameterValue attribute and any Optional attribute will be ignored. Note: 'null' needs to be annotated with the correct type, e.g. 'DefaultParameterValue(null:obj)'." tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced system DLL contained this type" 3213,typrelMemberHasMultiplePossibleDispatchSlots,"The member '%s' matches multiple overloads of the same method.\nPlease restrict it to one of the following:%s." -3214,methodIsNotStatic,"Method or object constructor '%s' is not static" \ No newline at end of file +3214,methodIsNotStatic,"Method or object constructor '%s' is not static" +3215,expressionHasNoName,"This expression does not have a name." +3216,nameofNotPermitted,"The nameof operator is not allowed in this position." diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj b/src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj index 278c681eb3..cbd6958adc 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core.Unittests.fsproj @@ -111,6 +111,7 @@ + diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs new file mode 100644 index 0000000000..1c82fc8ef0 --- /dev/null +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace FSharp.Core.Unittests +open System +open NUnit.Framework + +[] +type BasicNameOfTests() = + let localConstant = 23 + member this.MemberMethod() = 0 + member this.MemberProperty = this.MemberMethod() + static member StaticMethod() = 0 + static member StaticProperty = BasicNameOfTests.StaticMethod() + + [] + member this.``local variable name lookup`` () = + let a = 0 + let result = nameof a + Assert.AreEqual("a",result) + Assert.AreEqual("result",nameof result) + + [] + member this.``local int function name`` () = + let myFunction x = 0 * x + let b = nameof myFunction + Assert.AreEqual("myFunction",b) + + [] + member this.``local curried function name`` () = + let curriedFunction x y = x * y + let b = nameof curriedFunction + Assert.AreEqual("curriedFunction",b) + + [] + member this.``local tupled function name`` () = + let tupledFunction(x,y) = x * y + let b = nameof tupledFunction + Assert.AreEqual("tupledFunction",b) + + [] + member this.``local unit function name`` () = + let myFunction() = 1 + let b = nameof(myFunction) + Assert.AreEqual("myFunction",b) + + [] + member this.``local function parameter name`` () = + let myFunction parameter1 = nameof parameter1 + + Assert.AreEqual("parameter1",myFunction "x") + + [] + member this.``can get name from inside a local function (needs to be let rec)`` () = + let rec myLocalFunction x = + let z = 2 * x + nameof myLocalFunction + " " + z.ToString() + + Assert.AreEqual("myLocalFunction 46",myLocalFunction 23) + Assert.AreEqual("myLocalFunction 50",myLocalFunction 25) + + [] + member this.CanGetNameFromInsideAMember () = + let b = nameof(this.CanGetNameFromInsideAMember) + Assert.AreEqual("CanGetNameFromInsideAMember",b) + + [] + member this.``member function name`` () = + let b = nameof(this.MemberMethod) + Assert.AreEqual("MemberMethod",b) + + [] + member this.``member function which is defined below`` () = + let b = nameof(this.MemberMethodDefinedBelow) + Assert.AreEqual("MemberMethodDefinedBelow",b) + + member this.MemberMethodDefinedBelow(x,y) = x * y + + [] + member this.``static member function name`` () = + let b = nameof(BasicNameOfTests.StaticMethod) + Assert.AreEqual("StaticMethod",b) + + [] + member this.``class member lookup`` () = + let b = nameof(localConstant) + Assert.AreEqual("localConstant",b) + + [] + member this.``member property name`` () = + let b = nameof(this.MemberProperty) + Assert.AreEqual("MemberProperty",b) + + [] + member this.``static property name`` () = + let b = nameof(BasicNameOfTests.StaticProperty) + Assert.AreEqual("StaticProperty",b) + + member this.get_XYZ() = 1 + + [] + member this.``member method starting with get_`` () = + let b = nameof(this.get_XYZ) + Assert.AreEqual("get_XYZ",b) + + static member get_SXYZ() = 1 + + [] + member this.``static method starting with get_`` () = + let b = nameof(BasicNameOfTests.get_SXYZ) + Assert.AreEqual("get_SXYZ",b) + + [] + member this.``nameof local property with encapsulated name`` () = + let ``local property with encapsulated name and %.f`` = 0 + let b = nameof(``local property with encapsulated name and %.f``) + Assert.AreEqual("local property with encapsulated name and %.f",b) + +[] +type MethodGroupTests() = + member this.MethodGroup() = () + member this.MethodGroup(i:int) = () + + [] + member this.``method group name lookup`` () = + let b = nameof(this.MethodGroup) + Assert.AreEqual("MethodGroup",b) + +[] +type FrameworkMethodTests() = + [] + member this.``library function name`` () = + let b = nameof(List.map) + Assert.AreEqual("Map",b) + + [] + member this.``static class function name`` () = + let b = nameof(Tuple.Create) + Assert.AreEqual("Create",b) + +type CustomUnionType = +| OptionA of string +| OptionB of int * string + +[] +type NameOfOperatorForTypes() = + [] + member this.``use typenameof on Int32`` () = + let b = typenameof + Assert.AreEqual("System.Int32",b) + + [] + member this.``use typenameof on a custom type`` () = + let b = typenameof + Assert.AreEqual("FSharp.Core.Unittests.NameOfOperatorForTypes",b) + + [] + member this.``use typenameof on a custom union type`` () = + let b = typenameof + Assert.AreEqual("FSharp.Core.Unittests.CustomUnionType",b) +// +// [] +// member this.``use typenameof on a custom union case`` () = +// let b = typenameof +// Assert.AreEqual("FSharp.Core.Unittests.CustomUnionType.OptionB",b) + + [] + member this.``use typenameof on List`` () = + let b = typenameof> + Assert.AreEqual("System.Collections.Generic.List`1",b) + + [] + member this.``use typenameof on generic List`` () = + let b = typenameof> + Assert.AreEqual("System.Collections.Generic.List`1",b) + + + +[] +type OperatorNameTests() = + + [] + member this.``lookup name of typeof operator`` () = + let b = nameof(typeof) + Assert.AreEqual("TypeOf",b) + + [] + member this.``lookup name of + operator`` () = + let b = nameof(+) + Assert.AreEqual("op_Addition",b) + + [] + member this.``lookup name of |> operator`` () = + let a = nameof(|>) + Assert.AreEqual("op_PipeRight",a) + let b = nameof(op_PipeRight) + Assert.AreEqual("op_PipeRight",b) + + [] + member this.``lookup name of nameof operator`` () = + let b = nameof(nameof) + Assert.AreEqual("NameOf",b) + +[] +type PatternMatchingOfOperatorNameTests() = + member this.Method1(i:int) = () + + [] + member this.``use it as a match case guard`` () = + match "Method1" with + | x when x = nameof(this.Method1) -> () + | _ -> Assert.Fail("not expected") + +[] +type NameOfOperatorInQuotations() = + [] + member this.``use it in a quotation`` () = + let q = + <@ + let f(x:int) = nameof x + f 20 + @> + () + +[] +type NameOfOperatorForGenerics() = + [] + member this.``use it in a generic function`` () = + let fullyGeneric x = x + let b = nameof(fullyGeneric) + Assert.AreEqual("fullyGeneric",b) + +[] +type UserDefinedNameOfTests() = + [] + member this.``userdefined nameof should shadow the operator`` () = + let nameof x = "test" + x.ToString() + + let y = nameof 1 + Assert.AreEqual("test1",y) + +type Person = + { Name : string + Age : int } + member __.Update(fld : string, value : obj) = + match fld with + | x when x = nameof __.Name -> { __ with Name = string value } + | x when x = nameof __.Age -> { __ with Age = value :?> int } + | _ -> __ \ No newline at end of file diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs index bacb36eb34..d5a9e905f8 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs @@ -2632,8 +2632,10 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" +Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) +Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]() Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue]) Microsoft.FSharp.Core.Operators: System.Type GetType() diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs index cf8156e3fc..b618478397 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs @@ -2604,8 +2604,10 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" +Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) +Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]() Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue]) Microsoft.FSharp.Core.Operators: System.Type GetType() diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs index 01a15aff35..8078e44f42 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs @@ -2606,8 +2606,10 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" +Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) +Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]() Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue]) Microsoft.FSharp.Core.Operators: System.Type GetType() diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs index 7c003fea40..a3db8830ef 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs @@ -2617,8 +2617,10 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" +Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) +Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]() Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue]) Microsoft.FSharp.Core.Operators: System.Type GetType() diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs index 4f1d01c64b..799616f508 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs @@ -2604,8 +2604,10 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" +Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) +Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]() Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue]) Microsoft.FSharp.Core.Operators: System.Type GetType() diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 9fcc440268..4feb09cf01 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -4748,6 +4748,12 @@ namespace Microsoft.FSharp.Core [] let inline typeof<'T> = BasicInlinedOperations.typeof<'T> + [] + let inline typenameof<'T> : string = raise (Exception "may not call directly, should always be optimized away") + + [] + let inline nameof (_: 'T) : string = raise (Exception "may not call directly, should always be optimized away") + [] let methodhandleof (_call: ('T -> 'TResult)) : System.RuntimeMethodHandle = raise (Exception "may not call directly, should always be optimized away") diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index c943999a09..077dbd49e3 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -2320,6 +2320,15 @@ namespace Microsoft.FSharp.Core [] val inline typeof<'T> : System.Type + /// Returns the name of the given static type. + [] + [] + val inline typenameof<'T> : string + + /// Returns the name of the given symbol. + [] + val inline nameof : 'T -> string + /// An internal, library-only compiler intrinsic for compile-time /// generation of a RuntimeMethodHandle. [] diff --git a/src/fsharp/Optimizer.fs b/src/fsharp/Optimizer.fs index ee2c88c1b0..e237c02df2 100644 --- a/src/fsharp/Optimizer.fs +++ b/src/fsharp/Optimizer.fs @@ -1185,7 +1185,7 @@ let AbstractAndRemapModulInfo msg g m (repackage,hidden) info = info //------------------------------------------------------------------------- -// Misc helerps +// Misc helpers //------------------------------------------------------------------------- // Mark some variables (the ones we introduce via abstractBigTargets) as don't-eliminate @@ -2501,6 +2501,37 @@ and TryDevirtualizeApplication cenv env (f,tyargs,args,m) = MightMakeCriticalTailcall = false Info=UnknownValue}) + // Analyze the name of the given symbol and rewrite AST to constant string expression with the name + | Expr.Val(vref,_,_),_,_ when valRefEq cenv.g vref cenv.g.nameof_vref -> + PostTypeCheckSemanticChecks.tryExtractNameOf args + |> Option.map (fun name -> + Expr.Const(Const.String name, m, cenv.g.string_ty), + { TotalSize = 1 + FunctionSize = 1 + HasEffect = false + MightMakeCriticalTailcall = false + Info = UnknownValue }) + // Analyze the name of the given type and rewrite AST to constant string expression with the name + | Expr.Val(vref,_,_),_,_ when valRefEq cenv.g vref cenv.g.typenameof_vref -> + match tyargs with + | (typeName:TType):: _ -> + let name = + match typeName with + | TType_forall (_tps,ty) -> ty.ToString() + | TType_app (tcref, _) -> tcref.CompiledRepresentationForNamedType.FullName + | TType_tuple tinst -> "(" + String.concat "," (List.map string tinst) + ")" + | TType_fun (d,r) -> "(" + string d + " -> " + string r + ")" + | TType_ucase (uc,_) -> uc.CaseName + | TType_var tp -> tp.DisplayName + | TType_measure ms -> sprintf "%A" ms + + Some(Expr.Const(Const.String name, m, cenv.g.string_ty), + { TotalSize = 1 + FunctionSize = 1 + HasEffect = false + MightMakeCriticalTailcall = false + Info = UnknownValue }) + | _ -> None | _ -> None /// Attempt to inline an application of a known value at callsites diff --git a/src/fsharp/PostInferenceChecks.fs b/src/fsharp/PostInferenceChecks.fs index 0eb6936f0e..f2dbcd6b8a 100644 --- a/src/fsharp/PostInferenceChecks.fs +++ b/src/fsharp/PostInferenceChecks.fs @@ -507,6 +507,27 @@ let CheckMultipleInterfaceInstantiations cenv interfaces m = let rec CheckExprNoByrefs (cenv:cenv) (env:env) expr = CheckExpr cenv env expr NoByrefs +// tries to extract the name of an expression +let tryExtractNameOf args = + match args with + | [Expr.App(Expr.Val(r,_,_),_,_,Expr.Const(constant,_,_)::_,_)] -> + if r.CompiledName.StartsWith("get_") && constant = Const.Unit then // TODO: We need a better way to find static property getters + Some(r.CompiledName.Substring(4)) + else + None // the function was applied + | [Expr.App(Expr.Val(r,_,_),_,_,[],_)] -> Some(r.CompiledName) + | [Expr.App(Expr.Val(r,_,_),_,_,_,_)] -> + if r.CompiledName.StartsWith("get_") then // TODO: We need a better way to find member property getters + Some(r.CompiledName.Substring(4)) + else + None // the function was applied + | [Expr.Let(_,Expr.Val(r,_,_),_,_)] -> Some(r.CompiledName) + | [Expr.Let(_,Expr.Lambda(_,_,_,_,Expr.App(Expr.Val(r,_,_),_,_,_,_),_,_),_,_)] -> Some(r.CompiledName) + | [Expr.Lambda(_,_,_,_,Expr.App(Expr.Val(r,_,_),_,_,_,_),_,_)] -> Some(r.CompiledName) + | [Expr.Op(TOp.ValFieldGet(r),_,_,_)] -> Some(r.FieldName) + | [Expr.Lambda(_,_,_,_,Expr.Op(TOp.ILCall(_,_,_,_,_,_,_,r,_,_,_),_,_,_),_,_)] -> Some(r.Name) + | _ -> None + /// Check a value and CheckVal (cenv:cenv) (env:env) v m context = if cenv.reportErrors then @@ -536,8 +557,18 @@ and CheckExpr (cenv:cenv) (env:env) expr (context:ByrefContext) = CheckExpr cenv env body context | Expr.Const (_,m,ty) -> - CheckTypePermitByrefs cenv env m ty - + CheckTypePermitByrefs cenv env m ty + + | Expr.App(Expr.Val (v,_,_),_,_,args,m) -> + if cenv.reportErrors then + if valRefEq cenv.g v cenv.g.nameof_vref && tryExtractNameOf args = None then + errorR(Error(FSComp.SR.expressionHasNoName(), m)) + match args with + | [_;Expr.App(Expr.Val (v,_,_),_,_,args,m)] -> + if valRefEq cenv.g v cenv.g.nameof_vref && tryExtractNameOf args = None then + errorR(Error(FSComp.SR.nameofNotPermitted(), m)) + | _ -> () + | Expr.Val (v,vFlags,m) -> if cenv.reportErrors then if v.BaseOrThisInfo = BaseVal then diff --git a/src/fsharp/PostInferenceChecks.fsi b/src/fsharp/PostInferenceChecks.fsi index b647dd2cc0..e25cfed7f9 100644 --- a/src/fsharp/PostInferenceChecks.fsi +++ b/src/fsharp/PostInferenceChecks.fsi @@ -10,3 +10,4 @@ open Microsoft.FSharp.Compiler.InfoReader val testFlagMemberBody : bool ref val CheckTopImpl : TcGlobals * Import.ImportMap * bool * InfoReader * Tast.CompilationPath list * Tast.CcuThunk * Tastops.DisplayEnv * Tast.ModuleOrNamespaceExprWithSig * Tast.Attribs * (bool * bool) -> bool +val tryExtractNameOf : Microsoft.FSharp.Compiler.Tast.Expr list -> string option diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index f7d91a6f6d..c6d779165e 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -2879,6 +2879,11 @@ let isTypeOfValRef g vref = // There is an internal version of typeof defined in prim-types.fs that needs to be detected || (g.compilingFslib && vref.LogicalName = "typeof") +let isTypeNameOfValRef g vref = + valRefEq g vref g.typenameof_vref + // There is an internal version of typenameof defined in prim-types.fs that needs to be detected + || (g.compilingFslib && vref.LogicalName = "typenameof") + let isSizeOfValRef g vref = valRefEq g vref g.sizeof_vref // There is an internal version of typeof defined in prim-types.fs that needs to be detected @@ -2899,6 +2904,11 @@ let (|TypeOfExpr|_|) g expr = | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isTypeOfValRef g vref -> Some ty | _ -> None +let (|TypeNameOfExpr|_|) g expr = + match expr with + | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isTypeNameOfValRef g vref -> Some ty + | _ -> None + let (|SizeOfExpr|_|) g expr = match expr with | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isSizeOfValRef g vref -> Some ty @@ -6079,6 +6089,7 @@ let mkCallUnboxFast (g:TcGlobals) m ty e1 = mkApps g (typedExprFor let mkCallTypeTest (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.istype_info, [[ty]], [ e1 ], m) let mkCallTypeOf (g:TcGlobals) m ty = mkApps g (typedExprForIntrinsic g m g.typeof_info, [[ty]], [ ], m) let mkCallTypeDefOf (g:TcGlobals) m ty = mkApps g (typedExprForIntrinsic g m g.typedefof_info, [[ty]], [ ], m) +let mkCallTypeNameOf g m ty = mkApps g (typedExprForIntrinsic g m g.typenameof_info, [[ty]], [ ], m) let mkCallDispose (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.dispose_info, [[ty]], [ e1 ], m) @@ -7740,6 +7751,7 @@ let IsSimpleSyntacticConstantExpr g inputExpr = | Expr.Op (TOp.UnionCase _,_,[],_) // Nullary union cases | UncheckedDefaultOfExpr g _ | SizeOfExpr g _ + | TypeNameOfExpr g _ | TypeOfExpr g _ -> true // All others are not simple constant expressions | _ -> false diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 4ce0aab7a1..eafd901920 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -1179,6 +1179,7 @@ val mkCallTypeTest : TcGlobals -> range -> TType -> Expr -> Expr val canUseTypeTestFast : TcGlobals -> TType -> bool val mkCallTypeOf : TcGlobals -> range -> TType -> Expr +val mkCallTypeNameOf : TcGlobals -> range -> TType -> Expr val mkCallTypeDefOf : TcGlobals -> range -> TType -> Expr val mkCallCreateInstance : TcGlobals -> range -> TType -> Expr diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 44a70385f8..3303093ae1 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -162,6 +162,10 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d // The helper to find system types amongst referenced DLLs tryFindSysTypeCcu, emitDebugInfoInQuotations: bool, usesMscorlib: bool, noDebugData: bool) = + nameof_info : IntrinsicValRef + nameof_vref : ValRef + typenameof_info : IntrinsicValRef + typenameof_vref : ValRef let vara = NewRigidTypar "a" envRange let varb = NewRigidTypar "b" envRange @@ -569,6 +573,8 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_typeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typeof" , None , Some "TypeOf" , [vara], ([], v_system_Type_typ)) let v_methodhandleof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "methodhandleof" , None , Some "MethodHandleOf", [vara;varb], ([[varaTy --> varbTy]], v_system_RuntimeMethodHandle_typ)) let v_sizeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "sizeof" , None , Some "SizeOf" , [vara], ([], v_int_ty)) + let typenameof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typenameof" ,None ,Some "TypeNameOf" ,[vara], ([],string_ty)) + let nameof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "nameof" ,None ,Some "NameOf" ,[vara], ([[varaTy]],string_ty)) let v_unchecked_defaultof_info = makeIntrinsicValRef(fslib_MFOperatorsUnchecked_nleref, "defaultof" , None , Some "DefaultOf", [vara], ([], varaTy)) let v_typedefof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typedefof" , None , Some "TypeDefOf", [vara], ([], v_system_Type_typ)) let v_enum_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "enum" , None , Some "ToEnum" , [vara], ([[v_int_ty]], varaTy)) @@ -910,6 +916,10 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val system_MarshalByRefObject_typ = tryMkSysNonGenericTy sys "MarshalByRefObject" member __.system_Reflection_MethodInfo_typ = v_system_Reflection_MethodInfo_typ + nameof_info = nameof_info + nameof_vref = ValRefForIntrinsic nameof_info + typenameof_info = typenameof_info + typenameof_vref = ValRefForIntrinsic typenameof_info member val system_Array_tcref = findSysTyconRef sys "Array" member val system_Object_tcref = findSysTyconRef sys "Object" diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs new file mode 100644 index 0000000000..64c41f78e3 --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs @@ -0,0 +1,7 @@ +// #Regression #Conformance #DataExpressions +// Verify that nameof doesn't work on const string +//This expression does not have a name. + +let x = nameof(1+2) + +exit 0 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs new file mode 100644 index 0000000000..3a812478a8 --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs @@ -0,0 +1,8 @@ +// #Regression #Conformance #DataExpressions +// Verify that nameof doesn't work on applied functions +//This expression does not have a name. + +let f() = 1 +let x = nameof(f()) + +exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs new file mode 100644 index 0000000000..6411781236 --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs @@ -0,0 +1,7 @@ +// #Regression #Conformance #DataExpressions +// Verify that nameof can't be used as a function. +//This expression does not have a name. + +let f = nameof + +exit 0 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs new file mode 100644 index 0000000000..ff9915209f --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs @@ -0,0 +1,8 @@ +// #Regression #Conformance #DataExpressions +// Verify that nameof doesn't work on dictionary lookup +//This expression does not have a name. + +let dict = new System.Collections.Generic.Dictionary() +let b = nameof(dict.[2]) + +exit 0 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs new file mode 100644 index 0000000000..89aa6ae3b1 --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs @@ -0,0 +1,7 @@ +// #Regression #Conformance #DataExpressions +// Verify that nameof doesn't work on const int +//This expression does not have a name. + +let x = nameof 1 + +exit 0 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs new file mode 100644 index 0000000000..099ed0ad53 --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs @@ -0,0 +1,8 @@ +// #Regression #Conformance #DataExpressions +// Verify that nameof doesn't work on applied functions +//This expression does not have a name. + +let f x = 1 * x +let x = nameof(f 2) + +exit 0 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs new file mode 100644 index 0000000000..ad3f9772eb --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs @@ -0,0 +1,9 @@ +// #Regression #Conformance #DataExpressions +// Verify that nameof doesn't work on applied functions +//This expression does not have a name. + +let f x y = x y +let z x = 1 * x +let b = nameof(f z 1) + +exit 0 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs new file mode 100644 index 0000000000..3aa6244c07 --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs @@ -0,0 +1,8 @@ +// #Regression #Conformance #DataExpressions +// Verify that nameof doesn't work on partially applied functions +//This expression does not have a name. + +let f x y = y * x +let x = nameof(f 2) + +exit 0 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs new file mode 100644 index 0000000000..b225f8ea62 --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs @@ -0,0 +1,7 @@ +// #Regression #Conformance #DataExpressions +// Verify that nameof doesn't work on const string +//This expression does not have a name. + +let x = nameof "string" + +exit 0 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs new file mode 100644 index 0000000000..7973767fbc --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs @@ -0,0 +1,7 @@ +// #Regression #Conformance #DataExpressions +// Verify that nameof can't be used as a function. +//The nameof operator is not allowed in this position. + +let curriedFunction x y = x * y +let b = curriedFunction |> nameof +exit 0 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst new file mode 100644 index 0000000000..4b62ea892e --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst @@ -0,0 +1,10 @@ + SOURCE=E_NameOfIntConst.fs # E_NameOfIntConst.fs + SOURCE=E_NameOfStringConst.fs # E_NameOfStringConst.fs + SOURCE=E_NameOfAppliedFunction.fs # E_NameOfAppliedFunction.fs + SOURCE=E_NameOfIntegerAppliedFunction.fs # E_NameOfIntegerAppliedFunction.fs + SOURCE=E_NameOfPartiallyAppliedFunction.fs # E_NameOfPartiallyAppliedFunction.fs + SOURCE=E_NameOfDictLookup.fs # E_NameOfDictLookup.fs + SOURCE=E_NameOfAdditionExpr.fs # E_NameOfAdditionExpr.fs + SOURCE=E_NameOfParameterAppliedFunction.fs # E_NameOfParameterAppliedFunction.fs + SOURCE=E_NameOfAsAFunction.fs # E_NameOfAsAFunction.fs + SOURCE=E_NameOfWithPipe.fs # E_NameOfWithPipe.fs diff --git a/tests/fsharpqa/Source/test.lst b/tests/fsharpqa/Source/test.lst index e7fe7ebd14..aa6480ba9a 100644 --- a/tests/fsharpqa/Source/test.lst +++ b/tests/fsharpqa/Source/test.lst @@ -238,6 +238,7 @@ Conformance08 Conformance\UnitsOfMeasure\Parenthesis Conformance08 Conformance\UnitsOfMeasure\Parsing Conformance08 Conformance\UnitsOfMeasure\TypeChecker Conformance08 Conformance\UnitsOfMeasure\WithOOP +Conformance08 Conformance\Expressions\DataExpressions\NameOf Misc01 ClrFx\PseudoCustomAttributes\AssemblyAlgorithmId Misc01 ClrFx\PseudoCustomAttributes\AssemblyConfiguration From 529cc6fd9f54abbbd98f3b5be8093c8eb873b0b4 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Wed, 18 Jan 2017 16:44:42 +0300 Subject: [PATCH 003/286] Apply feedback --- src/fsharp/Optimizer.fs | 26 +++++++++---------- src/fsharp/PostInferenceChecks.fs | 11 +++++--- .../NameOf/E_NameOfAdditionExpr.fs | 2 +- .../NameOf/E_NameOfAppliedFunction.fs | 2 +- .../NameOf/E_NameOfAsAFunction.fs | 2 +- .../NameOf/E_NameOfDictLookup.fs | 2 +- .../NameOf/E_NameOfIntConst.fs | 2 +- .../NameOf/E_NameOfIntegerAppliedFunction.fs | 2 +- .../E_NameOfParameterAppliedFunction.fs | 2 +- .../E_NameOfPartiallyAppliedFunction.fs | 2 +- .../NameOf/E_NameOfStringConst.fs | 2 +- .../NameOf/E_NameOfWithPipe.fs | 2 +- 12 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/fsharp/Optimizer.fs b/src/fsharp/Optimizer.fs index e237c02df2..6caf53216a 100644 --- a/src/fsharp/Optimizer.fs +++ b/src/fsharp/Optimizer.fs @@ -2304,8 +2304,17 @@ and DevirtualizeApplication cenv env (vref:ValRef) ty tyargs args m = let transformedExpr = wrap (MakeApplicationAndBetaReduce cenv.g (exprForValRef m vref,vref.Type,(if isNil tyargs then [] else [tyargs]),args,m)) OptimizeExpr cenv env transformedExpr - - + +and GetNameFromTypeName tcGlobals m typeName = + match stripTyEqns tcGlobals typeName with + | TType_app (tcref, _) -> tcref.CompiledRepresentationForNamedType.FullName + | TType_forall _ -> errorR(Error(FSComp.SR.expressionHasNoName(), m)); "" + | TType_tuple _ -> errorR(Error(FSComp.SR.expressionHasNoName(), m)); "" + | TType_fun _ -> errorR(Error(FSComp.SR.expressionHasNoName(), m)); "" + | TType_ucase _ -> errorR(Error(FSComp.SR.expressionHasNoName(), m)); "" + | TType_var tp -> tp.DisplayName + | TType_measure ms -> sprintf "%A" ms + and TryDevirtualizeApplication cenv env (f,tyargs,args,m) = match f,tyargs,args with @@ -2514,17 +2523,8 @@ and TryDevirtualizeApplication cenv env (f,tyargs,args,m) = // Analyze the name of the given type and rewrite AST to constant string expression with the name | Expr.Val(vref,_,_),_,_ when valRefEq cenv.g vref cenv.g.typenameof_vref -> match tyargs with - | (typeName:TType):: _ -> - let name = - match typeName with - | TType_forall (_tps,ty) -> ty.ToString() - | TType_app (tcref, _) -> tcref.CompiledRepresentationForNamedType.FullName - | TType_tuple tinst -> "(" + String.concat "," (List.map string tinst) + ")" - | TType_fun (d,r) -> "(" + string d + " -> " + string r + ")" - | TType_ucase (uc,_) -> uc.CaseName - | TType_var tp -> tp.DisplayName - | TType_measure ms -> sprintf "%A" ms - + | typeName:: _ -> + let name = GetNameFromTypeName cenv.g m typeName Some(Expr.Const(Const.String name, m, cenv.g.string_ty), { TotalSize = 1 FunctionSize = 1 diff --git a/src/fsharp/PostInferenceChecks.fs b/src/fsharp/PostInferenceChecks.fs index f2dbcd6b8a..ee16d38962 100644 --- a/src/fsharp/PostInferenceChecks.fs +++ b/src/fsharp/PostInferenceChecks.fs @@ -511,10 +511,13 @@ let rec CheckExprNoByrefs (cenv:cenv) (env:env) expr = let tryExtractNameOf args = match args with | [Expr.App(Expr.Val(r,_,_),_,_,Expr.Const(constant,_,_)::_,_)] -> - if r.CompiledName.StartsWith("get_") && constant = Const.Unit then // TODO: We need a better way to find static property getters - Some(r.CompiledName.Substring(4)) - else - None // the function was applied + match constant with + | Const.Unit -> + if r.CompiledName.StartsWith("get_") then // TODO: We need a better way to find static property getters + Some(r.CompiledName.Substring(4)) + else + None // the function was applied + | _ -> None | [Expr.App(Expr.Val(r,_,_),_,_,[],_)] -> Some(r.CompiledName) | [Expr.App(Expr.Val(r,_,_),_,_,_,_)] -> if r.CompiledName.StartsWith("get_") then // TODO: We need a better way to find member property getters diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs index 64c41f78e3..f71add7dd7 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const string -//This expression does not have a name. +//This expression does not have a name. let x = nameof(1+2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs index 3a812478a8..6663899751 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//This expression does not have a name. +//This expression does not have a name. let f() = 1 let x = nameof(f()) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs index 6411781236..f7e104cfe6 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof can't be used as a function. -//This expression does not have a name. +//This expression does not have a name. let f = nameof diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs index ff9915209f..761b23cb3e 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on dictionary lookup -//This expression does not have a name. +//This expression does not have a name. let dict = new System.Collections.Generic.Dictionary() let b = nameof(dict.[2]) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs index 89aa6ae3b1..a5144348e0 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const int -//This expression does not have a name. +//This expression does not have a name. let x = nameof 1 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs index 099ed0ad53..7fe241fe86 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//This expression does not have a name. +//This expression does not have a name. let f x = 1 * x let x = nameof(f 2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs index ad3f9772eb..5f24456195 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//This expression does not have a name. +//This expression does not have a name. let f x y = x y let z x = 1 * x diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs index 3aa6244c07..4a572a983f 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on partially applied functions -//This expression does not have a name. +//This expression does not have a name. let f x y = y * x let x = nameof(f 2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs index b225f8ea62..b30f702b1a 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const string -//This expression does not have a name. +//This expression does not have a name. let x = nameof "string" diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs index 7973767fbc..f959420f99 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof can't be used as a function. -//The nameof operator is not allowed in this position. +//The nameof operator is not allowed in this position. let curriedFunction x y = x * y let b = curriedFunction |> nameof From f3c4ba59606b081c9b9ce400c1129b00f7726276 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Wed, 18 Jan 2017 16:51:14 +0300 Subject: [PATCH 004/286] Revert "Apply feedback" This reverts commit 529cc6fd9f54abbbd98f3b5be8093c8eb873b0b4. --- src/fsharp/Optimizer.fs | 26 +++++++++++++------------- src/fsharp/PostInferenceChecks.fs | 11 ++++------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/fsharp/Optimizer.fs b/src/fsharp/Optimizer.fs index 6caf53216a..e237c02df2 100644 --- a/src/fsharp/Optimizer.fs +++ b/src/fsharp/Optimizer.fs @@ -2304,17 +2304,8 @@ and DevirtualizeApplication cenv env (vref:ValRef) ty tyargs args m = let transformedExpr = wrap (MakeApplicationAndBetaReduce cenv.g (exprForValRef m vref,vref.Type,(if isNil tyargs then [] else [tyargs]),args,m)) OptimizeExpr cenv env transformedExpr - -and GetNameFromTypeName tcGlobals m typeName = - match stripTyEqns tcGlobals typeName with - | TType_app (tcref, _) -> tcref.CompiledRepresentationForNamedType.FullName - | TType_forall _ -> errorR(Error(FSComp.SR.expressionHasNoName(), m)); "" - | TType_tuple _ -> errorR(Error(FSComp.SR.expressionHasNoName(), m)); "" - | TType_fun _ -> errorR(Error(FSComp.SR.expressionHasNoName(), m)); "" - | TType_ucase _ -> errorR(Error(FSComp.SR.expressionHasNoName(), m)); "" - | TType_var tp -> tp.DisplayName - | TType_measure ms -> sprintf "%A" ms - + + and TryDevirtualizeApplication cenv env (f,tyargs,args,m) = match f,tyargs,args with @@ -2523,8 +2514,17 @@ and TryDevirtualizeApplication cenv env (f,tyargs,args,m) = // Analyze the name of the given type and rewrite AST to constant string expression with the name | Expr.Val(vref,_,_),_,_ when valRefEq cenv.g vref cenv.g.typenameof_vref -> match tyargs with - | typeName:: _ -> - let name = GetNameFromTypeName cenv.g m typeName + | (typeName:TType):: _ -> + let name = + match typeName with + | TType_forall (_tps,ty) -> ty.ToString() + | TType_app (tcref, _) -> tcref.CompiledRepresentationForNamedType.FullName + | TType_tuple tinst -> "(" + String.concat "," (List.map string tinst) + ")" + | TType_fun (d,r) -> "(" + string d + " -> " + string r + ")" + | TType_ucase (uc,_) -> uc.CaseName + | TType_var tp -> tp.DisplayName + | TType_measure ms -> sprintf "%A" ms + Some(Expr.Const(Const.String name, m, cenv.g.string_ty), { TotalSize = 1 FunctionSize = 1 diff --git a/src/fsharp/PostInferenceChecks.fs b/src/fsharp/PostInferenceChecks.fs index ee16d38962..f2dbcd6b8a 100644 --- a/src/fsharp/PostInferenceChecks.fs +++ b/src/fsharp/PostInferenceChecks.fs @@ -511,13 +511,10 @@ let rec CheckExprNoByrefs (cenv:cenv) (env:env) expr = let tryExtractNameOf args = match args with | [Expr.App(Expr.Val(r,_,_),_,_,Expr.Const(constant,_,_)::_,_)] -> - match constant with - | Const.Unit -> - if r.CompiledName.StartsWith("get_") then // TODO: We need a better way to find static property getters - Some(r.CompiledName.Substring(4)) - else - None // the function was applied - | _ -> None + if r.CompiledName.StartsWith("get_") && constant = Const.Unit then // TODO: We need a better way to find static property getters + Some(r.CompiledName.Substring(4)) + else + None // the function was applied | [Expr.App(Expr.Val(r,_,_),_,_,[],_)] -> Some(r.CompiledName) | [Expr.App(Expr.Val(r,_,_),_,_,_,_)] -> if r.CompiledName.StartsWith("get_") then // TODO: We need a better way to find member property getters From 8fd039239c427df0c4974f8995388431f711f396 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Wed, 18 Jan 2017 16:54:38 +0300 Subject: [PATCH 005/286] Revert "Implementing basic nameof and typenameof operators" This reverts commit 223d3137188d5c184c1be2c7640233183f447181. Conflicts: tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs --- src/fsharp/FSharp.Core/prim-types.fs | 6 ----- src/fsharp/FSharp.Core/prim-types.fsi | 9 ------- src/fsharp/Optimizer.fs | 33 +------------------------ src/fsharp/PostInferenceChecks.fs | 35 ++------------------------- src/fsharp/PostInferenceChecks.fsi | 1 - src/fsharp/TastOps.fs | 12 --------- src/fsharp/TastOps.fsi | 1 - src/fsharp/TcGlobals.fs | 10 -------- 8 files changed, 3 insertions(+), 104 deletions(-) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 4feb09cf01..9fcc440268 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -4748,12 +4748,6 @@ namespace Microsoft.FSharp.Core [] let inline typeof<'T> = BasicInlinedOperations.typeof<'T> - [] - let inline typenameof<'T> : string = raise (Exception "may not call directly, should always be optimized away") - - [] - let inline nameof (_: 'T) : string = raise (Exception "may not call directly, should always be optimized away") - [] let methodhandleof (_call: ('T -> 'TResult)) : System.RuntimeMethodHandle = raise (Exception "may not call directly, should always be optimized away") diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index 077dbd49e3..c943999a09 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -2320,15 +2320,6 @@ namespace Microsoft.FSharp.Core [] val inline typeof<'T> : System.Type - /// Returns the name of the given static type. - [] - [] - val inline typenameof<'T> : string - - /// Returns the name of the given symbol. - [] - val inline nameof : 'T -> string - /// An internal, library-only compiler intrinsic for compile-time /// generation of a RuntimeMethodHandle. [] diff --git a/src/fsharp/Optimizer.fs b/src/fsharp/Optimizer.fs index e237c02df2..ee2c88c1b0 100644 --- a/src/fsharp/Optimizer.fs +++ b/src/fsharp/Optimizer.fs @@ -1185,7 +1185,7 @@ let AbstractAndRemapModulInfo msg g m (repackage,hidden) info = info //------------------------------------------------------------------------- -// Misc helpers +// Misc helerps //------------------------------------------------------------------------- // Mark some variables (the ones we introduce via abstractBigTargets) as don't-eliminate @@ -2501,37 +2501,6 @@ and TryDevirtualizeApplication cenv env (f,tyargs,args,m) = MightMakeCriticalTailcall = false Info=UnknownValue}) - // Analyze the name of the given symbol and rewrite AST to constant string expression with the name - | Expr.Val(vref,_,_),_,_ when valRefEq cenv.g vref cenv.g.nameof_vref -> - PostTypeCheckSemanticChecks.tryExtractNameOf args - |> Option.map (fun name -> - Expr.Const(Const.String name, m, cenv.g.string_ty), - { TotalSize = 1 - FunctionSize = 1 - HasEffect = false - MightMakeCriticalTailcall = false - Info = UnknownValue }) - // Analyze the name of the given type and rewrite AST to constant string expression with the name - | Expr.Val(vref,_,_),_,_ when valRefEq cenv.g vref cenv.g.typenameof_vref -> - match tyargs with - | (typeName:TType):: _ -> - let name = - match typeName with - | TType_forall (_tps,ty) -> ty.ToString() - | TType_app (tcref, _) -> tcref.CompiledRepresentationForNamedType.FullName - | TType_tuple tinst -> "(" + String.concat "," (List.map string tinst) + ")" - | TType_fun (d,r) -> "(" + string d + " -> " + string r + ")" - | TType_ucase (uc,_) -> uc.CaseName - | TType_var tp -> tp.DisplayName - | TType_measure ms -> sprintf "%A" ms - - Some(Expr.Const(Const.String name, m, cenv.g.string_ty), - { TotalSize = 1 - FunctionSize = 1 - HasEffect = false - MightMakeCriticalTailcall = false - Info = UnknownValue }) - | _ -> None | _ -> None /// Attempt to inline an application of a known value at callsites diff --git a/src/fsharp/PostInferenceChecks.fs b/src/fsharp/PostInferenceChecks.fs index f2dbcd6b8a..0eb6936f0e 100644 --- a/src/fsharp/PostInferenceChecks.fs +++ b/src/fsharp/PostInferenceChecks.fs @@ -507,27 +507,6 @@ let CheckMultipleInterfaceInstantiations cenv interfaces m = let rec CheckExprNoByrefs (cenv:cenv) (env:env) expr = CheckExpr cenv env expr NoByrefs -// tries to extract the name of an expression -let tryExtractNameOf args = - match args with - | [Expr.App(Expr.Val(r,_,_),_,_,Expr.Const(constant,_,_)::_,_)] -> - if r.CompiledName.StartsWith("get_") && constant = Const.Unit then // TODO: We need a better way to find static property getters - Some(r.CompiledName.Substring(4)) - else - None // the function was applied - | [Expr.App(Expr.Val(r,_,_),_,_,[],_)] -> Some(r.CompiledName) - | [Expr.App(Expr.Val(r,_,_),_,_,_,_)] -> - if r.CompiledName.StartsWith("get_") then // TODO: We need a better way to find member property getters - Some(r.CompiledName.Substring(4)) - else - None // the function was applied - | [Expr.Let(_,Expr.Val(r,_,_),_,_)] -> Some(r.CompiledName) - | [Expr.Let(_,Expr.Lambda(_,_,_,_,Expr.App(Expr.Val(r,_,_),_,_,_,_),_,_),_,_)] -> Some(r.CompiledName) - | [Expr.Lambda(_,_,_,_,Expr.App(Expr.Val(r,_,_),_,_,_,_),_,_)] -> Some(r.CompiledName) - | [Expr.Op(TOp.ValFieldGet(r),_,_,_)] -> Some(r.FieldName) - | [Expr.Lambda(_,_,_,_,Expr.Op(TOp.ILCall(_,_,_,_,_,_,_,r,_,_,_),_,_,_),_,_)] -> Some(r.Name) - | _ -> None - /// Check a value and CheckVal (cenv:cenv) (env:env) v m context = if cenv.reportErrors then @@ -557,18 +536,8 @@ and CheckExpr (cenv:cenv) (env:env) expr (context:ByrefContext) = CheckExpr cenv env body context | Expr.Const (_,m,ty) -> - CheckTypePermitByrefs cenv env m ty - - | Expr.App(Expr.Val (v,_,_),_,_,args,m) -> - if cenv.reportErrors then - if valRefEq cenv.g v cenv.g.nameof_vref && tryExtractNameOf args = None then - errorR(Error(FSComp.SR.expressionHasNoName(), m)) - match args with - | [_;Expr.App(Expr.Val (v,_,_),_,_,args,m)] -> - if valRefEq cenv.g v cenv.g.nameof_vref && tryExtractNameOf args = None then - errorR(Error(FSComp.SR.nameofNotPermitted(), m)) - | _ -> () - + CheckTypePermitByrefs cenv env m ty + | Expr.Val (v,vFlags,m) -> if cenv.reportErrors then if v.BaseOrThisInfo = BaseVal then diff --git a/src/fsharp/PostInferenceChecks.fsi b/src/fsharp/PostInferenceChecks.fsi index e25cfed7f9..b647dd2cc0 100644 --- a/src/fsharp/PostInferenceChecks.fsi +++ b/src/fsharp/PostInferenceChecks.fsi @@ -10,4 +10,3 @@ open Microsoft.FSharp.Compiler.InfoReader val testFlagMemberBody : bool ref val CheckTopImpl : TcGlobals * Import.ImportMap * bool * InfoReader * Tast.CompilationPath list * Tast.CcuThunk * Tastops.DisplayEnv * Tast.ModuleOrNamespaceExprWithSig * Tast.Attribs * (bool * bool) -> bool -val tryExtractNameOf : Microsoft.FSharp.Compiler.Tast.Expr list -> string option diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index c6d779165e..f7d91a6f6d 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -2879,11 +2879,6 @@ let isTypeOfValRef g vref = // There is an internal version of typeof defined in prim-types.fs that needs to be detected || (g.compilingFslib && vref.LogicalName = "typeof") -let isTypeNameOfValRef g vref = - valRefEq g vref g.typenameof_vref - // There is an internal version of typenameof defined in prim-types.fs that needs to be detected - || (g.compilingFslib && vref.LogicalName = "typenameof") - let isSizeOfValRef g vref = valRefEq g vref g.sizeof_vref // There is an internal version of typeof defined in prim-types.fs that needs to be detected @@ -2904,11 +2899,6 @@ let (|TypeOfExpr|_|) g expr = | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isTypeOfValRef g vref -> Some ty | _ -> None -let (|TypeNameOfExpr|_|) g expr = - match expr with - | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isTypeNameOfValRef g vref -> Some ty - | _ -> None - let (|SizeOfExpr|_|) g expr = match expr with | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isSizeOfValRef g vref -> Some ty @@ -6089,7 +6079,6 @@ let mkCallUnboxFast (g:TcGlobals) m ty e1 = mkApps g (typedExprFor let mkCallTypeTest (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.istype_info, [[ty]], [ e1 ], m) let mkCallTypeOf (g:TcGlobals) m ty = mkApps g (typedExprForIntrinsic g m g.typeof_info, [[ty]], [ ], m) let mkCallTypeDefOf (g:TcGlobals) m ty = mkApps g (typedExprForIntrinsic g m g.typedefof_info, [[ty]], [ ], m) -let mkCallTypeNameOf g m ty = mkApps g (typedExprForIntrinsic g m g.typenameof_info, [[ty]], [ ], m) let mkCallDispose (g:TcGlobals) m ty e1 = mkApps g (typedExprForIntrinsic g m g.dispose_info, [[ty]], [ e1 ], m) @@ -7751,7 +7740,6 @@ let IsSimpleSyntacticConstantExpr g inputExpr = | Expr.Op (TOp.UnionCase _,_,[],_) // Nullary union cases | UncheckedDefaultOfExpr g _ | SizeOfExpr g _ - | TypeNameOfExpr g _ | TypeOfExpr g _ -> true // All others are not simple constant expressions | _ -> false diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index eafd901920..4ce0aab7a1 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -1179,7 +1179,6 @@ val mkCallTypeTest : TcGlobals -> range -> TType -> Expr -> Expr val canUseTypeTestFast : TcGlobals -> TType -> bool val mkCallTypeOf : TcGlobals -> range -> TType -> Expr -val mkCallTypeNameOf : TcGlobals -> range -> TType -> Expr val mkCallTypeDefOf : TcGlobals -> range -> TType -> Expr val mkCallCreateInstance : TcGlobals -> range -> TType -> Expr diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 3303093ae1..44a70385f8 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -162,10 +162,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d // The helper to find system types amongst referenced DLLs tryFindSysTypeCcu, emitDebugInfoInQuotations: bool, usesMscorlib: bool, noDebugData: bool) = - nameof_info : IntrinsicValRef - nameof_vref : ValRef - typenameof_info : IntrinsicValRef - typenameof_vref : ValRef let vara = NewRigidTypar "a" envRange let varb = NewRigidTypar "b" envRange @@ -573,8 +569,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_typeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typeof" , None , Some "TypeOf" , [vara], ([], v_system_Type_typ)) let v_methodhandleof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "methodhandleof" , None , Some "MethodHandleOf", [vara;varb], ([[varaTy --> varbTy]], v_system_RuntimeMethodHandle_typ)) let v_sizeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "sizeof" , None , Some "SizeOf" , [vara], ([], v_int_ty)) - let typenameof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typenameof" ,None ,Some "TypeNameOf" ,[vara], ([],string_ty)) - let nameof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "nameof" ,None ,Some "NameOf" ,[vara], ([[varaTy]],string_ty)) let v_unchecked_defaultof_info = makeIntrinsicValRef(fslib_MFOperatorsUnchecked_nleref, "defaultof" , None , Some "DefaultOf", [vara], ([], varaTy)) let v_typedefof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typedefof" , None , Some "TypeDefOf", [vara], ([], v_system_Type_typ)) let v_enum_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "enum" , None , Some "ToEnum" , [vara], ([[v_int_ty]], varaTy)) @@ -916,10 +910,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val system_MarshalByRefObject_typ = tryMkSysNonGenericTy sys "MarshalByRefObject" member __.system_Reflection_MethodInfo_typ = v_system_Reflection_MethodInfo_typ - nameof_info = nameof_info - nameof_vref = ValRefForIntrinsic nameof_info - typenameof_info = typenameof_info - typenameof_vref = ValRefForIntrinsic typenameof_info member val system_Array_tcref = findSysTyconRef sys "Array" member val system_Object_tcref = findSysTyconRef sys "Object" From 77c8f779042416c99d17cb6d88cadca847690e43 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Wed, 18 Jan 2017 20:07:39 +0300 Subject: [PATCH 006/286] revert nameof and typenameof functions to FSharp.Core --- src/fsharp/FSharp.Core/prim-types.fs | 6 ++++++ src/fsharp/FSharp.Core/prim-types.fsi | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 9fcc440268..4feb09cf01 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -4748,6 +4748,12 @@ namespace Microsoft.FSharp.Core [] let inline typeof<'T> = BasicInlinedOperations.typeof<'T> + [] + let inline typenameof<'T> : string = raise (Exception "may not call directly, should always be optimized away") + + [] + let inline nameof (_: 'T) : string = raise (Exception "may not call directly, should always be optimized away") + [] let methodhandleof (_call: ('T -> 'TResult)) : System.RuntimeMethodHandle = raise (Exception "may not call directly, should always be optimized away") diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index c943999a09..a13dbdad11 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -2320,6 +2320,15 @@ namespace Microsoft.FSharp.Core [] val inline typeof<'T> : System.Type + /// Returns the name of the given static type. + [] + [] + val inline typenameof<'T> : string + + /// Returns the name of the given symbol. + [] + val inline nameof : 'T -> string + /// An internal, library-only compiler intrinsic for compile-time /// generation of a RuntimeMethodHandle. [] From 3070c1dd4718ded17b213b2d8a20ec6bd854541d Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Wed, 18 Jan 2017 22:28:16 +0300 Subject: [PATCH 007/286] wip --- src/fsharp/TastOps.fs | 18 +++++++++++++++++ src/fsharp/TcGlobals.fs | 5 +++++ src/fsharp/TypeChecker.fs | 42 ++++++++++++++++++++++++--------------- 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index f7d91a6f6d..3400b9cd1a 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -2884,6 +2884,16 @@ let isSizeOfValRef g vref = // There is an internal version of typeof defined in prim-types.fs that needs to be detected || (g.compilingFslib && vref.LogicalName = "sizeof") +let isNameOfValRef g vref = + valRefEq g vref g.nameof_vref + // There is an internal version of typeof defined in prim-types.fs that needs to be detected + || (g.compilingFslib && vref.LogicalName = "nameof") + +let isTypeNameOfValRef g vref = + valRefEq g vref g.typenameof_vref + // There is an internal version of typeof defined in prim-types.fs that needs to be detected + || (g.compilingFslib && vref.LogicalName = "typenameof") + let isTypeDefOfValRef g vref = valRefEq g vref g.typedefof_vref // There is an internal version of typedefof defined in prim-types.fs that needs to be detected @@ -2909,7 +2919,15 @@ let (|TypeDefOfExpr|_|) g expr = | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isTypeDefOfValRef g vref -> Some ty | _ -> None +let (|NameOfExpr|_|) g expr = + match expr with + | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isNameOfValRef g vref -> Some ty + | _ -> None +let (|TypeNameOfExpr|_|) g expr = + match expr with + | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isTypeNameOfValRef g vref -> Some ty + | _ -> None //-------------------------------------------------------------------------- // DEBUG layout diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 44a70385f8..6c49417edc 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -569,6 +569,9 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_typeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typeof" , None , Some "TypeOf" , [vara], ([], v_system_Type_typ)) let v_methodhandleof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "methodhandleof" , None , Some "MethodHandleOf", [vara;varb], ([[varaTy --> varbTy]], v_system_RuntimeMethodHandle_typ)) let v_sizeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "sizeof" , None , Some "SizeOf" , [vara], ([], v_int_ty)) + let v_typenameof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typenameof" , None , Some "TypeNameOf" ,[vara], ([], v_string_ty)) + let v_nameof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "nameof" , None , Some "NameOf" , [vara], ([[varaTy]], v_string_ty)) + let v_unchecked_defaultof_info = makeIntrinsicValRef(fslib_MFOperatorsUnchecked_nleref, "defaultof" , None , Some "DefaultOf", [vara], ([], varaTy)) let v_typedefof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typedefof" , None , Some "TypeDefOf", [vara], ([], v_system_Type_typ)) let v_enum_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "enum" , None , Some "ToEnum" , [vara], ([[v_int_ty]], varaTy)) @@ -1121,6 +1124,8 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val methodhandleof_vref = ValRefForIntrinsic v_methodhandleof_info member val typeof_vref = ValRefForIntrinsic v_typeof_info member val sizeof_vref = ValRefForIntrinsic v_sizeof_info + member val nameof_vref = ValRefForIntrinsic v_nameof_info + member val typenameof_vref = ValRefForIntrinsic v_typenameof_info member val typedefof_vref = ValRefForIntrinsic v_typedefof_info member val enum_vref = ValRefForIntrinsic v_enum_info member val enumOfValue_vref = ValRefForIntrinsic v_enumOfValue_info diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 952e4c3b56..23d9fee620 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8249,22 +8249,32 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( // it is an error or a computation expression match UnifyFunctionTypeUndoIfFailed cenv denv mFunExpr exprty with | Some (domainTy,resultTy) -> - - // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library. - // Set a flag in the syntax tree to say we noticed a leading 'seq' - match synArg with - | SynExpr.CompExpr (false,isNotNakedRefCell,_comp,_m) -> - isNotNakedRefCell := - !isNotNakedRefCell - || - (match expr with - | ApplicableExpr(_,Expr.Op(TOp.Coerce,_,[Expr.App(Expr.Val(vf,_,_),_,_,_,_)],_),_) when valRefEq cenv.g vf cenv.g.seq_vref -> true - | _ -> false) - | _ -> () - - let arg,tpenv = TcExpr cenv domainTy env tpenv synArg - let exprAndArg = buildApp cenv expr exprty arg mExprAndArg - TcDelayed cenv overallTy env tpenv mExprAndArg exprAndArg resultTy atomicFlag delayed + match expr, synArg with + | (ApplicableExpr(_, Expr.Val(vref,_,_), _), SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _)) + when valRefEq cenv.g vref cenv.g.nameof_vref && not (isNil idents) -> + + let argIdent = List.last idents + let r = expr.Range + // generate fake `range` for the constant the `nameof(..)` we are substituting + let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + argIdent.idText.Length + 2)) // `2` are for quotes + TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(argIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed + | _ -> + // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library. + // Set a flag in the syntax tree to say we noticed a leading 'seq' + match synArg with + | SynExpr.CompExpr (false,isNotNakedRefCell,_comp,_m) -> + isNotNakedRefCell := + !isNotNakedRefCell + || + (match expr with + | ApplicableExpr(_,Expr.Op(TOp.Coerce,_,[Expr.App(Expr.Val(vf,_,_),_,_,_,_)],_),_) when valRefEq cenv.g vf cenv.g.seq_vref -> true + | _ -> false) + | _ -> () + + let arg,tpenv = TcExpr cenv domainTy env tpenv synArg + let exprAndArg = buildApp cenv expr exprty arg mExprAndArg + TcDelayed cenv overallTy env tpenv mExprAndArg exprAndArg resultTy atomicFlag delayed + | None -> // OK, 'expr' doesn't have function type, but perhaps 'expr' is a computation expression builder, and 'arg' is '{ ... }' match synArg with From b3e712d165a1093dafa180884ca1d3d8a58bed72 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Wed, 18 Jan 2017 23:40:58 +0300 Subject: [PATCH 008/286] it works --- src/fsharp/TypeChecker.fs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 23d9fee620..d0063f987b 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8241,19 +8241,27 @@ and delayRest rest mPrior delayed = //------------------------------------------------------------------------- and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty (synArg: SynExpr) atomicFlag delayed = - let denv = env.DisplayEnv let mArg = synArg.Range let mFunExpr = expr.Range + + let (|LastIdentOfLongIdentStripPars|_|) expr = + let rec stripParens expr = + match expr with + | SynExpr.Paren(expr, _, _, _) -> stripParens expr + | _ -> expr + + match stripParens expr with + | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) -> List.tryLast idents + | _ -> None + // If the type of 'synArg' unifies as a function type, then this is a function application, otherwise // it is an error or a computation expression match UnifyFunctionTypeUndoIfFailed cenv denv mFunExpr exprty with | Some (domainTy,resultTy) -> match expr, synArg with - | (ApplicableExpr(_, Expr.Val(vref,_,_), _), SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _)) - when valRefEq cenv.g vref cenv.g.nameof_vref && not (isNil idents) -> - - let argIdent = List.last idents + | (ApplicableExpr(_, Expr.App(Expr.Val(vref,_,_),_,_,_,_), _), LastIdentOfLongIdentStripPars argIdent) + when valRefEq cenv.g vref cenv.g.nameof_vref -> let r = expr.Range // generate fake `range` for the constant the `nameof(..)` we are substituting let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + argIdent.idText.Length + 2)) // `2` are for quotes From 7832be59b5354899a35fef054256beef3a85b627 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Thu, 19 Jan 2017 10:32:59 +0300 Subject: [PATCH 009/286] refactoring --- src/fsharp/TastOps.fs | 9 +++++++-- src/fsharp/TastOps.fsi | 3 +++ src/fsharp/TypeChecker.fs | 18 +++--------------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 3400b9cd1a..ca51d51df5 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -2891,12 +2891,12 @@ let isNameOfValRef g vref = let isTypeNameOfValRef g vref = valRefEq g vref g.typenameof_vref - // There is an internal version of typeof defined in prim-types.fs that needs to be detected + // There is an internal version of namef defined in prim-types.fs that needs to be detected || (g.compilingFslib && vref.LogicalName = "typenameof") let isTypeDefOfValRef g vref = valRefEq g vref g.typedefof_vref - // There is an internal version of typedefof defined in prim-types.fs that needs to be detected + // There is an internal version of typenameof defined in prim-types.fs that needs to be detected || (g.compilingFslib && vref.LogicalName = "typedefof") let (|UncheckedDefaultOfExpr|_|) g expr = @@ -2929,6 +2929,11 @@ let (|TypeNameOfExpr|_|) g expr = | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isTypeNameOfValRef g vref -> Some ty | _ -> None +let (|SeqExpr|_|) g expr = + match expr with + | Expr.App(Expr.Val(vref,_,_),_,_,_,_) when valRefEq g vref g.seq_vref -> Some() + | _ -> None + //-------------------------------------------------------------------------- // DEBUG layout //--------------------------------------------------------------------------- diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 4ce0aab7a1..eaebc6cb90 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -1409,6 +1409,9 @@ val (|AttribBitwiseOrExpr|_|) : TcGlobals -> Expr -> (Expr * Expr) option val (|EnumExpr|_|) : TcGlobals -> Expr -> Expr option val (|TypeOfExpr|_|) : TcGlobals -> Expr -> TType option val (|TypeDefOfExpr|_|) : TcGlobals -> Expr -> TType option +val (|NameOfExpr|_|) : TcGlobals -> Expr -> TType option +val (|TypeNameOfExpr|_|) : TcGlobals -> Expr -> TType option +val (|SeqExpr|_|) : TcGlobals -> Expr -> unit option val EvalLiteralExprOrAttribArg: TcGlobals -> Expr -> Expr val EvaledAttribExprEquality : TcGlobals -> Expr -> Expr -> bool diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index d0063f987b..a8a15e8f31 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8245,7 +8245,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( let mArg = synArg.Range let mFunExpr = expr.Range - let (|LastIdentOfLongIdentStripPars|_|) expr = + let (|LastPartOfLongIdentStripParens|_|) expr = let rec stripParens expr = match expr with | SynExpr.Paren(expr, _, _, _) -> stripParens expr @@ -8260,8 +8260,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( match UnifyFunctionTypeUndoIfFailed cenv denv mFunExpr exprty with | Some (domainTy,resultTy) -> match expr, synArg with - | (ApplicableExpr(_, Expr.App(Expr.Val(vref,_,_),_,_,_,_), _), LastIdentOfLongIdentStripPars argIdent) - when valRefEq cenv.g vref cenv.g.nameof_vref -> + | (ApplicableExpr(_, NameOfExpr cenv.g _, _), LastPartOfLongIdentStripParens argIdent) -> let r = expr.Range // generate fake `range` for the constant the `nameof(..)` we are substituting let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + argIdent.idText.Length + 2)) // `2` are for quotes @@ -8275,7 +8274,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( !isNotNakedRefCell || (match expr with - | ApplicableExpr(_,Expr.Op(TOp.Coerce,_,[Expr.App(Expr.Val(vf,_,_),_,_,_,_)],_),_) when valRefEq cenv.g vf cenv.g.seq_vref -> true + | ApplicableExpr(_,Expr.Op(TOp.Coerce,_,[SeqExpr cenv.g],_),_) -> true | _ -> false) | _ -> () @@ -8289,17 +8288,6 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( | SynExpr.CompExpr (false,_isNotNakedRefCell,comp,_m) -> let bodyOfCompExpr,tpenv = TcComputationOrSequenceExpression cenv env overallTy mFunExpr (Some(expr.Expr,exprty)) tpenv comp TcDelayed cenv overallTy env tpenv mExprAndArg (MakeApplicableExprNoFlex cenv bodyOfCompExpr) (tyOfExpr cenv.g bodyOfCompExpr) ExprAtomicFlag.NonAtomic delayed - | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) when not (isNil idents) -> - match expr with - // `nameof` operator - | ApplicableExpr (_, Expr.App(Expr.Const(Const.String("nameof"), _, _), _, _, _, _), _) -> // no idea really what shape we should match on here, will check in debugger - let argIdent = List.last idents - let r = expr.Range - // generate fake `range` for the constant the `nameof(..)` we are substituting - let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + argIdent.idText.Length + 2)) // `2` are for quotes - TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(argIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed - | _ -> - error (NotAFunction(denv,overallTy,mFunExpr,mArg)) | _ -> error (NotAFunction(denv,overallTy,mFunExpr,mArg)) From 65817902474e852393f5ddcdf09a6bed0f9cd572 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Thu, 19 Jan 2017 10:52:05 +0300 Subject: [PATCH 010/286] make it work on simple `Ident`s it raises a proper error if applicated to non (Long)Ident arg --- src/fsharp/FSComp.txt | 1 + src/fsharp/TypeChecker.fs | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index bb4f3ebfbb..03f9d02edd 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1335,3 +1335,4 @@ tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced 3214,methodIsNotStatic,"Method or object constructor '%s' is not static" 3215,expressionHasNoName,"This expression does not have a name." 3216,nameofNotPermitted,"The nameof operator is not allowed in this position." +3217,wrongNameofArgument,"Only identifiers are allowed as argument for nameof operator." \ No newline at end of file diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index a8a15e8f31..cd16bfc05a 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8252,6 +8252,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( | _ -> expr match stripParens expr with + | SynExpr.Ident ident -> Some ident | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) -> List.tryLast idents | _ -> None @@ -8259,12 +8260,15 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( // it is an error or a computation expression match UnifyFunctionTypeUndoIfFailed cenv denv mFunExpr exprty with | Some (domainTy,resultTy) -> - match expr, synArg with - | (ApplicableExpr(_, NameOfExpr cenv.g _, _), LastPartOfLongIdentStripParens argIdent) -> - let r = expr.Range - // generate fake `range` for the constant the `nameof(..)` we are substituting - let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + argIdent.idText.Length + 2)) // `2` are for quotes - TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(argIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed + match expr with + | ApplicableExpr(_, NameOfExpr cenv.g _, _) -> + match synArg with + | LastPartOfLongIdentStripParens argIdent -> + let r = expr.Range + // generate fake `range` for the constant the `nameof(..)` we are substituting + let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + argIdent.idText.Length + 2)) // `2` are for quotes + TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(argIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed + | _ -> error (Error(FSComp.SR.wrongNameofArgument(), synArg.Range)) | _ -> // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library. // Set a flag in the syntax tree to say we noticed a leading 'seq' From 0f5165f6a1c7887754646e169031939ffc6487f4 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Thu, 19 Jan 2017 12:49:41 +0300 Subject: [PATCH 011/286] use proper error message --- src/fsharp/FSComp.txt | 3 +-- src/fsharp/TypeChecker.fs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 03f9d02edd..e888d00c17 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1334,5 +1334,4 @@ tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced 3213,typrelMemberHasMultiplePossibleDispatchSlots,"The member '%s' matches multiple overloads of the same method.\nPlease restrict it to one of the following:%s." 3214,methodIsNotStatic,"Method or object constructor '%s' is not static" 3215,expressionHasNoName,"This expression does not have a name." -3216,nameofNotPermitted,"The nameof operator is not allowed in this position." -3217,wrongNameofArgument,"Only identifiers are allowed as argument for nameof operator." \ No newline at end of file +3216,nameofNotPermitted,"The nameof operator is not allowed in this position." \ No newline at end of file diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index cd16bfc05a..8cb13bc1d4 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8268,7 +8268,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( // generate fake `range` for the constant the `nameof(..)` we are substituting let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + argIdent.idText.Length + 2)) // `2` are for quotes TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(argIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed - | _ -> error (Error(FSComp.SR.wrongNameofArgument(), synArg.Range)) + | _ -> error (Error(FSComp.SR.expressionHasNoName(), synArg.Range)) | _ -> // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library. // Set a flag in the syntax tree to say we noticed a leading 'seq' From 22898adc81938c9b128f6b5b61de141d62503190 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Thu, 19 Jan 2017 13:17:13 +0300 Subject: [PATCH 012/286] restrict using `nameof` operator as first class --- src/fsharp/FSComp.txt | 3 ++- src/fsharp/PostInferenceChecks.fs | 1 + src/fsharp/TastOps.fs | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index e888d00c17..ce5fa7b0eb 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1334,4 +1334,5 @@ tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced 3213,typrelMemberHasMultiplePossibleDispatchSlots,"The member '%s' matches multiple overloads of the same method.\nPlease restrict it to one of the following:%s." 3214,methodIsNotStatic,"Method or object constructor '%s' is not static" 3215,expressionHasNoName,"This expression does not have a name." -3216,nameofNotPermitted,"The nameof operator is not allowed in this position." \ No newline at end of file +3216,nameofNotPermitted,"The nameof operator is not allowed in this position." +3217,chkNoFirstClassNameOf,"First-class uses of the 'nameof' operator is not permitted" \ No newline at end of file diff --git a/src/fsharp/PostInferenceChecks.fs b/src/fsharp/PostInferenceChecks.fs index 0eb6936f0e..eed9d56f60 100644 --- a/src/fsharp/PostInferenceChecks.fs +++ b/src/fsharp/PostInferenceChecks.fs @@ -514,6 +514,7 @@ and CheckVal (cenv:cenv) (env:env) v m context = if isSpliceOperator cenv.g v then errorR(Error(FSComp.SR.chkNoFirstClassSplicing(), m)) if valRefEq cenv.g v cenv.g.addrof_vref then errorR(Error(FSComp.SR.chkNoFirstClassAddressOf(), m)) if valRefEq cenv.g v cenv.g.reraise_vref then errorR(Error(FSComp.SR.chkNoFirstClassRethrow(), m)) + if valRefEq cenv.g v cenv.g.nameof_vref then errorR(Error(FSComp.SR.chkNoFirstClassNameOf(), m)) if noByrefs context && isByrefLikeTy cenv.g v.Type then // byref typed val can only occur in permitting contexts errorR(Error(FSComp.SR.chkNoByrefAtThisPoint(v.DisplayName), m)) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index ca51d51df5..39b06fd979 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -7763,7 +7763,9 @@ let IsSimpleSyntacticConstantExpr g inputExpr = | Expr.Op (TOp.UnionCase _,_,[],_) // Nullary union cases | UncheckedDefaultOfExpr g _ | SizeOfExpr g _ - | TypeOfExpr g _ -> true + | TypeOfExpr g _ + | NameOfExpr g _ + | TypeNameOfExpr g _ -> true // All others are not simple constant expressions | _ -> false From e5033af78a949eb5ad998b9209eb8dcf9be4b78d Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Thu, 19 Jan 2017 13:50:30 +0300 Subject: [PATCH 013/286] remove `typenameof` bits --- src/fsharp/FSComp.txt | 3 +-- src/fsharp/TastOps.fs | 13 +------------ src/fsharp/TastOps.fsi | 1 - src/fsharp/TcGlobals.fs | 20 +++++++++----------- 4 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index ce5fa7b0eb..5db6809f95 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1334,5 +1334,4 @@ tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced 3213,typrelMemberHasMultiplePossibleDispatchSlots,"The member '%s' matches multiple overloads of the same method.\nPlease restrict it to one of the following:%s." 3214,methodIsNotStatic,"Method or object constructor '%s' is not static" 3215,expressionHasNoName,"This expression does not have a name." -3216,nameofNotPermitted,"The nameof operator is not allowed in this position." -3217,chkNoFirstClassNameOf,"First-class uses of the 'nameof' operator is not permitted" \ No newline at end of file +3216,chkNoFirstClassNameOf,"First-class uses of the 'nameof' operator is not permitted" \ No newline at end of file diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 39b06fd979..33c19e02cc 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -2889,11 +2889,6 @@ let isNameOfValRef g vref = // There is an internal version of typeof defined in prim-types.fs that needs to be detected || (g.compilingFslib && vref.LogicalName = "nameof") -let isTypeNameOfValRef g vref = - valRefEq g vref g.typenameof_vref - // There is an internal version of namef defined in prim-types.fs that needs to be detected - || (g.compilingFslib && vref.LogicalName = "typenameof") - let isTypeDefOfValRef g vref = valRefEq g vref g.typedefof_vref // There is an internal version of typenameof defined in prim-types.fs that needs to be detected @@ -2924,11 +2919,6 @@ let (|NameOfExpr|_|) g expr = | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isNameOfValRef g vref -> Some ty | _ -> None -let (|TypeNameOfExpr|_|) g expr = - match expr with - | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isTypeNameOfValRef g vref -> Some ty - | _ -> None - let (|SeqExpr|_|) g expr = match expr with | Expr.App(Expr.Val(vref,_,_),_,_,_,_) when valRefEq g vref g.seq_vref -> Some() @@ -7764,8 +7754,7 @@ let IsSimpleSyntacticConstantExpr g inputExpr = | UncheckedDefaultOfExpr g _ | SizeOfExpr g _ | TypeOfExpr g _ - | NameOfExpr g _ - | TypeNameOfExpr g _ -> true + | NameOfExpr g _ -> true // All others are not simple constant expressions | _ -> false diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index eaebc6cb90..a81b9b8f81 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -1410,7 +1410,6 @@ val (|EnumExpr|_|) : TcGlobals -> Expr -> Expr option val (|TypeOfExpr|_|) : TcGlobals -> Expr -> TType option val (|TypeDefOfExpr|_|) : TcGlobals -> Expr -> TType option val (|NameOfExpr|_|) : TcGlobals -> Expr -> TType option -val (|TypeNameOfExpr|_|) : TcGlobals -> Expr -> TType option val (|SeqExpr|_|) : TcGlobals -> Expr -> unit option val EvalLiteralExprOrAttribArg: TcGlobals -> Expr -> Expr diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 6c49417edc..0b2bd149c0 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -569,7 +569,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_typeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typeof" , None , Some "TypeOf" , [vara], ([], v_system_Type_typ)) let v_methodhandleof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "methodhandleof" , None , Some "MethodHandleOf", [vara;varb], ([[varaTy --> varbTy]], v_system_RuntimeMethodHandle_typ)) let v_sizeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "sizeof" , None , Some "SizeOf" , [vara], ([], v_int_ty)) - let v_typenameof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typenameof" , None , Some "TypeNameOf" ,[vara], ([], v_string_ty)) let v_nameof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "nameof" , None , Some "NameOf" , [vara], ([[varaTy]], v_string_ty)) let v_unchecked_defaultof_info = makeIntrinsicValRef(fslib_MFOperatorsUnchecked_nleref, "defaultof" , None , Some "DefaultOf", [vara], ([], varaTy)) @@ -1125,7 +1124,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val typeof_vref = ValRefForIntrinsic v_typeof_info member val sizeof_vref = ValRefForIntrinsic v_sizeof_info member val nameof_vref = ValRefForIntrinsic v_nameof_info - member val typenameof_vref = ValRefForIntrinsic v_typenameof_info member val typedefof_vref = ValRefForIntrinsic v_typedefof_info member val enum_vref = ValRefForIntrinsic v_enum_info member val enumOfValue_vref = ValRefForIntrinsic v_enumOfValue_info @@ -1152,15 +1150,15 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val unbox_fast_vref = ValRefForIntrinsic v_unbox_fast_info member val istype_vref = ValRefForIntrinsic v_istype_info member val istype_fast_vref = ValRefForIntrinsic v_istype_fast_info - member val query_source_vref = ValRefForIntrinsic v_query_source_info - member val query_value_vref = ValRefForIntrinsic v_query_value_info - member val query_run_value_vref = ValRefForIntrinsic v_query_run_value_info - member val query_run_enumerable_vref = ValRefForIntrinsic v_query_run_enumerable_info - member val query_for_vref = ValRefForIntrinsic v_query_for_value_info - member val query_yield_vref = ValRefForIntrinsic v_query_yield_value_info - member val query_yield_from_vref = ValRefForIntrinsic v_query_yield_from_value_info - member val query_select_vref = ValRefForIntrinsic v_query_select_value_info - member val query_where_vref = ValRefForIntrinsic v_query_where_value_info + member val query_source_vref = ValRefForIntrinsic v_query_source_info + member val query_value_vref = ValRefForIntrinsic v_query_value_info + member val query_run_value_vref = ValRefForIntrinsic v_query_run_value_info + member val query_run_enumerable_vref = ValRefForIntrinsic v_query_run_enumerable_info + member val query_for_vref = ValRefForIntrinsic v_query_for_value_info + member val query_yield_vref = ValRefForIntrinsic v_query_yield_value_info + member val query_yield_from_vref = ValRefForIntrinsic v_query_yield_from_value_info + member val query_select_vref = ValRefForIntrinsic v_query_select_value_info + member val query_where_vref = ValRefForIntrinsic v_query_where_value_info member val query_zero_vref = ValRefForIntrinsic v_query_zero_value_info member __.seq_collect_info = v_seq_collect_info From 1ad0a0e2ff945ce063207d93e8fe6663c67cf527 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Thu, 19 Jan 2017 17:38:04 +0300 Subject: [PATCH 014/286] nameof(typeof<_>) works remove `typenameof and its tests --- .../Microsoft.FSharp.Core/NameOfTests.fs | 40 ++----------------- src/fsharp/FSharp.Core/prim-types.fs | 3 -- src/fsharp/FSharp.Core/prim-types.fsi | 5 --- src/fsharp/TastOps.fs | 2 +- src/fsharp/TypeChecker.fs | 1 + 5 files changed, 5 insertions(+), 46 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs index 1c82fc8ef0..8b49e88d54 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs @@ -130,7 +130,7 @@ type FrameworkMethodTests() = [] member this.``library function name`` () = let b = nameof(List.map) - Assert.AreEqual("Map",b) + Assert.AreEqual("map",b) [] member this.``static class function name`` () = @@ -141,47 +141,13 @@ type CustomUnionType = | OptionA of string | OptionB of int * string -[] -type NameOfOperatorForTypes() = - [] - member this.``use typenameof on Int32`` () = - let b = typenameof - Assert.AreEqual("System.Int32",b) - - [] - member this.``use typenameof on a custom type`` () = - let b = typenameof - Assert.AreEqual("FSharp.Core.Unittests.NameOfOperatorForTypes",b) - - [] - member this.``use typenameof on a custom union type`` () = - let b = typenameof - Assert.AreEqual("FSharp.Core.Unittests.CustomUnionType",b) -// -// [] -// member this.``use typenameof on a custom union case`` () = -// let b = typenameof -// Assert.AreEqual("FSharp.Core.Unittests.CustomUnionType.OptionB",b) - - [] - member this.``use typenameof on List`` () = - let b = typenameof> - Assert.AreEqual("System.Collections.Generic.List`1",b) - - [] - member this.``use typenameof on generic List`` () = - let b = typenameof> - Assert.AreEqual("System.Collections.Generic.List`1",b) - - - [] type OperatorNameTests() = [] member this.``lookup name of typeof operator`` () = let b = nameof(typeof) - Assert.AreEqual("TypeOf",b) + Assert.AreEqual("typeof",b) [] member this.``lookup name of + operator`` () = @@ -198,7 +164,7 @@ type OperatorNameTests() = [] member this.``lookup name of nameof operator`` () = let b = nameof(nameof) - Assert.AreEqual("NameOf",b) + Assert.AreEqual("nameof",b) [] type PatternMatchingOfOperatorNameTests() = diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 4feb09cf01..fb117c41f6 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -4748,9 +4748,6 @@ namespace Microsoft.FSharp.Core [] let inline typeof<'T> = BasicInlinedOperations.typeof<'T> - [] - let inline typenameof<'T> : string = raise (Exception "may not call directly, should always be optimized away") - [] let inline nameof (_: 'T) : string = raise (Exception "may not call directly, should always be optimized away") diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index a13dbdad11..d33c4f0aca 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -2320,11 +2320,6 @@ namespace Microsoft.FSharp.Core [] val inline typeof<'T> : System.Type - /// Returns the name of the given static type. - [] - [] - val inline typenameof<'T> : string - /// Returns the name of the given symbol. [] val inline nameof : 'T -> string diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 33c19e02cc..860e42164a 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -2891,7 +2891,7 @@ let isNameOfValRef g vref = let isTypeDefOfValRef g vref = valRefEq g vref g.typedefof_vref - // There is an internal version of typenameof defined in prim-types.fs that needs to be detected + // There is an internal version of typedefof defined in prim-types.fs that needs to be detected || (g.compilingFslib && vref.LogicalName = "typedefof") let (|UncheckedDefaultOfExpr|_|) g expr = diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 8cb13bc1d4..cdcc024774 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8253,6 +8253,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( match stripParens expr with | SynExpr.Ident ident -> Some ident + | SynExpr.TypeApp(expr = SynExpr.Ident(ident)) -> Some ident | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) -> List.tryLast idents | _ -> None From 56577597f7178414a277ff51a887d0f890e8d2fc Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Sat, 28 Jan 2017 16:55:22 +0300 Subject: [PATCH 015/286] fix QA tests --- src/fsharp/FSComp.txt | 2 +- src/fsharp/TypeChecker.fs | 2 +- .../Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs | 2 +- .../DataExpressions/NameOf/E_NameOfAppliedFunction.fs | 2 +- .../Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs | 2 +- .../Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs | 2 +- .../Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs | 2 +- .../DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs | 2 +- .../DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs | 2 +- .../DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs | 2 +- .../Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs | 2 +- .../Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 5db6809f95..4a51a5d9ee 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1334,4 +1334,4 @@ tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced 3213,typrelMemberHasMultiplePossibleDispatchSlots,"The member '%s' matches multiple overloads of the same method.\nPlease restrict it to one of the following:%s." 3214,methodIsNotStatic,"Method or object constructor '%s' is not static" 3215,expressionHasNoName,"This expression does not have a name." -3216,chkNoFirstClassNameOf,"First-class uses of the 'nameof' operator is not permitted" \ No newline at end of file +3216,chkNoFirstClassNameOf,"First-class uses of the 'nameof' operator is not permitted." \ No newline at end of file diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index cdcc024774..cb9bfe277e 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8269,7 +8269,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( // generate fake `range` for the constant the `nameof(..)` we are substituting let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + argIdent.idText.Length + 2)) // `2` are for quotes TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(argIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed - | _ -> error (Error(FSComp.SR.expressionHasNoName(), synArg.Range)) + | _ -> error (Error(FSComp.SR.expressionHasNoName(), expr.Range)) | _ -> // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library. // Set a flag in the syntax tree to say we noticed a leading 'seq' diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs index f71add7dd7..f1405cf7a0 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const string -//This expression does not have a name. +//This expression does not have a name. let x = nameof(1+2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs index 6663899751..8e9efc6a51 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//This expression does not have a name. +//This expression does not have a name. let f() = 1 let x = nameof(f()) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs index f7e104cfe6..76acc5a4bb 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof can't be used as a function. -//This expression does not have a name. +//First-class uses of the 'nameof' operator is not permitted let f = nameof diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs index 761b23cb3e..381335f059 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on dictionary lookup -//This expression does not have a name. +//This expression does not have a name. let dict = new System.Collections.Generic.Dictionary() let b = nameof(dict.[2]) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs index a5144348e0..2e5a153340 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const int -//This expression does not have a name. +//This expression does not have a name. let x = nameof 1 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs index 7fe241fe86..47db6146e7 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//This expression does not have a name. +//This expression does not have a name. let f x = 1 * x let x = nameof(f 2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs index 5f24456195..d98087f547 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//This expression does not have a name. +//This expression does not have a name. let f x y = x y let z x = 1 * x diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs index 4a572a983f..0d3a1cfae0 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on partially applied functions -//This expression does not have a name. +//This expression does not have a name. let f x y = y * x let x = nameof(f 2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs index b30f702b1a..9576f489a6 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const string -//This expression does not have a name. +//This expression does not have a name. let x = nameof "string" diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs index f959420f99..cae86f5ea0 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof can't be used as a function. -//The nameof operator is not allowed in this position. +//First-class uses of the 'nameof' operator is not permitted. let curriedFunction x y = x * y let b = curriedFunction |> nameof From a732de06cb7c60b78c742ce7d82024a5a8cb8b4e Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Fri, 3 Feb 2017 23:41:08 +0300 Subject: [PATCH 016/286] remove nameof function form FSharp.Core --- .../SurfaceArea.net40.fs | 2 - .../SurfaceArea.portable259.fs | 2 - .../SurfaceArea.portable47.fs | 2 - .../SurfaceArea.portable7.fs | 2 - .../SurfaceArea.portable78.fs | 2 - src/fsharp/FSharp.Core/prim-types.fs | 3 -- src/fsharp/FSharp.Core/prim-types.fsi | 4 -- src/fsharp/PostInferenceChecks.fs | 1 - src/fsharp/TastOps.fs | 13 +---- src/fsharp/TastOps.fsi | 1 - src/fsharp/TcGlobals.fs | 4 +- src/fsharp/TypeChecker.fs | 52 ++++++++++--------- 12 files changed, 30 insertions(+), 58 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs index d5a9e905f8..bacb36eb34 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs @@ -2632,10 +2632,8 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" -Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) -Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]() Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue]) Microsoft.FSharp.Core.Operators: System.Type GetType() diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs index b618478397..cf8156e3fc 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs @@ -2604,10 +2604,8 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" -Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) -Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]() Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue]) Microsoft.FSharp.Core.Operators: System.Type GetType() diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs index 8078e44f42..01a15aff35 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs @@ -2606,10 +2606,8 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" -Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) -Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]() Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue]) Microsoft.FSharp.Core.Operators: System.Type GetType() diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs index a3db8830ef..7c003fea40 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs @@ -2617,10 +2617,8 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" -Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) -Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]() Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue]) Microsoft.FSharp.Core.Operators: System.Type GetType() diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs index 799616f508..4f1d01c64b 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs @@ -2604,10 +2604,8 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" -Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) -Microsoft.FSharp.Core.Operators: System.String TypeNameOf[T]() Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) Microsoft.FSharp.Core.Operators: System.Tuple`2[TKey,TValue] KeyValuePattern[TKey,TValue](System.Collections.Generic.KeyValuePair`2[TKey,TValue]) Microsoft.FSharp.Core.Operators: System.Type GetType() diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index fb117c41f6..9fcc440268 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -4748,9 +4748,6 @@ namespace Microsoft.FSharp.Core [] let inline typeof<'T> = BasicInlinedOperations.typeof<'T> - [] - let inline nameof (_: 'T) : string = raise (Exception "may not call directly, should always be optimized away") - [] let methodhandleof (_call: ('T -> 'TResult)) : System.RuntimeMethodHandle = raise (Exception "may not call directly, should always be optimized away") diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index d33c4f0aca..c943999a09 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -2320,10 +2320,6 @@ namespace Microsoft.FSharp.Core [] val inline typeof<'T> : System.Type - /// Returns the name of the given symbol. - [] - val inline nameof : 'T -> string - /// An internal, library-only compiler intrinsic for compile-time /// generation of a RuntimeMethodHandle. [] diff --git a/src/fsharp/PostInferenceChecks.fs b/src/fsharp/PostInferenceChecks.fs index e8afcd6dd0..5c07964406 100644 --- a/src/fsharp/PostInferenceChecks.fs +++ b/src/fsharp/PostInferenceChecks.fs @@ -514,7 +514,6 @@ and CheckVal (cenv:cenv) (env:env) v m context = if isSpliceOperator cenv.g v then errorR(Error(FSComp.SR.chkNoFirstClassSplicing(), m)) if valRefEq cenv.g v cenv.g.addrof_vref then errorR(Error(FSComp.SR.chkNoFirstClassAddressOf(), m)) if valRefEq cenv.g v cenv.g.reraise_vref then errorR(Error(FSComp.SR.chkNoFirstClassRethrow(), m)) - if valRefEq cenv.g v cenv.g.nameof_vref then errorR(Error(FSComp.SR.chkNoFirstClassNameOf(), m)) if noByrefs context && isByrefLikeTy cenv.g v.Type then // byref typed val can only occur in permitting contexts errorR(Error(FSComp.SR.chkNoByrefAtThisPoint(v.DisplayName), m)) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 963e7c6c94..c1742f82ca 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -2884,11 +2884,6 @@ let isSizeOfValRef g vref = // There is an internal version of typeof defined in prim-types.fs that needs to be detected || (g.compilingFslib && vref.LogicalName = "sizeof") -let isNameOfValRef g vref = - valRefEq g vref g.nameof_vref - // There is an internal version of typeof defined in prim-types.fs that needs to be detected - || (g.compilingFslib && vref.LogicalName = "nameof") - let isTypeDefOfValRef g vref = valRefEq g vref g.typedefof_vref // There is an internal version of typedefof defined in prim-types.fs that needs to be detected @@ -2914,11 +2909,6 @@ let (|TypeDefOfExpr|_|) g expr = | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isTypeDefOfValRef g vref -> Some ty | _ -> None -let (|NameOfExpr|_|) g expr = - match expr with - | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isNameOfValRef g vref -> Some ty - | _ -> None - let (|SeqExpr|_|) g expr = match expr with | Expr.App(Expr.Val(vref,_,_),_,_,_,_) when valRefEq g vref g.seq_vref -> Some() @@ -7753,8 +7743,7 @@ let IsSimpleSyntacticConstantExpr g inputExpr = | Expr.Op (TOp.UnionCase _,_,[],_) // Nullary union cases | UncheckedDefaultOfExpr g _ | SizeOfExpr g _ - | TypeOfExpr g _ - | NameOfExpr g _ -> true + | TypeOfExpr g _ -> true // All others are not simple constant expressions | _ -> false diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index a81b9b8f81..4629ab97a6 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -1409,7 +1409,6 @@ val (|AttribBitwiseOrExpr|_|) : TcGlobals -> Expr -> (Expr * Expr) option val (|EnumExpr|_|) : TcGlobals -> Expr -> Expr option val (|TypeOfExpr|_|) : TcGlobals -> Expr -> TType option val (|TypeDefOfExpr|_|) : TcGlobals -> Expr -> TType option -val (|NameOfExpr|_|) : TcGlobals -> Expr -> TType option val (|SeqExpr|_|) : TcGlobals -> Expr -> unit option val EvalLiteralExprOrAttribArg: TcGlobals -> Expr -> Expr diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index eb223c3386..489c985d31 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -572,8 +572,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_typeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typeof" , None , Some "TypeOf" , [vara], ([], v_system_Type_typ)) let v_methodhandleof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "methodhandleof" , None , Some "MethodHandleOf", [vara;varb], ([[varaTy --> varbTy]], v_system_RuntimeMethodHandle_typ)) let v_sizeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "sizeof" , None , Some "SizeOf" , [vara], ([], v_int_ty)) - let v_nameof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "nameof" , None , Some "NameOf" , [vara], ([[varaTy]], v_string_ty)) - + let v_unchecked_defaultof_info = makeIntrinsicValRef(fslib_MFOperatorsUnchecked_nleref, "defaultof" , None , Some "DefaultOf", [vara], ([], varaTy)) let v_typedefof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typedefof" , None , Some "TypeDefOf", [vara], ([], v_system_Type_typ)) let v_enum_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "enum" , None , Some "ToEnum" , [vara], ([[v_int_ty]], varaTy)) @@ -1131,7 +1130,6 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val methodhandleof_vref = ValRefForIntrinsic v_methodhandleof_info member val typeof_vref = ValRefForIntrinsic v_typeof_info member val sizeof_vref = ValRefForIntrinsic v_sizeof_info - member val nameof_vref = ValRefForIntrinsic v_nameof_info member val typedefof_vref = ValRefForIntrinsic v_typedefof_info member val enum_vref = ValRefForIntrinsic v_enum_info member val enumOfValue_vref = ValRefForIntrinsic v_enumOfValue_info diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 11712da2cb..8c30959e5c 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8313,12 +8313,33 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) -> List.tryLast idents | _ -> None + let (|NameOfExpr|_|) expr = + match expr with + | Expr.App(Expr.Val(vref,_,_),_,_,[],_) when vref.CompiledName = "nameof" -> Some () + | _ -> None + // If the type of 'synArg' unifies as a function type, then this is a function application, otherwise // it is an error or a computation expression match UnifyFunctionTypeUndoIfFailed cenv denv mFunExpr exprty with | Some (domainTy,resultTy) -> + // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library. + // Set a flag in the syntax tree to say we noticed a leading 'seq' + match synArg with + | SynExpr.CompExpr (false,isNotNakedRefCell,_comp,_m) -> + isNotNakedRefCell := + !isNotNakedRefCell + || + (match expr with + | ApplicableExpr(_,Expr.Op(TOp.Coerce,_,[SeqExpr cenv.g],_),_) -> true + | _ -> false) + | _ -> () + + let arg,tpenv = TcExpr cenv domainTy env tpenv synArg + let exprAndArg = buildApp cenv expr exprty arg mExprAndArg + TcDelayed cenv overallTy env tpenv mExprAndArg exprAndArg resultTy atomicFlag delayed + | None -> match expr with - | ApplicableExpr(_, NameOfExpr cenv.g _, _) -> + | ApplicableExpr(_, NameOfExpr, _) -> match synArg with | LastPartOfLongIdentStripParens argIdent -> let r = expr.Range @@ -8327,30 +8348,13 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(argIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed | _ -> error (Error(FSComp.SR.expressionHasNoName(), expr.Range)) | _ -> - // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library. - // Set a flag in the syntax tree to say we noticed a leading 'seq' + // OK, 'expr' doesn't have function type, but perhaps 'expr' is a computation expression builder, and 'arg' is '{ ... }' match synArg with - | SynExpr.CompExpr (false,isNotNakedRefCell,_comp,_m) -> - isNotNakedRefCell := - !isNotNakedRefCell - || - (match expr with - | ApplicableExpr(_,Expr.Op(TOp.Coerce,_,[SeqExpr cenv.g],_),_) -> true - | _ -> false) - | _ -> () - - let arg,tpenv = TcExpr cenv domainTy env tpenv synArg - let exprAndArg = buildApp cenv expr exprty arg mExprAndArg - TcDelayed cenv overallTy env tpenv mExprAndArg exprAndArg resultTy atomicFlag delayed - - | None -> - // OK, 'expr' doesn't have function type, but perhaps 'expr' is a computation expression builder, and 'arg' is '{ ... }' - match synArg with - | SynExpr.CompExpr (false,_isNotNakedRefCell,comp,_m) -> - let bodyOfCompExpr,tpenv = TcComputationOrSequenceExpression cenv env overallTy mFunExpr (Some(expr.Expr,exprty)) tpenv comp - TcDelayed cenv overallTy env tpenv mExprAndArg (MakeApplicableExprNoFlex cenv bodyOfCompExpr) (tyOfExpr cenv.g bodyOfCompExpr) ExprAtomicFlag.NonAtomic delayed - | _ -> - error (NotAFunction(denv,overallTy,mFunExpr,mArg)) + | SynExpr.CompExpr (false,_isNotNakedRefCell,comp,_m) -> + let bodyOfCompExpr,tpenv = TcComputationOrSequenceExpression cenv env overallTy mFunExpr (Some(expr.Expr,exprty)) tpenv comp + TcDelayed cenv overallTy env tpenv mExprAndArg (MakeApplicableExprNoFlex cenv bodyOfCompExpr) (tyOfExpr cenv.g bodyOfCompExpr) ExprAtomicFlag.NonAtomic delayed + | _ -> + error (NotAFunction(denv,overallTy,mFunExpr,mArg)) //------------------------------------------------------------------------- // TcLongIdentThen : Typecheck "A.B.C.E.F ... " constructs From b7763a6283260b5ecdc3cfbe67b182d6bfdd2af7 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Sat, 4 Feb 2017 20:30:50 +0300 Subject: [PATCH 017/286] Revert "remove nameof function form FSharp.Core" This reverts commit a732de06cb7c60b78c742ce7d82024a5a8cb8b4e. --- .../SurfaceArea.net40.fs | 1 + .../SurfaceArea.portable259.fs | 1 + .../SurfaceArea.portable47.fs | 1 + .../SurfaceArea.portable7.fs | 1 + .../SurfaceArea.portable78.fs | 1 + src/fsharp/FSharp.Core/prim-types.fs | 3 ++ src/fsharp/FSharp.Core/prim-types.fsi | 4 ++ src/fsharp/PostInferenceChecks.fs | 1 + src/fsharp/TastOps.fs | 13 ++++- src/fsharp/TastOps.fsi | 1 + src/fsharp/TcGlobals.fs | 4 +- src/fsharp/TypeChecker.fs | 52 +++++++++---------- 12 files changed, 53 insertions(+), 30 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs index bacb36eb34..ca9752377a 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs @@ -2632,6 +2632,7 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" +Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs index cf8156e3fc..349fd24646 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs @@ -2604,6 +2604,7 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" +Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs index 01a15aff35..0be758f5f1 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs @@ -2606,6 +2606,7 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" +Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs index 7c003fea40..a9c5d78e17 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs @@ -2617,6 +2617,7 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" +Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) diff --git a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs index 4f1d01c64b..1530f4a6cd 100644 --- a/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs +++ b/src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs @@ -2604,6 +2604,7 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" +Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 9fcc440268..fb117c41f6 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -4748,6 +4748,9 @@ namespace Microsoft.FSharp.Core [] let inline typeof<'T> = BasicInlinedOperations.typeof<'T> + [] + let inline nameof (_: 'T) : string = raise (Exception "may not call directly, should always be optimized away") + [] let methodhandleof (_call: ('T -> 'TResult)) : System.RuntimeMethodHandle = raise (Exception "may not call directly, should always be optimized away") diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index c943999a09..d33c4f0aca 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -2320,6 +2320,10 @@ namespace Microsoft.FSharp.Core [] val inline typeof<'T> : System.Type + /// Returns the name of the given symbol. + [] + val inline nameof : 'T -> string + /// An internal, library-only compiler intrinsic for compile-time /// generation of a RuntimeMethodHandle. [] diff --git a/src/fsharp/PostInferenceChecks.fs b/src/fsharp/PostInferenceChecks.fs index 5c07964406..e8afcd6dd0 100644 --- a/src/fsharp/PostInferenceChecks.fs +++ b/src/fsharp/PostInferenceChecks.fs @@ -514,6 +514,7 @@ and CheckVal (cenv:cenv) (env:env) v m context = if isSpliceOperator cenv.g v then errorR(Error(FSComp.SR.chkNoFirstClassSplicing(), m)) if valRefEq cenv.g v cenv.g.addrof_vref then errorR(Error(FSComp.SR.chkNoFirstClassAddressOf(), m)) if valRefEq cenv.g v cenv.g.reraise_vref then errorR(Error(FSComp.SR.chkNoFirstClassRethrow(), m)) + if valRefEq cenv.g v cenv.g.nameof_vref then errorR(Error(FSComp.SR.chkNoFirstClassNameOf(), m)) if noByrefs context && isByrefLikeTy cenv.g v.Type then // byref typed val can only occur in permitting contexts errorR(Error(FSComp.SR.chkNoByrefAtThisPoint(v.DisplayName), m)) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index c1742f82ca..963e7c6c94 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -2884,6 +2884,11 @@ let isSizeOfValRef g vref = // There is an internal version of typeof defined in prim-types.fs that needs to be detected || (g.compilingFslib && vref.LogicalName = "sizeof") +let isNameOfValRef g vref = + valRefEq g vref g.nameof_vref + // There is an internal version of typeof defined in prim-types.fs that needs to be detected + || (g.compilingFslib && vref.LogicalName = "nameof") + let isTypeDefOfValRef g vref = valRefEq g vref g.typedefof_vref // There is an internal version of typedefof defined in prim-types.fs that needs to be detected @@ -2909,6 +2914,11 @@ let (|TypeDefOfExpr|_|) g expr = | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isTypeDefOfValRef g vref -> Some ty | _ -> None +let (|NameOfExpr|_|) g expr = + match expr with + | Expr.App(Expr.Val(vref,_,_),_,[ty],[],_) when isNameOfValRef g vref -> Some ty + | _ -> None + let (|SeqExpr|_|) g expr = match expr with | Expr.App(Expr.Val(vref,_,_),_,_,_,_) when valRefEq g vref g.seq_vref -> Some() @@ -7743,7 +7753,8 @@ let IsSimpleSyntacticConstantExpr g inputExpr = | Expr.Op (TOp.UnionCase _,_,[],_) // Nullary union cases | UncheckedDefaultOfExpr g _ | SizeOfExpr g _ - | TypeOfExpr g _ -> true + | TypeOfExpr g _ + | NameOfExpr g _ -> true // All others are not simple constant expressions | _ -> false diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 4629ab97a6..a81b9b8f81 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -1409,6 +1409,7 @@ val (|AttribBitwiseOrExpr|_|) : TcGlobals -> Expr -> (Expr * Expr) option val (|EnumExpr|_|) : TcGlobals -> Expr -> Expr option val (|TypeOfExpr|_|) : TcGlobals -> Expr -> TType option val (|TypeDefOfExpr|_|) : TcGlobals -> Expr -> TType option +val (|NameOfExpr|_|) : TcGlobals -> Expr -> TType option val (|SeqExpr|_|) : TcGlobals -> Expr -> unit option val EvalLiteralExprOrAttribArg: TcGlobals -> Expr -> Expr diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 489c985d31..eb223c3386 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -572,7 +572,8 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d let v_typeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typeof" , None , Some "TypeOf" , [vara], ([], v_system_Type_typ)) let v_methodhandleof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "methodhandleof" , None , Some "MethodHandleOf", [vara;varb], ([[varaTy --> varbTy]], v_system_RuntimeMethodHandle_typ)) let v_sizeof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "sizeof" , None , Some "SizeOf" , [vara], ([], v_int_ty)) - + let v_nameof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "nameof" , None , Some "NameOf" , [vara], ([[varaTy]], v_string_ty)) + let v_unchecked_defaultof_info = makeIntrinsicValRef(fslib_MFOperatorsUnchecked_nleref, "defaultof" , None , Some "DefaultOf", [vara], ([], varaTy)) let v_typedefof_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "typedefof" , None , Some "TypeDefOf", [vara], ([], v_system_Type_typ)) let v_enum_info = makeIntrinsicValRef(fslib_MFOperators_nleref, "enum" , None , Some "ToEnum" , [vara], ([[v_int_ty]], varaTy)) @@ -1130,6 +1131,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member val methodhandleof_vref = ValRefForIntrinsic v_methodhandleof_info member val typeof_vref = ValRefForIntrinsic v_typeof_info member val sizeof_vref = ValRefForIntrinsic v_sizeof_info + member val nameof_vref = ValRefForIntrinsic v_nameof_info member val typedefof_vref = ValRefForIntrinsic v_typedefof_info member val enum_vref = ValRefForIntrinsic v_enum_info member val enumOfValue_vref = ValRefForIntrinsic v_enumOfValue_info diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index c988d4b320..d2785a9e7e 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8313,33 +8313,12 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) -> List.tryLast idents | _ -> None - let (|NameOfExpr|_|) expr = - match expr with - | Expr.App(Expr.Val(vref,_,_),_,_,[],_) when vref.CompiledName = "nameof" -> Some () - | _ -> None - // If the type of 'synArg' unifies as a function type, then this is a function application, otherwise // it is an error or a computation expression match UnifyFunctionTypeUndoIfFailed cenv denv mFunExpr exprty with | Some (domainTy,resultTy) -> - // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library. - // Set a flag in the syntax tree to say we noticed a leading 'seq' - match synArg with - | SynExpr.CompExpr (false,isNotNakedRefCell,_comp,_m) -> - isNotNakedRefCell := - !isNotNakedRefCell - || - (match expr with - | ApplicableExpr(_,Expr.Op(TOp.Coerce,_,[SeqExpr cenv.g],_),_) -> true - | _ -> false) - | _ -> () - - let arg,tpenv = TcExpr cenv domainTy env tpenv synArg - let exprAndArg = buildApp cenv expr exprty arg mExprAndArg - TcDelayed cenv overallTy env tpenv mExprAndArg exprAndArg resultTy atomicFlag delayed - | None -> match expr with - | ApplicableExpr(_, NameOfExpr, _) -> + | ApplicableExpr(_, NameOfExpr cenv.g _, _) -> match synArg with | LastPartOfLongIdentStripParens argIdent -> let r = expr.Range @@ -8348,13 +8327,30 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(argIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed | _ -> error (Error(FSComp.SR.expressionHasNoName(), expr.Range)) | _ -> - // OK, 'expr' doesn't have function type, but perhaps 'expr' is a computation expression builder, and 'arg' is '{ ... }' + // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library. + // Set a flag in the syntax tree to say we noticed a leading 'seq' match synArg with - | SynExpr.CompExpr (false,_isNotNakedRefCell,comp,_m) -> - let bodyOfCompExpr,tpenv = TcComputationOrSequenceExpression cenv env overallTy mFunExpr (Some(expr.Expr,exprty)) tpenv comp - TcDelayed cenv overallTy env tpenv mExprAndArg (MakeApplicableExprNoFlex cenv bodyOfCompExpr) (tyOfExpr cenv.g bodyOfCompExpr) ExprAtomicFlag.NonAtomic delayed - | _ -> - error (NotAFunction(denv,overallTy,mFunExpr,mArg)) + | SynExpr.CompExpr (false,isNotNakedRefCell,_comp,_m) -> + isNotNakedRefCell := + !isNotNakedRefCell + || + (match expr with + | ApplicableExpr(_,Expr.Op(TOp.Coerce,_,[SeqExpr cenv.g],_),_) -> true + | _ -> false) + | _ -> () + + let arg,tpenv = TcExpr cenv domainTy env tpenv synArg + let exprAndArg = buildApp cenv expr exprty arg mExprAndArg + TcDelayed cenv overallTy env tpenv mExprAndArg exprAndArg resultTy atomicFlag delayed + + | None -> + // OK, 'expr' doesn't have function type, but perhaps 'expr' is a computation expression builder, and 'arg' is '{ ... }' + match synArg with + | SynExpr.CompExpr (false,_isNotNakedRefCell,comp,_m) -> + let bodyOfCompExpr,tpenv = TcComputationOrSequenceExpression cenv env overallTy mFunExpr (Some(expr.Expr,exprty)) tpenv comp + TcDelayed cenv overallTy env tpenv mExprAndArg (MakeApplicableExprNoFlex cenv bodyOfCompExpr) (tyOfExpr cenv.g bodyOfCompExpr) ExprAtomicFlag.NonAtomic delayed + | _ -> + error (NotAFunction(denv,overallTy,mFunExpr,mArg)) //------------------------------------------------------------------------- // TcLongIdentThen : Typecheck "A.B.C.E.F ... " constructs From 906a934514a58075f7bfe8fea048ff161e826f80 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Sat, 4 Feb 2017 21:18:54 +0300 Subject: [PATCH 018/286] Try to resolve the `nameof` operator argument to prevent passing anything to it. --- src/fsharp/TypeChecker.fs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index d2785a9e7e..58c609178e 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8308,9 +8308,9 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( | _ -> expr match stripParens expr with - | SynExpr.Ident ident -> Some ident - | SynExpr.TypeApp(expr = SynExpr.Ident(ident)) -> Some ident - | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) -> List.tryLast idents + | SynExpr.Ident ident -> Some ([ident], ident) + | SynExpr.TypeApp(expr = SynExpr.Ident(ident)) -> Some ([ident], ident) + | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) when not (List.isEmpty idents) -> Some (idents, List.last idents) | _ -> None // If the type of 'synArg' unifies as a function type, then this is a function application, otherwise @@ -8320,11 +8320,14 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( match expr with | ApplicableExpr(_, NameOfExpr cenv.g _, _) -> match synArg with - | LastPartOfLongIdentStripParens argIdent -> + | LastPartOfLongIdentStripParens (idents, lastIdent) -> + // Try to resolve the `nameof` operator argument to prevent passing anything to it. + ResolveExprLongIdent cenv.tcSink cenv.nameResolver mArg env.eAccessRights env.eNameResEnv TypeNameResolutionInfo.Default idents |> ignore + let r = expr.Range // generate fake `range` for the constant the `nameof(..)` we are substituting - let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + argIdent.idText.Length + 2)) // `2` are for quotes - TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(argIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed + let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + lastIdent.idText.Length + 2)) // `2` are for quotes + TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(lastIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed | _ -> error (Error(FSComp.SR.expressionHasNoName(), expr.Range)) | _ -> // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library. From a770e3c7ad1bec9ca31477dcadb4d448998c4f1b Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Sat, 4 Feb 2017 22:18:00 +0300 Subject: [PATCH 019/286] nameof works on generic types --- .../Microsoft.FSharp.Core/NameOfTests.fs | 5 +++++ src/fsharp/TypeChecker.fs | 13 ++++++++----- .../NameOf/E_NameOfUnresolvableName.fs | 6 ++++++ .../Expressions/DataExpressions/NameOf/env.lst | 1 + 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfUnresolvableName.fs diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs index 8b49e88d54..7795b3f46f 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs @@ -195,6 +195,11 @@ type NameOfOperatorForGenerics() = let b = nameof(fullyGeneric) Assert.AreEqual("fullyGeneric",b) + [] + member this.``lookup name of a generic class`` () = + let b = nameof System.Collections.Generic.List + Assert.AreEqual("List",b) + [] type UserDefinedNameOfTests() = [] diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 58c609178e..a9bfb931f3 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8307,11 +8307,14 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( | SynExpr.Paren(expr, _, _, _) -> stripParens expr | _ -> expr - match stripParens expr with - | SynExpr.Ident ident -> Some ([ident], ident) - | SynExpr.TypeApp(expr = SynExpr.Ident(ident)) -> Some ([ident], ident) - | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) when not (List.isEmpty idents) -> Some (idents, List.last idents) - | _ -> None + let rec findIdents expr = + match expr with + | SynExpr.Ident ident -> Some ([ident], ident) + | SynExpr.TypeApp (expr = expr) -> findIdents expr + | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) when not (List.isEmpty idents) -> Some (idents, List.last idents) + | _ -> None + + findIdents (stripParens expr) // If the type of 'synArg' unifies as a function type, then this is a function application, otherwise // it is an error or a computation expression diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfUnresolvableName.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfUnresolvableName.fs new file mode 100644 index 0000000000..f55c969a6f --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfUnresolvableName.fs @@ -0,0 +1,6 @@ +// #Regression #Conformance #DataExpressions +// Verify that passing unresolvable symbol name results with compilation error. +//The value or constructor 'ff' is not defined. + +let b = nameof System.Collections.Generic.Listtt +exit 0 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst index 4b62ea892e..7e08cf92ea 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst @@ -8,3 +8,4 @@ SOURCE=E_NameOfParameterAppliedFunction.fs # E_NameOfParameterAppliedFunction.fs SOURCE=E_NameOfAsAFunction.fs # E_NameOfAsAFunction.fs SOURCE=E_NameOfWithPipe.fs # E_NameOfWithPipe.fs + SOURCE=E_NameOfUnresolvableName.fs # E_NameOfUnresolvableName.fs From 067955a0d0fe7136c46b1401aa65d1db191e57f0 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Sat, 4 Feb 2017 23:21:00 +0300 Subject: [PATCH 020/286] fix error range in case of wrong `nameof`operator argument --- src/fsharp/FSComp.txt | 2 +- src/fsharp/TypeChecker.fs | 18 +++++++++--------- .../NameOf/E_NameOfAdditionExpr.fs | 2 +- .../NameOf/E_NameOfAppliedFunction.fs | 2 +- .../NameOf/E_NameOfDictLookup.fs | 2 +- .../DataExpressions/NameOf/E_NameOfIntConst.fs | 2 +- .../NameOf/E_NameOfIntegerAppliedFunction.fs | 2 +- .../NameOf/E_NameOfParameterAppliedFunction.fs | 2 +- .../NameOf/E_NameOfPartiallyAppliedFunction.fs | 2 +- .../NameOf/E_NameOfStringConst.fs | 2 +- .../NameOf/E_NameOfUnresolvableName.fs | 4 ++-- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 4a51a5d9ee..74a2619bef 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1333,5 +1333,5 @@ tcTupleStructMismatch,"One tuple type is a struct tuple, the other is a referenc tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced system DLL contained this type" 3213,typrelMemberHasMultiplePossibleDispatchSlots,"The member '%s' matches multiple overloads of the same method.\nPlease restrict it to one of the following:%s." 3214,methodIsNotStatic,"Method or object constructor '%s' is not static" -3215,expressionHasNoName,"This expression does not have a name." +3215,expressionHasNoName,"Expression does not have a name." 3216,chkNoFirstClassNameOf,"First-class uses of the 'nameof' operator is not permitted." \ No newline at end of file diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index a9bfb931f3..7b843ccdad 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8302,19 +8302,18 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( let mFunExpr = expr.Range let (|LastPartOfLongIdentStripParens|_|) expr = - let rec stripParens expr = - match expr with - | SynExpr.Paren(expr, _, _, _) -> stripParens expr - | _ -> expr - let rec findIdents expr = match expr with | SynExpr.Ident ident -> Some ([ident], ident) | SynExpr.TypeApp (expr = expr) -> findIdents expr | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) when not (List.isEmpty idents) -> Some (idents, List.last idents) | _ -> None - - findIdents (stripParens expr) + findIdents expr + + let rec stripParens expr = + match expr with + | SynExpr.Paren(expr, _, _, _) -> stripParens expr + | _ -> expr // If the type of 'synArg' unifies as a function type, then this is a function application, otherwise // it is an error or a computation expression @@ -8322,7 +8321,8 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( | Some (domainTy,resultTy) -> match expr with | ApplicableExpr(_, NameOfExpr cenv.g _, _) -> - match synArg with + let cleanSynArg = stripParens synArg + match cleanSynArg with | LastPartOfLongIdentStripParens (idents, lastIdent) -> // Try to resolve the `nameof` operator argument to prevent passing anything to it. ResolveExprLongIdent cenv.tcSink cenv.nameResolver mArg env.eAccessRights env.eNameResEnv TypeNameResolutionInfo.Default idents |> ignore @@ -8331,7 +8331,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( // generate fake `range` for the constant the `nameof(..)` we are substituting let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + lastIdent.idText.Length + 2)) // `2` are for quotes TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, Expr.Const(Const.String(lastIdent.idText), constRange, cenv.g.string_ty), true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed - | _ -> error (Error(FSComp.SR.expressionHasNoName(), expr.Range)) + | _ -> error (Error(FSComp.SR.expressionHasNoName(), cleanSynArg.Range)) | _ -> // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library. // Set a flag in the syntax tree to say we noticed a leading 'seq' diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs index f1405cf7a0..2e082efb21 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const string -//This expression does not have a name. +//Expression does not have a name. let x = nameof(1+2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs index 8e9efc6a51..49095e69ed 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//This expression does not have a name. +//Expression does not have a name. let f() = 1 let x = nameof(f()) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs index 381335f059..0a58a4bba7 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on dictionary lookup -//This expression does not have a name. +//Expression does not have a name. let dict = new System.Collections.Generic.Dictionary() let b = nameof(dict.[2]) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs index 2e5a153340..6b67627d67 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const int -//This expression does not have a name. +//Expression does not have a name. let x = nameof 1 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs index 47db6146e7..4fe8db0547 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//This expression does not have a name. +//Expression does not have a name. let f x = 1 * x let x = nameof(f 2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs index d98087f547..c24f7343a1 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//This expression does not have a name. +//Expression does not have a name. let f x y = x y let z x = 1 * x diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs index 0d3a1cfae0..71b66493b5 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on partially applied functions -//This expression does not have a name. +//Expression does not have a name. let f x y = y * x let x = nameof(f 2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs index 9576f489a6..1190f1e8b3 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const string -//This expression does not have a name. +//Expression does not have a name. let x = nameof "string" diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfUnresolvableName.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfUnresolvableName.fs index f55c969a6f..2f998cbb17 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfUnresolvableName.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfUnresolvableName.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that passing unresolvable symbol name results with compilation error. -//The value or constructor 'ff' is not defined. +//The value, constructor, namespace or type 'Unknown' is not defined. -let b = nameof System.Collections.Generic.Listtt +let b = nameof System.Collections.Generic.Unknown exit 0 From bfcc390c5563ba9994e9add43c0772229cfbdfae Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Sun, 5 Feb 2017 17:18:18 +0300 Subject: [PATCH 021/286] notify name resolution sink about nameof operator argument Item in order to not loose its FSharpSymbolUse --- src/fsharp/NameResolution.fs | 2 +- src/fsharp/TypeChecker.fs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index 6182ab553c..c64fe0447b 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -1193,7 +1193,7 @@ type ItemOccurence = type ITypecheckResultsSink = abstract NotifyEnvWithScope : range * NameResolutionEnv * AccessorDomain -> unit abstract NotifyExprHasType : pos * TType * Tastops.DisplayEnv * NameResolutionEnv * AccessorDomain * range -> unit - abstract NotifyNameResolution : pos * Item * Item * ItemOccurence * Tastops.DisplayEnv * NameResolutionEnv * AccessorDomain * range * bool -> unit + abstract NotifyNameResolution : pos * item: Item * itemMethodGroup: Item * ItemOccurence * Tastops.DisplayEnv * NameResolutionEnv * AccessorDomain * range * replace: bool -> unit abstract NotifyFormatSpecifierLocation : range -> unit abstract CurrentSource : string option diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 7b843ccdad..a913138a24 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8325,7 +8325,9 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( match cleanSynArg with | LastPartOfLongIdentStripParens (idents, lastIdent) -> // Try to resolve the `nameof` operator argument to prevent passing anything to it. - ResolveExprLongIdent cenv.tcSink cenv.nameResolver mArg env.eAccessRights env.eNameResEnv TypeNameResolutionInfo.Default idents |> ignore + let item, _ = ResolveExprLongIdent cenv.tcSink cenv.nameResolver mArg env.eAccessRights env.eNameResEnv TypeNameResolutionInfo.Default idents + // Notify name resolution sink about the resolved argument in order to not loose symbol use, which is used in IDE. + CallNameResolutionSink cenv.tcSink (cleanSynArg.Range, env.eNameResEnv, item, item, ItemOccurence.Use, env.DisplayEnv, env.eAccessRights) let r = expr.Range // generate fake `range` for the constant the `nameof(..)` we are substituting From 6a92a8039049e0efadcb5f83a2ea008bd3d615d2 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Sun, 5 Feb 2017 18:33:37 +0300 Subject: [PATCH 022/286] fully type check `nameof` argument --- src/fsharp/TypeChecker.fs | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index a913138a24..489b92c7a7 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8301,14 +8301,29 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( let mArg = synArg.Range let mFunExpr = expr.Range + /// Finds last ident of LongIdent in SynExpr.Ident, LongIdent or TypeApp. + /// Type checkes the whole thing as it goes in order to: + /// + /// * ensure we pass well typed things to `nameof` + /// + /// * not to loose `FSharpSymbolUse` for `nameof` argument, because we erase it with `Expr.Const(Const.String ...)` further in this function. let (|LastPartOfLongIdentStripParens|_|) expr = - let rec findIdents expr = + let rec findIdents expr (isTypeApp : bool) = match expr with - | SynExpr.Ident ident -> Some ([ident], ident) - | SynExpr.TypeApp (expr = expr) -> findIdents expr - | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) when not (List.isEmpty idents) -> Some (idents, List.last idents) + | SynExpr.Ident ident -> + if not isTypeApp then + TcExprOfUnknownType cenv env tpenv expr |> ignore + Some ident + | SynExpr.TypeApp (expr, _, typeNames, _, _, _, m) -> + TcExprOfUnknownType cenv env tpenv expr |> ignore + TcTypesOrMeasures None cenv ImplictlyBoundTyparsAllowed.NewTyparsOK CheckConstraints.NoCheckCxs ItemOccurence.Use env tpenv typeNames m |> ignore + findIdents expr true + | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) when not (List.isEmpty idents) -> + if not isTypeApp then + TcExprOfUnknownType cenv env tpenv expr |> ignore + List.tryLast idents | _ -> None - findIdents expr + findIdents expr false let rec stripParens expr = match expr with @@ -8323,12 +8338,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( | ApplicableExpr(_, NameOfExpr cenv.g _, _) -> let cleanSynArg = stripParens synArg match cleanSynArg with - | LastPartOfLongIdentStripParens (idents, lastIdent) -> - // Try to resolve the `nameof` operator argument to prevent passing anything to it. - let item, _ = ResolveExprLongIdent cenv.tcSink cenv.nameResolver mArg env.eAccessRights env.eNameResEnv TypeNameResolutionInfo.Default idents - // Notify name resolution sink about the resolved argument in order to not loose symbol use, which is used in IDE. - CallNameResolutionSink cenv.tcSink (cleanSynArg.Range, env.eNameResEnv, item, item, ItemOccurence.Use, env.DisplayEnv, env.eAccessRights) - + | LastPartOfLongIdentStripParens lastIdent -> let r = expr.Range // generate fake `range` for the constant the `nameof(..)` we are substituting let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + lastIdent.idText.Length + 2)) // `2` are for quotes From bcec6002d790d0973ccee13653b1f79dc7656be6 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Sun, 5 Feb 2017 18:58:39 +0300 Subject: [PATCH 023/286] try to type check arg again --- src/fsharp/TypeChecker.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 489b92c7a7..d973797e77 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8314,9 +8314,9 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( if not isTypeApp then TcExprOfUnknownType cenv env tpenv expr |> ignore Some ident - | SynExpr.TypeApp (expr, _, typeNames, _, _, _, m) -> - TcExprOfUnknownType cenv env tpenv expr |> ignore - TcTypesOrMeasures None cenv ImplictlyBoundTyparsAllowed.NewTyparsOK CheckConstraints.NoCheckCxs ItemOccurence.Use env tpenv typeNames m |> ignore + | SynExpr.TypeApp (expr, _, typeArgs, _, _, mTypeArgs, m) -> + TcExprOfUnknownTypeThen cenv env tpenv expr [ DelayedTypeApp (typeArgs, mTypeArgs, m) ] |> ignore + //TcTypesOrMeasures None cenv ImplictlyBoundTyparsAllowed.NewTyparsOK CheckConstraints.NoCheckCxs ItemOccurence.Use env tpenv typeNames m |> ignore findIdents expr true | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) when not (List.isEmpty idents) -> if not isTypeApp then From 0c1cad2a8d43f24c34fae4ebc21a73dc2c44a377 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Mon, 6 Feb 2017 22:06:56 +0300 Subject: [PATCH 024/286] type check `nameof` argument more carefully --- src/fsharp/TypeChecker.fs | 42 ++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index d973797e77..d77361389f 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8308,22 +8308,35 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( /// /// * not to loose `FSharpSymbolUse` for `nameof` argument, because we erase it with `Expr.Const(Const.String ...)` further in this function. let (|LastPartOfLongIdentStripParens|_|) expr = - let rec findIdents expr (isTypeApp : bool) = + let rec findIdents expr = match expr with - | SynExpr.Ident ident -> - if not isTypeApp then - TcExprOfUnknownType cenv env tpenv expr |> ignore - Some ident - | SynExpr.TypeApp (expr, _, typeArgs, _, _, mTypeArgs, m) -> - TcExprOfUnknownTypeThen cenv env tpenv expr [ DelayedTypeApp (typeArgs, mTypeArgs, m) ] |> ignore - //TcTypesOrMeasures None cenv ImplictlyBoundTyparsAllowed.NewTyparsOK CheckConstraints.NoCheckCxs ItemOccurence.Use env tpenv typeNames m |> ignore - findIdents expr true - | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) when not (List.isEmpty idents) -> - if not isTypeApp then - TcExprOfUnknownType cenv env tpenv expr |> ignore - List.tryLast idents + | SynExpr.Ident ident -> Some ident + | SynExpr.TypeApp (expr = expr) -> findIdents expr + | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) -> List.tryLast idents | _ -> None - findIdents expr false + findIdents expr + + let tcExpr = function + | SynExpr.Ident _ + | SynExpr.LongIdent(_, LongIdentWithDots _, _, _) as expr -> + ignore (TcExprOfUnknownType cenv env tpenv expr) + | SynExpr.TypeApp (expr, _, types, _, _, _, m) as fullExpr -> + let idents = + match expr with + | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) -> idents + | SynExpr.Ident ident -> [ident] + | _ -> [] + match idents with + | [] -> () + | idents -> + // try to type check it as type application, like A.B.C> + match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInType OpenQualified env.eNameResEnv env.eAccessRights idents (TypeNameResolutionStaticArgsInfo.FromTyArgs types.Length) PermitDirectReferenceToGeneratedType.No with + | ResultOrException.Result tcref -> + ignore (TcTypeApp cenv NewTyparsOK NoCheckCxs ItemOccurence.UseInType env tpenv m tcref [] types) + | _ -> + // now try to check it as generic function, like func> + ignore (TcExprOfUnknownType cenv env tpenv fullExpr) + | _ -> () let rec stripParens expr = match expr with @@ -8339,6 +8352,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( let cleanSynArg = stripParens synArg match cleanSynArg with | LastPartOfLongIdentStripParens lastIdent -> + tcExpr cleanSynArg let r = expr.Range // generate fake `range` for the constant the `nameof(..)` we are substituting let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + lastIdent.idText.Length + 2)) // `2` are for quotes From 588de2e4ca383d529e1cc092a29628a9d8375b74 Mon Sep 17 00:00:00 2001 From: Vasily Kirichenko Date: Wed, 1 Mar 2017 21:18:15 +0300 Subject: [PATCH 025/286] factor tcExpr to top level function add a multiple arguments overloaded method group test --- .../Microsoft.FSharp.Core/NameOfTests.fs | 11 ++++- src/fsharp/TypeChecker.fs | 49 ++++++++++--------- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs index 7795b3f46f..e545320b14 100644 --- a/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs +++ b/src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs @@ -120,11 +120,20 @@ type MethodGroupTests() = member this.MethodGroup() = () member this.MethodGroup(i:int) = () + member this.MethodGroup1(i:int, f:float, s:string) = 0 + member this.MethodGroup1(f:float, l:int64) = "foo" + member this.MethodGroup1(u:unit -> unit -> int, h: unit) : unit = () + [] - member this.``method group name lookup`` () = + member this.``single argument method group name lookup`` () = let b = nameof(this.MethodGroup) Assert.AreEqual("MethodGroup",b) + [] + member this.``multiple argument method group name lookup`` () = + let b = nameof(this.MethodGroup1) + Assert.AreEqual("MethodGroup1",b) + [] type FrameworkMethodTests() = [] diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 904d668660..87c222345a 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8303,6 +8303,31 @@ and delayRest rest mPrior delayed = let mPriorAndLongId = unionRanges mPrior (rangeOfLid longId) DelayedDotLookup (rest,mPriorAndLongId) :: delayed +//------------------------------------------------------------------------- +// TcNameOfExpr: Typecheck "nameof" expressions +//------------------------------------------------------------------------- +and TcNameOfExpr cenv env tpenv expr = + match expr with + | SynExpr.Ident _ + | SynExpr.LongIdent(_, LongIdentWithDots _, _, _) as expr -> + ignore (TcExprOfUnknownType cenv env tpenv expr) + | SynExpr.TypeApp (expr, _, types, _, _, _, m) as fullExpr -> + let idents = + match expr with + | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) -> idents + | SynExpr.Ident ident -> [ident] + | _ -> [] + match idents with + | [] -> () + | idents -> + // try to type check it as type application, like A.B.C> + match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInType OpenQualified env.eNameResEnv env.eAccessRights idents (TypeNameResolutionStaticArgsInfo.FromTyArgs types.Length) PermitDirectReferenceToGeneratedType.No with + | ResultOrException.Result tcref -> + ignore (TcTypeApp cenv NewTyparsOK NoCheckCxs ItemOccurence.UseInType env tpenv m tcref [] types) + | _ -> + // now try to check it as generic function, like func> + ignore (TcExprOfUnknownType cenv env tpenv fullExpr) + | _ -> () //------------------------------------------------------------------------- // TcFunctionApplicationThen: Typecheck "expr x" + projections @@ -8328,28 +8353,6 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( | _ -> None findIdents expr - let tcExpr = function - | SynExpr.Ident _ - | SynExpr.LongIdent(_, LongIdentWithDots _, _, _) as expr -> - ignore (TcExprOfUnknownType cenv env tpenv expr) - | SynExpr.TypeApp (expr, _, types, _, _, _, m) as fullExpr -> - let idents = - match expr with - | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) -> idents - | SynExpr.Ident ident -> [ident] - | _ -> [] - match idents with - | [] -> () - | idents -> - // try to type check it as type application, like A.B.C> - match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInType OpenQualified env.eNameResEnv env.eAccessRights idents (TypeNameResolutionStaticArgsInfo.FromTyArgs types.Length) PermitDirectReferenceToGeneratedType.No with - | ResultOrException.Result tcref -> - ignore (TcTypeApp cenv NewTyparsOK NoCheckCxs ItemOccurence.UseInType env tpenv m tcref [] types) - | _ -> - // now try to check it as generic function, like func> - ignore (TcExprOfUnknownType cenv env tpenv fullExpr) - | _ -> () - let rec stripParens expr = match expr with | SynExpr.Paren(expr, _, _, _) -> stripParens expr @@ -8364,7 +8367,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( let cleanSynArg = stripParens synArg match cleanSynArg with | LastPartOfLongIdentStripParens lastIdent -> - tcExpr cleanSynArg + TcNameOfExpr cenv env tpenv cleanSynArg let r = expr.Range // generate fake `range` for the constant the `nameof(..)` we are substituting let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + lastIdent.idText.Length + 2)) // `2` are for quotes From d1b13890945a95cfc691ab94e70f74bbc5c015a7 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Sat, 9 Mar 2019 16:54:17 -0800 Subject: [PATCH 026/286] add diagnostics --- tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs index 4597451990..e7a924bcfa 100644 --- a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs +++ b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs @@ -4026,7 +4026,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader // Emit compressed untagged integer member buf.EmitZUntaggedIndex big idx = if big then buf.EmitInt32 idx - elif idx > 0xffff then failwith "EmitZUntaggedIndex: too big for small address or simple index" + elif idx > 0xffff then failwithf "EmitZUntaggedIndex: too big for small address or simple index, idx = %d, big = %A, stack = %s" idx big ((new System.Diagnostics.StackTrace()).ToString()) else buf.EmitInt32AsUInt16 idx // Emit compressed tagged integer From 0f897111104f50dc93f2495c5f2c214de87e96ba Mon Sep 17 00:00:00 2001 From: Don Syme Date: Sat, 9 Mar 2019 16:54:17 -0800 Subject: [PATCH 027/286] add diagnostics From 7da6aff62f0c5f68453579b0747feb8cedf8d984 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 11 Mar 2019 14:42:08 +0000 Subject: [PATCH 028/286] diagnostics --- src/absil/ilwrite.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index cac9ccbcef..8cd58c957a 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -89,7 +89,7 @@ type ByteBuffer with // Emit compressed untagged integer member buf.EmitZUntaggedIndex big idx = if big then buf.EmitInt32 idx - elif idx > 0xffff then failwith "EmitZUntaggedIndex: too big for small address or simple index" + elif idx > 0xffff then failwithf "EmitZUntaggedIndex: too big for small address or simple index, idx = %d, big = %A, stack = %s" idx big ((new System.Diagnostics.StackTrace()).ToString()) else buf.EmitInt32AsUInt16 idx // Emit compressed tagged integer From 871489bd13e9eb55cef3d212b0f4211a5a877c6c Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 11 Mar 2019 14:51:43 +0000 Subject: [PATCH 029/286] diagnostics --- src/absil/ilwrite.fs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index 8cd58c957a..6e13993d7f 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -87,9 +87,9 @@ type ByteBuffer with buf.EmitByte 0x0uy // Emit compressed untagged integer - member buf.EmitZUntaggedIndex big idx = + member buf.EmitZUntaggedIndex nm sz big idx = if big then buf.EmitInt32 idx - elif idx > 0xffff then failwithf "EmitZUntaggedIndex: too big for small address or simple index, idx = %d, big = %A, stack = %s" idx big ((new System.Diagnostics.StackTrace()).ToString()) + elif idx > 0xffff then failwithf "EmitZUntaggedIndex: index into table '%d' is too big for small address or simple index, idx = %d, big = %A, size of table = %d, stack = %s" nm idx big sz ((new System.Diagnostics.StackTrace()).ToString()) else buf.EmitInt32AsUInt16 idx // Emit compressed tagged integer @@ -3198,8 +3198,10 @@ let writeILMetadataAndCode (generatePdb, desiredMetadataVersion, ilg, emitTailca let codedTables = + let sizesTable = Array.map Array.length sortedTables let bignessTable = Array.map (fun rows -> Array.length rows >= 0x10000) sortedTables let bigness (tab:int32) = bignessTable.[tab] + let size (tab:int32) = sizesTable.[tab] let codedBigness nbits tab = (tableSize tab) >= (0x10000 >>> nbits) @@ -3323,10 +3325,12 @@ let writeILMetadataAndCode (generatePdb, desiredMetadataVersion, ilg, emitTailca | _ when t = RowElementTags.ULong -> tablesBuf.EmitInt32 n | _ when t = RowElementTags.Data -> recordRequiredDataFixup requiredDataFixups tablesBuf (tablesStreamStart + tablesBuf.Position) (n, false) | _ when t = RowElementTags.DataResources -> recordRequiredDataFixup requiredDataFixups tablesBuf (tablesStreamStart + tablesBuf.Position) (n, true) - | _ when t = RowElementTags.Guid -> tablesBuf.EmitZUntaggedIndex guidsBig (guidAddress n) - | _ when t = RowElementTags.Blob -> tablesBuf.EmitZUntaggedIndex blobsBig (blobAddress n) - | _ when t = RowElementTags.String -> tablesBuf.EmitZUntaggedIndex stringsBig (stringAddress n) - | _ when t <= RowElementTags.SimpleIndexMax -> tablesBuf.EmitZUntaggedIndex (bigness (t - RowElementTags.SimpleIndexMin)) n + | _ when t = RowElementTags.Guid -> tablesBuf.EmitZUntaggedIndex -3 guidsStreamPaddedSize guidsBig (guidAddress n) + | _ when t = RowElementTags.Blob -> tablesBuf.EmitZUntaggedIndex -2 blobsStreamPaddedSize blobsBig (blobAddress n) + | _ when t = RowElementTags.String -> tablesBuf.EmitZUntaggedIndex -1 stringsStreamPaddedSize stringsBig (stringAddress n) + | _ when t <= RowElementTags.SimpleIndexMax -> + let tnum = t - RowElementTags.SimpleIndexMin + tablesBuf.EmitZUntaggedIndex tnum (size tnum) (bigness tnum) n | _ when t <= RowElementTags.TypeDefOrRefOrSpecMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.TypeDefOrRefOrSpecMin) 2 tdorBigness n | _ when t <= RowElementTags.TypeOrMethodDefMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.TypeOrMethodDefMin) 1 tomdBigness n | _ when t <= RowElementTags.HasConstantMax -> tablesBuf.EmitZTaggedIndex (t - RowElementTags.HasConstantMin) 2 hcBigness n From 27d00a09c829d9d3086bd056c81b880a5c7c970f Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 11 Mar 2019 14:53:57 +0000 Subject: [PATCH 030/286] diagnostics --- tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs index e7a924bcfa..4597451990 100644 --- a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs +++ b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs @@ -4026,7 +4026,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader // Emit compressed untagged integer member buf.EmitZUntaggedIndex big idx = if big then buf.EmitInt32 idx - elif idx > 0xffff then failwithf "EmitZUntaggedIndex: too big for small address or simple index, idx = %d, big = %A, stack = %s" idx big ((new System.Diagnostics.StackTrace()).ToString()) + elif idx > 0xffff then failwith "EmitZUntaggedIndex: too big for small address or simple index" else buf.EmitInt32AsUInt16 idx // Emit compressed tagged integer From 7d98d16f6a55a9877089a9ec144d2699d2c589e5 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 11 Mar 2019 15:03:22 +0000 Subject: [PATCH 031/286] add diagnostics and possible fix for tp smoke tests --- .../DummyProviderForLanguageServiceTesting.fs | 27 ++++++++++--------- .../Tests.LanguageService.Script.fs | 6 +++-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs index 1e17fda491..697ba4a2d7 100644 --- a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs +++ b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs @@ -113,33 +113,36 @@ module internal TPModule = // Used by unit testing to check that Dispose is being called on the type provider module GlobalCounters = - let mutable creations = 0 - let mutable disposals = 0 - let mutable configs = ([]: TypeProviderConfig list) - let GetTotalCreations() = creations - let GetTotalDisposals() = disposals + let counterLock = obj() + let mutable private creations = 0 + let mutable private disposals = 0 + let mutable private configs = ([]: TypeProviderConfig list) + let GetTotalCreations() = lock counterLock (fun () -> creations) + let GetTotalDisposals() = lock counterLock (fun () -> disposals) + let IncrementCreations() = lock counterLock (fun () -> creations <- creations + 1) + let IncrementDisposals() = lock counterLock (fun () -> disposals <- disposals + 1) + let AddConfig c = lock counterLock (fun () -> configs <- c :: configs) + let GetConfigs() = lock counterLock (fun () -> configs) let CheckAllConfigsDisposed() = - for c in configs do + for c in GetConfigs() do try c.SystemRuntimeContainsType("System.Object") |> ignore failwith "expected configuration object to be disposed" with :? System.ObjectDisposedException -> () - - [] type HelloWorldProvider(config: TypeProviderConfig) = inherit TypeProviderForNamespaces(TPModule.namespaceName,TPModule.types) - do GlobalCounters.creations <- GlobalCounters.creations + 1 + do GlobalCounters.IncrementCreations() let mutable disposed = false - do GlobalCounters.configs <- config :: GlobalCounters.configs + do GlobalCounters.AddConfig config interface System.IDisposable with member x.Dispose() = System.Diagnostics.Debug.Assert(not disposed) disposed <- true - GlobalCounters.disposals <- GlobalCounters.disposals + 1 - if GlobalCounters.disposals % 5 = 0 then failwith "simulate random error during disposal" + do GlobalCounters.IncrementDisposals() + if GlobalCounters.GetTotalDisposals() % 5 = 0 then failwith "simulate random error during disposal" // implementation of a poorly behaving TP that sleeps for various numbers of seconds when traversing into members. diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs index cbe55e9baf..9255acf343 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs @@ -1624,8 +1624,10 @@ type UsingMSBuild() as this = // The disposals should be at least one less Assert.IsTrue(countDisposals() < i, "Check1, countDisposals() < i, iteration " + string i) - Assert.IsTrue(countCreations() >= countDisposals(), "Check2, countCreations() >= countDisposals(), iteration " + string i) - Assert.IsTrue(countCreations() = i, "Check3, countCreations() = i, iteration " + string i) + let c = countCreations() + let d = countDisposals() + Assert.IsTrue(c >= countDisposals(), "Check2, countCreations() >= countDisposals(), iteration " + string i + ", countCreations() = " + string c + ", countDisposals() = " + string d) + Assert.IsTrue((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 From cc6e992c0600f51da712bad6012333238d8bf2fa Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 11 Mar 2019 15:30:09 +0000 Subject: [PATCH 032/286] fix build --- src/absil/ilwrite.fs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index 6e13993d7f..4ef18af006 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -89,7 +89,13 @@ type ByteBuffer with // Emit compressed untagged integer member buf.EmitZUntaggedIndex nm sz big idx = if big then buf.EmitInt32 idx - elif idx > 0xffff then failwithf "EmitZUntaggedIndex: index into table '%d' is too big for small address or simple index, idx = %d, big = %A, size of table = %d, stack = %s" nm idx big sz ((new System.Diagnostics.StackTrace()).ToString()) + elif idx > 0xffff then +#if NETSTANDARD1_6 + let trace = "no stack trace on.NET Standard 1.6" +#else + let trace = (new Diagnostics.StackTrace()).ToString() +#endif + failwithf "EmitZUntaggedIndex: index into table '%d' is too big for small address or simple index, idx = %d, big = %A, size of table = %d, stack = %s" nm idx big sz trace else buf.EmitInt32AsUInt16 idx // Emit compressed tagged integer From e13b385554fac0903a9079123ef238c56d87148c Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 11 Mar 2019 16:47:00 +0000 Subject: [PATCH 033/286] fix build --- src/absil/ilwrite.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index 4ef18af006..62628eb016 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -93,7 +93,7 @@ type ByteBuffer with #if NETSTANDARD1_6 let trace = "no stack trace on.NET Standard 1.6" #else - let trace = (new Diagnostics.StackTrace()).ToString() + let trace = (new System.Diagnostics.StackTrace()).ToString() #endif failwithf "EmitZUntaggedIndex: index into table '%d' is too big for small address or simple index, idx = %d, big = %A, size of table = %d, stack = %s" nm idx big sz trace else buf.EmitInt32AsUInt16 idx From ce0961e29d523dfc86a41861336aee64f98e68f6 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 11 Mar 2019 17:41:57 +0000 Subject: [PATCH 034/286] more diagnostics --- .../LegacyLanguageService/Tests.LanguageService.Script.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs index 9255acf343..fb969a7258 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs @@ -1623,16 +1623,16 @@ type UsingMSBuild() as this = let file1 = OpenFile(project,fileName) // The disposals should be at least one less - Assert.IsTrue(countDisposals() < i, "Check1, countDisposals() < i, iteration " + string i) let c = countCreations() let d = countDisposals() - Assert.IsTrue(c >= countDisposals(), "Check2, countCreations() >= countDisposals(), iteration " + string i + ", countCreations() = " + string c + ", countDisposals() = " + string d) + Assert.IsTrue(d < i, "Check1, countDisposals() < i, iteration " + string i + "countDisposals() = " + string d) + Assert.IsTrue(c >= d, "Check2, countCreations() >= countDisposals(), iteration " + string i + ", countCreations() = " + string c + ", countDisposals() = " + string d) Assert.IsTrue((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(i >= countDisposals() + 3, "Check4a, i >= countDisposals() + 3, iteration " + string i + ", i = " + string i + ", countDisposals() = " + string (countDisposals())) + Assert.IsTrue(i >= d + 3, "Check4a, i >= countDisposals() + 3, iteration " + string i + ", i = " + string i + ", countDisposals() = " + string d) printfn "Check4a2, i = %d, countInvaldiationHandlersRemoved() = %d" i (countInvaldiationHandlersRemoved()) // If we forcefully clear out caches and force a collection, then we can say much stronger things... From b1bf49d2aa8e44099d3c7b8154073211c5c8724c Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 12 Mar 2019 09:52:19 +0000 Subject: [PATCH 035/286] update xlf --- src/fsharp/xlf/FSComp.txt.cs.xlf | 10 ++++++++++ src/fsharp/xlf/FSComp.txt.de.xlf | 10 ++++++++++ src/fsharp/xlf/FSComp.txt.en.xlf | 10 ++++++++++ src/fsharp/xlf/FSComp.txt.es.xlf | 10 ++++++++++ src/fsharp/xlf/FSComp.txt.fr.xlf | 10 ++++++++++ src/fsharp/xlf/FSComp.txt.it.xlf | 10 ++++++++++ src/fsharp/xlf/FSComp.txt.ja.xlf | 10 ++++++++++ src/fsharp/xlf/FSComp.txt.ko.xlf | 10 ++++++++++ src/fsharp/xlf/FSComp.txt.pl.xlf | 10 ++++++++++ src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 10 ++++++++++ src/fsharp/xlf/FSComp.txt.ru.xlf | 10 ++++++++++ src/fsharp/xlf/FSComp.txt.tr.xlf | 10 ++++++++++ src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 10 ++++++++++ src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 10 ++++++++++ 14 files changed, 140 insertions(+) diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 2a1a49f154..3af791420a 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 58b4c63530..a0940167af 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.en.xlf b/src/fsharp/xlf/FSComp.txt.en.xlf index 4749ca3804..e38e9f2c97 100644 --- a/src/fsharp/xlf/FSComp.txt.en.xlf +++ b/src/fsharp/xlf/FSComp.txt.en.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index 2b1ad2daaa..38922ac1cd 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index ec1569c439..e5c2ea2913 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 3de0fd7964..71b62cb334 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 3266c305a3..1653867ec3 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index 960ddb4076..3a5b5a1cf4 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index 4ec0bfecf7..10339ac320 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 042c8ec9f2..ec1f44cce3 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index bf2c051ff8..3dd95d0f5e 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index fae96aa4ed..21066bca30 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index 8dc7a20924..3d1f275815 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 498f48b6bd..647d0f2f16 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -7132,6 +7132,16 @@ The function or method has an invalid return type '{0}'. This is not permitted by the rules of Common IL. + + Expression does not have a name. + Expression does not have a name. + + + + First-class uses of the 'nameof' operator is not permitted. + First-class uses of the 'nameof' operator is not permitted. + + \ No newline at end of file From ad6165982f946602f0956562b7bc1a13ab99b037 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 12 Mar 2019 09:56:49 +0000 Subject: [PATCH 036/286] fix build --- src/fsharp/TypeChecker.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 24a3b25658..4458425018 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8678,8 +8678,8 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( | _ -> false) | _ -> () - let arg,tpenv = TcExpr cenv domainTy env tpenv synArg - let exprAndArg, resultTy = buildApp cenv expr exprty arg mExprAndArg + let arg, tpenv = TcExpr cenv domainTy env tpenv synArg + let exprAndArg, resultTy = buildApp cenv expr resultTy arg mExprAndArg TcDelayed cenv overallTy env tpenv mExprAndArg exprAndArg resultTy atomicFlag delayed | ValueNone -> From 90b46fbaf4653379f5b3fd48e98cc804e12c6fa1 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 12 Mar 2019 11:56:32 +0000 Subject: [PATCH 037/286] revamp implementation for types and modules --- src/fsharp/TypeChecker.fs | 133 +++++++++--------- .../Microsoft.FSharp.Core/NameOfTests.fs | 36 ++++- 2 files changed, 95 insertions(+), 74 deletions(-) diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 4458425018..ad4a32080f 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8594,32 +8594,52 @@ and delayRest rest mPrior delayed = let mPriorAndLongId = unionRanges mPrior (rangeOfLid longId) DelayedDotLookup (rest, mPriorAndLongId) :: delayed -//------------------------------------------------------------------------- -// TcNameOfExpr: Typecheck "nameof" expressions -//------------------------------------------------------------------------- -and TcNameOfExpr cenv env tpenv expr = - match expr with - | SynExpr.Ident _ - | SynExpr.LongIdent(_, LongIdentWithDots _, _, _) as expr -> - ignore (TcExprOfUnknownType cenv env tpenv expr) - | SynExpr.TypeApp (expr, _, types, _, _, _, m) as fullExpr -> - let idents = - match expr with - | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) -> idents - | SynExpr.Ident ident -> [ident] - | _ -> [] - match idents with - | [] -> () - | idents -> - // try to type check it as type application, like A.B.C> - match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInType OpenQualified env.eNameResEnv env.eAccessRights idents (TypeNameResolutionStaticArgsInfo.FromTyArgs types.Length) PermitDirectReferenceToGeneratedType.No with - | ResultOrException.Result tcref -> - ignore (TcTypeApp cenv NewTyparsOK NoCheckCxs ItemOccurence.UseInType env tpenv m tcref [] types) - | _ -> - // now try to check it as generic function, like func> - ignore (TcExprOfUnknownType cenv env tpenv fullExpr) - | _ -> () +/// Typecheck "nameof" expressions +and TcNameOfExpr cenv env tpenv (synArg: SynExpr) = + + let rec stripParens expr = + match expr with + | SynExpr.Paren(expr, _, _, _) -> stripParens expr + | _ -> expr + + let cleanSynArg = stripParens synArg + let m = cleanSynArg.Range + let rec check overallTyOpt expr (delayed: DelayedItem list) = + match expr with + | LongOrSingleIdent (false, (LongIdentWithDots(longId, _) as lidd), _, _) when longId.Length > 0 -> + let ad = env.eAccessRights + let id, rest = List.headAndTail longId + match ResolveLongIndentAsModuleOrNamespace cenv.tcSink ResultCollectionSettings.AllResults cenv.amap m true OpenQualified env.eNameResEnv ad id rest true with + | Result modref when delayed.IsEmpty && modref |> List.exists (p23 >> IsEntityAccessible cenv.amap m ad) -> + () // resolved to a module or namespace, done with checks + | _ -> + let (TypeNameResolutionInfo(_, staticArgsInfo)) = GetLongIdentTypeNameInfo delayed + match ResolveTypeLongIdent cenv.tcSink cenv.nameResolver ItemOccurence.UseInAttribute OpenQualified env.eNameResEnv ad longId staticArgsInfo PermitDirectReferenceToGeneratedType.No with + | Result tcref when IsEntityAccessible cenv.amap m ad tcref -> + () // resolved to a type name, done with checks + | _ -> + let overallTy = match overallTyOpt with None -> NewInferenceType() | Some t -> t + let _, _ = TcLongIdentThen cenv overallTy env tpenv lidd delayed + () // checked as an expression, done with checks + List.last longId + + | SynExpr.TypeApp (hd, _, types, _, _, _, m) -> + check overallTyOpt hd (DelayedTypeApp(types, m, m) :: delayed) + + | SynExpr.Paren(expr, _, _, _) when overallTyOpt.IsNone && delayed.IsEmpty -> + check overallTyOpt expr [] + + | SynExpr.Typed (synBodyExpr, synType, _m) when delayed.IsEmpty && overallTyOpt.IsNone -> + let tgtTy, _tpenv = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurence.UseInType env tpenv synType + check (Some tgtTy) synBodyExpr [] + + | _ -> + error (Error(FSComp.SR.expressionHasNoName(), m)) + let lastIdent = check None cleanSynArg [] + let constRange = mkRange m.FileName m.Start (mkPos m.StartLine (m.StartColumn + lastIdent.idText.Length + 2)) // `2` are for quotes + Expr.Const(Const.String(lastIdent.idText), constRange, cenv.g.string_ty) + //------------------------------------------------------------------------- // TcFunctionApplicationThen: Typecheck "expr x" + projections //------------------------------------------------------------------------- @@ -8629,42 +8649,14 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( let mArg = synArg.Range let mFunExpr = expr.Range - /// Finds last ident of LongIdent in SynExpr.Ident, LongIdent or TypeApp. - /// Type checkes the whole thing as it goes in order to: - /// - /// * ensure we pass well typed things to `nameof` - /// - /// * not to loose `FSharpSymbolUse` for `nameof` argument, because we erase it with `Expr.Const(Const.String ...)` further in this function. - let (|LastPartOfLongIdentStripParens|_|) expr = - let rec findIdents expr = - match expr with - | SynExpr.Ident ident -> Some ident - | SynExpr.TypeApp (expr = expr) -> findIdents expr - | SynExpr.LongIdent(_, LongIdentWithDots(idents, _), _, _) -> List.tryLast idents - | _ -> None - findIdents expr - - let rec stripParens expr = - match expr with - | SynExpr.Paren(expr, _, _, _) -> stripParens expr - | _ -> expr - // If the type of 'synArg' unifies as a function type, then this is a function application, otherwise // it is an error or a computation expression match UnifyFunctionTypeUndoIfFailed cenv denv mFunExpr exprty with | ValueSome (domainTy, resultTy) -> match expr with | ApplicableExpr(_, NameOfExpr cenv.g _, _) -> - let cleanSynArg = stripParens synArg - match cleanSynArg with - | LastPartOfLongIdentStripParens lastIdent -> - TcNameOfExpr cenv env tpenv cleanSynArg - let r = expr.Range - // generate fake `range` for the constant the `nameof(..)` we are substituting - let constRange = mkRange r.FileName r.Start (mkPos r.StartLine (r.StartColumn + lastIdent.idText.Length + 2)) // `2` are for quotes - let replacementExpr = ApplicableExpr(cenv, Expr.Const(Const.String(lastIdent.idText), constRange, cenv.g.string_ty), true) - TcDelayed cenv overallTy env tpenv mExprAndArg replacementExpr cenv.g.string_ty ExprAtomicFlag.Atomic delayed - | _ -> error (Error(FSComp.SR.expressionHasNoName(), cleanSynArg.Range)) + let replacementExpr = TcNameOfExpr cenv env tpenv synArg + TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, replacementExpr, true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed | _ -> // Notice the special case 'seq { ... }'. In this case 'seq' is actually a function in the F# library. // Set a flag in the syntax tree to say we noticed a leading 'seq' @@ -8695,25 +8687,26 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( // TcLongIdentThen : Typecheck "A.B.C.E.F ... " constructs //------------------------------------------------------------------------- -and TcLongIdentThen cenv overallTy env tpenv (LongIdentWithDots(longId, _)) delayed = +and GetLongIdentTypeNameInfo delayed = + // Given 'MyOverloadedType.MySubType...' use arity of #given type arguments to help + // resolve type name lookup of 'MyOverloadedType' + // Also determine if type names should resolve to Item.Types or Item.CtorGroup + match delayed with + | DelayedTypeApp (tyargs, _, _) :: (DelayedDot | DelayedDotLookup _) :: _ -> + // cases like 'MyType.Sth' + TypeNameResolutionInfo(ResolveTypeNamesToTypeRefs, TypeNameResolutionStaticArgsInfo.FromTyArgs tyargs.Length) - let ad = env.eAccessRights - let typeNameResInfo = - // Given 'MyOverloadedType.MySubType...' use arity of #given type arguments to help - // resolve type name lookup of 'MyOverloadedType' - // Also determine if type names should resolve to Item.Types or Item.CtorGroup - match delayed with - | DelayedTypeApp (tyargs, _, _) :: (DelayedDot | DelayedDotLookup _) :: _ -> - // cases like 'MyType.Sth' - TypeNameResolutionInfo(ResolveTypeNamesToTypeRefs, TypeNameResolutionStaticArgsInfo.FromTyArgs tyargs.Length) + | DelayedTypeApp (tyargs, _, _) :: _ -> + // Note, this also covers the case 'MyType.' (without LValue_get), which is needed for VS (when typing) + TypeNameResolutionInfo(ResolveTypeNamesToCtors, TypeNameResolutionStaticArgsInfo.FromTyArgs tyargs.Length) - | DelayedTypeApp (tyargs, _, _) :: _ -> - // Note, this also covers the case 'MyType.' (without LValue_get), which is needed for VS (when typing) - TypeNameResolutionInfo(ResolveTypeNamesToCtors, TypeNameResolutionStaticArgsInfo.FromTyArgs tyargs.Length) + | _ -> + TypeNameResolutionInfo.Default - | _ -> - TypeNameResolutionInfo.Default +and TcLongIdentThen cenv overallTy env tpenv (LongIdentWithDots(longId, _)) delayed = + let ad = env.eAccessRights + let typeNameResInfo = GetLongIdentTypeNameInfo delayed let nameResolutionResult = ResolveLongIdentAsExprAndComputeRange cenv.tcSink cenv.nameResolver (rangeOfLid longId) ad env.eNameResEnv typeNameResInfo longId TcItemThen cenv overallTy env tpenv nameResolutionResult delayed diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs index e545320b14..5f2de436c9 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs @@ -4,7 +4,8 @@ namespace FSharp.Core.Unittests open System open NUnit.Framework -[] +exception ABC + type BasicNameOfTests() = let localConstant = 23 member this.MemberMethod() = 0 @@ -68,6 +69,31 @@ type BasicNameOfTests() = let b = nameof(this.MemberMethod) Assert.AreEqual("MemberMethod",b) + [] + member this.``namespace name`` () = + let b = nameof(FSharp.Core) + Assert.AreEqual("Core",b) + + [] + member this.``module name`` () = + let b = nameof(FSharp.Core.Operators) + Assert.AreEqual("Operators",b) + + [] + member this.``exception name`` () = + let b = nameof(ABC) + Assert.AreEqual("ABC",b) + + [] + member this.``nested type name 1`` () = + let b = nameof(System.Collections.Generic.List.Enumerator<_>) + Assert.AreEqual("Enumerator",b) + + [] + member this.``type name 2`` () = + let b = nameof(System.Action<_>) + Assert.AreEqual("Action",b) + [] member this.``member function which is defined below`` () = let b = nameof(this.MemberMethodDefinedBelow) @@ -131,7 +157,7 @@ type MethodGroupTests() = [] member this.``multiple argument method group name lookup`` () = - let b = nameof(this.MethodGroup1) + let b = nameof(this.MethodGroup1 : (float * int64 -> _)) Assert.AreEqual("MethodGroup1",b) [] @@ -143,9 +169,10 @@ type FrameworkMethodTests() = [] member this.``static class function name`` () = - let b = nameof(Tuple.Create) + let b = nameof(System.Tuple.Create) Assert.AreEqual("Create",b) + type CustomUnionType = | OptionA of string | OptionB of int * string @@ -225,4 +252,5 @@ type Person = match fld with | x when x = nameof __.Name -> { __ with Name = string value } | x when x = nameof __.Age -> { __ with Age = value :?> int } - | _ -> __ \ No newline at end of file + | _ -> __ + From 21b4705ea46770589bbbe428078bd1d5f2aa0a5d Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 12 Mar 2019 13:47:40 +0000 Subject: [PATCH 038/286] update tests --- .../FSharp.Core.UnitTests.fsproj | 4 +- .../Microsoft.FSharp.Core/NameOfTests.fs | 49 +++++++++++++++++-- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj index 9b52a7accb..883176be07 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj @@ -86,14 +86,12 @@ - + - - diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs index 5f2de436c9..c9f9c51b2f 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs @@ -142,7 +142,7 @@ type BasicNameOfTests() = Assert.AreEqual("local property with encapsulated name and %.f",b) [] -type MethodGroupTests() = +type MethodGroupNameOfTests() = member this.MethodGroup() = () member this.MethodGroup(i:int) = () @@ -174,11 +174,53 @@ type FrameworkMethodTests() = type CustomUnionType = -| OptionA of string +| OptionA | OptionB of int * string +type CustomRecordType = + { X: int; Y: int } + +[] type Milliquacks + [] -type OperatorNameTests() = +type UnionAndRecordNameOfTests() = + + + [] + member this.``measure 1`` () = + let b = nameof(Milliquacks) + Assert.AreEqual("Milliquacks",b) + + [] + member this.``record case 1`` () = + let sample = Unchecked.defaultof + let b = nameof(sample.X) + Assert.AreEqual("X",b) + let b = nameof(sample.Y) + Assert.AreEqual("Y",b) + + [] + member this.``union case 1`` () = + let b = nameof(OptionA) + Assert.AreEqual("OptionA",b) + + [] + member this.``union case 2`` () = + let b = nameof(OptionB) + Assert.AreEqual("OptionB",b) + +[] +type AttributeNameOfTests() = + + [] + member this.``ok in attribute`` () = + let t = typeof.GetMethod("ok in attribute") + let attrs = t.GetCustomAttributes(typeof, false) + let attr = attrs.[0] :?> ObsoleteAttribute + Assert.AreEqual(attr.Message, "test string") + +[] +type OperatorNameOfTests() = [] member this.``lookup name of typeof operator`` () = @@ -254,3 +296,4 @@ type Person = | x when x = nameof __.Age -> { __ with Age = value :?> int } | _ -> __ + From 51e201225af989e81e4c98746d481ddacd01af64 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 12 Mar 2019 14:11:28 +0000 Subject: [PATCH 039/286] try to fix flaky test --- .../DummyProviderForLanguageServiceTesting.fs | 5 ++- .../Tests.LanguageService.Script.fs | 32 ++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs index 697ba4a2d7..7c36d8f37e 100644 --- a/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs +++ b/vsintegration/tests/MockTypeProviders/DummyProviderForLanguageServiceTesting/DummyProviderForLanguageServiceTesting.fs @@ -124,7 +124,10 @@ module GlobalCounters = let AddConfig c = lock counterLock (fun () -> configs <- c :: configs) let GetConfigs() = lock counterLock (fun () -> configs) let CheckAllConfigsDisposed() = - for c in GetConfigs() do + let cs = GetConfigs() + lock counterLock (fun () -> + configs <- []) + for c in cs do try c.SystemRuntimeContainsType("System.Object") |> ignore failwith "expected configuration object to be disposed" diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs index fb969a7258..8199896559 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs @@ -1625,26 +1625,42 @@ type UsingMSBuild() as this = // The disposals should be at least one less let c = countCreations() let d = countDisposals() - Assert.IsTrue(d < i, "Check1, countDisposals() < i, iteration " + string i + "countDisposals() = " + string d) + + // 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.IsTrue((c = i), "Check3, countCreations() = i, iteration " + string i + ", countCreations() = " + string c) + + // 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) + 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(i >= d + 3, "Check4a, i >= countDisposals() + 3, iteration " + string i + ", i = " + string i + ", countDisposals() = " + string d) + Assert.IsTrue(c >= d + 3, "Check4a, c >= countDisposals() + 3, iteration " + string i + ", i = " + string i + ", countDisposals() = " + string d) printfn "Check4a2, i = %d, countInvaldiationHandlersRemoved() = %d" i (countInvaldiationHandlersRemoved()) // If we forcefully clear out caches and force a collection, then we can say much stronger things... if clearing then ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients(this.VS) - Assert.IsTrue((i = countDisposals()), "Check4b, countCreations() = countDisposals(), iteration " + string i) - Assert.IsTrue(countInvaldiationHandlersAdded() - countInvaldiationHandlersRemoved() = 0, "Check4b2, all invlidation handlers removed, iteration " + string i) + let c = countCreations() + let d = countDisposals() + + // Creations should be equal to disposals after a `ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients` + Assert.IsTrue((c = d), "Check4b, countCreations() = countDisposals(), iteration " + string i) + Assert.IsTrue((countInvaldiationHandlersAdded() = countInvaldiationHandlersRemoved()), "Check4b2, all invlidation handlers removed, iteration " + string i) - Assert.IsTrue(countCreations() = 50, "Check5, at end, countCreations() = 50") + let c = countCreations() + let d = countDisposals() + Assert.IsTrue(c >= 50, "Check5, at end, countCreations() >= 50") + ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients(this.VS) - Assert.IsTrue(countDisposals() = 50, "Check6b, at end, countDisposals() = 50 after explicit clearing") - Assert.IsTrue(countInvaldiationHandlersAdded() - countInvaldiationHandlersRemoved() = 0, "Check6b2, at end, all invalidation handlers removed after explicit cleraring") + + 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((countInvaldiationHandlersAdded() = countInvaldiationHandlersRemoved()) = 0, "Check6b2, at end, all invalidation handlers removed after explicit cleraring") checkConfigsDisposed() [] From d482527dd923fa6c139e3f8686c755b012b7cc16 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 12 Mar 2019 15:37:44 +0000 Subject: [PATCH 040/286] fix error numbers --- .../Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs | 2 +- .../DataExpressions/NameOf/E_NameOfAppliedFunction.fs | 2 +- .../Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs | 2 +- .../Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs | 2 +- .../DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs | 2 +- .../DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs | 2 +- .../DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs | 2 +- .../Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs | 2 +- tests/fsharpqa/Source/Warnings/EqualsInsteadOfInInForLoop.fs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs index 2e082efb21..e0ea446400 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const string -//Expression does not have a name. +//Expression does not have a name. let x = nameof(1+2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs index 49095e69ed..40b57503e2 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//Expression does not have a name. +//Expression does not have a name. let f() = 1 let x = nameof(f()) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs index 0a58a4bba7..1ae13ab859 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on dictionary lookup -//Expression does not have a name. +//Expression does not have a name. let dict = new System.Collections.Generic.Dictionary() let b = nameof(dict.[2]) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs index 6b67627d67..727c9ec3b8 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const int -//Expression does not have a name. +//Expression does not have a name. let x = nameof 1 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs index 4fe8db0547..ad8d0e5426 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//Expression does not have a name. +//Expression does not have a name. let f x = 1 * x let x = nameof(f 2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs index c24f7343a1..1793de15bc 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//Expression does not have a name. +//Expression does not have a name. let f x y = x y let z x = 1 * x diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs index 71b66493b5..ca993e87e0 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on partially applied functions -//Expression does not have a name. +//Expression does not have a name. let f x y = y * x let x = nameof(f 2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs index 1190f1e8b3..2d7428c0c4 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const string -//Expression does not have a name. +//Expression does not have a name. let x = nameof "string" diff --git a/tests/fsharpqa/Source/Warnings/EqualsInsteadOfInInForLoop.fs b/tests/fsharpqa/Source/Warnings/EqualsInsteadOfInInForLoop.fs index 4100e205a5..064b69e1ee 100644 --- a/tests/fsharpqa/Source/Warnings/EqualsInsteadOfInInForLoop.fs +++ b/tests/fsharpqa/Source/Warnings/EqualsInsteadOfInInForLoop.fs @@ -1,5 +1,5 @@ // #Warnings -//Unexpected symbol '=' in expression. Did you intend to use 'for x in y .. z do' instead? +//Unexpected symbol '=' in expression. Did you intend to use 'for x in y .. z do' instead? for i = 0 .. 100 do () From 26e05dde26e2b003693f211c9f3380577d90926d Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 12 Mar 2019 15:44:16 +0000 Subject: [PATCH 041/286] fix build --- .../LegacyLanguageService/Tests.LanguageService.Script.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs index 8199896559..cb5c4da346 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Script.fs @@ -1660,7 +1660,7 @@ type UsingMSBuild() as this = 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((countInvaldiationHandlersAdded() = countInvaldiationHandlersRemoved()) = 0, "Check6b2, at end, all invalidation handlers removed after explicit cleraring") + Assert.IsTrue((countInvaldiationHandlersAdded() = countInvaldiationHandlersRemoved()), "Check6b2, at end, all invalidation handlers removed after explicit cleraring") checkConfigsDisposed() [] From 8a7f0465163f34d4383d502abc72e3e2d61a5a79 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 12 Mar 2019 16:49:10 +0000 Subject: [PATCH 042/286] update build from source --- .../FSharp.Compiler.Private/FSComp.fs | 2796 ++++++++--------- .../FSharp.Compiler.Private/FSComp.resx | 11 +- 2 files changed, 1402 insertions(+), 1405 deletions(-) diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs b/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs index c6ff96cb90..1784224723 100644 --- a/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs +++ b/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs @@ -15,19 +15,9 @@ type internal SR private() = // BEGIN BOILERPLATE - static let getCurrentAssembly () = - #if FX_RESHAPED_REFLECTION - typeof.GetTypeInfo().Assembly - #else - System.Reflection.Assembly.GetExecutingAssembly() - #endif + static let getCurrentAssembly () = System.Reflection.Assembly.GetExecutingAssembly() - static let getTypeInfo (t: System.Type) = - #if FX_RESHAPED_REFLECTION - t.GetTypeInfo() - #else - t - #endif + static let getTypeInfo (t: System.Type) = t static let resources = lazy (new System.Resources.ResourceManager("FSComp", getCurrentAssembly())) @@ -244,4160 +234,4163 @@ type internal SR private() = /// Multiple references to '%s.dll' are not permitted /// (Originally from ..\FSComp.txt:46) static member buildMultipleReferencesNotAllowed(a0 : System.String) = (215, GetStringFunc("buildMultipleReferencesNotAllowed",",,,%s,,,") a0) - /// Could not read version from mscorlib.dll - /// (Originally from ..\FSComp.txt:47) - static member buildCouldNotReadVersionInfoFromMscorlib() = (GetStringFunc("buildCouldNotReadVersionInfoFromMscorlib",",,,") ) /// Unable to read assembly '%s' - /// (Originally from ..\FSComp.txt:48) + /// (Originally from ..\FSComp.txt:47) static member buildCannotReadAssembly(a0 : System.String) = (218, GetStringFunc("buildCannotReadAssembly",",,,%s,,,") a0) /// Assembly resolution failure at or near this location - /// (Originally from ..\FSComp.txt:49) + /// (Originally from ..\FSComp.txt:48) static member buildAssemblyResolutionFailed() = (220, GetStringFunc("buildAssemblyResolutionFailed",",,,") ) /// The declarations in this file will be placed in an implicit module '%s' based on the file name '%s'. However this is not a valid F# identifier, so the contents will not be accessible from other files. Consider renaming the file or adding a 'module' or 'namespace' declaration at the top of the file. - /// (Originally from ..\FSComp.txt:50) + /// (Originally from ..\FSComp.txt:49) static member buildImplicitModuleIsNotLegalIdentifier(a0 : System.String, a1 : System.String) = (221, GetStringFunc("buildImplicitModuleIsNotLegalIdentifier",",,,%s,,,%s,,,") a0 a1) /// Files in libraries or multiple-file applications must begin with a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'. Only the last source file of an application may omit such a declaration. - /// (Originally from ..\FSComp.txt:51) + /// (Originally from ..\FSComp.txt:50) static member buildMultiFileRequiresNamespaceOrModule() = (222, GetStringFunc("buildMultiFileRequiresNamespaceOrModule",",,,") ) /// Files in libraries or multiple-file applications must begin with a namespace or module declaration. When using a module declaration at the start of a file the '=' sign is not allowed. If this is a top-level module, consider removing the = to resolve this error. - /// (Originally from ..\FSComp.txt:52) + /// (Originally from ..\FSComp.txt:51) static member noEqualSignAfterModule() = (222, GetStringFunc("noEqualSignAfterModule",",,,") ) /// This file contains multiple declarations of the form 'module SomeNamespace.SomeModule'. Only one declaration of this form is permitted in a file. Change your file to use an initial namespace declaration and/or use 'module ModuleName = ...' to define your modules. - /// (Originally from ..\FSComp.txt:53) + /// (Originally from ..\FSComp.txt:52) static member buildMultipleToplevelModules() = (223, GetStringFunc("buildMultipleToplevelModules",",,,") ) /// Option requires parameter: %s - /// (Originally from ..\FSComp.txt:54) + /// (Originally from ..\FSComp.txt:53) static member buildOptionRequiresParameter(a0 : System.String) = (224, GetStringFunc("buildOptionRequiresParameter",",,,%s,,,") a0) /// Source file '%s' could not be found - /// (Originally from ..\FSComp.txt:55) + /// (Originally from ..\FSComp.txt:54) static member buildCouldNotFindSourceFile(a0 : System.String) = (225, GetStringFunc("buildCouldNotFindSourceFile",",,,%s,,,") a0) /// The file extension of '%s' is not recognized. Source files must have extension .fs, .fsi, .fsx, .fsscript, .ml or .mli. - /// (Originally from ..\FSComp.txt:56) + /// (Originally from ..\FSComp.txt:55) static member buildInvalidSourceFileExtension(a0 : System.String) = (226, GetStringFunc("buildInvalidSourceFileExtension",",,,%s,,,") a0) /// Could not resolve assembly '%s' - /// (Originally from ..\FSComp.txt:57) + /// (Originally from ..\FSComp.txt:56) static member buildCouldNotResolveAssembly(a0 : System.String) = (227, GetStringFunc("buildCouldNotResolveAssembly",",,,%s,,,") a0) /// Could not resolve assembly '%s' required by '%s' - /// (Originally from ..\FSComp.txt:58) + /// (Originally from ..\FSComp.txt:57) static member buildCouldNotResolveAssemblyRequiredByFile(a0 : System.String, a1 : System.String) = (228, GetStringFunc("buildCouldNotResolveAssemblyRequiredByFile",",,,%s,,,%s,,,") a0 a1) /// Error opening binary file '%s': %s - /// (Originally from ..\FSComp.txt:59) + /// (Originally from ..\FSComp.txt:58) static member buildErrorOpeningBinaryFile(a0 : System.String, a1 : System.String) = (229, GetStringFunc("buildErrorOpeningBinaryFile",",,,%s,,,%s,,,") a0 a1) /// The F#-compiled DLL '%s' needs to be recompiled to be used with this version of F# - /// (Originally from ..\FSComp.txt:60) + /// (Originally from ..\FSComp.txt:59) static member buildDifferentVersionMustRecompile(a0 : System.String) = (231, GetStringFunc("buildDifferentVersionMustRecompile",",,,%s,,,") a0) /// Invalid directive. Expected '#I \"\"'. - /// (Originally from ..\FSComp.txt:61) + /// (Originally from ..\FSComp.txt:60) static member buildInvalidHashIDirective() = (232, GetStringFunc("buildInvalidHashIDirective",",,,") ) /// Invalid directive. Expected '#r \"\"'. - /// (Originally from ..\FSComp.txt:62) + /// (Originally from ..\FSComp.txt:61) static member buildInvalidHashrDirective() = (233, GetStringFunc("buildInvalidHashrDirective",",,,") ) /// Invalid directive. Expected '#load \"\" ... \"\"'. - /// (Originally from ..\FSComp.txt:63) + /// (Originally from ..\FSComp.txt:62) static member buildInvalidHashloadDirective() = (234, GetStringFunc("buildInvalidHashloadDirective",",,,") ) /// Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - /// (Originally from ..\FSComp.txt:64) + /// (Originally from ..\FSComp.txt:63) static member buildInvalidHashtimeDirective() = (235, GetStringFunc("buildInvalidHashtimeDirective",",,,") ) /// Directives inside modules are ignored - /// (Originally from ..\FSComp.txt:65) + /// (Originally from ..\FSComp.txt:64) static member buildDirectivesInModulesAreIgnored() = (236, GetStringFunc("buildDirectivesInModulesAreIgnored",",,,") ) /// A signature for the file or module '%s' has already been specified - /// (Originally from ..\FSComp.txt:66) + /// (Originally from ..\FSComp.txt:65) static member buildSignatureAlreadySpecified(a0 : System.String) = (237, GetStringFunc("buildSignatureAlreadySpecified",",,,%s,,,") a0) /// An implementation of file or module '%s' has already been given. Compilation order is significant in F# because of type inference. You may need to adjust the order of your files to place the signature file before the implementation. In Visual Studio files are type-checked in the order they appear in the project file, which can be edited manually or adjusted using the solution explorer. - /// (Originally from ..\FSComp.txt:67) + /// (Originally from ..\FSComp.txt:66) static member buildImplementationAlreadyGivenDetail(a0 : System.String) = (238, GetStringFunc("buildImplementationAlreadyGivenDetail",",,,%s,,,") a0) /// An implementation of the file or module '%s' has already been given - /// (Originally from ..\FSComp.txt:68) + /// (Originally from ..\FSComp.txt:67) static member buildImplementationAlreadyGiven(a0 : System.String) = (239, GetStringFunc("buildImplementationAlreadyGiven",",,,%s,,,") a0) /// The signature file '%s' does not have a corresponding implementation file. If an implementation file exists then check the 'module' and 'namespace' declarations in the signature and implementation files match. - /// (Originally from ..\FSComp.txt:69) + /// (Originally from ..\FSComp.txt:68) static member buildSignatureWithoutImplementation(a0 : System.String) = (240, GetStringFunc("buildSignatureWithoutImplementation",",,,%s,,,") a0) /// '%s' is not a valid integer argument - /// (Originally from ..\FSComp.txt:70) + /// (Originally from ..\FSComp.txt:69) static member buildArgInvalidInt(a0 : System.String) = (241, GetStringFunc("buildArgInvalidInt",",,,%s,,,") a0) /// '%s' is not a valid floating point argument - /// (Originally from ..\FSComp.txt:71) + /// (Originally from ..\FSComp.txt:70) static member buildArgInvalidFloat(a0 : System.String) = (242, GetStringFunc("buildArgInvalidFloat",",,,%s,,,") a0) /// Unrecognized option: '%s' - /// (Originally from ..\FSComp.txt:72) + /// (Originally from ..\FSComp.txt:71) static member buildUnrecognizedOption(a0 : System.String) = (243, GetStringFunc("buildUnrecognizedOption",",,,%s,,,") a0) /// Invalid module or namespace name - /// (Originally from ..\FSComp.txt:73) + /// (Originally from ..\FSComp.txt:72) static member buildInvalidModuleOrNamespaceName() = (244, GetStringFunc("buildInvalidModuleOrNamespaceName",",,,") ) /// Error reading/writing metadata for the F# compiled DLL '%s'. Was the DLL compiled with an earlier version of the F# compiler? (error: '%s'). - /// (Originally from ..\FSComp.txt:74) + /// (Originally from ..\FSComp.txt:73) static member pickleErrorReadingWritingMetadata(a0 : System.String, a1 : System.String) = (GetStringFunc("pickleErrorReadingWritingMetadata",",,,%s,,,%s,,,") a0 a1) /// The type/module '%s' is not a concrete module or type - /// (Originally from ..\FSComp.txt:75) + /// (Originally from ..\FSComp.txt:74) static member tastTypeOrModuleNotConcrete(a0 : System.String) = (245, GetStringFunc("tastTypeOrModuleNotConcrete",",,,%s,,,") a0) /// The type '%s' has an inline assembly code representation - /// (Originally from ..\FSComp.txt:76) + /// (Originally from ..\FSComp.txt:75) static member tastTypeHasAssemblyCodeRepresentation(a0 : System.String) = (GetStringFunc("tastTypeHasAssemblyCodeRepresentation",",,,%s,,,") a0) /// A namespace and a module named '%s' both occur in two parts of this assembly - /// (Originally from ..\FSComp.txt:77) + /// (Originally from ..\FSComp.txt:76) static member tastNamespaceAndModuleWithSameNameInAssembly(a0 : System.String) = (247, GetStringFunc("tastNamespaceAndModuleWithSameNameInAssembly",",,,%s,,,") a0) /// Two modules named '%s' occur in two parts of this assembly - /// (Originally from ..\FSComp.txt:78) + /// (Originally from ..\FSComp.txt:77) static member tastTwoModulesWithSameNameInAssembly(a0 : System.String) = (248, GetStringFunc("tastTwoModulesWithSameNameInAssembly",",,,%s,,,") a0) /// Two type definitions named '%s' occur in namespace '%s' in two parts of this assembly - /// (Originally from ..\FSComp.txt:79) + /// (Originally from ..\FSComp.txt:78) static member tastDuplicateTypeDefinitionInAssembly(a0 : System.String, a1 : System.String) = (249, GetStringFunc("tastDuplicateTypeDefinitionInAssembly",",,,%s,,,%s,,,") a0 a1) /// A module and a type definition named '%s' occur in namespace '%s' in two parts of this assembly - /// (Originally from ..\FSComp.txt:80) + /// (Originally from ..\FSComp.txt:79) static member tastConflictingModuleAndTypeDefinitionInAssembly(a0 : System.String, a1 : System.String) = (250, GetStringFunc("tastConflictingModuleAndTypeDefinitionInAssembly",",,,%s,,,%s,,,") a0 a1) /// Invalid member signature encountered because of an earlier error - /// (Originally from ..\FSComp.txt:81) + /// (Originally from ..\FSComp.txt:80) static member tastInvalidMemberSignature() = (251, GetStringFunc("tastInvalidMemberSignature",",,,") ) /// This value does not have a valid property setter type - /// (Originally from ..\FSComp.txt:82) + /// (Originally from ..\FSComp.txt:81) static member tastValueDoesNotHaveSetterType() = (252, GetStringFunc("tastValueDoesNotHaveSetterType",",,,") ) /// Invalid form for a property getter. At least one '()' argument is required when using the explicit syntax. - /// (Originally from ..\FSComp.txt:83) + /// (Originally from ..\FSComp.txt:82) static member tastInvalidFormForPropertyGetter() = (253, GetStringFunc("tastInvalidFormForPropertyGetter",",,,") ) /// Invalid form for a property setter. At least one argument is required. - /// (Originally from ..\FSComp.txt:84) + /// (Originally from ..\FSComp.txt:83) static member tastInvalidFormForPropertySetter() = (254, GetStringFunc("tastInvalidFormForPropertySetter",",,,") ) /// Unexpected use of a byref-typed variable - /// (Originally from ..\FSComp.txt:85) + /// (Originally from ..\FSComp.txt:84) static member tastUnexpectedByRef() = (255, GetStringFunc("tastUnexpectedByRef",",,,") ) /// A value must be mutable in order to mutate the contents or take the address of a value type, e.g. 'let mutable x = ...' - /// (Originally from ..\FSComp.txt:86) + /// (Originally from ..\FSComp.txt:85) static member tastValueMustBeMutable() = (256, GetStringFunc("tastValueMustBeMutable",",,,") ) /// Invalid mutation of a constant expression. Consider copying the expression to a mutable local, e.g. 'let mutable x = ...'. - /// (Originally from ..\FSComp.txt:87) + /// (Originally from ..\FSComp.txt:86) static member tastInvalidMutationOfConstant() = (257, GetStringFunc("tastInvalidMutationOfConstant",",,,") ) /// The value has been copied to ensure the original is not mutated by this operation or because the copy is implicit when returning a struct from a member and another member is then accessed - /// (Originally from ..\FSComp.txt:88) + /// (Originally from ..\FSComp.txt:87) static member tastValueHasBeenCopied() = (GetStringFunc("tastValueHasBeenCopied",",,,") ) /// Recursively defined values cannot appear directly as part of the construction of a tuple value within a recursive binding - /// (Originally from ..\FSComp.txt:89) + /// (Originally from ..\FSComp.txt:88) static member tastRecursiveValuesMayNotBeInConstructionOfTuple() = (259, GetStringFunc("tastRecursiveValuesMayNotBeInConstructionOfTuple",",,,") ) /// Recursive values cannot appear directly as a construction of the type '%s' within a recursive binding. This feature has been removed from the F# language. Consider using a record instead. - /// (Originally from ..\FSComp.txt:90) + /// (Originally from ..\FSComp.txt:89) static member tastRecursiveValuesMayNotAppearInConstructionOfType(a0 : System.String) = (260, GetStringFunc("tastRecursiveValuesMayNotAppearInConstructionOfType",",,,%s,,,") a0) /// Recursive values cannot be directly assigned to the non-mutable field '%s' of the type '%s' within a recursive binding. Consider using a mutable field instead. - /// (Originally from ..\FSComp.txt:91) + /// (Originally from ..\FSComp.txt:90) static member tastRecursiveValuesMayNotBeAssignedToNonMutableField(a0 : System.String, a1 : System.String) = (261, GetStringFunc("tastRecursiveValuesMayNotBeAssignedToNonMutableField",",,,%s,,,%s,,,") a0 a1) /// Unexpected decode of AutoOpenAttribute - /// (Originally from ..\FSComp.txt:92) + /// (Originally from ..\FSComp.txt:91) static member tastUnexpectedDecodeOfAutoOpenAttribute() = (GetStringFunc("tastUnexpectedDecodeOfAutoOpenAttribute",",,,") ) /// Unexpected decode of InternalsVisibleToAttribute - /// (Originally from ..\FSComp.txt:93) + /// (Originally from ..\FSComp.txt:92) static member tastUnexpectedDecodeOfInternalsVisibleToAttribute() = (GetStringFunc("tastUnexpectedDecodeOfInternalsVisibleToAttribute",",,,") ) /// Unexpected decode of InterfaceDataVersionAttribute - /// (Originally from ..\FSComp.txt:94) + /// (Originally from ..\FSComp.txt:93) static member tastUnexpectedDecodeOfInterfaceDataVersionAttribute() = (GetStringFunc("tastUnexpectedDecodeOfInterfaceDataVersionAttribute",",,,") ) /// Active patterns cannot return more than 7 possibilities - /// (Originally from ..\FSComp.txt:95) + /// (Originally from ..\FSComp.txt:94) static member tastActivePatternsLimitedToSeven() = (265, GetStringFunc("tastActivePatternsLimitedToSeven",",,,") ) /// This is not a valid constant expression or custom attribute value - /// (Originally from ..\FSComp.txt:96) + /// (Originally from ..\FSComp.txt:95) static member tastNotAConstantExpression() = (267, GetStringFunc("tastNotAConstantExpression",",,,") ) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe mutability attributes differ - /// (Originally from ..\FSComp.txt:97) + /// (Originally from ..\FSComp.txt:96) static member ValueNotContainedMutabilityAttributesDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityAttributesDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe names differ - /// (Originally from ..\FSComp.txt:98) + /// (Originally from ..\FSComp.txt:97) static member ValueNotContainedMutabilityNamesDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityNamesDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe compiled names differ - /// (Originally from ..\FSComp.txt:99) + /// (Originally from ..\FSComp.txt:98) static member ValueNotContainedMutabilityCompiledNamesDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityCompiledNamesDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe display names differ - /// (Originally from ..\FSComp.txt:100) + /// (Originally from ..\FSComp.txt:99) static member ValueNotContainedMutabilityDisplayNamesDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityDisplayNamesDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe accessibility specified in the signature is more than that specified in the implementation - /// (Originally from ..\FSComp.txt:101) + /// (Originally from ..\FSComp.txt:100) static member ValueNotContainedMutabilityAccessibilityMore(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityAccessibilityMore",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe inline flags differ - /// (Originally from ..\FSComp.txt:102) + /// (Originally from ..\FSComp.txt:101) static member ValueNotContainedMutabilityInlineFlagsDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityInlineFlagsDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe literal constant values and/or attributes differ - /// (Originally from ..\FSComp.txt:103) + /// (Originally from ..\FSComp.txt:102) static member ValueNotContainedMutabilityLiteralConstantValuesDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityLiteralConstantValuesDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nOne is a type function and the other is not. The signature requires explicit type parameters if they are present in the implementation. - /// (Originally from ..\FSComp.txt:104) + /// (Originally from ..\FSComp.txt:103) static member ValueNotContainedMutabilityOneIsTypeFunction(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityOneIsTypeFunction",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe respective type parameter counts differ - /// (Originally from ..\FSComp.txt:105) + /// (Originally from ..\FSComp.txt:104) static member ValueNotContainedMutabilityParameterCountsDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityParameterCountsDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe types differ - /// (Originally from ..\FSComp.txt:106) + /// (Originally from ..\FSComp.txt:105) static member ValueNotContainedMutabilityTypesDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityTypesDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nOne is an extension member and the other is not - /// (Originally from ..\FSComp.txt:107) + /// (Originally from ..\FSComp.txt:106) static member ValueNotContainedMutabilityExtensionsDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityExtensionsDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nAn arity was not inferred for this value - /// (Originally from ..\FSComp.txt:108) + /// (Originally from ..\FSComp.txt:107) static member ValueNotContainedMutabilityArityNotInferred(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityArityNotInferred",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe number of generic parameters in the signature and implementation differ (the signature declares %s but the implementation declares %s - /// (Originally from ..\FSComp.txt:109) + /// (Originally from ..\FSComp.txt:108) static member ValueNotContainedMutabilityGenericParametersDiffer(a0 : System.String, a1 : System.String, a2 : System.String, a3 : System.String, a4 : System.String) = (GetStringFunc("ValueNotContainedMutabilityGenericParametersDiffer",",,,%s,,,%s,,,%s,,,%s,,,%s,,,") a0 a1 a2 a3 a4) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe generic parameters in the signature and implementation have different kinds. Perhaps there is a missing [] attribute. - /// (Originally from ..\FSComp.txt:110) + /// (Originally from ..\FSComp.txt:109) static member ValueNotContainedMutabilityGenericParametersAreDifferentKinds(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityGenericParametersAreDifferentKinds",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe arities in the signature and implementation differ. The signature specifies that '%s' is function definition or lambda expression accepting at least %s argument(s), but the implementation is a computed function value. To declare that a computed function value is a permitted implementation simply parenthesize its type in the signature, e.g.\n\tval %s: int -> (int -> int)\ninstead of\n\tval %s: int -> int -> int. - /// (Originally from ..\FSComp.txt:111) + /// (Originally from ..\FSComp.txt:110) static member ValueNotContainedMutabilityAritiesDiffer(a0 : System.String, a1 : System.String, a2 : System.String, a3 : System.String, a4 : System.String, a5 : System.String, a6 : System.String) = (GetStringFunc("ValueNotContainedMutabilityAritiesDiffer",",,,%s,,,%s,,,%s,,,%s,,,%s,,,%s,,,%s,,,") a0 a1 a2 a3 a4 a5 a6) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe CLI member names differ - /// (Originally from ..\FSComp.txt:112) + /// (Originally from ..\FSComp.txt:111) static member ValueNotContainedMutabilityDotNetNamesDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityDotNetNamesDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nOne is static and the other isn't - /// (Originally from ..\FSComp.txt:113) + /// (Originally from ..\FSComp.txt:112) static member ValueNotContainedMutabilityStaticsDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityStaticsDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nOne is virtual and the other isn't - /// (Originally from ..\FSComp.txt:114) + /// (Originally from ..\FSComp.txt:113) static member ValueNotContainedMutabilityVirtualsDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityVirtualsDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nOne is abstract and the other isn't - /// (Originally from ..\FSComp.txt:115) + /// (Originally from ..\FSComp.txt:114) static member ValueNotContainedMutabilityAbstractsDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityAbstractsDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nOne is final and the other isn't - /// (Originally from ..\FSComp.txt:116) + /// (Originally from ..\FSComp.txt:115) static member ValueNotContainedMutabilityFinalsDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityFinalsDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nOne is marked as an override and the other isn't - /// (Originally from ..\FSComp.txt:117) + /// (Originally from ..\FSComp.txt:116) static member ValueNotContainedMutabilityOverridesDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityOverridesDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nOne is a constructor/property and the other is not - /// (Originally from ..\FSComp.txt:118) + /// (Originally from ..\FSComp.txt:117) static member ValueNotContainedMutabilityOneIsConstructor(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityOneIsConstructor",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe compiled representation of this method is as a static member but the signature indicates its compiled representation is as an instance member - /// (Originally from ..\FSComp.txt:119) + /// (Originally from ..\FSComp.txt:118) static member ValueNotContainedMutabilityStaticButInstance(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityStaticButInstance",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Module '%s' contains\n %s \nbut its signature specifies\n %s \nThe compiled representation of this method is as an instance member, but the signature indicates its compiled representation is as a static member - /// (Originally from ..\FSComp.txt:120) + /// (Originally from ..\FSComp.txt:119) static member ValueNotContainedMutabilityInstanceButStatic(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ValueNotContainedMutabilityInstanceButStatic",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The %s definitions in the signature and implementation are not compatible because the names differ. The type is called '%s' in the signature file but '%s' in implementation. - /// (Originally from ..\FSComp.txt:121) + /// (Originally from ..\FSComp.txt:120) static member DefinitionsInSigAndImplNotCompatibleNamesDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (290, GetStringFunc("DefinitionsInSigAndImplNotCompatibleNamesDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the respective type parameter counts differ - /// (Originally from ..\FSComp.txt:122) + /// (Originally from ..\FSComp.txt:121) static member DefinitionsInSigAndImplNotCompatibleParameterCountsDiffer(a0 : System.String, a1 : System.String) = (291, GetStringFunc("DefinitionsInSigAndImplNotCompatibleParameterCountsDiffer",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the accessibility specified in the signature is more than that specified in the implementation - /// (Originally from ..\FSComp.txt:123) + /// (Originally from ..\FSComp.txt:122) static member DefinitionsInSigAndImplNotCompatibleAccessibilityDiffer(a0 : System.String, a1 : System.String) = (292, GetStringFunc("DefinitionsInSigAndImplNotCompatibleAccessibilityDiffer",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the signature requires that the type supports the interface %s but the interface has not been implemented - /// (Originally from ..\FSComp.txt:124) + /// (Originally from ..\FSComp.txt:123) static member DefinitionsInSigAndImplNotCompatibleMissingInterface(a0 : System.String, a1 : System.String, a2 : System.String) = (293, GetStringFunc("DefinitionsInSigAndImplNotCompatibleMissingInterface",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the implementation says this type may use nulls as a representation but the signature does not - /// (Originally from ..\FSComp.txt:125) + /// (Originally from ..\FSComp.txt:124) static member DefinitionsInSigAndImplNotCompatibleImplementationSaysNull(a0 : System.String, a1 : System.String) = (294, GetStringFunc("DefinitionsInSigAndImplNotCompatibleImplementationSaysNull",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the implementation says this type may use nulls as an extra value but the signature does not - /// (Originally from ..\FSComp.txt:126) + /// (Originally from ..\FSComp.txt:125) static member DefinitionsInSigAndImplNotCompatibleImplementationSaysNull2(a0 : System.String, a1 : System.String) = (294, GetStringFunc("DefinitionsInSigAndImplNotCompatibleImplementationSaysNull2",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the signature says this type may use nulls as a representation but the implementation does not - /// (Originally from ..\FSComp.txt:127) + /// (Originally from ..\FSComp.txt:126) static member DefinitionsInSigAndImplNotCompatibleSignatureSaysNull(a0 : System.String, a1 : System.String) = (295, GetStringFunc("DefinitionsInSigAndImplNotCompatibleSignatureSaysNull",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the signature says this type may use nulls as an extra value but the implementation does not - /// (Originally from ..\FSComp.txt:128) + /// (Originally from ..\FSComp.txt:127) static member DefinitionsInSigAndImplNotCompatibleSignatureSaysNull2(a0 : System.String, a1 : System.String) = (295, GetStringFunc("DefinitionsInSigAndImplNotCompatibleSignatureSaysNull2",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the implementation type is sealed but the signature implies it is not. Consider adding the [] attribute to the signature. - /// (Originally from ..\FSComp.txt:129) + /// (Originally from ..\FSComp.txt:128) static member DefinitionsInSigAndImplNotCompatibleImplementationSealed(a0 : System.String, a1 : System.String) = (296, GetStringFunc("DefinitionsInSigAndImplNotCompatibleImplementationSealed",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the implementation type is not sealed but signature implies it is. Consider adding the [] attribute to the implementation. - /// (Originally from ..\FSComp.txt:130) + /// (Originally from ..\FSComp.txt:129) static member DefinitionsInSigAndImplNotCompatibleImplementationIsNotSealed(a0 : System.String, a1 : System.String) = (297, GetStringFunc("DefinitionsInSigAndImplNotCompatibleImplementationIsNotSealed",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the implementation is an abstract class but the signature is not. Consider adding the [] attribute to the signature. - /// (Originally from ..\FSComp.txt:131) + /// (Originally from ..\FSComp.txt:130) static member DefinitionsInSigAndImplNotCompatibleImplementationIsAbstract(a0 : System.String, a1 : System.String) = (298, GetStringFunc("DefinitionsInSigAndImplNotCompatibleImplementationIsAbstract",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the signature is an abstract class but the implementation is not. Consider adding the [] attribute to the implementation. - /// (Originally from ..\FSComp.txt:132) + /// (Originally from ..\FSComp.txt:131) static member DefinitionsInSigAndImplNotCompatibleSignatureIsAbstract(a0 : System.String, a1 : System.String) = (299, GetStringFunc("DefinitionsInSigAndImplNotCompatibleSignatureIsAbstract",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the types have different base types - /// (Originally from ..\FSComp.txt:133) + /// (Originally from ..\FSComp.txt:132) static member DefinitionsInSigAndImplNotCompatibleTypesHaveDifferentBaseTypes(a0 : System.String, a1 : System.String) = (300, GetStringFunc("DefinitionsInSigAndImplNotCompatibleTypesHaveDifferentBaseTypes",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the number of %ss differ - /// (Originally from ..\FSComp.txt:134) + /// (Originally from ..\FSComp.txt:133) static member DefinitionsInSigAndImplNotCompatibleNumbersDiffer(a0 : System.String, a1 : System.String, a2 : System.String) = (301, GetStringFunc("DefinitionsInSigAndImplNotCompatibleNumbersDiffer",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the signature defines the %s '%s' but the implementation does not (or does, but not in the same order) - /// (Originally from ..\FSComp.txt:135) + /// (Originally from ..\FSComp.txt:134) static member DefinitionsInSigAndImplNotCompatibleSignatureDefinesButImplDoesNot(a0 : System.String, a1 : System.String, a2 : System.String, a3 : System.String) = (302, GetStringFunc("DefinitionsInSigAndImplNotCompatibleSignatureDefinesButImplDoesNot",",,,%s,,,%s,,,%s,,,%s,,,") a0 a1 a2 a3) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the implementation defines the %s '%s' but the signature does not (or does, but not in the same order) - /// (Originally from ..\FSComp.txt:136) + /// (Originally from ..\FSComp.txt:135) static member DefinitionsInSigAndImplNotCompatibleImplDefinesButSignatureDoesNot(a0 : System.String, a1 : System.String, a2 : System.String, a3 : System.String) = (303, GetStringFunc("DefinitionsInSigAndImplNotCompatibleImplDefinesButSignatureDoesNot",",,,%s,,,%s,,,%s,,,%s,,,") a0 a1 a2 a3) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the implementation defines a struct but the signature defines a type with a hidden representation - /// (Originally from ..\FSComp.txt:137) + /// (Originally from ..\FSComp.txt:136) static member DefinitionsInSigAndImplNotCompatibleImplDefinesStruct(a0 : System.String, a1 : System.String) = (304, GetStringFunc("DefinitionsInSigAndImplNotCompatibleImplDefinesStruct",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because a CLI type representation is being hidden by a signature - /// (Originally from ..\FSComp.txt:138) + /// (Originally from ..\FSComp.txt:137) static member DefinitionsInSigAndImplNotCompatibleDotNetTypeRepresentationIsHidden(a0 : System.String, a1 : System.String) = (305, GetStringFunc("DefinitionsInSigAndImplNotCompatibleDotNetTypeRepresentationIsHidden",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because a type representation is being hidden by a signature - /// (Originally from ..\FSComp.txt:139) + /// (Originally from ..\FSComp.txt:138) static member DefinitionsInSigAndImplNotCompatibleTypeIsHidden(a0 : System.String, a1 : System.String) = (306, GetStringFunc("DefinitionsInSigAndImplNotCompatibleTypeIsHidden",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the types are of different kinds - /// (Originally from ..\FSComp.txt:140) + /// (Originally from ..\FSComp.txt:139) static member DefinitionsInSigAndImplNotCompatibleTypeIsDifferentKind(a0 : System.String, a1 : System.String) = (307, GetStringFunc("DefinitionsInSigAndImplNotCompatibleTypeIsDifferentKind",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the IL representations differ - /// (Originally from ..\FSComp.txt:141) + /// (Originally from ..\FSComp.txt:140) static member DefinitionsInSigAndImplNotCompatibleILDiffer(a0 : System.String, a1 : System.String) = (308, GetStringFunc("DefinitionsInSigAndImplNotCompatibleILDiffer",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the representations differ - /// (Originally from ..\FSComp.txt:142) + /// (Originally from ..\FSComp.txt:141) static member DefinitionsInSigAndImplNotCompatibleRepresentationsDiffer(a0 : System.String, a1 : System.String) = (309, GetStringFunc("DefinitionsInSigAndImplNotCompatibleRepresentationsDiffer",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the field %s was present in the implementation but not in the signature - /// (Originally from ..\FSComp.txt:143) + /// (Originally from ..\FSComp.txt:142) static member DefinitionsInSigAndImplNotCompatibleFieldWasPresent(a0 : System.String, a1 : System.String, a2 : System.String) = (311, GetStringFunc("DefinitionsInSigAndImplNotCompatibleFieldWasPresent",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the order of the fields is different in the signature and implementation - /// (Originally from ..\FSComp.txt:144) + /// (Originally from ..\FSComp.txt:143) static member DefinitionsInSigAndImplNotCompatibleFieldOrderDiffer(a0 : System.String, a1 : System.String) = (312, GetStringFunc("DefinitionsInSigAndImplNotCompatibleFieldOrderDiffer",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the field %s was required by the signature but was not specified by the implementation - /// (Originally from ..\FSComp.txt:145) + /// (Originally from ..\FSComp.txt:144) static member DefinitionsInSigAndImplNotCompatibleFieldRequiredButNotSpecified(a0 : System.String, a1 : System.String, a2 : System.String) = (313, GetStringFunc("DefinitionsInSigAndImplNotCompatibleFieldRequiredButNotSpecified",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the field '%s' was present in the implementation but not in the signature. Struct types must now reveal their fields in the signature for the type, though the fields may still be labelled 'private' or 'internal'. - /// (Originally from ..\FSComp.txt:146) + /// (Originally from ..\FSComp.txt:145) static member DefinitionsInSigAndImplNotCompatibleFieldIsInImplButNotSig(a0 : System.String, a1 : System.String, a2 : System.String) = (314, GetStringFunc("DefinitionsInSigAndImplNotCompatibleFieldIsInImplButNotSig",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the abstract member '%s' was required by the signature but was not specified by the implementation - /// (Originally from ..\FSComp.txt:147) + /// (Originally from ..\FSComp.txt:146) static member DefinitionsInSigAndImplNotCompatibleAbstractMemberMissingInImpl(a0 : System.String, a1 : System.String, a2 : System.String) = (315, GetStringFunc("DefinitionsInSigAndImplNotCompatibleAbstractMemberMissingInImpl",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the abstract member '%s' was present in the implementation but not in the signature - /// (Originally from ..\FSComp.txt:148) + /// (Originally from ..\FSComp.txt:147) static member DefinitionsInSigAndImplNotCompatibleAbstractMemberMissingInSig(a0 : System.String, a1 : System.String, a2 : System.String) = (316, GetStringFunc("DefinitionsInSigAndImplNotCompatibleAbstractMemberMissingInSig",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the signature declares a %s while the implementation declares a %s - /// (Originally from ..\FSComp.txt:149) + /// (Originally from ..\FSComp.txt:148) static member DefinitionsInSigAndImplNotCompatibleSignatureDeclaresDiffer(a0 : System.String, a1 : System.String, a2 : System.String, a3 : System.String) = (317, GetStringFunc("DefinitionsInSigAndImplNotCompatibleSignatureDeclaresDiffer",",,,%s,,,%s,,,%s,,,%s,,,") a0 a1 a2 a3) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the abbreviations differ: %s versus %s - /// (Originally from ..\FSComp.txt:150) + /// (Originally from ..\FSComp.txt:149) static member DefinitionsInSigAndImplNotCompatibleAbbreviationsDiffer(a0 : System.String, a1 : System.String, a2 : System.String, a3 : System.String) = (318, GetStringFunc("DefinitionsInSigAndImplNotCompatibleAbbreviationsDiffer",",,,%s,,,%s,,,%s,,,%s,,,") a0 a1 a2 a3) /// The %s definitions for type '%s' in the signature and implementation are not compatible because an abbreviation is being hidden by a signature. The abbreviation must be visible to other CLI languages. Consider making the abbreviation visible in the signature. - /// (Originally from ..\FSComp.txt:151) + /// (Originally from ..\FSComp.txt:150) static member DefinitionsInSigAndImplNotCompatibleAbbreviationHiddenBySig(a0 : System.String, a1 : System.String) = (319, GetStringFunc("DefinitionsInSigAndImplNotCompatibleAbbreviationHiddenBySig",",,,%s,,,%s,,,") a0 a1) /// The %s definitions for type '%s' in the signature and implementation are not compatible because the signature has an abbreviation while the implementation does not - /// (Originally from ..\FSComp.txt:152) + /// (Originally from ..\FSComp.txt:151) static member DefinitionsInSigAndImplNotCompatibleSigHasAbbreviation(a0 : System.String, a1 : System.String) = (320, GetStringFunc("DefinitionsInSigAndImplNotCompatibleSigHasAbbreviation",",,,%s,,,%s,,,") a0 a1) /// The module contains the constructor\n %s \nbut its signature specifies\n %s \nThe names differ - /// (Originally from ..\FSComp.txt:153) + /// (Originally from ..\FSComp.txt:152) static member ModuleContainsConstructorButNamesDiffer(a0 : System.String, a1 : System.String) = (GetStringFunc("ModuleContainsConstructorButNamesDiffer",",,,%s,,,%s,,,") a0 a1) /// The module contains the constructor\n %s \nbut its signature specifies\n %s \nThe respective number of data fields differ - /// (Originally from ..\FSComp.txt:154) + /// (Originally from ..\FSComp.txt:153) static member ModuleContainsConstructorButDataFieldsDiffer(a0 : System.String, a1 : System.String) = (GetStringFunc("ModuleContainsConstructorButDataFieldsDiffer",",,,%s,,,%s,,,") a0 a1) /// The module contains the constructor\n %s \nbut its signature specifies\n %s \nThe types of the fields differ - /// (Originally from ..\FSComp.txt:155) + /// (Originally from ..\FSComp.txt:154) static member ModuleContainsConstructorButTypesOfFieldsDiffer(a0 : System.String, a1 : System.String) = (GetStringFunc("ModuleContainsConstructorButTypesOfFieldsDiffer",",,,%s,,,%s,,,") a0 a1) /// The module contains the constructor\n %s \nbut its signature specifies\n %s \nthe accessibility specified in the signature is more than that specified in the implementation - /// (Originally from ..\FSComp.txt:156) + /// (Originally from ..\FSComp.txt:155) static member ModuleContainsConstructorButAccessibilityDiffers(a0 : System.String, a1 : System.String) = (GetStringFunc("ModuleContainsConstructorButAccessibilityDiffers",",,,%s,,,%s,,,") a0 a1) /// The module contains the field\n %s \nbut its signature specifies\n %s \nThe names differ - /// (Originally from ..\FSComp.txt:157) + /// (Originally from ..\FSComp.txt:156) static member FieldNotContainedNamesDiffer(a0 : System.String, a1 : System.String) = (GetStringFunc("FieldNotContainedNamesDiffer",",,,%s,,,%s,,,") a0 a1) /// The module contains the field\n %s \nbut its signature specifies\n %s \nthe accessibility specified in the signature is more than that specified in the implementation - /// (Originally from ..\FSComp.txt:158) + /// (Originally from ..\FSComp.txt:157) static member FieldNotContainedAccessibilitiesDiffer(a0 : System.String, a1 : System.String) = (GetStringFunc("FieldNotContainedAccessibilitiesDiffer",",,,%s,,,%s,,,") a0 a1) /// The module contains the field\n %s \nbut its signature specifies\n %s \nThe 'static' modifiers differ - /// (Originally from ..\FSComp.txt:159) + /// (Originally from ..\FSComp.txt:158) static member FieldNotContainedStaticsDiffer(a0 : System.String, a1 : System.String) = (GetStringFunc("FieldNotContainedStaticsDiffer",",,,%s,,,%s,,,") a0 a1) /// The module contains the field\n %s \nbut its signature specifies\n %s \nThe 'mutable' modifiers differ - /// (Originally from ..\FSComp.txt:160) + /// (Originally from ..\FSComp.txt:159) static member FieldNotContainedMutablesDiffer(a0 : System.String, a1 : System.String) = (GetStringFunc("FieldNotContainedMutablesDiffer",",,,%s,,,%s,,,") a0 a1) /// The module contains the field\n %s \nbut its signature specifies\n %s \nThe 'literal' modifiers differ - /// (Originally from ..\FSComp.txt:161) + /// (Originally from ..\FSComp.txt:160) static member FieldNotContainedLiteralsDiffer(a0 : System.String, a1 : System.String) = (GetStringFunc("FieldNotContainedLiteralsDiffer",",,,%s,,,%s,,,") a0 a1) /// The module contains the field\n %s \nbut its signature specifies\n %s \nThe types differ - /// (Originally from ..\FSComp.txt:162) + /// (Originally from ..\FSComp.txt:161) static member FieldNotContainedTypesDiffer(a0 : System.String, a1 : System.String) = (GetStringFunc("FieldNotContainedTypesDiffer",",,,%s,,,%s,,,") a0 a1) /// The implicit instantiation of a generic construct at or near this point could not be resolved because it could resolve to multiple unrelated types, e.g. '%s' and '%s'. Consider using type annotations to resolve the ambiguity - /// (Originally from ..\FSComp.txt:163) + /// (Originally from ..\FSComp.txt:162) static member typrelCannotResolveImplicitGenericInstantiation(a0 : System.String, a1 : System.String) = (331, GetStringFunc("typrelCannotResolveImplicitGenericInstantiation",",,,%s,,,%s,,,") a0 a1) /// Could not resolve the ambiguity inherent in the use of a 'printf'-style format string - /// (Originally from ..\FSComp.txt:164) + /// (Originally from ..\FSComp.txt:163) static member typrelCannotResolveAmbiguityInPrintf() = (333, GetStringFunc("typrelCannotResolveAmbiguityInPrintf",",,,") ) /// Could not resolve the ambiguity in the use of a generic construct with an 'enum' constraint at or near this position - /// (Originally from ..\FSComp.txt:165) + /// (Originally from ..\FSComp.txt:164) static member typrelCannotResolveAmbiguityInEnum() = (334, GetStringFunc("typrelCannotResolveAmbiguityInEnum",",,,") ) /// Could not resolve the ambiguity in the use of a generic construct with a 'delegate' constraint at or near this position - /// (Originally from ..\FSComp.txt:166) + /// (Originally from ..\FSComp.txt:165) static member typrelCannotResolveAmbiguityInDelegate() = (335, GetStringFunc("typrelCannotResolveAmbiguityInDelegate",",,,") ) /// Invalid value - /// (Originally from ..\FSComp.txt:167) + /// (Originally from ..\FSComp.txt:166) static member typrelInvalidValue() = (337, GetStringFunc("typrelInvalidValue",",,,") ) /// The signature and implementation are not compatible because the respective type parameter counts differ - /// (Originally from ..\FSComp.txt:168) + /// (Originally from ..\FSComp.txt:167) static member typrelSigImplNotCompatibleParamCountsDiffer() = (338, GetStringFunc("typrelSigImplNotCompatibleParamCountsDiffer",",,,") ) /// The signature and implementation are not compatible because the type parameter in the class/signature has a different compile-time requirement to the one in the member/implementation - /// (Originally from ..\FSComp.txt:169) + /// (Originally from ..\FSComp.txt:168) static member typrelSigImplNotCompatibleCompileTimeRequirementsDiffer() = (339, GetStringFunc("typrelSigImplNotCompatibleCompileTimeRequirementsDiffer",",,,") ) /// The signature and implementation are not compatible because the declaration of the type parameter '%s' requires a constraint of the form %s - /// (Originally from ..\FSComp.txt:170) + /// (Originally from ..\FSComp.txt:169) static member typrelSigImplNotCompatibleConstraintsDiffer(a0 : System.String, a1 : System.String) = (340, GetStringFunc("typrelSigImplNotCompatibleConstraintsDiffer",",,,%s,,,%s,,,") a0 a1) /// The signature and implementation are not compatible because the type parameter '%s' has a constraint of the form %s but the implementation does not. Either remove this constraint from the signature or add it to the implementation. - /// (Originally from ..\FSComp.txt:171) + /// (Originally from ..\FSComp.txt:170) static member typrelSigImplNotCompatibleConstraintsDifferRemove(a0 : System.String, a1 : System.String) = (341, GetStringFunc("typrelSigImplNotCompatibleConstraintsDifferRemove",",,,%s,,,%s,,,") a0 a1) /// The type '%s' implements 'System.IComparable'. Consider also adding an explicit override for 'Object.Equals' - /// (Originally from ..\FSComp.txt:172) + /// (Originally from ..\FSComp.txt:171) static member typrelTypeImplementsIComparableShouldOverrideObjectEquals(a0 : System.String) = (342, GetStringFunc("typrelTypeImplementsIComparableShouldOverrideObjectEquals",",,,%s,,,") a0) /// The type '%s' implements 'System.IComparable' explicitly but provides no corresponding override for 'Object.Equals'. An implementation of 'Object.Equals' has been automatically provided, implemented via 'System.IComparable'. Consider implementing the override 'Object.Equals' explicitly - /// (Originally from ..\FSComp.txt:173) + /// (Originally from ..\FSComp.txt:172) static member typrelTypeImplementsIComparableDefaultObjectEqualsProvided(a0 : System.String) = (343, GetStringFunc("typrelTypeImplementsIComparableDefaultObjectEqualsProvided",",,,%s,,,") a0) /// The struct, record or union type '%s' has an explicit implementation of 'Object.GetHashCode' or 'Object.Equals'. You must apply the 'CustomEquality' attribute to the type - /// (Originally from ..\FSComp.txt:174) + /// (Originally from ..\FSComp.txt:173) static member typrelExplicitImplementationOfGetHashCodeOrEquals(a0 : System.String) = (344, GetStringFunc("typrelExplicitImplementationOfGetHashCodeOrEquals",",,,%s,,,") a0) /// The struct, record or union type '%s' has an explicit implementation of 'Object.GetHashCode'. Consider implementing a matching override for 'Object.Equals(obj)' - /// (Originally from ..\FSComp.txt:175) + /// (Originally from ..\FSComp.txt:174) static member typrelExplicitImplementationOfGetHashCode(a0 : System.String) = (345, GetStringFunc("typrelExplicitImplementationOfGetHashCode",",,,%s,,,") a0) /// The struct, record or union type '%s' has an explicit implementation of 'Object.Equals'. Consider implementing a matching override for 'Object.GetHashCode()' - /// (Originally from ..\FSComp.txt:176) + /// (Originally from ..\FSComp.txt:175) static member typrelExplicitImplementationOfEquals(a0 : System.String) = (346, GetStringFunc("typrelExplicitImplementationOfEquals",",,,%s,,,") a0) /// The exception definitions are not compatible because a CLI exception mapping is being hidden by a signature. The exception mapping must be visible to other modules. The module contains the exception definition\n %s \nbut its signature specifies\n\t%s - /// (Originally from ..\FSComp.txt:177) + /// (Originally from ..\FSComp.txt:176) static member ExceptionDefsNotCompatibleHiddenBySignature(a0 : System.String, a1 : System.String) = (GetStringFunc("ExceptionDefsNotCompatibleHiddenBySignature",",,,%s,,,%s,,,") a0 a1) /// The exception definitions are not compatible because the CLI representations differ. The module contains the exception definition\n %s \nbut its signature specifies\n\t%s - /// (Originally from ..\FSComp.txt:178) + /// (Originally from ..\FSComp.txt:177) static member ExceptionDefsNotCompatibleDotNetRepresentationsDiffer(a0 : System.String, a1 : System.String) = (GetStringFunc("ExceptionDefsNotCompatibleDotNetRepresentationsDiffer",",,,%s,,,%s,,,") a0 a1) /// The exception definitions are not compatible because the exception abbreviation is being hidden by the signature. The abbreviation must be visible to other CLI languages. Consider making the abbreviation visible in the signature. The module contains the exception definition\n %s \nbut its signature specifies\n\t%s. - /// (Originally from ..\FSComp.txt:179) + /// (Originally from ..\FSComp.txt:178) static member ExceptionDefsNotCompatibleAbbreviationHiddenBySignature(a0 : System.String, a1 : System.String) = (GetStringFunc("ExceptionDefsNotCompatibleAbbreviationHiddenBySignature",",,,%s,,,%s,,,") a0 a1) /// The exception definitions are not compatible because the exception abbreviations in the signature and implementation differ. The module contains the exception definition\n %s \nbut its signature specifies\n\t%s. - /// (Originally from ..\FSComp.txt:180) + /// (Originally from ..\FSComp.txt:179) static member ExceptionDefsNotCompatibleSignaturesDiffer(a0 : System.String, a1 : System.String) = (GetStringFunc("ExceptionDefsNotCompatibleSignaturesDiffer",",,,%s,,,%s,,,") a0 a1) /// The exception definitions are not compatible because the exception declarations differ. The module contains the exception definition\n %s \nbut its signature specifies\n\t%s. - /// (Originally from ..\FSComp.txt:181) + /// (Originally from ..\FSComp.txt:180) static member ExceptionDefsNotCompatibleExceptionDeclarationsDiffer(a0 : System.String, a1 : System.String) = (GetStringFunc("ExceptionDefsNotCompatibleExceptionDeclarationsDiffer",",,,%s,,,%s,,,") a0 a1) /// The exception definitions are not compatible because the field '%s' was required by the signature but was not specified by the implementation. The module contains the exception definition\n %s \nbut its signature specifies\n\t%s. - /// (Originally from ..\FSComp.txt:182) + /// (Originally from ..\FSComp.txt:181) static member ExceptionDefsNotCompatibleFieldInSigButNotImpl(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ExceptionDefsNotCompatibleFieldInSigButNotImpl",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The exception definitions are not compatible because the field '%s' was present in the implementation but not in the signature. The module contains the exception definition\n %s \nbut its signature specifies\n\t%s. - /// (Originally from ..\FSComp.txt:183) + /// (Originally from ..\FSComp.txt:182) static member ExceptionDefsNotCompatibleFieldInImplButNotSig(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("ExceptionDefsNotCompatibleFieldInImplButNotSig",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The exception definitions are not compatible because the order of the fields is different in the signature and implementation. The module contains the exception definition\n %s \nbut its signature specifies\n\t%s. - /// (Originally from ..\FSComp.txt:184) + /// (Originally from ..\FSComp.txt:183) static member ExceptionDefsNotCompatibleFieldOrderDiffers(a0 : System.String, a1 : System.String) = (GetStringFunc("ExceptionDefsNotCompatibleFieldOrderDiffers",",,,%s,,,%s,,,") a0 a1) /// The namespace or module attributes differ between signature and implementation - /// (Originally from ..\FSComp.txt:185) + /// (Originally from ..\FSComp.txt:184) static member typrelModuleNamespaceAttributesDifferInSigAndImpl() = (355, GetStringFunc("typrelModuleNamespaceAttributesDifferInSigAndImpl",",,,") ) /// This method is over-constrained in its type parameters - /// (Originally from ..\FSComp.txt:186) + /// (Originally from ..\FSComp.txt:185) static member typrelMethodIsOverconstrained() = (356, GetStringFunc("typrelMethodIsOverconstrained",",,,") ) /// No implementations of '%s' had the correct number of arguments and type parameters. The required signature is '%s'. - /// (Originally from ..\FSComp.txt:187) + /// (Originally from ..\FSComp.txt:186) static member typrelOverloadNotFound(a0 : System.String, a1 : System.String) = (357, GetStringFunc("typrelOverloadNotFound",",,,%s,,,%s,,,") a0 a1) /// The override for '%s' was ambiguous - /// (Originally from ..\FSComp.txt:188) + /// (Originally from ..\FSComp.txt:187) static member typrelOverrideWasAmbiguous(a0 : System.String) = (358, GetStringFunc("typrelOverrideWasAmbiguous",",,,%s,,,") a0) /// More than one override implements '%s' - /// (Originally from ..\FSComp.txt:189) + /// (Originally from ..\FSComp.txt:188) static member typrelMoreThenOneOverride(a0 : System.String) = (359, GetStringFunc("typrelMoreThenOneOverride",",,,%s,,,") a0) /// The method '%s' is sealed and cannot be overridden - /// (Originally from ..\FSComp.txt:190) + /// (Originally from ..\FSComp.txt:189) static member typrelMethodIsSealed(a0 : System.String) = (360, GetStringFunc("typrelMethodIsSealed",",,,%s,,,") a0) /// The override '%s' implements more than one abstract slot, e.g. '%s' and '%s' - /// (Originally from ..\FSComp.txt:191) + /// (Originally from ..\FSComp.txt:190) static member typrelOverrideImplementsMoreThenOneSlot(a0 : System.String, a1 : System.String, a2 : System.String) = (361, GetStringFunc("typrelOverrideImplementsMoreThenOneSlot",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Duplicate or redundant interface - /// (Originally from ..\FSComp.txt:192) + /// (Originally from ..\FSComp.txt:191) static member typrelDuplicateInterface() = (362, GetStringFunc("typrelDuplicateInterface",",,,") ) /// The interface '%s' is included in multiple explicitly implemented interface types. Add an explicit implementation of this interface. - /// (Originally from ..\FSComp.txt:193) + /// (Originally from ..\FSComp.txt:192) static member typrelNeedExplicitImplementation(a0 : System.String) = (363, GetStringFunc("typrelNeedExplicitImplementation",",,,%s,,,") a0) /// A named argument has been assigned more than one value - /// (Originally from ..\FSComp.txt:194) + /// (Originally from ..\FSComp.txt:193) static member typrelNamedArgumentHasBeenAssignedMoreThenOnce() = (364, GetStringFunc("typrelNamedArgumentHasBeenAssignedMoreThenOnce",",,,") ) /// No implementation was given for '%s' - /// (Originally from ..\FSComp.txt:195) + /// (Originally from ..\FSComp.txt:194) static member typrelNoImplementationGiven(a0 : System.String) = (365, GetStringFunc("typrelNoImplementationGiven",",,,%s,,,") a0) /// No implementation was given for '%s'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'. - /// (Originally from ..\FSComp.txt:196) + /// (Originally from ..\FSComp.txt:195) static member typrelNoImplementationGivenWithSuggestion(a0 : System.String) = (366, GetStringFunc("typrelNoImplementationGivenWithSuggestion",",,,%s,,,") a0) /// The member '%s' does not have the correct number of arguments. The required signature is '%s'. - /// (Originally from ..\FSComp.txt:197) + /// (Originally from ..\FSComp.txt:196) static member typrelMemberDoesNotHaveCorrectNumberOfArguments(a0 : System.String, a1 : System.String) = (367, GetStringFunc("typrelMemberDoesNotHaveCorrectNumberOfArguments",",,,%s,,,%s,,,") a0 a1) /// The member '%s' does not have the correct number of method type parameters. The required signature is '%s'. - /// (Originally from ..\FSComp.txt:198) + /// (Originally from ..\FSComp.txt:197) static member typrelMemberDoesNotHaveCorrectNumberOfTypeParameters(a0 : System.String, a1 : System.String) = (368, GetStringFunc("typrelMemberDoesNotHaveCorrectNumberOfTypeParameters",",,,%s,,,%s,,,") a0 a1) /// The member '%s' does not have the correct kinds of generic parameters. The required signature is '%s'. - /// (Originally from ..\FSComp.txt:199) + /// (Originally from ..\FSComp.txt:198) static member typrelMemberDoesNotHaveCorrectKindsOfGenericParameters(a0 : System.String, a1 : System.String) = (369, GetStringFunc("typrelMemberDoesNotHaveCorrectKindsOfGenericParameters",",,,%s,,,%s,,,") a0 a1) /// The member '%s' cannot be used to implement '%s'. The required signature is '%s'. - /// (Originally from ..\FSComp.txt:200) + /// (Originally from ..\FSComp.txt:199) static member typrelMemberCannotImplement(a0 : System.String, a1 : System.String, a2 : System.String) = (370, GetStringFunc("typrelMemberCannotImplement",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Error while parsing embedded IL - /// (Originally from ..\FSComp.txt:201) + /// (Originally from ..\FSComp.txt:200) static member astParseEmbeddedILError() = (371, GetStringFunc("astParseEmbeddedILError",",,,") ) /// Error while parsing embedded IL type - /// (Originally from ..\FSComp.txt:202) + /// (Originally from ..\FSComp.txt:201) static member astParseEmbeddedILTypeError() = (372, GetStringFunc("astParseEmbeddedILTypeError",",,,") ) /// This indexer notation has been removed from the F# language - /// (Originally from ..\FSComp.txt:203) + /// (Originally from ..\FSComp.txt:202) static member astDeprecatedIndexerNotation() = (GetStringFunc("astDeprecatedIndexerNotation",",,,") ) /// Invalid expression on left of assignment - /// (Originally from ..\FSComp.txt:204) + /// (Originally from ..\FSComp.txt:203) static member astInvalidExprLeftHandOfAssignment() = (374, GetStringFunc("astInvalidExprLeftHandOfAssignment",",,,") ) /// The 'ReferenceEquality' attribute cannot be used on structs. Consider using the 'StructuralEquality' attribute instead, or implement an override for 'System.Object.Equals(obj)'. - /// (Originally from ..\FSComp.txt:205) + /// (Originally from ..\FSComp.txt:204) static member augNoRefEqualsOnStruct() = (376, GetStringFunc("augNoRefEqualsOnStruct",",,,") ) /// This type uses an invalid mix of the attributes 'NoEquality', 'ReferenceEquality', 'StructuralEquality', 'NoComparison' and 'StructuralComparison' - /// (Originally from ..\FSComp.txt:206) + /// (Originally from ..\FSComp.txt:205) static member augInvalidAttrs() = (377, GetStringFunc("augInvalidAttrs",",,,") ) /// The 'NoEquality' attribute must be used in conjunction with the 'NoComparison' attribute - /// (Originally from ..\FSComp.txt:207) + /// (Originally from ..\FSComp.txt:206) static member augNoEqualityNeedsNoComparison() = (378, GetStringFunc("augNoEqualityNeedsNoComparison",",,,") ) /// The 'StructuralComparison' attribute must be used in conjunction with the 'StructuralEquality' attribute - /// (Originally from ..\FSComp.txt:208) + /// (Originally from ..\FSComp.txt:207) static member augStructCompNeedsStructEquality() = (379, GetStringFunc("augStructCompNeedsStructEquality",",,,") ) /// The 'StructuralEquality' attribute must be used in conjunction with the 'NoComparison' or 'StructuralComparison' attributes - /// (Originally from ..\FSComp.txt:209) + /// (Originally from ..\FSComp.txt:208) static member augStructEqNeedsNoCompOrStructComp() = (380, GetStringFunc("augStructEqNeedsNoCompOrStructComp",",,,") ) /// A type cannot have both the 'ReferenceEquality' and 'StructuralEquality' or 'StructuralComparison' attributes - /// (Originally from ..\FSComp.txt:210) + /// (Originally from ..\FSComp.txt:209) static member augTypeCantHaveRefEqAndStructAttrs() = (381, GetStringFunc("augTypeCantHaveRefEqAndStructAttrs",",,,") ) /// Only record, union, exception and struct types may be augmented with the 'ReferenceEquality', 'StructuralEquality' and 'StructuralComparison' attributes - /// (Originally from ..\FSComp.txt:211) + /// (Originally from ..\FSComp.txt:210) static member augOnlyCertainTypesCanHaveAttrs() = (382, GetStringFunc("augOnlyCertainTypesCanHaveAttrs",",,,") ) /// A type with attribute 'ReferenceEquality' cannot have an explicit implementation of 'Object.Equals(obj)', 'System.IEquatable<_>' or 'System.Collections.IStructuralEquatable' - /// (Originally from ..\FSComp.txt:212) + /// (Originally from ..\FSComp.txt:211) static member augRefEqCantHaveObjEquals() = (383, GetStringFunc("augRefEqCantHaveObjEquals",",,,") ) /// A type with attribute 'CustomEquality' must have an explicit implementation of at least one of 'Object.Equals(obj)', 'System.IEquatable<_>' or 'System.Collections.IStructuralEquatable' - /// (Originally from ..\FSComp.txt:213) + /// (Originally from ..\FSComp.txt:212) static member augCustomEqNeedsObjEquals() = (384, GetStringFunc("augCustomEqNeedsObjEquals",",,,") ) /// A type with attribute 'CustomComparison' must have an explicit implementation of at least one of 'System.IComparable' or 'System.Collections.IStructuralComparable' - /// (Originally from ..\FSComp.txt:214) + /// (Originally from ..\FSComp.txt:213) static member augCustomCompareNeedsIComp() = (385, GetStringFunc("augCustomCompareNeedsIComp",",,,") ) /// A type with attribute 'NoEquality' should not usually have an explicit implementation of 'Object.Equals(obj)'. Disable this warning if this is intentional for interoperability purposes - /// (Originally from ..\FSComp.txt:215) + /// (Originally from ..\FSComp.txt:214) static member augNoEqNeedsNoObjEquals() = (386, GetStringFunc("augNoEqNeedsNoObjEquals",",,,") ) /// A type with attribute 'NoComparison' should not usually have an explicit implementation of 'System.IComparable', 'System.IComparable<_>' or 'System.Collections.IStructuralComparable'. Disable this warning if this is intentional for interoperability purposes - /// (Originally from ..\FSComp.txt:216) + /// (Originally from ..\FSComp.txt:215) static member augNoCompCantImpIComp() = (386, GetStringFunc("augNoCompCantImpIComp",",,,") ) /// The 'CustomEquality' attribute must be used in conjunction with the 'NoComparison' or 'CustomComparison' attributes - /// (Originally from ..\FSComp.txt:217) + /// (Originally from ..\FSComp.txt:216) static member augCustomEqNeedsNoCompOrCustomComp() = (387, GetStringFunc("augCustomEqNeedsNoCompOrCustomComp",",,,") ) /// Positional specifiers are not permitted in format strings - /// (Originally from ..\FSComp.txt:218) + /// (Originally from ..\FSComp.txt:217) static member forPositionalSpecifiersNotPermitted() = (GetStringFunc("forPositionalSpecifiersNotPermitted",",,,") ) /// Missing format specifier - /// (Originally from ..\FSComp.txt:219) + /// (Originally from ..\FSComp.txt:218) static member forMissingFormatSpecifier() = (GetStringFunc("forMissingFormatSpecifier",",,,") ) /// '%s' flag set twice - /// (Originally from ..\FSComp.txt:220) + /// (Originally from ..\FSComp.txt:219) static member forFlagSetTwice(a0 : System.String) = (GetStringFunc("forFlagSetTwice",",,,%s,,,") a0) /// Prefix flag (' ' or '+') set twice - /// (Originally from ..\FSComp.txt:221) + /// (Originally from ..\FSComp.txt:220) static member forPrefixFlagSpacePlusSetTwice() = (GetStringFunc("forPrefixFlagSpacePlusSetTwice",",,,") ) /// The # formatting modifier is invalid in F# - /// (Originally from ..\FSComp.txt:222) + /// (Originally from ..\FSComp.txt:221) static member forHashSpecifierIsInvalid() = (GetStringFunc("forHashSpecifierIsInvalid",",,,") ) /// Bad precision in format specifier - /// (Originally from ..\FSComp.txt:223) + /// (Originally from ..\FSComp.txt:222) static member forBadPrecision() = (GetStringFunc("forBadPrecision",",,,") ) /// Bad width in format specifier - /// (Originally from ..\FSComp.txt:224) + /// (Originally from ..\FSComp.txt:223) static member forBadWidth() = (GetStringFunc("forBadWidth",",,,") ) /// '%s' format does not support '0' flag - /// (Originally from ..\FSComp.txt:225) + /// (Originally from ..\FSComp.txt:224) static member forDoesNotSupportZeroFlag(a0 : System.String) = (GetStringFunc("forDoesNotSupportZeroFlag",",,,%s,,,") a0) /// Precision missing after the '.' - /// (Originally from ..\FSComp.txt:226) + /// (Originally from ..\FSComp.txt:225) static member forPrecisionMissingAfterDot() = (GetStringFunc("forPrecisionMissingAfterDot",",,,") ) /// '%s' format does not support precision - /// (Originally from ..\FSComp.txt:227) + /// (Originally from ..\FSComp.txt:226) static member forFormatDoesntSupportPrecision(a0 : System.String) = (GetStringFunc("forFormatDoesntSupportPrecision",",,,%s,,,") a0) /// Bad format specifier (after l or L): Expected ld,li,lo,lu,lx or lX. In F# code you can use %%d, %%x, %%o or %%u instead, which are overloaded to work with all basic integer types. - /// (Originally from ..\FSComp.txt:228) + /// (Originally from ..\FSComp.txt:227) static member forBadFormatSpecifier() = (GetStringFunc("forBadFormatSpecifier",",,,") ) /// The 'l' or 'L' in this format specifier is unnecessary. In F# code you can use %%d, %%x, %%o or %%u instead, which are overloaded to work with all basic integer types. - /// (Originally from ..\FSComp.txt:229) + /// (Originally from ..\FSComp.txt:228) static member forLIsUnnecessary() = (GetStringFunc("forLIsUnnecessary",",,,") ) /// The 'h' or 'H' in this format specifier is unnecessary. You can use %%d, %%x, %%o or %%u instead, which are overloaded to work with all basic integer types. - /// (Originally from ..\FSComp.txt:230) + /// (Originally from ..\FSComp.txt:229) static member forHIsUnnecessary() = (GetStringFunc("forHIsUnnecessary",",,,") ) /// '%s' does not support prefix '%s' flag - /// (Originally from ..\FSComp.txt:231) + /// (Originally from ..\FSComp.txt:230) static member forDoesNotSupportPrefixFlag(a0 : System.String, a1 : System.String) = (GetStringFunc("forDoesNotSupportPrefixFlag",",,,%s,,,%s,,,") a0 a1) /// Bad format specifier: '%s' - /// (Originally from ..\FSComp.txt:232) + /// (Originally from ..\FSComp.txt:231) static member forBadFormatSpecifierGeneral(a0 : System.String) = (GetStringFunc("forBadFormatSpecifierGeneral",",,,%s,,,") a0) /// System.Environment.Exit did not exit - /// (Originally from ..\FSComp.txt:233) + /// (Originally from ..\FSComp.txt:232) static member elSysEnvExitDidntExit() = (GetStringFunc("elSysEnvExitDidntExit",",,,") ) /// The treatment of this operator is now handled directly by the F# compiler and its meaning cannot be redefined - /// (Originally from ..\FSComp.txt:234) + /// (Originally from ..\FSComp.txt:233) static member elDeprecatedOperator() = (GetStringFunc("elDeprecatedOperator",",,,") ) /// A protected member is called or 'base' is being used. This is only allowed in the direct implementation of members since they could escape their object scope. - /// (Originally from ..\FSComp.txt:235) + /// (Originally from ..\FSComp.txt:234) static member chkProtectedOrBaseCalled() = (405, GetStringFunc("chkProtectedOrBaseCalled",",,,") ) /// The byref-typed variable '%s' is used in an invalid way. Byrefs cannot be captured by closures or passed to inner functions. - /// (Originally from ..\FSComp.txt:236) + /// (Originally from ..\FSComp.txt:235) static member chkByrefUsedInInvalidWay(a0 : System.String) = (406, GetStringFunc("chkByrefUsedInInvalidWay",",,,%s,,,") a0) /// The 'base' keyword is used in an invalid way. Base calls cannot be used in closures. Consider using a private member to make base calls. - /// (Originally from ..\FSComp.txt:237) + /// (Originally from ..\FSComp.txt:236) static member chkBaseUsedInInvalidWay() = (408, GetStringFunc("chkBaseUsedInInvalidWay",",,,") ) /// The variable '%s' is used in an invalid way - /// (Originally from ..\FSComp.txt:238) + /// (Originally from ..\FSComp.txt:237) static member chkVariableUsedInInvalidWay(a0 : System.String) = (GetStringFunc("chkVariableUsedInInvalidWay",",,,%s,,,") a0) /// The type '%s' is less accessible than the value, member or type '%s' it is used in. - /// (Originally from ..\FSComp.txt:239) + /// (Originally from ..\FSComp.txt:238) static member chkTypeLessAccessibleThanType(a0 : System.String, a1 : System.String) = (410, GetStringFunc("chkTypeLessAccessibleThanType",",,,%s,,,%s,,,") a0 a1) /// 'System.Void' can only be used as 'typeof' in F# - /// (Originally from ..\FSComp.txt:240) + /// (Originally from ..\FSComp.txt:239) static member chkSystemVoidOnlyInTypeof() = (411, GetStringFunc("chkSystemVoidOnlyInTypeof",",,,") ) /// A type instantiation involves a byref type. This is not permitted by the rules of Common IL. - /// (Originally from ..\FSComp.txt:241) + /// (Originally from ..\FSComp.txt:240) static member chkErrorUseOfByref() = (412, GetStringFunc("chkErrorUseOfByref",",,,") ) /// Calls to 'reraise' may only occur directly in a handler of a try-with - /// (Originally from ..\FSComp.txt:242) + /// (Originally from ..\FSComp.txt:241) static member chkErrorContainsCallToRethrow() = (413, GetStringFunc("chkErrorContainsCallToRethrow",",,,") ) /// Expression-splicing operators may only be used within quotations - /// (Originally from ..\FSComp.txt:243) + /// (Originally from ..\FSComp.txt:242) static member chkSplicingOnlyInQuotations() = (414, GetStringFunc("chkSplicingOnlyInQuotations",",,,") ) /// First-class uses of the expression-splicing operator are not permitted - /// (Originally from ..\FSComp.txt:244) + /// (Originally from ..\FSComp.txt:243) static member chkNoFirstClassSplicing() = (415, GetStringFunc("chkNoFirstClassSplicing",",,,") ) /// First-class uses of the address-of operators are not permitted - /// (Originally from ..\FSComp.txt:245) + /// (Originally from ..\FSComp.txt:244) static member chkNoFirstClassAddressOf() = (416, GetStringFunc("chkNoFirstClassAddressOf",",,,") ) /// First-class uses of the 'reraise' function is not permitted - /// (Originally from ..\FSComp.txt:246) + /// (Originally from ..\FSComp.txt:245) static member chkNoFirstClassRethrow() = (417, GetStringFunc("chkNoFirstClassRethrow",",,,") ) /// The byref typed value '%s' cannot be used at this point - /// (Originally from ..\FSComp.txt:247) + /// (Originally from ..\FSComp.txt:246) static member chkNoByrefAtThisPoint(a0 : System.String) = (418, GetStringFunc("chkNoByrefAtThisPoint",",,,%s,,,") a0) /// 'base' values may only be used to make direct calls to the base implementations of overridden members - /// (Originally from ..\FSComp.txt:248) + /// (Originally from ..\FSComp.txt:247) static member chkLimitationsOfBaseKeyword() = (419, GetStringFunc("chkLimitationsOfBaseKeyword",",,,") ) /// Object constructors cannot directly use try/with and try/finally prior to the initialization of the object. This includes constructs such as 'for x in ...' that may elaborate to uses of these constructs. This is a limitation imposed by Common IL. - /// (Originally from ..\FSComp.txt:249) + /// (Originally from ..\FSComp.txt:248) static member chkObjCtorsCantUseExceptionHandling() = (420, GetStringFunc("chkObjCtorsCantUseExceptionHandling",",,,") ) /// The address of the variable '%s' cannot be used at this point - /// (Originally from ..\FSComp.txt:250) + /// (Originally from ..\FSComp.txt:249) static member chkNoAddressOfAtThisPoint(a0 : System.String) = (421, GetStringFunc("chkNoAddressOfAtThisPoint",",,,%s,,,") a0) /// The address of the static field '%s' cannot be used at this point - /// (Originally from ..\FSComp.txt:251) + /// (Originally from ..\FSComp.txt:250) static member chkNoAddressStaticFieldAtThisPoint(a0 : System.String) = (422, GetStringFunc("chkNoAddressStaticFieldAtThisPoint",",,,%s,,,") a0) /// The address of the field '%s' cannot be used at this point - /// (Originally from ..\FSComp.txt:252) + /// (Originally from ..\FSComp.txt:251) static member chkNoAddressFieldAtThisPoint(a0 : System.String) = (423, GetStringFunc("chkNoAddressFieldAtThisPoint",",,,%s,,,") a0) /// The address of an array element cannot be used at this point - /// (Originally from ..\FSComp.txt:253) + /// (Originally from ..\FSComp.txt:252) static member chkNoAddressOfArrayElementAtThisPoint() = (424, GetStringFunc("chkNoAddressOfArrayElementAtThisPoint",",,,") ) /// The type of a first-class function cannot contain byrefs - /// (Originally from ..\FSComp.txt:254) + /// (Originally from ..\FSComp.txt:253) static member chkFirstClassFuncNoByref() = (425, GetStringFunc("chkFirstClassFuncNoByref",",,,") ) /// A method return type would contain byrefs which is not permitted - /// (Originally from ..\FSComp.txt:255) + /// (Originally from ..\FSComp.txt:254) static member chkReturnTypeNoByref() = (426, GetStringFunc("chkReturnTypeNoByref",",,,") ) /// Invalid custom attribute value (not a constant or literal) - /// (Originally from ..\FSComp.txt:256) + /// (Originally from ..\FSComp.txt:255) static member chkInvalidCustAttrVal() = (428, GetStringFunc("chkInvalidCustAttrVal",",,,") ) /// The attribute type '%s' has 'AllowMultiple=false'. Multiple instances of this attribute cannot be attached to a single language element. - /// (Originally from ..\FSComp.txt:257) + /// (Originally from ..\FSComp.txt:256) static member chkAttrHasAllowMultiFalse(a0 : System.String) = (429, GetStringFunc("chkAttrHasAllowMultiFalse",",,,%s,,,") a0) /// The member '%s' is used in an invalid way. A use of '%s' has been inferred prior to its definition at or near '%s'. This is an invalid forward reference. - /// (Originally from ..\FSComp.txt:258) + /// (Originally from ..\FSComp.txt:257) static member chkMemberUsedInInvalidWay(a0 : System.String, a1 : System.String, a2 : System.String) = (430, GetStringFunc("chkMemberUsedInInvalidWay",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// A byref typed value would be stored here. Top-level let-bound byref values are not permitted. - /// (Originally from ..\FSComp.txt:259) + /// (Originally from ..\FSComp.txt:258) static member chkNoByrefAsTopValue() = (431, GetStringFunc("chkNoByrefAsTopValue",",,,") ) /// [] terms cannot contain uses of the prefix splice operator '%%' - /// (Originally from ..\FSComp.txt:260) + /// (Originally from ..\FSComp.txt:259) static member chkReflectedDefCantSplice() = (432, GetStringFunc("chkReflectedDefCantSplice",",,,") ) /// A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence. - /// (Originally from ..\FSComp.txt:261) + /// (Originally from ..\FSComp.txt:260) static member chkEntryPointUsage() = (433, GetStringFunc("chkEntryPointUsage",",,,") ) /// compiled form of the union case - /// (Originally from ..\FSComp.txt:262) + /// (Originally from ..\FSComp.txt:261) static member chkUnionCaseCompiledForm() = (GetStringFunc("chkUnionCaseCompiledForm",",,,") ) /// default augmentation of the union case - /// (Originally from ..\FSComp.txt:263) + /// (Originally from ..\FSComp.txt:262) static member chkUnionCaseDefaultAugmentation() = (GetStringFunc("chkUnionCaseDefaultAugmentation",",,,") ) /// The property '%s' has the same name as a method in type '%s'. - /// (Originally from ..\FSComp.txt:264) + /// (Originally from ..\FSComp.txt:263) static member chkPropertySameNameMethod(a0 : System.String, a1 : System.String) = (434, GetStringFunc("chkPropertySameNameMethod",",,,%s,,,%s,,,") a0 a1) /// The property '%s' of type '%s' has a getter and a setter that do not match. If one is abstract then the other must be as well. - /// (Originally from ..\FSComp.txt:265) + /// (Originally from ..\FSComp.txt:264) static member chkGetterSetterDoNotMatchAbstract(a0 : System.String, a1 : System.String) = (435, GetStringFunc("chkGetterSetterDoNotMatchAbstract",",,,%s,,,%s,,,") a0 a1) /// The property '%s' has the same name as another property in type '%s', but one takes indexer arguments and the other does not. You may be missing an indexer argument to one of your properties. - /// (Originally from ..\FSComp.txt:266) + /// (Originally from ..\FSComp.txt:265) static member chkPropertySameNameIndexer(a0 : System.String, a1 : System.String) = (436, GetStringFunc("chkPropertySameNameIndexer",",,,%s,,,%s,,,") a0 a1) /// A type would store a byref typed value. This is not permitted by Common IL. - /// (Originally from ..\FSComp.txt:267) + /// (Originally from ..\FSComp.txt:266) static member chkCantStoreByrefValue() = (437, GetStringFunc("chkCantStoreByrefValue",",,,") ) /// Duplicate method. The method '%s' has the same name and signature as another method in type '%s'. - /// (Originally from ..\FSComp.txt:269) + /// (Originally from ..\FSComp.txt:268) static member chkDuplicateMethod(a0 : System.String, a1 : System.String) = (438, GetStringFunc("chkDuplicateMethod",",,,%s,,,%s,,,") a0 a1) /// Duplicate method. The method '%s' has the same name and signature as another method in type '%s' once tuples, functions, units of measure and/or provided types are erased. - /// (Originally from ..\FSComp.txt:270) + /// (Originally from ..\FSComp.txt:269) static member chkDuplicateMethodWithSuffix(a0 : System.String, a1 : System.String) = (438, GetStringFunc("chkDuplicateMethodWithSuffix",",,,%s,,,%s,,,") a0 a1) /// The method '%s' has curried arguments but has the same name as another method in type '%s'. Methods with curried arguments cannot be overloaded. Consider using a method taking tupled arguments. - /// (Originally from ..\FSComp.txt:271) + /// (Originally from ..\FSComp.txt:270) static member chkDuplicateMethodCurried(a0 : System.String, a1 : System.String) = (439, GetStringFunc("chkDuplicateMethodCurried",",,,%s,,,%s,,,") a0 a1) /// Methods with curried arguments cannot declare 'out', 'ParamArray', 'optional', 'ReflectedDefinition', 'byref', 'CallerLineNumber', 'CallerMemberName', or 'CallerFilePath' arguments - /// (Originally from ..\FSComp.txt:272) + /// (Originally from ..\FSComp.txt:271) static member chkCurriedMethodsCantHaveOutParams() = (440, GetStringFunc("chkCurriedMethodsCantHaveOutParams",",,,") ) /// Duplicate property. The property '%s' has the same name and signature as another property in type '%s'. - /// (Originally from ..\FSComp.txt:273) + /// (Originally from ..\FSComp.txt:272) static member chkDuplicateProperty(a0 : System.String, a1 : System.String) = (441, GetStringFunc("chkDuplicateProperty",",,,%s,,,%s,,,") a0 a1) /// Duplicate property. The property '%s' has the same name and signature as another property in type '%s' once tuples, functions, units of measure and/or provided types are erased. - /// (Originally from ..\FSComp.txt:274) + /// (Originally from ..\FSComp.txt:273) static member chkDuplicatePropertyWithSuffix(a0 : System.String, a1 : System.String) = (441, GetStringFunc("chkDuplicatePropertyWithSuffix",",,,%s,,,%s,,,") a0 a1) /// Duplicate method. The abstract method '%s' has the same name and signature as an abstract method in an inherited type. - /// (Originally from ..\FSComp.txt:275) + /// (Originally from ..\FSComp.txt:274) static member chkDuplicateMethodInheritedType(a0 : System.String) = (442, GetStringFunc("chkDuplicateMethodInheritedType",",,,%s,,,") a0) /// Duplicate method. The abstract method '%s' has the same name and signature as an abstract method in an inherited type once tuples, functions, units of measure and/or provided types are erased. - /// (Originally from ..\FSComp.txt:276) + /// (Originally from ..\FSComp.txt:275) static member chkDuplicateMethodInheritedTypeWithSuffix(a0 : System.String) = (442, GetStringFunc("chkDuplicateMethodInheritedTypeWithSuffix",",,,%s,,,") a0) /// This type implements the same interface at different generic instantiations '%s' and '%s'. This is not permitted in this version of F#. - /// (Originally from ..\FSComp.txt:277) + /// (Originally from ..\FSComp.txt:276) static member chkMultipleGenericInterfaceInstantiations(a0 : System.String, a1 : System.String) = (443, GetStringFunc("chkMultipleGenericInterfaceInstantiations",",,,%s,,,%s,,,") a0 a1) /// The type of a field using the 'DefaultValue' attribute must admit default initialization, i.e. have 'null' as a proper value or be a struct type whose fields all admit default initialization. You can use 'DefaultValue(false)' to disable this check - /// (Originally from ..\FSComp.txt:278) + /// (Originally from ..\FSComp.txt:277) static member chkValueWithDefaultValueMustHaveDefaultValue() = (444, GetStringFunc("chkValueWithDefaultValueMustHaveDefaultValue",",,,") ) /// The type abbreviation contains byrefs. This is not permitted by F#. - /// (Originally from ..\FSComp.txt:279) + /// (Originally from ..\FSComp.txt:278) static member chkNoByrefInTypeAbbrev() = (445, GetStringFunc("chkNoByrefInTypeAbbrev",",,,") ) /// The variable '%s' is bound in a quotation but is used as part of a spliced expression. This is not permitted since it may escape its scope. - /// (Originally from ..\FSComp.txt:280) + /// (Originally from ..\FSComp.txt:279) static member crefBoundVarUsedInSplice(a0 : System.String) = (446, GetStringFunc("crefBoundVarUsedInSplice",",,,%s,,,") a0) /// Quotations cannot contain uses of generic expressions - /// (Originally from ..\FSComp.txt:281) + /// (Originally from ..\FSComp.txt:280) static member crefQuotationsCantContainGenericExprs() = (447, GetStringFunc("crefQuotationsCantContainGenericExprs",",,,") ) /// Quotations cannot contain function definitions that are inferred or declared to be generic. Consider adding some type constraints to make this a valid quoted expression. - /// (Originally from ..\FSComp.txt:282) + /// (Originally from ..\FSComp.txt:281) static member crefQuotationsCantContainGenericFunctions() = (448, GetStringFunc("crefQuotationsCantContainGenericFunctions",",,,") ) /// Quotations cannot contain object expressions - /// (Originally from ..\FSComp.txt:283) + /// (Originally from ..\FSComp.txt:282) static member crefQuotationsCantContainObjExprs() = (449, GetStringFunc("crefQuotationsCantContainObjExprs",",,,") ) /// Quotations cannot contain expressions that take the address of a field - /// (Originally from ..\FSComp.txt:284) + /// (Originally from ..\FSComp.txt:283) static member crefQuotationsCantContainAddressOf() = (450, GetStringFunc("crefQuotationsCantContainAddressOf",",,,") ) /// Quotations cannot contain expressions that fetch static fields - /// (Originally from ..\FSComp.txt:285) + /// (Originally from ..\FSComp.txt:284) static member crefQuotationsCantContainStaticFieldRef() = (451, GetStringFunc("crefQuotationsCantContainStaticFieldRef",",,,") ) /// Quotations cannot contain inline assembly code or pattern matching on arrays - /// (Originally from ..\FSComp.txt:286) + /// (Originally from ..\FSComp.txt:285) static member crefQuotationsCantContainInlineIL() = (452, GetStringFunc("crefQuotationsCantContainInlineIL",",,,") ) /// Quotations cannot contain descending for loops - /// (Originally from ..\FSComp.txt:287) + /// (Originally from ..\FSComp.txt:286) static member crefQuotationsCantContainDescendingForLoops() = (453, GetStringFunc("crefQuotationsCantContainDescendingForLoops",",,,") ) /// Quotations cannot contain expressions that fetch union case indexes - /// (Originally from ..\FSComp.txt:288) + /// (Originally from ..\FSComp.txt:287) static member crefQuotationsCantFetchUnionIndexes() = (454, GetStringFunc("crefQuotationsCantFetchUnionIndexes",",,,") ) /// Quotations cannot contain expressions that set union case fields - /// (Originally from ..\FSComp.txt:289) + /// (Originally from ..\FSComp.txt:288) static member crefQuotationsCantSetUnionFields() = (455, GetStringFunc("crefQuotationsCantSetUnionFields",",,,") ) /// Quotations cannot contain expressions that set fields in exception values - /// (Originally from ..\FSComp.txt:290) + /// (Originally from ..\FSComp.txt:289) static member crefQuotationsCantSetExceptionFields() = (456, GetStringFunc("crefQuotationsCantSetExceptionFields",",,,") ) /// Quotations cannot contain expressions that require byref pointers - /// (Originally from ..\FSComp.txt:291) + /// (Originally from ..\FSComp.txt:290) static member crefQuotationsCantRequireByref() = (457, GetStringFunc("crefQuotationsCantRequireByref",",,,") ) /// Quotations cannot contain expressions that make member constraint calls, or uses of operators that implicitly resolve to a member constraint call - /// (Originally from ..\FSComp.txt:292) + /// (Originally from ..\FSComp.txt:291) static member crefQuotationsCantCallTraitMembers() = (458, GetStringFunc("crefQuotationsCantCallTraitMembers",",,,") ) /// Quotations cannot contain this kind of constant - /// (Originally from ..\FSComp.txt:293) + /// (Originally from ..\FSComp.txt:292) static member crefQuotationsCantContainThisConstant() = (459, GetStringFunc("crefQuotationsCantContainThisConstant",",,,") ) /// Quotations cannot contain this kind of pattern match - /// (Originally from ..\FSComp.txt:294) + /// (Originally from ..\FSComp.txt:293) static member crefQuotationsCantContainThisPatternMatch() = (460, GetStringFunc("crefQuotationsCantContainThisPatternMatch",",,,") ) /// Quotations cannot contain array pattern matching - /// (Originally from ..\FSComp.txt:295) + /// (Originally from ..\FSComp.txt:294) static member crefQuotationsCantContainArrayPatternMatching() = (461, GetStringFunc("crefQuotationsCantContainArrayPatternMatching",",,,") ) /// Quotations cannot contain this kind of type - /// (Originally from ..\FSComp.txt:296) + /// (Originally from ..\FSComp.txt:295) static member crefQuotationsCantContainThisType() = (462, GetStringFunc("crefQuotationsCantContainThisType",",,,") ) /// The declared type parameter '%s' cannot be used here since the type parameter cannot be resolved at compile time - /// (Originally from ..\FSComp.txt:297) + /// (Originally from ..\FSComp.txt:296) static member csTypeCannotBeResolvedAtCompileTime(a0 : System.String) = (GetStringFunc("csTypeCannotBeResolvedAtCompileTime",",,,%s,,,") a0) /// This code is less generic than indicated by its annotations. A unit-of-measure specified using '_' has been determined to be '1', i.e. dimensionless. Consider making the code generic, or removing the use of '_'. - /// (Originally from ..\FSComp.txt:298) + /// (Originally from ..\FSComp.txt:297) static member csCodeLessGeneric() = (464, GetStringFunc("csCodeLessGeneric",",,,") ) /// Type inference problem too complicated (maximum iteration depth reached). Consider adding further type annotations. - /// (Originally from ..\FSComp.txt:299) + /// (Originally from ..\FSComp.txt:298) static member csTypeInferenceMaxDepth() = (465, GetStringFunc("csTypeInferenceMaxDepth",",,,") ) /// Expected arguments to an instance member - /// (Originally from ..\FSComp.txt:300) + /// (Originally from ..\FSComp.txt:299) static member csExpectedArguments() = (GetStringFunc("csExpectedArguments",",,,") ) /// This indexer expects %d arguments but is here given %d - /// (Originally from ..\FSComp.txt:301) + /// (Originally from ..\FSComp.txt:300) static member csIndexArgumentMismatch(a0 : System.Int32, a1 : System.Int32) = (GetStringFunc("csIndexArgumentMismatch",",,,%d,,,%d,,,") a0 a1) /// Expecting a type supporting the operator '%s' but given a function type. You may be missing an argument to a function. - /// (Originally from ..\FSComp.txt:302) + /// (Originally from ..\FSComp.txt:301) static member csExpectTypeWithOperatorButGivenFunction(a0 : System.String) = (GetStringFunc("csExpectTypeWithOperatorButGivenFunction",",,,%s,,,") a0) /// Expecting a type supporting the operator '%s' but given a tuple type - /// (Originally from ..\FSComp.txt:303) + /// (Originally from ..\FSComp.txt:302) static member csExpectTypeWithOperatorButGivenTuple(a0 : System.String) = (GetStringFunc("csExpectTypeWithOperatorButGivenTuple",",,,%s,,,") a0) /// None of the types '%s' support the operator '%s' - /// (Originally from ..\FSComp.txt:304) + /// (Originally from ..\FSComp.txt:303) static member csTypesDoNotSupportOperator(a0 : System.String, a1 : System.String) = (GetStringFunc("csTypesDoNotSupportOperator",",,,%s,,,%s,,,") a0 a1) /// The type '%s' does not support the operator '%s' - /// (Originally from ..\FSComp.txt:305) + /// (Originally from ..\FSComp.txt:304) static member csTypeDoesNotSupportOperator(a0 : System.String, a1 : System.String) = (GetStringFunc("csTypeDoesNotSupportOperator",",,,%s,,,%s,,,") a0 a1) /// None of the types '%s' support the operator '%s'. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'. - /// (Originally from ..\FSComp.txt:306) + /// (Originally from ..\FSComp.txt:305) static member csTypesDoNotSupportOperatorNullable(a0 : System.String, a1 : System.String) = (GetStringFunc("csTypesDoNotSupportOperatorNullable",",,,%s,,,%s,,,") a0 a1) /// The type '%s' does not support the operator '%s'. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'. - /// (Originally from ..\FSComp.txt:307) + /// (Originally from ..\FSComp.txt:306) static member csTypeDoesNotSupportOperatorNullable(a0 : System.String, a1 : System.String) = (GetStringFunc("csTypeDoesNotSupportOperatorNullable",",,,%s,,,%s,,,") a0 a1) /// The type '%s' does not support a conversion to the type '%s' - /// (Originally from ..\FSComp.txt:308) + /// (Originally from ..\FSComp.txt:307) static member csTypeDoesNotSupportConversion(a0 : System.String, a1 : System.String) = (GetStringFunc("csTypeDoesNotSupportConversion",",,,%s,,,%s,,,") a0 a1) /// The type '%s' has a method '%s' (full name '%s'), but the method is static - /// (Originally from ..\FSComp.txt:309) + /// (Originally from ..\FSComp.txt:308) static member csMethodFoundButIsStatic(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("csMethodFoundButIsStatic",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The type '%s' has a method '%s' (full name '%s'), but the method is not static - /// (Originally from ..\FSComp.txt:310) + /// (Originally from ..\FSComp.txt:309) static member csMethodFoundButIsNotStatic(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("csMethodFoundButIsNotStatic",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The constraints 'struct' and 'not struct' are inconsistent - /// (Originally from ..\FSComp.txt:311) + /// (Originally from ..\FSComp.txt:310) static member csStructConstraintInconsistent() = (472, GetStringFunc("csStructConstraintInconsistent",",,,") ) /// The type '%s' does not have 'null' as a proper value - /// (Originally from ..\FSComp.txt:312) + /// (Originally from ..\FSComp.txt:311) static member csTypeDoesNotHaveNull(a0 : System.String) = (GetStringFunc("csTypeDoesNotHaveNull",",,,%s,,,") a0) /// The type '%s' does not have 'null' as a proper value. To create a null value for a Nullable type use 'System.Nullable()'. - /// (Originally from ..\FSComp.txt:313) + /// (Originally from ..\FSComp.txt:312) static member csNullableTypeDoesNotHaveNull(a0 : System.String) = (GetStringFunc("csNullableTypeDoesNotHaveNull",",,,%s,,,") a0) /// The type '%s' does not support the 'comparison' constraint because it has the 'NoComparison' attribute - /// (Originally from ..\FSComp.txt:314) + /// (Originally from ..\FSComp.txt:313) static member csTypeDoesNotSupportComparison1(a0 : System.String) = (GetStringFunc("csTypeDoesNotSupportComparison1",",,,%s,,,") a0) /// The type '%s' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface - /// (Originally from ..\FSComp.txt:315) + /// (Originally from ..\FSComp.txt:314) static member csTypeDoesNotSupportComparison2(a0 : System.String) = (GetStringFunc("csTypeDoesNotSupportComparison2",",,,%s,,,") a0) /// The type '%s' does not support the 'comparison' constraint because it is a record, union or struct with one or more structural element types which do not support the 'comparison' constraint. Either avoid the use of comparison with this type, or add the 'StructuralComparison' attribute to the type to determine which field type does not support comparison - /// (Originally from ..\FSComp.txt:316) + /// (Originally from ..\FSComp.txt:315) static member csTypeDoesNotSupportComparison3(a0 : System.String) = (GetStringFunc("csTypeDoesNotSupportComparison3",",,,%s,,,") a0) /// The type '%s' does not support the 'equality' constraint because it has the 'NoEquality' attribute - /// (Originally from ..\FSComp.txt:317) + /// (Originally from ..\FSComp.txt:316) static member csTypeDoesNotSupportEquality1(a0 : System.String) = (GetStringFunc("csTypeDoesNotSupportEquality1",",,,%s,,,") a0) /// The type '%s' does not support the 'equality' constraint because it is a function type - /// (Originally from ..\FSComp.txt:318) + /// (Originally from ..\FSComp.txt:317) static member csTypeDoesNotSupportEquality2(a0 : System.String) = (GetStringFunc("csTypeDoesNotSupportEquality2",",,,%s,,,") a0) /// The type '%s' does not support the 'equality' constraint because it is a record, union or struct with one or more structural element types which do not support the 'equality' constraint. Either avoid the use of equality with this type, or add the 'StructuralEquality' attribute to the type to determine which field type does not support equality - /// (Originally from ..\FSComp.txt:319) + /// (Originally from ..\FSComp.txt:318) static member csTypeDoesNotSupportEquality3(a0 : System.String) = (GetStringFunc("csTypeDoesNotSupportEquality3",",,,%s,,,") a0) /// The type '%s' is not a CLI enum type - /// (Originally from ..\FSComp.txt:320) + /// (Originally from ..\FSComp.txt:319) static member csTypeIsNotEnumType(a0 : System.String) = (GetStringFunc("csTypeIsNotEnumType",",,,%s,,,") a0) /// The type '%s' has a non-standard delegate type - /// (Originally from ..\FSComp.txt:321) + /// (Originally from ..\FSComp.txt:320) static member csTypeHasNonStandardDelegateType(a0 : System.String) = (GetStringFunc("csTypeHasNonStandardDelegateType",",,,%s,,,") a0) /// The type '%s' is not a CLI delegate type - /// (Originally from ..\FSComp.txt:322) + /// (Originally from ..\FSComp.txt:321) static member csTypeIsNotDelegateType(a0 : System.String) = (GetStringFunc("csTypeIsNotDelegateType",",,,%s,,,") a0) /// This type parameter cannot be instantiated to 'Nullable'. This is a restriction imposed in order to ensure the meaning of 'null' in some CLI languages is not confusing when used in conjunction with 'Nullable' values. - /// (Originally from ..\FSComp.txt:323) + /// (Originally from ..\FSComp.txt:322) static member csTypeParameterCannotBeNullable() = (GetStringFunc("csTypeParameterCannotBeNullable",",,,") ) /// A generic construct requires that the type '%s' is a CLI or F# struct type - /// (Originally from ..\FSComp.txt:324) + /// (Originally from ..\FSComp.txt:323) static member csGenericConstructRequiresStructType(a0 : System.String) = (GetStringFunc("csGenericConstructRequiresStructType",",,,%s,,,") a0) /// A generic construct requires that the type '%s' is an unmanaged type - /// (Originally from ..\FSComp.txt:325) + /// (Originally from ..\FSComp.txt:324) static member csGenericConstructRequiresUnmanagedType(a0 : System.String) = (GetStringFunc("csGenericConstructRequiresUnmanagedType",",,,%s,,,") a0) /// The type '%s' is not compatible with any of the types %s, arising from the use of a printf-style format string - /// (Originally from ..\FSComp.txt:326) + /// (Originally from ..\FSComp.txt:325) static member csTypeNotCompatibleBecauseOfPrintf(a0 : System.String, a1 : System.String) = (GetStringFunc("csTypeNotCompatibleBecauseOfPrintf",",,,%s,,,%s,,,") a0 a1) /// A generic construct requires that the type '%s' have reference semantics, but it does not, i.e. it is a struct - /// (Originally from ..\FSComp.txt:327) + /// (Originally from ..\FSComp.txt:326) static member csGenericConstructRequiresReferenceSemantics(a0 : System.String) = (GetStringFunc("csGenericConstructRequiresReferenceSemantics",",,,%s,,,") a0) /// A generic construct requires that the type '%s' be non-abstract - /// (Originally from ..\FSComp.txt:328) + /// (Originally from ..\FSComp.txt:327) static member csGenericConstructRequiresNonAbstract(a0 : System.String) = (GetStringFunc("csGenericConstructRequiresNonAbstract",",,,%s,,,") a0) /// A generic construct requires that the type '%s' have a public default constructor - /// (Originally from ..\FSComp.txt:329) + /// (Originally from ..\FSComp.txt:328) static member csGenericConstructRequiresPublicDefaultConstructor(a0 : System.String) = (GetStringFunc("csGenericConstructRequiresPublicDefaultConstructor",",,,%s,,,") a0) /// Type instantiation length mismatch - /// (Originally from ..\FSComp.txt:330) + /// (Originally from ..\FSComp.txt:329) static member csTypeInstantiationLengthMismatch() = (483, GetStringFunc("csTypeInstantiationLengthMismatch",",,,") ) /// Optional arguments not permitted here - /// (Originally from ..\FSComp.txt:331) + /// (Originally from ..\FSComp.txt:330) static member csOptionalArgumentNotPermittedHere() = (484, GetStringFunc("csOptionalArgumentNotPermittedHere",",,,") ) /// %s is not a static member - /// (Originally from ..\FSComp.txt:332) + /// (Originally from ..\FSComp.txt:331) static member csMemberIsNotStatic(a0 : System.String) = (485, GetStringFunc("csMemberIsNotStatic",",,,%s,,,") a0) /// %s is not an instance member - /// (Originally from ..\FSComp.txt:333) + /// (Originally from ..\FSComp.txt:332) static member csMemberIsNotInstance(a0 : System.String) = (486, GetStringFunc("csMemberIsNotInstance",",,,%s,,,") a0) /// Argument length mismatch - /// (Originally from ..\FSComp.txt:334) + /// (Originally from ..\FSComp.txt:333) static member csArgumentLengthMismatch() = (487, GetStringFunc("csArgumentLengthMismatch",",,,") ) /// The argument types don't match - /// (Originally from ..\FSComp.txt:335) + /// (Originally from ..\FSComp.txt:334) static member csArgumentTypesDoNotMatch() = (488, GetStringFunc("csArgumentTypesDoNotMatch",",,,") ) /// This method expects a CLI 'params' parameter in this position. 'params' is a way of passing a variable number of arguments to a method in languages such as C#. Consider passing an array for this argument - /// (Originally from ..\FSComp.txt:336) + /// (Originally from ..\FSComp.txt:335) static member csMethodExpectsParams() = (489, GetStringFunc("csMethodExpectsParams",",,,") ) /// The member or object constructor '%s' is not %s - /// (Originally from ..\FSComp.txt:337) + /// (Originally from ..\FSComp.txt:336) static member csMemberIsNotAccessible(a0 : System.String, a1 : System.String) = (490, GetStringFunc("csMemberIsNotAccessible",",,,%s,,,%s,,,") a0 a1) /// The member or object constructor '%s' is not %s. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions. - /// (Originally from ..\FSComp.txt:338) + /// (Originally from ..\FSComp.txt:337) static member csMemberIsNotAccessible2(a0 : System.String, a1 : System.String) = (491, GetStringFunc("csMemberIsNotAccessible2",",,,%s,,,%s,,,") a0 a1) /// %s is not a static method - /// (Originally from ..\FSComp.txt:339) + /// (Originally from ..\FSComp.txt:338) static member csMethodIsNotAStaticMethod(a0 : System.String) = (492, GetStringFunc("csMethodIsNotAStaticMethod",",,,%s,,,") a0) /// %s is not an instance method - /// (Originally from ..\FSComp.txt:340) + /// (Originally from ..\FSComp.txt:339) static member csMethodIsNotAnInstanceMethod(a0 : System.String) = (493, GetStringFunc("csMethodIsNotAnInstanceMethod",",,,%s,,,") a0) /// The member or object constructor '%s' has no argument or settable return property '%s'. %s. - /// (Originally from ..\FSComp.txt:341) + /// (Originally from ..\FSComp.txt:340) static member csMemberHasNoArgumentOrReturnProperty(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("csMemberHasNoArgumentOrReturnProperty",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The object constructor '%s' has no argument or settable return property '%s'. %s. - /// (Originally from ..\FSComp.txt:342) + /// (Originally from ..\FSComp.txt:341) static member csCtorHasNoArgumentOrReturnProperty(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("csCtorHasNoArgumentOrReturnProperty",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The required signature is %s - /// (Originally from ..\FSComp.txt:343) + /// (Originally from ..\FSComp.txt:342) static member csRequiredSignatureIs(a0 : System.String) = (495, GetStringFunc("csRequiredSignatureIs",",,,%s,,,") a0) /// The member or object constructor '%s' requires %d argument(s). The required signature is '%s'. - /// (Originally from ..\FSComp.txt:344) + /// (Originally from ..\FSComp.txt:343) static member csMemberSignatureMismatch(a0 : System.String, a1 : System.Int32, a2 : System.String) = (496, GetStringFunc("csMemberSignatureMismatch",",,,%s,,,%d,,,%s,,,") a0 a1 a2) /// The member or object constructor '%s' requires %d additional argument(s). The required signature is '%s'. - /// (Originally from ..\FSComp.txt:345) + /// (Originally from ..\FSComp.txt:344) static member csMemberSignatureMismatch2(a0 : System.String, a1 : System.Int32, a2 : System.String) = (497, GetStringFunc("csMemberSignatureMismatch2",",,,%s,,,%d,,,%s,,,") a0 a1 a2) /// The member or object constructor '%s' requires %d argument(s). The required signature is '%s'. Some names for missing arguments are %s. - /// (Originally from ..\FSComp.txt:346) + /// (Originally from ..\FSComp.txt:345) static member csMemberSignatureMismatch3(a0 : System.String, a1 : System.Int32, a2 : System.String, a3 : System.String) = (498, GetStringFunc("csMemberSignatureMismatch3",",,,%s,,,%d,,,%s,,,%s,,,") a0 a1 a2 a3) /// The member or object constructor '%s' requires %d additional argument(s). The required signature is '%s'. Some names for missing arguments are %s. - /// (Originally from ..\FSComp.txt:347) + /// (Originally from ..\FSComp.txt:346) static member csMemberSignatureMismatch4(a0 : System.String, a1 : System.Int32, a2 : System.String, a3 : System.String) = (499, GetStringFunc("csMemberSignatureMismatch4",",,,%s,,,%d,,,%s,,,%s,,,") a0 a1 a2 a3) /// The member or object constructor '%s' requires %d argument(s) but is here given %d unnamed and %d named argument(s). The required signature is '%s'. - /// (Originally from ..\FSComp.txt:348) + /// (Originally from ..\FSComp.txt:347) static member csMemberSignatureMismatchArityNamed(a0 : System.String, a1 : System.Int32, a2 : System.Int32, a3 : System.Int32, a4 : System.String) = (500, GetStringFunc("csMemberSignatureMismatchArityNamed",",,,%s,,,%d,,,%d,,,%d,,,%s,,,") a0 a1 a2 a3 a4) /// The member or object constructor '%s' takes %d argument(s) but is here given %d. The required signature is '%s'. - /// (Originally from ..\FSComp.txt:349) + /// (Originally from ..\FSComp.txt:348) static member csMemberSignatureMismatchArity(a0 : System.String, a1 : System.Int32, a2 : System.Int32, a3 : System.String) = (501, GetStringFunc("csMemberSignatureMismatchArity",",,,%s,,,%d,,,%d,,,%s,,,") a0 a1 a2 a3) /// The object constructor '%s' takes %d argument(s) but is here given %d. The required signature is '%s'. - /// (Originally from ..\FSComp.txt:350) + /// (Originally from ..\FSComp.txt:349) static member csCtorSignatureMismatchArity(a0 : System.String, a1 : System.Int32, a2 : System.Int32, a3 : System.String) = (501, GetStringFunc("csCtorSignatureMismatchArity",",,,%s,,,%d,,,%d,,,%s,,,") a0 a1 a2 a3) /// The object constructor '%s' takes %d argument(s) but is here given %d. The required signature is '%s'. If some of the arguments are meant to assign values to properties, consider separating those arguments with a comma (','). - /// (Originally from ..\FSComp.txt:351) + /// (Originally from ..\FSComp.txt:350) static member csCtorSignatureMismatchArityProp(a0 : System.String, a1 : System.Int32, a2 : System.Int32, a3 : System.String) = (501, GetStringFunc("csCtorSignatureMismatchArityProp",",,,%s,,,%d,,,%d,,,%s,,,") a0 a1 a2 a3) /// The member or object constructor '%s' takes %d type argument(s) but is here given %d. The required signature is '%s'. - /// (Originally from ..\FSComp.txt:352) + /// (Originally from ..\FSComp.txt:351) static member csMemberSignatureMismatchArityType(a0 : System.String, a1 : System.Int32, a2 : System.Int32, a3 : System.String) = (502, GetStringFunc("csMemberSignatureMismatchArityType",",,,%s,,,%d,,,%d,,,%s,,,") a0 a1 a2 a3) /// A member or object constructor '%s' taking %d arguments is not accessible from this code location. All accessible versions of method '%s' take %d arguments. - /// (Originally from ..\FSComp.txt:353) + /// (Originally from ..\FSComp.txt:352) static member csMemberNotAccessible(a0 : System.String, a1 : System.Int32, a2 : System.String, a3 : System.Int32) = (503, GetStringFunc("csMemberNotAccessible",",,,%s,,,%d,,,%s,,,%d,,,") a0 a1 a2 a3) /// Incorrect generic instantiation. No %s member named '%s' takes %d generic arguments. - /// (Originally from ..\FSComp.txt:354) + /// (Originally from ..\FSComp.txt:353) static member csIncorrectGenericInstantiation(a0 : System.String, a1 : System.String, a2 : System.Int32) = (504, GetStringFunc("csIncorrectGenericInstantiation",",,,%s,,,%s,,,%d,,,") a0 a1 a2) /// The member or object constructor '%s' does not take %d argument(s). An overload was found taking %d arguments. - /// (Originally from ..\FSComp.txt:355) + /// (Originally from ..\FSComp.txt:354) static member csMemberOverloadArityMismatch(a0 : System.String, a1 : System.Int32, a2 : System.Int32) = (505, GetStringFunc("csMemberOverloadArityMismatch",",,,%s,,,%d,,,%d,,,") a0 a1 a2) /// No %s member or object constructor named '%s' takes %d arguments - /// (Originally from ..\FSComp.txt:356) + /// (Originally from ..\FSComp.txt:355) static member csNoMemberTakesTheseArguments(a0 : System.String, a1 : System.String, a2 : System.Int32) = (506, GetStringFunc("csNoMemberTakesTheseArguments",",,,%s,,,%s,,,%d,,,") a0 a1 a2) /// No %s member or object constructor named '%s' takes %d arguments. Note the call to this member also provides %d named arguments. - /// (Originally from ..\FSComp.txt:357) + /// (Originally from ..\FSComp.txt:356) static member csNoMemberTakesTheseArguments2(a0 : System.String, a1 : System.String, a2 : System.Int32, a3 : System.Int32) = (507, GetStringFunc("csNoMemberTakesTheseArguments2",",,,%s,,,%s,,,%d,,,%d,,,") a0 a1 a2 a3) /// No %s member or object constructor named '%s' takes %d arguments. The named argument '%s' doesn't correspond to any argument or settable return property for any overload. - /// (Originally from ..\FSComp.txt:358) + /// (Originally from ..\FSComp.txt:357) static member csNoMemberTakesTheseArguments3(a0 : System.String, a1 : System.String, a2 : System.Int32, a3 : System.String) = (508, GetStringFunc("csNoMemberTakesTheseArguments3",",,,%s,,,%s,,,%d,,,%s,,,") a0 a1 a2 a3) /// Method or object constructor '%s' not found - /// (Originally from ..\FSComp.txt:359) + /// (Originally from ..\FSComp.txt:358) static member csMethodNotFound(a0 : System.String) = (509, GetStringFunc("csMethodNotFound",",,,%s,,,") a0) /// No overloads match for method '%s'. - /// (Originally from ..\FSComp.txt:360) + /// (Originally from ..\FSComp.txt:359) static member csNoOverloadsFound(a0 : System.String) = (GetStringFunc("csNoOverloadsFound",",,,%s,,,") a0) /// A unique overload for method '%s' could not be determined based on type information prior to this program point. A type annotation may be needed. - /// (Originally from ..\FSComp.txt:361) + /// (Originally from ..\FSComp.txt:360) static member csMethodIsOverloaded(a0 : System.String) = (GetStringFunc("csMethodIsOverloaded",",,,%s,,,") a0) /// Candidates: %s - /// (Originally from ..\FSComp.txt:362) + /// (Originally from ..\FSComp.txt:361) static member csCandidates(a0 : System.String) = (GetStringFunc("csCandidates",",,,%s,,,") a0) /// The available overloads are shown below. - /// (Originally from ..\FSComp.txt:363) + /// (Originally from ..\FSComp.txt:362) static member csSeeAvailableOverloads() = (GetStringFunc("csSeeAvailableOverloads",",,,") ) /// Accessibility modifiers are not permitted on 'do' bindings, but '%s' was given. - /// (Originally from ..\FSComp.txt:364) + /// (Originally from ..\FSComp.txt:363) static member parsDoCannotHaveVisibilityDeclarations(a0 : System.String) = (512, GetStringFunc("parsDoCannotHaveVisibilityDeclarations",",,,%s,,,") a0) /// End of file in #if section begun at or after here - /// (Originally from ..\FSComp.txt:365) + /// (Originally from ..\FSComp.txt:364) static member parsEofInHashIf() = (513, GetStringFunc("parsEofInHashIf",",,,") ) /// End of file in string begun at or before here - /// (Originally from ..\FSComp.txt:366) + /// (Originally from ..\FSComp.txt:365) static member parsEofInString() = (514, GetStringFunc("parsEofInString",",,,") ) /// End of file in verbatim string begun at or before here - /// (Originally from ..\FSComp.txt:367) + /// (Originally from ..\FSComp.txt:366) static member parsEofInVerbatimString() = (515, GetStringFunc("parsEofInVerbatimString",",,,") ) /// End of file in comment begun at or before here - /// (Originally from ..\FSComp.txt:368) + /// (Originally from ..\FSComp.txt:367) static member parsEofInComment() = (516, GetStringFunc("parsEofInComment",",,,") ) /// End of file in string embedded in comment begun at or before here - /// (Originally from ..\FSComp.txt:369) + /// (Originally from ..\FSComp.txt:368) static member parsEofInStringInComment() = (517, GetStringFunc("parsEofInStringInComment",",,,") ) /// End of file in verbatim string embedded in comment begun at or before here - /// (Originally from ..\FSComp.txt:370) + /// (Originally from ..\FSComp.txt:369) static member parsEofInVerbatimStringInComment() = (518, GetStringFunc("parsEofInVerbatimStringInComment",",,,") ) /// End of file in IF-OCAML section begun at or before here - /// (Originally from ..\FSComp.txt:371) + /// (Originally from ..\FSComp.txt:370) static member parsEofInIfOcaml() = (519, GetStringFunc("parsEofInIfOcaml",",,,") ) /// End of file in directive begun at or before here - /// (Originally from ..\FSComp.txt:372) + /// (Originally from ..\FSComp.txt:371) static member parsEofInDirective() = (520, GetStringFunc("parsEofInDirective",",,,") ) /// No #endif found for #if or #else - /// (Originally from ..\FSComp.txt:373) + /// (Originally from ..\FSComp.txt:372) static member parsNoHashEndIfFound() = (521, GetStringFunc("parsNoHashEndIfFound",",,,") ) /// Attributes have been ignored in this construct - /// (Originally from ..\FSComp.txt:374) + /// (Originally from ..\FSComp.txt:373) static member parsAttributesIgnored() = (522, GetStringFunc("parsAttributesIgnored",",,,") ) /// 'use' bindings are not permitted in primary constructors - /// (Originally from ..\FSComp.txt:375) + /// (Originally from ..\FSComp.txt:374) static member parsUseBindingsIllegalInImplicitClassConstructors() = (523, GetStringFunc("parsUseBindingsIllegalInImplicitClassConstructors",",,,") ) /// 'use' bindings are not permitted in modules and are treated as 'let' bindings - /// (Originally from ..\FSComp.txt:376) + /// (Originally from ..\FSComp.txt:375) static member parsUseBindingsIllegalInModules() = (524, GetStringFunc("parsUseBindingsIllegalInModules",",,,") ) /// An integer for loop must use a simple identifier - /// (Originally from ..\FSComp.txt:377) + /// (Originally from ..\FSComp.txt:376) static member parsIntegerForLoopRequiresSimpleIdentifier() = (525, GetStringFunc("parsIntegerForLoopRequiresSimpleIdentifier",",,,") ) /// At most one 'with' augmentation is permitted - /// (Originally from ..\FSComp.txt:378) + /// (Originally from ..\FSComp.txt:377) static member parsOnlyOneWithAugmentationAllowed() = (526, GetStringFunc("parsOnlyOneWithAugmentationAllowed",",,,") ) /// A semicolon is not expected at this point - /// (Originally from ..\FSComp.txt:379) + /// (Originally from ..\FSComp.txt:378) static member parsUnexpectedSemicolon() = (527, GetStringFunc("parsUnexpectedSemicolon",",,,") ) /// Unexpected end of input - /// (Originally from ..\FSComp.txt:380) + /// (Originally from ..\FSComp.txt:379) static member parsUnexpectedEndOfFile() = (528, GetStringFunc("parsUnexpectedEndOfFile",",,,") ) /// Accessibility modifiers are not permitted here, but '%s' was given. - /// (Originally from ..\FSComp.txt:381) + /// (Originally from ..\FSComp.txt:380) static member parsUnexpectedVisibilityDeclaration(a0 : System.String) = (529, GetStringFunc("parsUnexpectedVisibilityDeclaration",",,,%s,,,") a0) /// Only '#' compiler directives may occur prior to the first 'namespace' declaration - /// (Originally from ..\FSComp.txt:382) + /// (Originally from ..\FSComp.txt:381) static member parsOnlyHashDirectivesAllowed() = (530, GetStringFunc("parsOnlyHashDirectivesAllowed",",,,") ) /// Accessibility modifiers should come immediately prior to the identifier naming a construct - /// (Originally from ..\FSComp.txt:383) + /// (Originally from ..\FSComp.txt:382) static member parsVisibilityDeclarationsShouldComePriorToIdentifier() = (531, GetStringFunc("parsVisibilityDeclarationsShouldComePriorToIdentifier",",,,") ) /// Files should begin with either a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule', but not both. To define a module within a namespace use 'module SomeModule = ...' - /// (Originally from ..\FSComp.txt:384) + /// (Originally from ..\FSComp.txt:383) static member parsNamespaceOrModuleNotBoth() = (532, GetStringFunc("parsNamespaceOrModuleNotBoth",",,,") ) /// A module abbreviation must be a simple name, not a path - /// (Originally from ..\FSComp.txt:385) + /// (Originally from ..\FSComp.txt:384) static member parsModuleAbbreviationMustBeSimpleName() = (534, GetStringFunc("parsModuleAbbreviationMustBeSimpleName",",,,") ) /// Ignoring attributes on module abbreviation - /// (Originally from ..\FSComp.txt:386) + /// (Originally from ..\FSComp.txt:385) static member parsIgnoreAttributesOnModuleAbbreviation() = (535, GetStringFunc("parsIgnoreAttributesOnModuleAbbreviation",",,,") ) /// The '%s' accessibility attribute is not allowed on module abbreviation. Module abbreviations are always private. - /// (Originally from ..\FSComp.txt:387) + /// (Originally from ..\FSComp.txt:386) static member parsIgnoreAttributesOnModuleAbbreviationAlwaysPrivate(a0 : System.String) = (536, GetStringFunc("parsIgnoreAttributesOnModuleAbbreviationAlwaysPrivate",",,,%s,,,") a0) /// The '%s' visibility attribute is not allowed on module abbreviation. Module abbreviations are always private. - /// (Originally from ..\FSComp.txt:388) + /// (Originally from ..\FSComp.txt:387) static member parsIgnoreVisibilityOnModuleAbbreviationAlwaysPrivate(a0 : System.String) = (537, GetStringFunc("parsIgnoreVisibilityOnModuleAbbreviationAlwaysPrivate",",,,%s,,,") a0) /// Unclosed block - /// (Originally from ..\FSComp.txt:389) + /// (Originally from ..\FSComp.txt:388) static member parsUnClosedBlockInHashLight() = (538, GetStringFunc("parsUnClosedBlockInHashLight",",,,") ) /// Unmatched 'begin' or 'struct' - /// (Originally from ..\FSComp.txt:390) + /// (Originally from ..\FSComp.txt:389) static member parsUnmatchedBeginOrStruct() = (539, GetStringFunc("parsUnmatchedBeginOrStruct",",,,") ) /// A module name must be a simple name, not a path - /// (Originally from ..\FSComp.txt:391) + /// (Originally from ..\FSComp.txt:390) static member parsModuleDefnMustBeSimpleName() = (541, GetStringFunc("parsModuleDefnMustBeSimpleName",",,,") ) /// Unexpected empty type moduleDefn list - /// (Originally from ..\FSComp.txt:392) + /// (Originally from ..\FSComp.txt:391) static member parsUnexpectedEmptyModuleDefn() = (542, GetStringFunc("parsUnexpectedEmptyModuleDefn",",,,") ) /// Attributes should be placed before 'val' - /// (Originally from ..\FSComp.txt:393) + /// (Originally from ..\FSComp.txt:392) static member parsAttributesMustComeBeforeVal() = (GetStringFunc("parsAttributesMustComeBeforeVal",",,,") ) /// Attributes are not permitted on interface implementations - /// (Originally from ..\FSComp.txt:394) + /// (Originally from ..\FSComp.txt:393) static member parsAttributesAreNotPermittedOnInterfaceImplementations() = (543, GetStringFunc("parsAttributesAreNotPermittedOnInterfaceImplementations",",,,") ) /// Syntax error - /// (Originally from ..\FSComp.txt:395) + /// (Originally from ..\FSComp.txt:394) static member parsSyntaxError() = (544, GetStringFunc("parsSyntaxError",",,,") ) /// Augmentations are not permitted on delegate type moduleDefns - /// (Originally from ..\FSComp.txt:396) + /// (Originally from ..\FSComp.txt:395) static member parsAugmentationsIllegalOnDelegateType() = (545, GetStringFunc("parsAugmentationsIllegalOnDelegateType",",,,") ) /// Unmatched 'class', 'interface' or 'struct' - /// (Originally from ..\FSComp.txt:397) + /// (Originally from ..\FSComp.txt:396) static member parsUnmatchedClassInterfaceOrStruct() = (546, GetStringFunc("parsUnmatchedClassInterfaceOrStruct",",,,") ) /// A type definition requires one or more members or other declarations. If you intend to define an empty class, struct or interface, then use 'type ... = class end', 'interface end' or 'struct end'. - /// (Originally from ..\FSComp.txt:398) + /// (Originally from ..\FSComp.txt:397) static member parsEmptyTypeDefinition() = (547, GetStringFunc("parsEmptyTypeDefinition",",,,") ) /// Unmatched 'with' or badly formatted 'with' block - /// (Originally from ..\FSComp.txt:399) + /// (Originally from ..\FSComp.txt:398) static member parsUnmatchedWith() = (550, GetStringFunc("parsUnmatchedWith",",,,") ) /// 'get', 'set' or 'get,set' required - /// (Originally from ..\FSComp.txt:400) + /// (Originally from ..\FSComp.txt:399) static member parsGetOrSetRequired() = (551, GetStringFunc("parsGetOrSetRequired",",,,") ) /// Only class types may take value arguments - /// (Originally from ..\FSComp.txt:401) + /// (Originally from ..\FSComp.txt:400) static member parsOnlyClassCanTakeValueArguments() = (552, GetStringFunc("parsOnlyClassCanTakeValueArguments",",,,") ) /// Unmatched 'begin' - /// (Originally from ..\FSComp.txt:402) + /// (Originally from ..\FSComp.txt:401) static member parsUnmatchedBegin() = (553, GetStringFunc("parsUnmatchedBegin",",,,") ) /// Invalid declaration syntax - /// (Originally from ..\FSComp.txt:403) + /// (Originally from ..\FSComp.txt:402) static member parsInvalidDeclarationSyntax() = (554, GetStringFunc("parsInvalidDeclarationSyntax",",,,") ) /// 'get' and/or 'set' required - /// (Originally from ..\FSComp.txt:404) + /// (Originally from ..\FSComp.txt:403) static member parsGetAndOrSetRequired() = (555, GetStringFunc("parsGetAndOrSetRequired",",,,") ) /// Type annotations on property getters and setters must be given after the 'get()' or 'set(v)', e.g. 'with get() : string = ...' - /// (Originally from ..\FSComp.txt:405) + /// (Originally from ..\FSComp.txt:404) static member parsTypeAnnotationsOnGetSet() = (556, GetStringFunc("parsTypeAnnotationsOnGetSet",",,,") ) /// A getter property is expected to be a function, e.g. 'get() = ...' or 'get(index) = ...' - /// (Originally from ..\FSComp.txt:406) + /// (Originally from ..\FSComp.txt:405) static member parsGetterMustHaveAtLeastOneArgument() = (557, GetStringFunc("parsGetterMustHaveAtLeastOneArgument",",,,") ) /// Multiple accessibilities given for property getter or setter - /// (Originally from ..\FSComp.txt:407) + /// (Originally from ..\FSComp.txt:406) static member parsMultipleAccessibilitiesForGetSet() = (558, GetStringFunc("parsMultipleAccessibilitiesForGetSet",",,,") ) /// Property setters must be defined using 'set value = ', 'set idx value = ' or 'set (idx1,...,idxN) value = ... ' - /// (Originally from ..\FSComp.txt:408) + /// (Originally from ..\FSComp.txt:407) static member parsSetSyntax() = (559, GetStringFunc("parsSetSyntax",",,,") ) /// Interfaces always have the same visibility as the enclosing type - /// (Originally from ..\FSComp.txt:409) + /// (Originally from ..\FSComp.txt:408) static member parsInterfacesHaveSameVisibilityAsEnclosingType() = (560, GetStringFunc("parsInterfacesHaveSameVisibilityAsEnclosingType",",,,") ) /// Accessibility modifiers are not allowed on this member. Abstract slots always have the same visibility as the enclosing type. - /// (Originally from ..\FSComp.txt:410) + /// (Originally from ..\FSComp.txt:409) static member parsAccessibilityModsIllegalForAbstract() = (561, GetStringFunc("parsAccessibilityModsIllegalForAbstract",",,,") ) /// Attributes are not permitted on 'inherit' declarations - /// (Originally from ..\FSComp.txt:411) + /// (Originally from ..\FSComp.txt:410) static member parsAttributesIllegalOnInherit() = (562, GetStringFunc("parsAttributesIllegalOnInherit",",,,") ) /// Accessibility modifiers are not permitted on an 'inherits' declaration - /// (Originally from ..\FSComp.txt:412) + /// (Originally from ..\FSComp.txt:411) static member parsVisibilityIllegalOnInherit() = (563, GetStringFunc("parsVisibilityIllegalOnInherit",",,,") ) /// 'inherit' declarations cannot have 'as' bindings. To access members of the base class when overriding a method, the syntax 'base.SomeMember' may be used; 'base' is a keyword. Remove this 'as' binding. - /// (Originally from ..\FSComp.txt:413) + /// (Originally from ..\FSComp.txt:412) static member parsInheritDeclarationsCannotHaveAsBindings() = (564, GetStringFunc("parsInheritDeclarationsCannotHaveAsBindings",",,,") ) /// Attributes are not allowed here - /// (Originally from ..\FSComp.txt:414) + /// (Originally from ..\FSComp.txt:413) static member parsAttributesIllegalHere() = (565, GetStringFunc("parsAttributesIllegalHere",",,,") ) /// Accessibility modifiers are not permitted in this position for type abbreviations - /// (Originally from ..\FSComp.txt:415) + /// (Originally from ..\FSComp.txt:414) static member parsTypeAbbreviationsCannotHaveVisibilityDeclarations() = (566, GetStringFunc("parsTypeAbbreviationsCannotHaveVisibilityDeclarations",",,,") ) /// Accessibility modifiers are not permitted in this position for enum types - /// (Originally from ..\FSComp.txt:416) + /// (Originally from ..\FSComp.txt:415) static member parsEnumTypesCannotHaveVisibilityDeclarations() = (567, GetStringFunc("parsEnumTypesCannotHaveVisibilityDeclarations",",,,") ) /// All enum fields must be given values - /// (Originally from ..\FSComp.txt:417) + /// (Originally from ..\FSComp.txt:416) static member parsAllEnumFieldsRequireValues() = (568, GetStringFunc("parsAllEnumFieldsRequireValues",",,,") ) /// Accessibility modifiers are not permitted on inline assembly code types - /// (Originally from ..\FSComp.txt:418) + /// (Originally from ..\FSComp.txt:417) static member parsInlineAssemblyCannotHaveVisibilityDeclarations() = (569, GetStringFunc("parsInlineAssemblyCannotHaveVisibilityDeclarations",",,,") ) /// Unexpected identifier: '%s' - /// (Originally from ..\FSComp.txt:419) + /// (Originally from ..\FSComp.txt:418) static member parsUnexpectedIdentifier(a0 : System.String) = (571, GetStringFunc("parsUnexpectedIdentifier",",,,%s,,,") a0) /// Accessibility modifiers are not permitted on union cases. Use 'type U = internal ...' or 'type U = private ...' to give an accessibility to the whole representation. - /// (Originally from ..\FSComp.txt:420) + /// (Originally from ..\FSComp.txt:419) static member parsUnionCasesCannotHaveVisibilityDeclarations() = (572, GetStringFunc("parsUnionCasesCannotHaveVisibilityDeclarations",",,,") ) /// Accessibility modifiers are not permitted on enumeration fields - /// (Originally from ..\FSComp.txt:421) + /// (Originally from ..\FSComp.txt:420) static member parsEnumFieldsCannotHaveVisibilityDeclarations() = (573, GetStringFunc("parsEnumFieldsCannotHaveVisibilityDeclarations",",,,") ) /// Consider using a separate record type instead - /// (Originally from ..\FSComp.txt:422) + /// (Originally from ..\FSComp.txt:421) static member parsConsiderUsingSeparateRecordType() = (GetStringFunc("parsConsiderUsingSeparateRecordType",",,,") ) /// Accessibility modifiers are not permitted on record fields. Use 'type R = internal ...' or 'type R = private ...' to give an accessibility to the whole representation. - /// (Originally from ..\FSComp.txt:423) + /// (Originally from ..\FSComp.txt:422) static member parsRecordFieldsCannotHaveVisibilityDeclarations() = (575, GetStringFunc("parsRecordFieldsCannotHaveVisibilityDeclarations",",,,") ) /// The declaration form 'let ... and ...' for non-recursive bindings is not used in F# code. Consider using a sequence of 'let' bindings - /// (Originally from ..\FSComp.txt:424) + /// (Originally from ..\FSComp.txt:423) static member parsLetAndForNonRecBindings() = (576, GetStringFunc("parsLetAndForNonRecBindings",",,,") ) /// Unmatched '(' - /// (Originally from ..\FSComp.txt:425) + /// (Originally from ..\FSComp.txt:424) static member parsUnmatchedParen() = (583, GetStringFunc("parsUnmatchedParen",",,,") ) /// Successive patterns should be separated by spaces or tupled - /// (Originally from ..\FSComp.txt:426) + /// (Originally from ..\FSComp.txt:425) static member parsSuccessivePatternsShouldBeSpacedOrTupled() = (584, GetStringFunc("parsSuccessivePatternsShouldBeSpacedOrTupled",",,,") ) /// No matching 'in' found for this 'let' - /// (Originally from ..\FSComp.txt:427) + /// (Originally from ..\FSComp.txt:426) static member parsNoMatchingInForLet() = (586, GetStringFunc("parsNoMatchingInForLet",",,,") ) /// Error in the return expression for this 'let'. Possible incorrect indentation. - /// (Originally from ..\FSComp.txt:428) + /// (Originally from ..\FSComp.txt:427) static member parsErrorInReturnForLetIncorrectIndentation() = (587, GetStringFunc("parsErrorInReturnForLetIncorrectIndentation",",,,") ) /// The block following this '%s' is unfinished. Every code block is an expression and must have a result. '%s' cannot be the final code element in a block. Consider giving this block an explicit result. - /// (Originally from ..\FSComp.txt:429) + /// (Originally from ..\FSComp.txt:428) static member parsExpectedExpressionAfterLet(a0 : System.String, a1 : System.String) = (588, GetStringFunc("parsExpectedExpressionAfterLet",",,,%s,,,%s,,,") a0 a1) /// Incomplete conditional. Expected 'if then ' or 'if then else '. - /// (Originally from ..\FSComp.txt:430) + /// (Originally from ..\FSComp.txt:429) static member parsIncompleteIf() = (589, GetStringFunc("parsIncompleteIf",",,,") ) /// 'assert' may not be used as a first class value. Use 'assert ' instead. - /// (Originally from ..\FSComp.txt:431) + /// (Originally from ..\FSComp.txt:430) static member parsAssertIsNotFirstClassValue() = (590, GetStringFunc("parsAssertIsNotFirstClassValue",",,,") ) /// Identifier expected - /// (Originally from ..\FSComp.txt:432) + /// (Originally from ..\FSComp.txt:431) static member parsIdentifierExpected() = (594, GetStringFunc("parsIdentifierExpected",",,,") ) /// 'in' or '=' expected - /// (Originally from ..\FSComp.txt:433) + /// (Originally from ..\FSComp.txt:432) static member parsInOrEqualExpected() = (595, GetStringFunc("parsInOrEqualExpected",",,,") ) /// The use of '->' in sequence and computation expressions is limited to the form 'for pat in expr -> expr'. Use the syntax 'for ... in ... do ... yield...' to generate elements in more complex sequence expressions. - /// (Originally from ..\FSComp.txt:434) + /// (Originally from ..\FSComp.txt:433) static member parsArrowUseIsLimited() = (596, GetStringFunc("parsArrowUseIsLimited",",,,") ) /// Successive arguments should be separated by spaces or tupled, and arguments involving function or method applications should be parenthesized - /// (Originally from ..\FSComp.txt:435) + /// (Originally from ..\FSComp.txt:434) static member parsSuccessiveArgsShouldBeSpacedOrTupled() = (597, GetStringFunc("parsSuccessiveArgsShouldBeSpacedOrTupled",",,,") ) /// Unmatched '[' - /// (Originally from ..\FSComp.txt:436) + /// (Originally from ..\FSComp.txt:435) static member parsUnmatchedBracket() = (598, GetStringFunc("parsUnmatchedBracket",",,,") ) /// Missing qualification after '.' - /// (Originally from ..\FSComp.txt:437) + /// (Originally from ..\FSComp.txt:436) static member parsMissingQualificationAfterDot() = (599, GetStringFunc("parsMissingQualificationAfterDot",",,,") ) /// In F# code you may use 'expr.[expr]'. A type annotation may be required to indicate the first expression is an array - /// (Originally from ..\FSComp.txt:438) + /// (Originally from ..\FSComp.txt:437) static member parsParenFormIsForML() = (GetStringFunc("parsParenFormIsForML",",,,") ) /// Mismatched quotation, beginning with '%s' - /// (Originally from ..\FSComp.txt:439) + /// (Originally from ..\FSComp.txt:438) static member parsMismatchedQuote(a0 : System.String) = (601, GetStringFunc("parsMismatchedQuote",",,,%s,,,") a0) /// Unmatched '%s' - /// (Originally from ..\FSComp.txt:440) + /// (Originally from ..\FSComp.txt:439) static member parsUnmatched(a0 : System.String) = (602, GetStringFunc("parsUnmatched",",,,%s,,,") a0) /// Unmatched '[|' - /// (Originally from ..\FSComp.txt:441) + /// (Originally from ..\FSComp.txt:440) static member parsUnmatchedBracketBar() = (603, GetStringFunc("parsUnmatchedBracketBar",",,,") ) /// Unmatched '{' - /// (Originally from ..\FSComp.txt:442) + /// (Originally from ..\FSComp.txt:441) static member parsUnmatchedBrace() = (604, GetStringFunc("parsUnmatchedBrace",",,,") ) /// Unmatched '{|' - /// (Originally from ..\FSComp.txt:443) + /// (Originally from ..\FSComp.txt:442) static member parsUnmatchedBraceBar() = (605, GetStringFunc("parsUnmatchedBraceBar",",,,") ) /// Field bindings must have the form 'id = expr;' - /// (Originally from ..\FSComp.txt:444) + /// (Originally from ..\FSComp.txt:443) static member parsFieldBinding() = (609, GetStringFunc("parsFieldBinding",",,,") ) /// This member is not permitted in an object implementation - /// (Originally from ..\FSComp.txt:445) + /// (Originally from ..\FSComp.txt:444) static member parsMemberIllegalInObjectImplementation() = (610, GetStringFunc("parsMemberIllegalInObjectImplementation",",,,") ) /// Missing function body - /// (Originally from ..\FSComp.txt:446) + /// (Originally from ..\FSComp.txt:445) static member parsMissingFunctionBody() = (611, GetStringFunc("parsMissingFunctionBody",",,,") ) /// Syntax error in labelled type argument - /// (Originally from ..\FSComp.txt:447) + /// (Originally from ..\FSComp.txt:446) static member parsSyntaxErrorInLabeledType() = (613, GetStringFunc("parsSyntaxErrorInLabeledType",",,,") ) /// Unexpected infix operator in type expression - /// (Originally from ..\FSComp.txt:448) + /// (Originally from ..\FSComp.txt:447) static member parsUnexpectedInfixOperator() = (615, GetStringFunc("parsUnexpectedInfixOperator",",,,") ) /// The syntax '(typ,...,typ) ident' is not used in F# code. Consider using 'ident' instead - /// (Originally from ..\FSComp.txt:449) + /// (Originally from ..\FSComp.txt:448) static member parsMultiArgumentGenericTypeFormDeprecated() = (GetStringFunc("parsMultiArgumentGenericTypeFormDeprecated",",,,") ) /// Invalid literal in type - /// (Originally from ..\FSComp.txt:450) + /// (Originally from ..\FSComp.txt:449) static member parsInvalidLiteralInType() = (618, GetStringFunc("parsInvalidLiteralInType",",,,") ) /// Unexpected infix operator in unit-of-measure expression. Legal operators are '*', '/' and '^'. - /// (Originally from ..\FSComp.txt:451) + /// (Originally from ..\FSComp.txt:450) static member parsUnexpectedOperatorForUnitOfMeasure() = (619, GetStringFunc("parsUnexpectedOperatorForUnitOfMeasure",",,,") ) /// Unexpected integer literal in unit-of-measure expression - /// (Originally from ..\FSComp.txt:452) + /// (Originally from ..\FSComp.txt:451) static member parsUnexpectedIntegerLiteralForUnitOfMeasure() = (620, GetStringFunc("parsUnexpectedIntegerLiteralForUnitOfMeasure",",,,") ) /// Syntax error: unexpected type parameter specification - /// (Originally from ..\FSComp.txt:453) + /// (Originally from ..\FSComp.txt:452) static member parsUnexpectedTypeParameter() = (621, GetStringFunc("parsUnexpectedTypeParameter",",,,") ) /// Mismatched quotation operator name, beginning with '%s' - /// (Originally from ..\FSComp.txt:454) + /// (Originally from ..\FSComp.txt:453) static member parsMismatchedQuotationName(a0 : System.String) = (622, GetStringFunc("parsMismatchedQuotationName",",,,%s,,,") a0) /// Active pattern case identifiers must begin with an uppercase letter - /// (Originally from ..\FSComp.txt:455) + /// (Originally from ..\FSComp.txt:454) static member parsActivePatternCaseMustBeginWithUpperCase() = (623, GetStringFunc("parsActivePatternCaseMustBeginWithUpperCase",",,,") ) /// The '|' character is not permitted in active pattern case identifiers - /// (Originally from ..\FSComp.txt:456) + /// (Originally from ..\FSComp.txt:455) static member parsActivePatternCaseContainsPipe() = (624, GetStringFunc("parsActivePatternCaseContainsPipe",",,,") ) /// Denominator must not be 0 in unit-of-measure exponent - /// (Originally from ..\FSComp.txt:457) + /// (Originally from ..\FSComp.txt:456) static member parsIllegalDenominatorForMeasureExponent() = (625, GetStringFunc("parsIllegalDenominatorForMeasureExponent",",,,") ) /// No '=' symbol should follow a 'namespace' declaration - /// (Originally from ..\FSComp.txt:458) + /// (Originally from ..\FSComp.txt:457) static member parsNoEqualShouldFollowNamespace() = (GetStringFunc("parsNoEqualShouldFollowNamespace",",,,") ) /// The syntax 'module ... = struct .. end' is not used in F# code. Consider using 'module ... = begin .. end' - /// (Originally from ..\FSComp.txt:459) + /// (Originally from ..\FSComp.txt:458) static member parsSyntaxModuleStructEndDeprecated() = (GetStringFunc("parsSyntaxModuleStructEndDeprecated",",,,") ) /// The syntax 'module ... : sig .. end' is not used in F# code. Consider using 'module ... = begin .. end' - /// (Originally from ..\FSComp.txt:460) + /// (Originally from ..\FSComp.txt:459) static member parsSyntaxModuleSigEndDeprecated() = (GetStringFunc("parsSyntaxModuleSigEndDeprecated",",,,") ) /// A static field was used where an instance field is expected - /// (Originally from ..\FSComp.txt:461) + /// (Originally from ..\FSComp.txt:460) static member tcStaticFieldUsedWhenInstanceFieldExpected() = (627, GetStringFunc("tcStaticFieldUsedWhenInstanceFieldExpected",",,,") ) /// Method '%s' is not accessible from this code location - /// (Originally from ..\FSComp.txt:462) + /// (Originally from ..\FSComp.txt:461) static member tcMethodNotAccessible(a0 : System.String) = (629, GetStringFunc("tcMethodNotAccessible",",,,%s,,,") a0) /// Implicit product of measures following / - /// (Originally from ..\FSComp.txt:464) + /// (Originally from ..\FSComp.txt:463) static member tcImplicitMeasureFollowingSlash() = (632, GetStringFunc("tcImplicitMeasureFollowingSlash",",,,") ) /// Unexpected SynMeasure.Anon - /// (Originally from ..\FSComp.txt:465) + /// (Originally from ..\FSComp.txt:464) static member tcUnexpectedMeasureAnon() = (633, GetStringFunc("tcUnexpectedMeasureAnon",",,,") ) /// Non-zero constants cannot have generic units. For generic zero, write 0.0<_>. - /// (Originally from ..\FSComp.txt:466) + /// (Originally from ..\FSComp.txt:465) static member tcNonZeroConstantCannotHaveGenericUnit() = (634, GetStringFunc("tcNonZeroConstantCannotHaveGenericUnit",",,,") ) /// In sequence expressions, results are generated using 'yield' - /// (Originally from ..\FSComp.txt:467) + /// (Originally from ..\FSComp.txt:466) static member tcSeqResultsUseYield() = (635, GetStringFunc("tcSeqResultsUseYield",",,,") ) /// Unexpected big rational constant - /// (Originally from ..\FSComp.txt:468) + /// (Originally from ..\FSComp.txt:467) static member tcUnexpectedBigRationalConstant() = (GetStringFunc("tcUnexpectedBigRationalConstant",",,,") ) /// Units-of-measure supported only on float, float32, decimal and signed integer types - /// (Originally from ..\FSComp.txt:469) + /// (Originally from ..\FSComp.txt:468) static member tcInvalidTypeForUnitsOfMeasure() = (636, GetStringFunc("tcInvalidTypeForUnitsOfMeasure",",,,") ) /// Unexpected Const_uint16array - /// (Originally from ..\FSComp.txt:470) + /// (Originally from ..\FSComp.txt:469) static member tcUnexpectedConstUint16Array() = (GetStringFunc("tcUnexpectedConstUint16Array",",,,") ) /// Unexpected Const_bytearray - /// (Originally from ..\FSComp.txt:471) + /// (Originally from ..\FSComp.txt:470) static member tcUnexpectedConstByteArray() = (GetStringFunc("tcUnexpectedConstByteArray",",,,") ) /// A parameter with attributes must also be given a name, e.g. '[] Name : Type' - /// (Originally from ..\FSComp.txt:472) + /// (Originally from ..\FSComp.txt:471) static member tcParameterRequiresName() = (640, GetStringFunc("tcParameterRequiresName",",,,") ) /// Return values cannot have names - /// (Originally from ..\FSComp.txt:473) + /// (Originally from ..\FSComp.txt:472) static member tcReturnValuesCannotHaveNames() = (641, GetStringFunc("tcReturnValuesCannotHaveNames",",,,") ) /// MemberKind.PropertyGetSet only expected in parse trees - /// (Originally from ..\FSComp.txt:474) + /// (Originally from ..\FSComp.txt:473) static member tcMemberKindPropertyGetSetNotExpected() = (GetStringFunc("tcMemberKindPropertyGetSetNotExpected",",,,") ) /// Namespaces cannot contain values. Consider using a module to hold your value declarations. - /// (Originally from ..\FSComp.txt:475) + /// (Originally from ..\FSComp.txt:474) static member tcNamespaceCannotContainValues() = (201, GetStringFunc("tcNamespaceCannotContainValues",",,,") ) /// Namespaces cannot contain extension members except in the same file and namespace declaration group where the type is defined. Consider using a module to hold declarations of extension members. - /// (Originally from ..\FSComp.txt:476) + /// (Originally from ..\FSComp.txt:475) static member tcNamespaceCannotContainExtensionMembers() = (644, GetStringFunc("tcNamespaceCannotContainExtensionMembers",",,,") ) /// Multiple visibility attributes have been specified for this identifier - /// (Originally from ..\FSComp.txt:477) + /// (Originally from ..\FSComp.txt:476) static member tcMultipleVisibilityAttributes() = (645, GetStringFunc("tcMultipleVisibilityAttributes",",,,") ) /// Multiple visibility attributes have been specified for this identifier. 'let' bindings in classes are always private, as are any 'let' bindings inside expressions. - /// (Originally from ..\FSComp.txt:478) + /// (Originally from ..\FSComp.txt:477) static member tcMultipleVisibilityAttributesWithLet() = (646, GetStringFunc("tcMultipleVisibilityAttributesWithLet",",,,") ) /// The name '(%s)' should not be used as a member name. To define comparison semantics for a type, implement the 'System.IComparable' interface. If defining a static member for use from other CLI languages then use the name '%s' instead. - /// (Originally from ..\FSComp.txt:479) + /// (Originally from ..\FSComp.txt:478) static member tcInvalidMethodNameForRelationalOperator(a0 : System.String, a1 : System.String) = (GetStringFunc("tcInvalidMethodNameForRelationalOperator",",,,%s,,,%s,,,") a0 a1) /// The name '(%s)' should not be used as a member name. To define equality semantics for a type, override the 'Object.Equals' member. If defining a static member for use from other CLI languages then use the name '%s' instead. - /// (Originally from ..\FSComp.txt:480) + /// (Originally from ..\FSComp.txt:479) static member tcInvalidMethodNameForEquality(a0 : System.String, a1 : System.String) = (GetStringFunc("tcInvalidMethodNameForEquality",",,,%s,,,%s,,,") a0 a1) /// The name '(%s)' should not be used as a member name. If defining a static member for use from other CLI languages then use the name '%s' instead. - /// (Originally from ..\FSComp.txt:481) + /// (Originally from ..\FSComp.txt:480) static member tcInvalidMemberName(a0 : System.String, a1 : System.String) = (GetStringFunc("tcInvalidMemberName",",,,%s,,,%s,,,") a0 a1) /// The name '(%s)' should not be used as a member name because it is given a standard definition in the F# library over fixed types - /// (Originally from ..\FSComp.txt:482) + /// (Originally from ..\FSComp.txt:481) static member tcInvalidMemberNameFixedTypes(a0 : System.String) = (GetStringFunc("tcInvalidMemberNameFixedTypes",",,,%s,,,") a0) /// The '%s' operator should not normally be redefined. To define overloaded comparison semantics for a particular type, implement the 'System.IComparable' interface in the definition of that type. - /// (Originally from ..\FSComp.txt:483) + /// (Originally from ..\FSComp.txt:482) static member tcInvalidOperatorDefinitionRelational(a0 : System.String) = (GetStringFunc("tcInvalidOperatorDefinitionRelational",",,,%s,,,") a0) /// The '%s' operator should not normally be redefined. To define equality semantics for a type, override the 'Object.Equals' member in the definition of that type. - /// (Originally from ..\FSComp.txt:484) + /// (Originally from ..\FSComp.txt:483) static member tcInvalidOperatorDefinitionEquality(a0 : System.String) = (GetStringFunc("tcInvalidOperatorDefinitionEquality",",,,%s,,,") a0) /// The '%s' operator should not normally be redefined. Consider using a different operator name - /// (Originally from ..\FSComp.txt:485) + /// (Originally from ..\FSComp.txt:484) static member tcInvalidOperatorDefinition(a0 : System.String) = (GetStringFunc("tcInvalidOperatorDefinition",",,,%s,,,") a0) /// The '%s' operator cannot be redefined. Consider using a different operator name - /// (Originally from ..\FSComp.txt:486) + /// (Originally from ..\FSComp.txt:485) static member tcInvalidIndexOperatorDefinition(a0 : System.String) = (GetStringFunc("tcInvalidIndexOperatorDefinition",",,,%s,,,") a0) /// Expected module or namespace parent %s - /// (Originally from ..\FSComp.txt:487) + /// (Originally from ..\FSComp.txt:486) static member tcExpectModuleOrNamespaceParent(a0 : System.String) = (GetStringFunc("tcExpectModuleOrNamespaceParent",",,,%s,,,") a0) /// The struct, record or union type '%s' implements the interface 'System.IComparable' explicitly. You must apply the 'CustomComparison' attribute to the type. - /// (Originally from ..\FSComp.txt:488) + /// (Originally from ..\FSComp.txt:487) static member tcImplementsIComparableExplicitly(a0 : System.String) = (647, GetStringFunc("tcImplementsIComparableExplicitly",",,,%s,,,") a0) /// The struct, record or union type '%s' implements the interface 'System.IComparable<_>' explicitly. You must apply the 'CustomComparison' attribute to the type, and should also provide a consistent implementation of the non-generic interface System.IComparable. - /// (Originally from ..\FSComp.txt:489) + /// (Originally from ..\FSComp.txt:488) static member tcImplementsGenericIComparableExplicitly(a0 : System.String) = (648, GetStringFunc("tcImplementsGenericIComparableExplicitly",",,,%s,,,") a0) /// The struct, record or union type '%s' implements the interface 'System.IStructuralComparable' explicitly. Apply the 'CustomComparison' attribute to the type. - /// (Originally from ..\FSComp.txt:490) + /// (Originally from ..\FSComp.txt:489) static member tcImplementsIStructuralComparableExplicitly(a0 : System.String) = (649, GetStringFunc("tcImplementsIStructuralComparableExplicitly",",,,%s,,,") a0) /// This record contains fields from inconsistent types - /// (Originally from ..\FSComp.txt:491) + /// (Originally from ..\FSComp.txt:490) static member tcRecordFieldInconsistentTypes() = (656, GetStringFunc("tcRecordFieldInconsistentTypes",",,,") ) /// DLLImport stubs cannot be inlined - /// (Originally from ..\FSComp.txt:492) + /// (Originally from ..\FSComp.txt:491) static member tcDllImportStubsCannotBeInlined() = (657, GetStringFunc("tcDllImportStubsCannotBeInlined",",,,") ) /// Structs may only bind a 'this' parameter at member declarations - /// (Originally from ..\FSComp.txt:493) + /// (Originally from ..\FSComp.txt:492) static member tcStructsCanOnlyBindThisAtMemberDeclaration() = (658, GetStringFunc("tcStructsCanOnlyBindThisAtMemberDeclaration",",,,") ) /// Unexpected expression at recursive inference point - /// (Originally from ..\FSComp.txt:494) + /// (Originally from ..\FSComp.txt:493) static member tcUnexpectedExprAtRecInfPoint() = (659, GetStringFunc("tcUnexpectedExprAtRecInfPoint",",,,") ) /// This code is less generic than required by its annotations because the explicit type variable '%s' could not be generalized. It was constrained to be '%s'. - /// (Originally from ..\FSComp.txt:495) + /// (Originally from ..\FSComp.txt:494) static member tcLessGenericBecauseOfAnnotation(a0 : System.String, a1 : System.String) = (660, GetStringFunc("tcLessGenericBecauseOfAnnotation",",,,%s,,,%s,,,") a0 a1) /// One or more of the explicit class or function type variables for this binding could not be generalized, because they were constrained to other types - /// (Originally from ..\FSComp.txt:496) + /// (Originally from ..\FSComp.txt:495) static member tcConstrainedTypeVariableCannotBeGeneralized() = (661, GetStringFunc("tcConstrainedTypeVariableCannotBeGeneralized",",,,") ) /// A generic type parameter has been used in a way that constrains it to always be '%s' - /// (Originally from ..\FSComp.txt:497) + /// (Originally from ..\FSComp.txt:496) static member tcGenericParameterHasBeenConstrained(a0 : System.String) = (662, GetStringFunc("tcGenericParameterHasBeenConstrained",",,,%s,,,") a0) /// This type parameter has been used in a way that constrains it to always be '%s' - /// (Originally from ..\FSComp.txt:498) + /// (Originally from ..\FSComp.txt:497) static member tcTypeParameterHasBeenConstrained(a0 : System.String) = (663, GetStringFunc("tcTypeParameterHasBeenConstrained",",,,%s,,,") a0) /// The type parameters inferred for this value are not stable under the erasure of type abbreviations. This is due to the use of type abbreviations which drop or reorder type parameters, e.g. \n\ttype taggedInt<'a> = int or\n\ttype swap<'a,'b> = 'b * 'a.\nConsider declaring the type parameters for this value explicitly, e.g.\n\tlet f<'a,'b> ((x,y) : swap<'b,'a>) : swap<'a,'b> = (y,x). - /// (Originally from ..\FSComp.txt:499) + /// (Originally from ..\FSComp.txt:498) static member tcTypeParametersInferredAreNotStable() = (664, GetStringFunc("tcTypeParametersInferredAreNotStable",",,,") ) /// Explicit type parameters may only be used on module or member bindings - /// (Originally from ..\FSComp.txt:500) + /// (Originally from ..\FSComp.txt:499) static member tcExplicitTypeParameterInvalid() = (665, GetStringFunc("tcExplicitTypeParameterInvalid",",,,") ) /// You must explicitly declare either all or no type parameters when overriding a generic abstract method - /// (Originally from ..\FSComp.txt:501) + /// (Originally from ..\FSComp.txt:500) static member tcOverridingMethodRequiresAllOrNoTypeParameters() = (666, GetStringFunc("tcOverridingMethodRequiresAllOrNoTypeParameters",",,,") ) /// The field labels and expected type of this record expression or pattern do not uniquely determine a corresponding record type - /// (Originally from ..\FSComp.txt:502) + /// (Originally from ..\FSComp.txt:501) static member tcFieldsDoNotDetermineUniqueRecordType() = (667, GetStringFunc("tcFieldsDoNotDetermineUniqueRecordType",",,,") ) /// The field '%s' appears twice in this record expression or pattern - /// (Originally from ..\FSComp.txt:503) + /// (Originally from ..\FSComp.txt:502) static member tcFieldAppearsTwiceInRecord(a0 : System.String) = (668, GetStringFunc("tcFieldAppearsTwiceInRecord",",,,%s,,,") a0) /// Unknown union case - /// (Originally from ..\FSComp.txt:504) + /// (Originally from ..\FSComp.txt:503) static member tcUnknownUnion() = (669, GetStringFunc("tcUnknownUnion",",,,") ) /// This code is not sufficiently generic. The type variable %s could not be generalized because it would escape its scope. - /// (Originally from ..\FSComp.txt:505) + /// (Originally from ..\FSComp.txt:504) static member tcNotSufficientlyGenericBecauseOfScope(a0 : System.String) = (670, GetStringFunc("tcNotSufficientlyGenericBecauseOfScope",",,,%s,,,") a0) /// A property cannot have explicit type parameters. Consider using a method instead. - /// (Originally from ..\FSComp.txt:506) + /// (Originally from ..\FSComp.txt:505) static member tcPropertyRequiresExplicitTypeParameters() = (671, GetStringFunc("tcPropertyRequiresExplicitTypeParameters",",,,") ) /// A constructor cannot have explicit type parameters. Consider using a static construction method instead. - /// (Originally from ..\FSComp.txt:507) + /// (Originally from ..\FSComp.txt:506) static member tcConstructorCannotHaveTypeParameters() = (672, GetStringFunc("tcConstructorCannotHaveTypeParameters",",,,") ) /// This instance member needs a parameter to represent the object being invoked. Make the member static or use the notation 'member x.Member(args) = ...'. - /// (Originally from ..\FSComp.txt:508) + /// (Originally from ..\FSComp.txt:507) static member tcInstanceMemberRequiresTarget() = (673, GetStringFunc("tcInstanceMemberRequiresTarget",",,,") ) /// Unexpected source-level property specification in syntax tree - /// (Originally from ..\FSComp.txt:509) + /// (Originally from ..\FSComp.txt:508) static member tcUnexpectedPropertyInSyntaxTree() = (674, GetStringFunc("tcUnexpectedPropertyInSyntaxTree",",,,") ) /// A static initializer requires an argument - /// (Originally from ..\FSComp.txt:510) + /// (Originally from ..\FSComp.txt:509) static member tcStaticInitializerRequiresArgument() = (675, GetStringFunc("tcStaticInitializerRequiresArgument",",,,") ) /// An object constructor requires an argument - /// (Originally from ..\FSComp.txt:511) + /// (Originally from ..\FSComp.txt:510) static member tcObjectConstructorRequiresArgument() = (676, GetStringFunc("tcObjectConstructorRequiresArgument",",,,") ) /// This static member should not have a 'this' parameter. Consider using the notation 'member Member(args) = ...'. - /// (Originally from ..\FSComp.txt:512) + /// (Originally from ..\FSComp.txt:511) static member tcStaticMemberShouldNotHaveThis() = (677, GetStringFunc("tcStaticMemberShouldNotHaveThis",",,,") ) /// An explicit static initializer should use the syntax 'static new(args) = expr' - /// (Originally from ..\FSComp.txt:513) + /// (Originally from ..\FSComp.txt:512) static member tcExplicitStaticInitializerSyntax() = (678, GetStringFunc("tcExplicitStaticInitializerSyntax",",,,") ) /// An explicit object constructor should use the syntax 'new(args) = expr' - /// (Originally from ..\FSComp.txt:514) + /// (Originally from ..\FSComp.txt:513) static member tcExplicitObjectConstructorSyntax() = (679, GetStringFunc("tcExplicitObjectConstructorSyntax",",,,") ) /// Unexpected source-level property specification - /// (Originally from ..\FSComp.txt:515) + /// (Originally from ..\FSComp.txt:514) static member tcUnexpectedPropertySpec() = (680, GetStringFunc("tcUnexpectedPropertySpec",",,,") ) /// This form of object expression is not used in F#. Use 'member this.MemberName ... = ...' to define member implementations in object expressions. - /// (Originally from ..\FSComp.txt:516) + /// (Originally from ..\FSComp.txt:515) static member tcObjectExpressionFormDeprecated() = (GetStringFunc("tcObjectExpressionFormDeprecated",",,,") ) /// Invalid declaration - /// (Originally from ..\FSComp.txt:517) + /// (Originally from ..\FSComp.txt:516) static member tcInvalidDeclaration() = (682, GetStringFunc("tcInvalidDeclaration",",,,") ) /// Attributes are not allowed within patterns - /// (Originally from ..\FSComp.txt:518) + /// (Originally from ..\FSComp.txt:517) static member tcAttributesInvalidInPatterns() = (683, GetStringFunc("tcAttributesInvalidInPatterns",",,,") ) /// The generic function '%s' must be given explicit type argument(s) - /// (Originally from ..\FSComp.txt:519) + /// (Originally from ..\FSComp.txt:518) static member tcFunctionRequiresExplicitTypeArguments(a0 : System.String) = (685, GetStringFunc("tcFunctionRequiresExplicitTypeArguments",",,,%s,,,") a0) /// The method or function '%s' should not be given explicit type argument(s) because it does not declare its type parameters explicitly - /// (Originally from ..\FSComp.txt:520) + /// (Originally from ..\FSComp.txt:519) static member tcDoesNotAllowExplicitTypeArguments(a0 : System.String) = (686, GetStringFunc("tcDoesNotAllowExplicitTypeArguments",",,,%s,,,") a0) /// This value, type or method expects %d type parameter(s) but was given %d - /// (Originally from ..\FSComp.txt:521) + /// (Originally from ..\FSComp.txt:520) static member tcTypeParameterArityMismatch(a0 : System.Int32, a1 : System.Int32) = (687, GetStringFunc("tcTypeParameterArityMismatch",",,,%d,,,%d,,,") a0 a1) /// The default, zero-initializing constructor of a struct type may only be used if all the fields of the struct type admit default initialization - /// (Originally from ..\FSComp.txt:522) + /// (Originally from ..\FSComp.txt:521) static member tcDefaultStructConstructorCall() = (688, GetStringFunc("tcDefaultStructConstructorCall",",,,") ) /// Couldn't find Dispose on IDisposable, or it was overloaded - /// (Originally from ..\FSComp.txt:523) + /// (Originally from ..\FSComp.txt:522) static member tcCouldNotFindIDisposable() = (GetStringFunc("tcCouldNotFindIDisposable",",,,") ) /// This value is not a literal and cannot be used in a pattern - /// (Originally from ..\FSComp.txt:524) + /// (Originally from ..\FSComp.txt:523) static member tcNonLiteralCannotBeUsedInPattern() = (689, GetStringFunc("tcNonLiteralCannotBeUsedInPattern",",,,") ) /// This field is readonly - /// (Originally from ..\FSComp.txt:525) + /// (Originally from ..\FSComp.txt:524) static member tcFieldIsReadonly() = (690, GetStringFunc("tcFieldIsReadonly",",,,") ) /// Named arguments must appear after all other arguments - /// (Originally from ..\FSComp.txt:526) + /// (Originally from ..\FSComp.txt:525) static member tcNameArgumentsMustAppearLast() = (691, GetStringFunc("tcNameArgumentsMustAppearLast",",,,") ) /// This function value is being used to construct a delegate type whose signature includes a byref argument. You must use an explicit lambda expression taking %d arguments. - /// (Originally from ..\FSComp.txt:527) + /// (Originally from ..\FSComp.txt:526) static member tcFunctionRequiresExplicitLambda(a0 : System.Int32) = (692, GetStringFunc("tcFunctionRequiresExplicitLambda",",,,%d,,,") a0) /// The type '%s' is not a type whose values can be enumerated with this syntax, i.e. is not compatible with either seq<_>, IEnumerable<_> or IEnumerable and does not have a GetEnumerator method - /// (Originally from ..\FSComp.txt:528) + /// (Originally from ..\FSComp.txt:527) static member tcTypeCannotBeEnumerated(a0 : System.String) = (693, GetStringFunc("tcTypeCannotBeEnumerated",",,,%s,,,") a0) /// This recursive binding uses an invalid mixture of recursive forms - /// (Originally from ..\FSComp.txt:529) + /// (Originally from ..\FSComp.txt:528) static member tcInvalidMixtureOfRecursiveForms() = (695, GetStringFunc("tcInvalidMixtureOfRecursiveForms",",,,") ) /// This is not a valid object construction expression. Explicit object constructors must either call an alternate constructor or initialize all fields of the object and specify a call to a super class constructor. - /// (Originally from ..\FSComp.txt:530) + /// (Originally from ..\FSComp.txt:529) static member tcInvalidObjectConstructionExpression() = (696, GetStringFunc("tcInvalidObjectConstructionExpression",",,,") ) /// Invalid constraint - /// (Originally from ..\FSComp.txt:531) + /// (Originally from ..\FSComp.txt:530) static member tcInvalidConstraint() = (697, GetStringFunc("tcInvalidConstraint",",,,") ) /// Invalid constraint: the type used for the constraint is sealed, which means the constraint could only be satisfied by at most one solution - /// (Originally from ..\FSComp.txt:532) + /// (Originally from ..\FSComp.txt:531) static member tcInvalidConstraintTypeSealed() = (698, GetStringFunc("tcInvalidConstraintTypeSealed",",,,") ) /// An 'enum' constraint must be of the form 'enum' - /// (Originally from ..\FSComp.txt:533) + /// (Originally from ..\FSComp.txt:532) static member tcInvalidEnumConstraint() = (699, GetStringFunc("tcInvalidEnumConstraint",",,,") ) /// 'new' constraints must take one argument of type 'unit' and return the constructed type - /// (Originally from ..\FSComp.txt:534) + /// (Originally from ..\FSComp.txt:533) static member tcInvalidNewConstraint() = (700, GetStringFunc("tcInvalidNewConstraint",",,,") ) /// This property has an invalid type. Properties taking multiple indexer arguments should have types of the form 'ty1 * ty2 -> ty3'. Properties returning functions should have types of the form '(ty1 -> ty2)'. - /// (Originally from ..\FSComp.txt:535) + /// (Originally from ..\FSComp.txt:534) static member tcInvalidPropertyType() = (701, GetStringFunc("tcInvalidPropertyType",",,,") ) /// Expected unit-of-measure parameter, not type parameter. Explicit unit-of-measure parameters must be marked with the [] attribute. - /// (Originally from ..\FSComp.txt:536) + /// (Originally from ..\FSComp.txt:535) static member tcExpectedUnitOfMeasureMarkWithAttribute() = (702, GetStringFunc("tcExpectedUnitOfMeasureMarkWithAttribute",",,,") ) /// Expected type parameter, not unit-of-measure parameter - /// (Originally from ..\FSComp.txt:537) + /// (Originally from ..\FSComp.txt:536) static member tcExpectedTypeParameter() = (703, GetStringFunc("tcExpectedTypeParameter",",,,") ) /// Expected type, not unit-of-measure - /// (Originally from ..\FSComp.txt:538) + /// (Originally from ..\FSComp.txt:537) static member tcExpectedTypeNotUnitOfMeasure() = (704, GetStringFunc("tcExpectedTypeNotUnitOfMeasure",",,,") ) /// Expected unit-of-measure, not type - /// (Originally from ..\FSComp.txt:539) + /// (Originally from ..\FSComp.txt:538) static member tcExpectedUnitOfMeasureNotType() = (705, GetStringFunc("tcExpectedUnitOfMeasureNotType",",,,") ) /// Units-of-measure cannot be used as prefix arguments to a type. Rewrite as postfix arguments in angle brackets. - /// (Originally from ..\FSComp.txt:540) + /// (Originally from ..\FSComp.txt:539) static member tcInvalidUnitsOfMeasurePrefix() = (706, GetStringFunc("tcInvalidUnitsOfMeasurePrefix",",,,") ) /// Unit-of-measure cannot be used in type constructor application - /// (Originally from ..\FSComp.txt:541) + /// (Originally from ..\FSComp.txt:540) static member tcUnitsOfMeasureInvalidInTypeConstructor() = (707, GetStringFunc("tcUnitsOfMeasureInvalidInTypeConstructor",",,,") ) /// This control construct may only be used if the computation expression builder defines a '%s' method - /// (Originally from ..\FSComp.txt:542) + /// (Originally from ..\FSComp.txt:541) static member tcRequireBuilderMethod(a0 : System.String) = (708, GetStringFunc("tcRequireBuilderMethod",",,,%s,,,") a0) /// This type has no nested types - /// (Originally from ..\FSComp.txt:543) + /// (Originally from ..\FSComp.txt:542) static member tcTypeHasNoNestedTypes() = (709, GetStringFunc("tcTypeHasNoNestedTypes",",,,") ) /// Unexpected %s in type expression - /// (Originally from ..\FSComp.txt:544) + /// (Originally from ..\FSComp.txt:543) static member tcUnexpectedSymbolInTypeExpression(a0 : System.String) = (711, GetStringFunc("tcUnexpectedSymbolInTypeExpression",",,,%s,,,") a0) /// Type parameter cannot be used as type constructor - /// (Originally from ..\FSComp.txt:545) + /// (Originally from ..\FSComp.txt:544) static member tcTypeParameterInvalidAsTypeConstructor() = (712, GetStringFunc("tcTypeParameterInvalidAsTypeConstructor",",,,") ) /// Illegal syntax in type expression - /// (Originally from ..\FSComp.txt:546) + /// (Originally from ..\FSComp.txt:545) static member tcIllegalSyntaxInTypeExpression() = (713, GetStringFunc("tcIllegalSyntaxInTypeExpression",",,,") ) /// Anonymous unit-of-measure cannot be nested inside another unit-of-measure expression - /// (Originally from ..\FSComp.txt:547) + /// (Originally from ..\FSComp.txt:546) static member tcAnonymousUnitsOfMeasureCannotBeNested() = (714, GetStringFunc("tcAnonymousUnitsOfMeasureCannotBeNested",",,,") ) /// Anonymous type variables are not permitted in this declaration - /// (Originally from ..\FSComp.txt:548) + /// (Originally from ..\FSComp.txt:547) static member tcAnonymousTypeInvalidInDeclaration() = (715, GetStringFunc("tcAnonymousTypeInvalidInDeclaration",",,,") ) /// Unexpected / in type - /// (Originally from ..\FSComp.txt:549) + /// (Originally from ..\FSComp.txt:548) static member tcUnexpectedSlashInType() = (716, GetStringFunc("tcUnexpectedSlashInType",",,,") ) /// Unexpected type arguments - /// (Originally from ..\FSComp.txt:550) + /// (Originally from ..\FSComp.txt:549) static member tcUnexpectedTypeArguments() = (717, GetStringFunc("tcUnexpectedTypeArguments",",,,") ) /// Optional arguments are only permitted on type members - /// (Originally from ..\FSComp.txt:551) + /// (Originally from ..\FSComp.txt:550) static member tcOptionalArgsOnlyOnMembers() = (718, GetStringFunc("tcOptionalArgsOnlyOnMembers",",,,") ) /// Name '%s' not bound in pattern context - /// (Originally from ..\FSComp.txt:552) + /// (Originally from ..\FSComp.txt:551) static member tcNameNotBoundInPattern(a0 : System.String) = (719, GetStringFunc("tcNameNotBoundInPattern",",,,%s,,,") a0) /// Non-primitive numeric literal constants cannot be used in pattern matches because they can be mapped to multiple different types through the use of a NumericLiteral module. Consider using replacing with a variable, and use 'when = ' at the end of the match clause. - /// (Originally from ..\FSComp.txt:553) + /// (Originally from ..\FSComp.txt:552) static member tcInvalidNonPrimitiveLiteralInPatternMatch() = (720, GetStringFunc("tcInvalidNonPrimitiveLiteralInPatternMatch",",,,") ) /// Type arguments cannot be specified here - /// (Originally from ..\FSComp.txt:554) + /// (Originally from ..\FSComp.txt:553) static member tcInvalidTypeArgumentUsage() = (721, GetStringFunc("tcInvalidTypeArgumentUsage",",,,") ) /// Only active patterns returning exactly one result may accept arguments - /// (Originally from ..\FSComp.txt:555) + /// (Originally from ..\FSComp.txt:554) static member tcRequireActivePatternWithOneResult() = (722, GetStringFunc("tcRequireActivePatternWithOneResult",",,,") ) /// Invalid argument to parameterized pattern label - /// (Originally from ..\FSComp.txt:556) + /// (Originally from ..\FSComp.txt:555) static member tcInvalidArgForParameterizedPattern() = (723, GetStringFunc("tcInvalidArgForParameterizedPattern",",,,") ) /// Internal error. Invalid index into active pattern array - /// (Originally from ..\FSComp.txt:557) + /// (Originally from ..\FSComp.txt:556) static member tcInvalidIndexIntoActivePatternArray() = (724, GetStringFunc("tcInvalidIndexIntoActivePatternArray",",,,") ) /// This union case does not take arguments - /// (Originally from ..\FSComp.txt:558) + /// (Originally from ..\FSComp.txt:557) static member tcUnionCaseDoesNotTakeArguments() = (725, GetStringFunc("tcUnionCaseDoesNotTakeArguments",",,,") ) /// This union case takes one argument - /// (Originally from ..\FSComp.txt:559) + /// (Originally from ..\FSComp.txt:558) static member tcUnionCaseRequiresOneArgument() = (726, GetStringFunc("tcUnionCaseRequiresOneArgument",",,,") ) /// This union case expects %d arguments in tupled form - /// (Originally from ..\FSComp.txt:560) + /// (Originally from ..\FSComp.txt:559) static member tcUnionCaseExpectsTupledArguments(a0 : System.Int32) = (727, GetStringFunc("tcUnionCaseExpectsTupledArguments",",,,%d,,,") a0) /// Field '%s' is not static - /// (Originally from ..\FSComp.txt:561) + /// (Originally from ..\FSComp.txt:560) static member tcFieldIsNotStatic(a0 : System.String) = (728, GetStringFunc("tcFieldIsNotStatic",",,,%s,,,") a0) /// This field is not a literal and cannot be used in a pattern - /// (Originally from ..\FSComp.txt:562) + /// (Originally from ..\FSComp.txt:561) static member tcFieldNotLiteralCannotBeUsedInPattern() = (729, GetStringFunc("tcFieldNotLiteralCannotBeUsedInPattern",",,,") ) /// This is not a variable, constant, active recognizer or literal - /// (Originally from ..\FSComp.txt:563) + /// (Originally from ..\FSComp.txt:562) static member tcRequireVarConstRecogOrLiteral() = (730, GetStringFunc("tcRequireVarConstRecogOrLiteral",",,,") ) /// This is not a valid pattern - /// (Originally from ..\FSComp.txt:564) + /// (Originally from ..\FSComp.txt:563) static member tcInvalidPattern() = (731, GetStringFunc("tcInvalidPattern",",,,") ) /// Character range matches have been removed in F#. Consider using a 'when' pattern guard instead. - /// (Originally from ..\FSComp.txt:565) + /// (Originally from ..\FSComp.txt:564) static member tcUseWhenPatternGuard() = (GetStringFunc("tcUseWhenPatternGuard",",,,") ) /// Illegal pattern - /// (Originally from ..\FSComp.txt:566) + /// (Originally from ..\FSComp.txt:565) static member tcIllegalPattern() = (733, GetStringFunc("tcIllegalPattern",",,,") ) /// Syntax error - unexpected '?' symbol - /// (Originally from ..\FSComp.txt:567) + /// (Originally from ..\FSComp.txt:566) static member tcSyntaxErrorUnexpectedQMark() = (734, GetStringFunc("tcSyntaxErrorUnexpectedQMark",",,,") ) /// Expected %d expressions, got %d - /// (Originally from ..\FSComp.txt:568) + /// (Originally from ..\FSComp.txt:567) static member tcExpressionCountMisMatch(a0 : System.Int32, a1 : System.Int32) = (735, GetStringFunc("tcExpressionCountMisMatch",",,,%d,,,%d,,,") a0 a1) /// TcExprUndelayed: delayed - /// (Originally from ..\FSComp.txt:569) + /// (Originally from ..\FSComp.txt:568) static member tcExprUndelayed() = (736, GetStringFunc("tcExprUndelayed",",,,") ) /// This expression form may only be used in sequence and computation expressions - /// (Originally from ..\FSComp.txt:570) + /// (Originally from ..\FSComp.txt:569) static member tcExpressionRequiresSequence() = (737, GetStringFunc("tcExpressionRequiresSequence",",,,") ) /// Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces. - /// (Originally from ..\FSComp.txt:571) + /// (Originally from ..\FSComp.txt:570) static member tcInvalidObjectExpressionSyntaxForm() = (738, GetStringFunc("tcInvalidObjectExpressionSyntaxForm",",,,") ) /// Invalid object, sequence or record expression - /// (Originally from ..\FSComp.txt:572) + /// (Originally from ..\FSComp.txt:571) static member tcInvalidObjectSequenceOrRecordExpression() = (739, GetStringFunc("tcInvalidObjectSequenceOrRecordExpression",",,,") ) /// Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq { ... }' - /// (Originally from ..\FSComp.txt:573) + /// (Originally from ..\FSComp.txt:572) static member tcInvalidSequenceExpressionSyntaxForm() = (740, GetStringFunc("tcInvalidSequenceExpressionSyntaxForm",",,,") ) /// This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression - /// (Originally from ..\FSComp.txt:574) + /// (Originally from ..\FSComp.txt:573) static member tcExpressionWithIfRequiresParenthesis() = (GetStringFunc("tcExpressionWithIfRequiresParenthesis",",,,") ) /// Unable to parse format string '%s' - /// (Originally from ..\FSComp.txt:575) + /// (Originally from ..\FSComp.txt:574) static member tcUnableToParseFormatString(a0 : System.String) = (741, GetStringFunc("tcUnableToParseFormatString",",,,%s,,,") a0) /// This list expression exceeds the maximum size for list literals. Use an array for larger literals and call Array.ToList. - /// (Originally from ..\FSComp.txt:576) + /// (Originally from ..\FSComp.txt:575) static member tcListLiteralMaxSize() = (742, GetStringFunc("tcListLiteralMaxSize",",,,") ) /// The expression form 'expr then expr' may only be used as part of an explicit object constructor - /// (Originally from ..\FSComp.txt:577) + /// (Originally from ..\FSComp.txt:576) static member tcExpressionFormRequiresObjectConstructor() = (743, GetStringFunc("tcExpressionFormRequiresObjectConstructor",",,,") ) /// Named arguments cannot be given to member trait calls - /// (Originally from ..\FSComp.txt:578) + /// (Originally from ..\FSComp.txt:577) static member tcNamedArgumentsCannotBeUsedInMemberTraits() = (744, GetStringFunc("tcNamedArgumentsCannotBeUsedInMemberTraits",",,,") ) /// This is not a valid name for an enumeration case - /// (Originally from ..\FSComp.txt:579) + /// (Originally from ..\FSComp.txt:578) static member tcNotValidEnumCaseName() = (745, GetStringFunc("tcNotValidEnumCaseName",",,,") ) /// This field is not mutable - /// (Originally from ..\FSComp.txt:580) + /// (Originally from ..\FSComp.txt:579) static member tcFieldIsNotMutable() = (746, GetStringFunc("tcFieldIsNotMutable",",,,") ) /// 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 - /// (Originally from ..\FSComp.txt:581) + /// (Originally from ..\FSComp.txt:580) static member tcConstructRequiresListArrayOrSequence() = (747, GetStringFunc("tcConstructRequiresListArrayOrSequence",",,,") ) /// This construct may only be used within computation expressions. To return a value from an ordinary function simply write the expression without 'return'. - /// (Originally from ..\FSComp.txt:582) + /// (Originally from ..\FSComp.txt:581) static member tcConstructRequiresComputationExpressions() = (748, GetStringFunc("tcConstructRequiresComputationExpressions",",,,") ) /// This construct may only be used within sequence or computation expressions - /// (Originally from ..\FSComp.txt:583) + /// (Originally from ..\FSComp.txt:582) static member tcConstructRequiresSequenceOrComputations() = (749, GetStringFunc("tcConstructRequiresSequenceOrComputations",",,,") ) /// This construct may only be used within computation expressions - /// (Originally from ..\FSComp.txt:584) + /// (Originally from ..\FSComp.txt:583) static member tcConstructRequiresComputationExpression() = (750, GetStringFunc("tcConstructRequiresComputationExpression",",,,") ) /// Invalid indexer expression - /// (Originally from ..\FSComp.txt:585) + /// (Originally from ..\FSComp.txt:584) static member tcInvalidIndexerExpression() = (751, GetStringFunc("tcInvalidIndexerExpression",",,,") ) /// The operator 'expr.[idx]' has been used on an object of indeterminate type based on information prior to this program point. Consider adding further type constraints - /// (Originally from ..\FSComp.txt:586) + /// (Originally from ..\FSComp.txt:585) static member tcObjectOfIndeterminateTypeUsedRequireTypeConstraint() = (752, GetStringFunc("tcObjectOfIndeterminateTypeUsedRequireTypeConstraint",",,,") ) /// Cannot inherit from a variable type - /// (Originally from ..\FSComp.txt:587) + /// (Originally from ..\FSComp.txt:586) static member tcCannotInheritFromVariableType() = (753, GetStringFunc("tcCannotInheritFromVariableType",",,,") ) /// Calls to object constructors on type parameters cannot be given arguments - /// (Originally from ..\FSComp.txt:588) + /// (Originally from ..\FSComp.txt:587) static member tcObjectConstructorsOnTypeParametersCannotTakeArguments() = (754, GetStringFunc("tcObjectConstructorsOnTypeParametersCannotTakeArguments",",,,") ) /// The 'CompiledName' attribute cannot be used with this language element - /// (Originally from ..\FSComp.txt:589) + /// (Originally from ..\FSComp.txt:588) static member tcCompiledNameAttributeMisused() = (755, GetStringFunc("tcCompiledNameAttributeMisused",",,,") ) /// '%s' may only be used with named types - /// (Originally from ..\FSComp.txt:590) + /// (Originally from ..\FSComp.txt:589) static member tcNamedTypeRequired(a0 : System.String) = (756, GetStringFunc("tcNamedTypeRequired",",,,%s,,,") a0) /// 'inherit' cannot be used on interface types. Consider implementing the interface by using 'interface ... with ... end' instead. - /// (Originally from ..\FSComp.txt:591) + /// (Originally from ..\FSComp.txt:590) static member tcInheritCannotBeUsedOnInterfaceType() = (757, GetStringFunc("tcInheritCannotBeUsedOnInterfaceType",",,,") ) /// 'new' cannot be used on interface types. Consider using an object expression '{ new ... with ... }' instead. - /// (Originally from ..\FSComp.txt:592) + /// (Originally from ..\FSComp.txt:591) static member tcNewCannotBeUsedOnInterfaceType() = (758, GetStringFunc("tcNewCannotBeUsedOnInterfaceType",",,,") ) /// Instances of this type cannot be created since it has been marked abstract or not all methods have been given implementations. Consider using an object expression '{ new ... with ... }' instead. - /// (Originally from ..\FSComp.txt:593) + /// (Originally from ..\FSComp.txt:592) static member tcAbstractTypeCannotBeInstantiated() = (759, GetStringFunc("tcAbstractTypeCannotBeInstantiated",",,,") ) /// It is recommended that objects supporting the IDisposable interface are created using the syntax 'new Type(args)', rather than 'Type(args)' or 'Type' as a function value representing the constructor, to indicate that resources may be owned by the generated value - /// (Originally from ..\FSComp.txt:594) + /// (Originally from ..\FSComp.txt:593) static member tcIDisposableTypeShouldUseNew() = (760, GetStringFunc("tcIDisposableTypeShouldUseNew",",,,") ) /// '%s' may only be used to construct object types - /// (Originally from ..\FSComp.txt:595) + /// (Originally from ..\FSComp.txt:594) static member tcSyntaxCanOnlyBeUsedToCreateObjectTypes(a0 : System.String) = (761, GetStringFunc("tcSyntaxCanOnlyBeUsedToCreateObjectTypes",",,,%s,,,") a0) /// Constructors for the type '%s' must directly or indirectly call its implicit object constructor. Use a call to the implicit object constructor instead of a record expression. - /// (Originally from ..\FSComp.txt:596) + /// (Originally from ..\FSComp.txt:595) static member tcConstructorRequiresCall(a0 : System.String) = (762, GetStringFunc("tcConstructorRequiresCall",",,,%s,,,") a0) /// The field '%s' has been given a value, but is not present in the type '%s' - /// (Originally from ..\FSComp.txt:597) + /// (Originally from ..\FSComp.txt:596) static member tcUndefinedField(a0 : System.String, a1 : System.String) = (763, GetStringFunc("tcUndefinedField",",,,%s,,,%s,,,") a0 a1) /// No assignment given for field '%s' of type '%s' - /// (Originally from ..\FSComp.txt:598) + /// (Originally from ..\FSComp.txt:597) static member tcFieldRequiresAssignment(a0 : System.String, a1 : System.String) = (764, GetStringFunc("tcFieldRequiresAssignment",",,,%s,,,%s,,,") a0 a1) /// Extraneous fields have been given values - /// (Originally from ..\FSComp.txt:599) + /// (Originally from ..\FSComp.txt:598) static member tcExtraneousFieldsGivenValues() = (765, GetStringFunc("tcExtraneousFieldsGivenValues",",,,") ) /// Only overrides of abstract and virtual members may be specified in object expressions - /// (Originally from ..\FSComp.txt:600) + /// (Originally from ..\FSComp.txt:599) static member tcObjectExpressionsCanOnlyOverrideAbstractOrVirtual() = (766, GetStringFunc("tcObjectExpressionsCanOnlyOverrideAbstractOrVirtual",",,,") ) /// The member '%s' does not correspond to any abstract or virtual method available to override or implement. - /// (Originally from ..\FSComp.txt:601) + /// (Originally from ..\FSComp.txt:600) static member tcNoAbstractOrVirtualMemberFound(a0 : System.String) = (767, GetStringFunc("tcNoAbstractOrVirtualMemberFound",",,,%s,,,") a0) /// The type %s contains the member '%s' but it is not a virtual or abstract method that is available to override or implement. - /// (Originally from ..\FSComp.txt:602) + /// (Originally from ..\FSComp.txt:601) static member tcMemberFoundIsNotAbstractOrVirtual(a0 : System.String, a1 : System.String) = (767, GetStringFunc("tcMemberFoundIsNotAbstractOrVirtual",",,,%s,,,%s,,,") a0 a1) /// The member '%s' does not accept the correct number of arguments. %d argument(s) are expected, but %d were given. The required signature is '%s'.%s - /// (Originally from ..\FSComp.txt:603) + /// (Originally from ..\FSComp.txt:602) static member tcArgumentArityMismatch(a0 : System.String, a1 : System.Int32, a2 : System.Int32, a3 : System.String, a4 : System.String) = (768, GetStringFunc("tcArgumentArityMismatch",",,,%s,,,%d,,,%d,,,%s,,,%s,,,") a0 a1 a2 a3 a4) /// The member '%s' does not accept the correct number of arguments. One overload accepts %d arguments, but %d were given. The required signature is '%s'.%s - /// (Originally from ..\FSComp.txt:604) + /// (Originally from ..\FSComp.txt:603) static member tcArgumentArityMismatchOneOverload(a0 : System.String, a1 : System.Int32, a2 : System.Int32, a3 : System.String, a4 : System.String) = (769, GetStringFunc("tcArgumentArityMismatchOneOverload",",,,%s,,,%d,,,%d,,,%s,,,%s,,,") a0 a1 a2 a3 a4) /// A simple method name is required here - /// (Originally from ..\FSComp.txt:605) + /// (Originally from ..\FSComp.txt:604) static member tcSimpleMethodNameRequired() = (770, GetStringFunc("tcSimpleMethodNameRequired",",,,") ) /// The types System.ValueType, System.Enum, System.Delegate, System.MulticastDelegate and System.Array cannot be used as super types in an object expression or class - /// (Originally from ..\FSComp.txt:606) + /// (Originally from ..\FSComp.txt:605) static member tcPredefinedTypeCannotBeUsedAsSuperType() = (771, GetStringFunc("tcPredefinedTypeCannotBeUsedAsSuperType",",,,") ) /// 'new' must be used with a named type - /// (Originally from ..\FSComp.txt:607) + /// (Originally from ..\FSComp.txt:606) static member tcNewMustBeUsedWithNamedType() = (772, GetStringFunc("tcNewMustBeUsedWithNamedType",",,,") ) /// Cannot create an extension of a sealed type - /// (Originally from ..\FSComp.txt:608) + /// (Originally from ..\FSComp.txt:607) static member tcCannotCreateExtensionOfSealedType() = (773, GetStringFunc("tcCannotCreateExtensionOfSealedType",",,,") ) /// No arguments may be given when constructing a record value - /// (Originally from ..\FSComp.txt:609) + /// (Originally from ..\FSComp.txt:608) static member tcNoArgumentsForRecordValue() = (774, GetStringFunc("tcNoArgumentsForRecordValue",",,,") ) /// Interface implementations cannot be given on construction expressions - /// (Originally from ..\FSComp.txt:610) + /// (Originally from ..\FSComp.txt:609) static member tcNoInterfaceImplementationForConstructionExpression() = (775, GetStringFunc("tcNoInterfaceImplementationForConstructionExpression",",,,") ) /// Object construction expressions may only be used to implement constructors in class types - /// (Originally from ..\FSComp.txt:611) + /// (Originally from ..\FSComp.txt:610) static member tcObjectConstructionCanOnlyBeUsedInClassTypes() = (776, GetStringFunc("tcObjectConstructionCanOnlyBeUsedInClassTypes",",,,") ) /// Only simple bindings of the form 'id = expr' can be used in construction expressions - /// (Originally from ..\FSComp.txt:612) + /// (Originally from ..\FSComp.txt:611) static member tcOnlySimpleBindingsCanBeUsedInConstructionExpressions() = (777, GetStringFunc("tcOnlySimpleBindingsCanBeUsedInConstructionExpressions",",,,") ) /// Objects must be initialized by an object construction expression that calls an inherited object constructor and assigns a value to each field - /// (Originally from ..\FSComp.txt:613) + /// (Originally from ..\FSComp.txt:612) static member tcObjectsMustBeInitializedWithObjectExpression() = (778, GetStringFunc("tcObjectsMustBeInitializedWithObjectExpression",",,,") ) /// Expected an interface type - /// (Originally from ..\FSComp.txt:614) + /// (Originally from ..\FSComp.txt:613) static member tcExpectedInterfaceType() = (779, GetStringFunc("tcExpectedInterfaceType",",,,") ) /// Constructor expressions for interfaces do not take arguments - /// (Originally from ..\FSComp.txt:615) + /// (Originally from ..\FSComp.txt:614) static member tcConstructorForInterfacesDoNotTakeArguments() = (780, GetStringFunc("tcConstructorForInterfacesDoNotTakeArguments",",,,") ) /// This object constructor requires arguments - /// (Originally from ..\FSComp.txt:616) + /// (Originally from ..\FSComp.txt:615) static member tcConstructorRequiresArguments() = (781, GetStringFunc("tcConstructorRequiresArguments",",,,") ) /// 'new' may only be used with object constructors - /// (Originally from ..\FSComp.txt:617) + /// (Originally from ..\FSComp.txt:616) static member tcNewRequiresObjectConstructor() = (782, GetStringFunc("tcNewRequiresObjectConstructor",",,,") ) /// At least one override did not correctly implement its corresponding abstract member - /// (Originally from ..\FSComp.txt:618) + /// (Originally from ..\FSComp.txt:617) static member tcAtLeastOneOverrideIsInvalid() = (783, GetStringFunc("tcAtLeastOneOverrideIsInvalid",",,,") ) /// This numeric literal requires that a module '%s' defining functions FromZero, FromOne, FromInt32, FromInt64 and FromString be in scope - /// (Originally from ..\FSComp.txt:619) + /// (Originally from ..\FSComp.txt:618) static member tcNumericLiteralRequiresModule(a0 : System.String) = (784, GetStringFunc("tcNumericLiteralRequiresModule",",,,%s,,,") a0) /// Invalid record construction - /// (Originally from ..\FSComp.txt:620) + /// (Originally from ..\FSComp.txt:619) static member tcInvalidRecordConstruction() = (785, GetStringFunc("tcInvalidRecordConstruction",",,,") ) /// The expression form { expr with ... } may only be used with record types. To build object types use { new Type(...) with ... } - /// (Originally from ..\FSComp.txt:621) + /// (Originally from ..\FSComp.txt:620) static member tcExpressionFormRequiresRecordTypes() = (786, GetStringFunc("tcExpressionFormRequiresRecordTypes",",,,") ) /// The inherited type is not an object model type - /// (Originally from ..\FSComp.txt:622) + /// (Originally from ..\FSComp.txt:621) static member tcInheritedTypeIsNotObjectModelType() = (787, GetStringFunc("tcInheritedTypeIsNotObjectModelType",",,,") ) /// Object construction expressions (i.e. record expressions with inheritance specifications) may only be used to implement constructors in object model types. Use 'new ObjectType(args)' to construct instances of object model types outside of constructors - /// (Originally from ..\FSComp.txt:623) + /// (Originally from ..\FSComp.txt:622) static member tcObjectConstructionExpressionCanOnlyImplementConstructorsInObjectModelTypes() = (788, GetStringFunc("tcObjectConstructionExpressionCanOnlyImplementConstructorsInObjectModelTypes",",,,") ) /// '{ }' is not a valid expression. Records must include at least one field. Empty sequences are specified by using Seq.empty or an empty list '[]'. - /// (Originally from ..\FSComp.txt:624) + /// (Originally from ..\FSComp.txt:623) static member tcEmptyRecordInvalid() = (789, GetStringFunc("tcEmptyRecordInvalid",",,,") ) /// This type is not a record type. Values of class and struct types must be created using calls to object constructors. - /// (Originally from ..\FSComp.txt:625) + /// (Originally from ..\FSComp.txt:624) static member tcTypeIsNotARecordTypeNeedConstructor() = (790, GetStringFunc("tcTypeIsNotARecordTypeNeedConstructor",",,,") ) /// This type is not a record type - /// (Originally from ..\FSComp.txt:626) + /// (Originally from ..\FSComp.txt:625) static member tcTypeIsNotARecordType() = (791, GetStringFunc("tcTypeIsNotARecordType",",,,") ) /// This construct is ambiguous as part of a computation expression. Nested expressions may be written using 'let _ = (...)' and nested computations using 'let! res = builder { ... }'. - /// (Originally from ..\FSComp.txt:627) + /// (Originally from ..\FSComp.txt:626) static member tcConstructIsAmbiguousInComputationExpression() = (792, GetStringFunc("tcConstructIsAmbiguousInComputationExpression",",,,") ) /// This construct is ambiguous as part of a sequence expression. Nested expressions may be written using 'let _ = (...)' and nested sequences using 'yield! seq {... }'. - /// (Originally from ..\FSComp.txt:628) + /// (Originally from ..\FSComp.txt:627) static member tcConstructIsAmbiguousInSequenceExpression() = (793, GetStringFunc("tcConstructIsAmbiguousInSequenceExpression",",,,") ) /// 'do!' cannot be used within sequence expressions - /// (Originally from ..\FSComp.txt:629) + /// (Originally from ..\FSComp.txt:628) static member tcDoBangIllegalInSequenceExpression() = (794, GetStringFunc("tcDoBangIllegalInSequenceExpression",",,,") ) /// The use of 'let! x = coll' in sequence expressions is not permitted. Use 'for x in coll' instead. - /// (Originally from ..\FSComp.txt:630) + /// (Originally from ..\FSComp.txt:629) static member tcUseForInSequenceExpression() = (795, GetStringFunc("tcUseForInSequenceExpression",",,,") ) /// 'try'/'with' cannot be used within sequence expressions - /// (Originally from ..\FSComp.txt:631) + /// (Originally from ..\FSComp.txt:630) static member tcTryIllegalInSequenceExpression() = (796, GetStringFunc("tcTryIllegalInSequenceExpression",",,,") ) /// In sequence expressions, multiple results are generated using 'yield!' - /// (Originally from ..\FSComp.txt:632) + /// (Originally from ..\FSComp.txt:631) static member tcUseYieldBangForMultipleResults() = (797, GetStringFunc("tcUseYieldBangForMultipleResults",",,,") ) /// Invalid assignment - /// (Originally from ..\FSComp.txt:633) + /// (Originally from ..\FSComp.txt:632) static member tcInvalidAssignment() = (799, GetStringFunc("tcInvalidAssignment",",,,") ) /// Invalid use of a type name - /// (Originally from ..\FSComp.txt:634) + /// (Originally from ..\FSComp.txt:633) static member tcInvalidUseOfTypeName() = (800, GetStringFunc("tcInvalidUseOfTypeName",",,,") ) /// This type has no accessible object constructors - /// (Originally from ..\FSComp.txt:635) + /// (Originally from ..\FSComp.txt:634) static member tcTypeHasNoAccessibleConstructor() = (801, GetStringFunc("tcTypeHasNoAccessibleConstructor",",,,") ) /// Invalid use of an interface type - /// (Originally from ..\FSComp.txt:638) + /// (Originally from ..\FSComp.txt:637) static member tcInvalidUseOfInterfaceType() = (804, GetStringFunc("tcInvalidUseOfInterfaceType",",,,") ) /// Invalid use of a delegate constructor. Use the syntax 'new Type(args)' or just 'Type(args)'. - /// (Originally from ..\FSComp.txt:639) + /// (Originally from ..\FSComp.txt:638) static member tcInvalidUseOfDelegate() = (805, GetStringFunc("tcInvalidUseOfDelegate",",,,") ) /// Property '%s' is not static - /// (Originally from ..\FSComp.txt:640) + /// (Originally from ..\FSComp.txt:639) static member tcPropertyIsNotStatic(a0 : System.String) = (806, GetStringFunc("tcPropertyIsNotStatic",",,,%s,,,") a0) /// Property '%s' is not readable - /// (Originally from ..\FSComp.txt:641) + /// (Originally from ..\FSComp.txt:640) static member tcPropertyIsNotReadable(a0 : System.String) = (807, GetStringFunc("tcPropertyIsNotReadable",",,,%s,,,") a0) /// This lookup cannot be used here - /// (Originally from ..\FSComp.txt:642) + /// (Originally from ..\FSComp.txt:641) static member tcLookupMayNotBeUsedHere() = (808, GetStringFunc("tcLookupMayNotBeUsedHere",",,,") ) /// Property '%s' is static - /// (Originally from ..\FSComp.txt:643) + /// (Originally from ..\FSComp.txt:642) static member tcPropertyIsStatic(a0 : System.String) = (809, GetStringFunc("tcPropertyIsStatic",",,,%s,,,") a0) /// Property '%s' cannot be set - /// (Originally from ..\FSComp.txt:644) + /// (Originally from ..\FSComp.txt:643) static member tcPropertyCannotBeSet1(a0 : System.String) = (810, GetStringFunc("tcPropertyCannotBeSet1",",,,%s,,,") a0) /// Constructors must be applied to arguments and cannot be used as first-class values. If necessary use an anonymous function '(fun arg1 ... argN -> new Type(arg1,...,argN))'. - /// (Originally from ..\FSComp.txt:645) + /// (Originally from ..\FSComp.txt:644) static member tcConstructorsCannotBeFirstClassValues() = (811, GetStringFunc("tcConstructorsCannotBeFirstClassValues",",,,") ) /// The syntax 'expr.id' may only be used with record labels, properties and fields - /// (Originally from ..\FSComp.txt:646) + /// (Originally from ..\FSComp.txt:645) static member tcSyntaxFormUsedOnlyWithRecordLabelsPropertiesAndFields() = (812, GetStringFunc("tcSyntaxFormUsedOnlyWithRecordLabelsPropertiesAndFields",",,,") ) /// Event '%s' is static - /// (Originally from ..\FSComp.txt:647) + /// (Originally from ..\FSComp.txt:646) static member tcEventIsStatic(a0 : System.String) = (813, GetStringFunc("tcEventIsStatic",",,,%s,,,") a0) /// Event '%s' is not static - /// (Originally from ..\FSComp.txt:648) + /// (Originally from ..\FSComp.txt:647) static member tcEventIsNotStatic(a0 : System.String) = (814, GetStringFunc("tcEventIsNotStatic",",,,%s,,,") a0) /// The named argument '%s' did not match any argument or mutable property - /// (Originally from ..\FSComp.txt:649) + /// (Originally from ..\FSComp.txt:648) static member tcNamedArgumentDidNotMatch(a0 : System.String) = (815, GetStringFunc("tcNamedArgumentDidNotMatch",",,,%s,,,") a0) /// One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. - /// (Originally from ..\FSComp.txt:650) + /// (Originally from ..\FSComp.txt:649) static member tcOverloadsCannotHaveCurriedArguments() = (816, GetStringFunc("tcOverloadsCannotHaveCurriedArguments",",,,") ) /// The unnamed arguments do not form a prefix of the arguments of the method called - /// (Originally from ..\FSComp.txt:651) + /// (Originally from ..\FSComp.txt:650) static member tcUnnamedArgumentsDoNotFormPrefix() = (GetStringFunc("tcUnnamedArgumentsDoNotFormPrefix",",,,") ) /// Static optimization conditionals are only for use within the F# library - /// (Originally from ..\FSComp.txt:652) + /// (Originally from ..\FSComp.txt:651) static member tcStaticOptimizationConditionalsOnlyForFSharpLibrary() = (817, GetStringFunc("tcStaticOptimizationConditionalsOnlyForFSharpLibrary",",,,") ) /// The corresponding formal argument is not optional - /// (Originally from ..\FSComp.txt:653) + /// (Originally from ..\FSComp.txt:652) static member tcFormalArgumentIsNotOptional() = (818, GetStringFunc("tcFormalArgumentIsNotOptional",",,,") ) /// Invalid optional assignment to a property or field - /// (Originally from ..\FSComp.txt:654) + /// (Originally from ..\FSComp.txt:653) static member tcInvalidOptionalAssignmentToPropertyOrField() = (819, GetStringFunc("tcInvalidOptionalAssignmentToPropertyOrField",",,,") ) /// A delegate constructor must be passed a single function value - /// (Originally from ..\FSComp.txt:655) + /// (Originally from ..\FSComp.txt:654) static member tcDelegateConstructorMustBePassed() = (820, GetStringFunc("tcDelegateConstructorMustBePassed",",,,") ) /// A binding cannot be marked both 'use' and 'rec' - /// (Originally from ..\FSComp.txt:656) + /// (Originally from ..\FSComp.txt:655) static member tcBindingCannotBeUseAndRec() = (821, GetStringFunc("tcBindingCannotBeUseAndRec",",,,") ) /// The 'VolatileField' attribute may only be used on 'let' bindings in classes - /// (Originally from ..\FSComp.txt:657) + /// (Originally from ..\FSComp.txt:656) static member tcVolatileOnlyOnClassLetBindings() = (823, GetStringFunc("tcVolatileOnlyOnClassLetBindings",",,,") ) /// Attributes are not permitted on 'let' bindings in expressions - /// (Originally from ..\FSComp.txt:658) + /// (Originally from ..\FSComp.txt:657) static member tcAttributesAreNotPermittedOnLetBindings() = (824, GetStringFunc("tcAttributesAreNotPermittedOnLetBindings",",,,") ) /// The 'DefaultValue' attribute may only be used on 'val' declarations - /// (Originally from ..\FSComp.txt:659) + /// (Originally from ..\FSComp.txt:658) static member tcDefaultValueAttributeRequiresVal() = (825, GetStringFunc("tcDefaultValueAttributeRequiresVal",",,,") ) /// The 'ConditionalAttribute' attribute may only be used on members - /// (Originally from ..\FSComp.txt:660) + /// (Originally from ..\FSComp.txt:659) static member tcConditionalAttributeRequiresMembers() = (826, GetStringFunc("tcConditionalAttributeRequiresMembers",",,,") ) /// This is not a valid name for an active pattern - /// (Originally from ..\FSComp.txt:661) + /// (Originally from ..\FSComp.txt:660) static member tcInvalidActivePatternName() = (827, GetStringFunc("tcInvalidActivePatternName",",,,") ) /// The 'EntryPointAttribute' attribute may only be used on function definitions in modules - /// (Originally from ..\FSComp.txt:662) + /// (Originally from ..\FSComp.txt:661) static member tcEntryPointAttributeRequiresFunctionInModule() = (828, GetStringFunc("tcEntryPointAttributeRequiresFunctionInModule",",,,") ) /// Mutable values cannot be marked 'inline' - /// (Originally from ..\FSComp.txt:663) + /// (Originally from ..\FSComp.txt:662) static member tcMutableValuesCannotBeInline() = (829, GetStringFunc("tcMutableValuesCannotBeInline",",,,") ) /// Mutable values cannot have generic parameters - /// (Originally from ..\FSComp.txt:664) + /// (Originally from ..\FSComp.txt:663) static member tcMutableValuesMayNotHaveGenericParameters() = (830, GetStringFunc("tcMutableValuesMayNotHaveGenericParameters",",,,") ) /// Mutable function values should be written 'let mutable f = (fun args -> ...)' - /// (Originally from ..\FSComp.txt:665) + /// (Originally from ..\FSComp.txt:664) static member tcMutableValuesSyntax() = (831, GetStringFunc("tcMutableValuesSyntax",",,,") ) /// Only functions may be marked 'inline' - /// (Originally from ..\FSComp.txt:666) + /// (Originally from ..\FSComp.txt:665) static member tcOnlyFunctionsCanBeInline() = (832, GetStringFunc("tcOnlyFunctionsCanBeInline",",,,") ) /// A literal value cannot be given the [] or [] attributes - /// (Originally from ..\FSComp.txt:667) + /// (Originally from ..\FSComp.txt:666) static member tcIllegalAttributesForLiteral() = (833, GetStringFunc("tcIllegalAttributesForLiteral",",,,") ) /// A literal value cannot be marked 'mutable' - /// (Originally from ..\FSComp.txt:668) + /// (Originally from ..\FSComp.txt:667) static member tcLiteralCannotBeMutable() = (834, GetStringFunc("tcLiteralCannotBeMutable",",,,") ) /// A literal value cannot be marked 'inline' - /// (Originally from ..\FSComp.txt:669) + /// (Originally from ..\FSComp.txt:668) static member tcLiteralCannotBeInline() = (835, GetStringFunc("tcLiteralCannotBeInline",",,,") ) /// Literal values cannot have generic parameters - /// (Originally from ..\FSComp.txt:670) + /// (Originally from ..\FSComp.txt:669) static member tcLiteralCannotHaveGenericParameters() = (836, GetStringFunc("tcLiteralCannotHaveGenericParameters",",,,") ) /// This is not a valid constant expression - /// (Originally from ..\FSComp.txt:671) + /// (Originally from ..\FSComp.txt:670) static member tcInvalidConstantExpression() = (837, GetStringFunc("tcInvalidConstantExpression",",,,") ) /// This type is not accessible from this code location - /// (Originally from ..\FSComp.txt:672) + /// (Originally from ..\FSComp.txt:671) static member tcTypeIsInaccessible() = (838, GetStringFunc("tcTypeIsInaccessible",",,,") ) /// Unexpected condition in imported assembly: failed to decode AttributeUsage attribute - /// (Originally from ..\FSComp.txt:673) + /// (Originally from ..\FSComp.txt:672) static member tcUnexpectedConditionInImportedAssembly() = (839, GetStringFunc("tcUnexpectedConditionInImportedAssembly",",,,") ) /// Unrecognized attribute target. Valid attribute targets are 'assembly', 'module', 'type', 'method', 'property', 'return', 'param', 'field', 'event', 'constructor'. - /// (Originally from ..\FSComp.txt:674) + /// (Originally from ..\FSComp.txt:673) static member tcUnrecognizedAttributeTarget() = (840, GetStringFunc("tcUnrecognizedAttributeTarget",",,,") ) /// This attribute is not valid for use on this language element. Assembly attributes should be attached to a 'do ()' declaration, if necessary within an F# module. - /// (Originally from ..\FSComp.txt:675) + /// (Originally from ..\FSComp.txt:674) static member tcAttributeIsNotValidForLanguageElementUseDo() = (841, GetStringFunc("tcAttributeIsNotValidForLanguageElementUseDo",",,,") ) /// This attribute is not valid for use on this language element - /// (Originally from ..\FSComp.txt:676) + /// (Originally from ..\FSComp.txt:675) static member tcAttributeIsNotValidForLanguageElement() = (842, GetStringFunc("tcAttributeIsNotValidForLanguageElement",",,,") ) /// Optional arguments cannot be used in custom attributes - /// (Originally from ..\FSComp.txt:677) + /// (Originally from ..\FSComp.txt:676) static member tcOptionalArgumentsCannotBeUsedInCustomAttribute() = (843, GetStringFunc("tcOptionalArgumentsCannotBeUsedInCustomAttribute",",,,") ) /// This property cannot be set - /// (Originally from ..\FSComp.txt:678) + /// (Originally from ..\FSComp.txt:677) static member tcPropertyCannotBeSet0() = (844, GetStringFunc("tcPropertyCannotBeSet0",",,,") ) /// This property or field was not found on this custom attribute type - /// (Originally from ..\FSComp.txt:679) + /// (Originally from ..\FSComp.txt:678) static member tcPropertyOrFieldNotFoundInAttribute() = (845, GetStringFunc("tcPropertyOrFieldNotFoundInAttribute",",,,") ) /// A custom attribute must be a reference type - /// (Originally from ..\FSComp.txt:680) + /// (Originally from ..\FSComp.txt:679) static member tcCustomAttributeMustBeReferenceType() = (846, GetStringFunc("tcCustomAttributeMustBeReferenceType",",,,") ) /// The number of args for a custom attribute does not match the expected number of args for the attribute constructor - /// (Originally from ..\FSComp.txt:681) + /// (Originally from ..\FSComp.txt:680) static member tcCustomAttributeArgumentMismatch() = (847, GetStringFunc("tcCustomAttributeArgumentMismatch",",,,") ) /// A custom attribute must invoke an object constructor - /// (Originally from ..\FSComp.txt:682) + /// (Originally from ..\FSComp.txt:681) static member tcCustomAttributeMustInvokeConstructor() = (848, GetStringFunc("tcCustomAttributeMustInvokeConstructor",",,,") ) /// Attribute expressions must be calls to object constructors - /// (Originally from ..\FSComp.txt:683) + /// (Originally from ..\FSComp.txt:682) static member tcAttributeExpressionsMustBeConstructorCalls() = (849, GetStringFunc("tcAttributeExpressionsMustBeConstructorCalls",",,,") ) /// This attribute cannot be used in this version of F# - /// (Originally from ..\FSComp.txt:684) + /// (Originally from ..\FSComp.txt:683) static member tcUnsupportedAttribute() = (850, GetStringFunc("tcUnsupportedAttribute",",,,") ) /// Invalid inline specification - /// (Originally from ..\FSComp.txt:685) + /// (Originally from ..\FSComp.txt:684) static member tcInvalidInlineSpecification() = (851, GetStringFunc("tcInvalidInlineSpecification",",,,") ) /// 'use' bindings must be of the form 'use = ' - /// (Originally from ..\FSComp.txt:686) + /// (Originally from ..\FSComp.txt:685) static member tcInvalidUseBinding() = (852, GetStringFunc("tcInvalidUseBinding",",,,") ) /// Abstract members are not permitted in an augmentation - they must be defined as part of the type itself - /// (Originally from ..\FSComp.txt:687) + /// (Originally from ..\FSComp.txt:686) static member tcAbstractMembersIllegalInAugmentation() = (853, GetStringFunc("tcAbstractMembersIllegalInAugmentation",",,,") ) /// Method overrides and interface implementations are not permitted here - /// (Originally from ..\FSComp.txt:688) + /// (Originally from ..\FSComp.txt:687) static member tcMethodOverridesIllegalHere() = (854, GetStringFunc("tcMethodOverridesIllegalHere",",,,") ) /// No abstract or interface member was found that corresponds to this override - /// (Originally from ..\FSComp.txt:689) + /// (Originally from ..\FSComp.txt:688) static member tcNoMemberFoundForOverride() = (855, GetStringFunc("tcNoMemberFoundForOverride",",,,") ) /// This override takes a different number of arguments to the corresponding abstract member. The following abstract members were found:%s - /// (Originally from ..\FSComp.txt:690) + /// (Originally from ..\FSComp.txt:689) static member tcOverrideArityMismatch(a0 : System.String) = (856, GetStringFunc("tcOverrideArityMismatch",",,,%s,,,") a0) /// This method already has a default implementation - /// (Originally from ..\FSComp.txt:691) + /// (Originally from ..\FSComp.txt:690) static member tcDefaultImplementationAlreadyExists() = (857, GetStringFunc("tcDefaultImplementationAlreadyExists",",,,") ) /// The method implemented by this default is ambiguous - /// (Originally from ..\FSComp.txt:692) + /// (Originally from ..\FSComp.txt:691) static member tcDefaultAmbiguous() = (858, GetStringFunc("tcDefaultAmbiguous",",,,") ) /// No abstract property was found that corresponds to this override - /// (Originally from ..\FSComp.txt:693) + /// (Originally from ..\FSComp.txt:692) static member tcNoPropertyFoundForOverride() = (859, GetStringFunc("tcNoPropertyFoundForOverride",",,,") ) /// This property overrides or implements an abstract property but the abstract property doesn't have a corresponding %s - /// (Originally from ..\FSComp.txt:694) + /// (Originally from ..\FSComp.txt:693) static member tcAbstractPropertyMissingGetOrSet(a0 : System.String) = (860, GetStringFunc("tcAbstractPropertyMissingGetOrSet",",,,%s,,,") a0) /// Invalid signature for set member - /// (Originally from ..\FSComp.txt:695) + /// (Originally from ..\FSComp.txt:694) static member tcInvalidSignatureForSet() = (861, GetStringFunc("tcInvalidSignatureForSet",",,,") ) /// This new member hides the abstract member '%s'. Rename the member or use 'override' instead. - /// (Originally from ..\FSComp.txt:696) + /// (Originally from ..\FSComp.txt:695) static member tcNewMemberHidesAbstractMember(a0 : System.String) = (864, GetStringFunc("tcNewMemberHidesAbstractMember",",,,%s,,,") a0) /// This new member hides the abstract member '%s' once tuples, functions, units of measure and/or provided types are erased. Rename the member or use 'override' instead. - /// (Originally from ..\FSComp.txt:697) + /// (Originally from ..\FSComp.txt:696) static member tcNewMemberHidesAbstractMemberWithSuffix(a0 : System.String) = (864, GetStringFunc("tcNewMemberHidesAbstractMemberWithSuffix",",,,%s,,,") a0) /// Interfaces cannot contain definitions of static initializers - /// (Originally from ..\FSComp.txt:698) + /// (Originally from ..\FSComp.txt:697) static member tcStaticInitializersIllegalInInterface() = (865, GetStringFunc("tcStaticInitializersIllegalInInterface",",,,") ) /// Interfaces cannot contain definitions of object constructors - /// (Originally from ..\FSComp.txt:699) + /// (Originally from ..\FSComp.txt:698) static member tcObjectConstructorsIllegalInInterface() = (866, GetStringFunc("tcObjectConstructorsIllegalInInterface",",,,") ) /// Interfaces cannot contain definitions of member overrides - /// (Originally from ..\FSComp.txt:700) + /// (Originally from ..\FSComp.txt:699) static member tcMemberOverridesIllegalInInterface() = (867, GetStringFunc("tcMemberOverridesIllegalInInterface",",,,") ) /// Interfaces cannot contain definitions of concrete members. You may need to define a constructor on your type to indicate that the type is a class. - /// (Originally from ..\FSComp.txt:701) + /// (Originally from ..\FSComp.txt:700) static member tcConcreteMembersIllegalInInterface() = (868, GetStringFunc("tcConcreteMembersIllegalInInterface",",,,") ) /// Constructors cannot be specified in exception augmentations - /// (Originally from ..\FSComp.txt:702) + /// (Originally from ..\FSComp.txt:701) static member tcConstructorsDisallowedInExceptionAugmentation() = (869, GetStringFunc("tcConstructorsDisallowedInExceptionAugmentation",",,,") ) /// Structs cannot have an object constructor with no arguments. This is a restriction imposed on all CLI languages as structs automatically support a default constructor. - /// (Originally from ..\FSComp.txt:703) + /// (Originally from ..\FSComp.txt:702) static member tcStructsCannotHaveConstructorWithNoArguments() = (870, GetStringFunc("tcStructsCannotHaveConstructorWithNoArguments",",,,") ) /// Constructors cannot be defined for this type - /// (Originally from ..\FSComp.txt:704) + /// (Originally from ..\FSComp.txt:703) static member tcConstructorsIllegalForThisType() = (871, GetStringFunc("tcConstructorsIllegalForThisType",",,,") ) /// Recursive bindings that include member specifications can only occur as a direct augmentation of a type - /// (Originally from ..\FSComp.txt:705) + /// (Originally from ..\FSComp.txt:704) static member tcRecursiveBindingsWithMembersMustBeDirectAugmentation() = (872, GetStringFunc("tcRecursiveBindingsWithMembersMustBeDirectAugmentation",",,,") ) /// Only simple variable patterns can be bound in 'let rec' constructs - /// (Originally from ..\FSComp.txt:706) + /// (Originally from ..\FSComp.txt:705) static member tcOnlySimplePatternsInLetRec() = (873, GetStringFunc("tcOnlySimplePatternsInLetRec",",,,") ) /// Only record fields and simple, non-recursive 'let' bindings may be marked mutable - /// (Originally from ..\FSComp.txt:707) + /// (Originally from ..\FSComp.txt:706) static member tcOnlyRecordFieldsAndSimpleLetCanBeMutable() = (874, GetStringFunc("tcOnlyRecordFieldsAndSimpleLetCanBeMutable",",,,") ) /// This member is not sufficiently generic - /// (Originally from ..\FSComp.txt:708) + /// (Originally from ..\FSComp.txt:707) static member tcMemberIsNotSufficientlyGeneric() = (875, GetStringFunc("tcMemberIsNotSufficientlyGeneric",",,,") ) /// A declaration may only be the [] attribute if a constant value is also given, e.g. 'val x : int = 1' - /// (Originally from ..\FSComp.txt:709) + /// (Originally from ..\FSComp.txt:708) static member tcLiteralAttributeRequiresConstantValue() = (876, GetStringFunc("tcLiteralAttributeRequiresConstantValue",",,,") ) /// A declaration may only be given a value in a signature if the declaration has the [] attribute - /// (Originally from ..\FSComp.txt:710) + /// (Originally from ..\FSComp.txt:709) static member tcValueInSignatureRequiresLiteralAttribute() = (877, GetStringFunc("tcValueInSignatureRequiresLiteralAttribute",",,,") ) /// Thread-static and context-static variables must be static and given the [] attribute to indicate that the value is initialized to the default value on each new thread - /// (Originally from ..\FSComp.txt:711) + /// (Originally from ..\FSComp.txt:710) static member tcThreadStaticAndContextStaticMustBeStatic() = (878, GetStringFunc("tcThreadStaticAndContextStaticMustBeStatic",",,,") ) /// Volatile fields must be marked 'mutable' and cannot be thread-static - /// (Originally from ..\FSComp.txt:712) + /// (Originally from ..\FSComp.txt:711) static member tcVolatileFieldsMustBeMutable() = (879, GetStringFunc("tcVolatileFieldsMustBeMutable",",,,") ) /// Uninitialized 'val' fields must be mutable and marked with the '[]' attribute. Consider using a 'let' binding instead of a 'val' field. - /// (Originally from ..\FSComp.txt:713) + /// (Originally from ..\FSComp.txt:712) static member tcUninitializedValFieldsMustBeMutable() = (880, GetStringFunc("tcUninitializedValFieldsMustBeMutable",",,,") ) /// Static 'val' fields in types must be mutable, private and marked with the '[]' attribute. They are initialized to the 'null' or 'zero' value for their type. Consider also using a 'static let mutable' binding in a class type. - /// (Originally from ..\FSComp.txt:714) + /// (Originally from ..\FSComp.txt:713) static member tcStaticValFieldsMustBeMutableAndPrivate() = (881, GetStringFunc("tcStaticValFieldsMustBeMutableAndPrivate",",,,") ) /// This field requires a name - /// (Originally from ..\FSComp.txt:715) + /// (Originally from ..\FSComp.txt:714) static member tcFieldRequiresName() = (882, GetStringFunc("tcFieldRequiresName",",,,") ) /// Invalid namespace, module, type or union case name - /// (Originally from ..\FSComp.txt:716) + /// (Originally from ..\FSComp.txt:715) static member tcInvalidNamespaceModuleTypeUnionName() = (883, GetStringFunc("tcInvalidNamespaceModuleTypeUnionName",",,,") ) /// Explicit type declarations for constructors must be of the form 'ty1 * ... * tyN -> resTy'. Parentheses may be required around 'resTy' - /// (Originally from ..\FSComp.txt:717) + /// (Originally from ..\FSComp.txt:716) static member tcIllegalFormForExplicitTypeDeclaration() = (884, GetStringFunc("tcIllegalFormForExplicitTypeDeclaration",",,,") ) /// Return types of union cases must be identical to the type being defined, up to abbreviations - /// (Originally from ..\FSComp.txt:718) + /// (Originally from ..\FSComp.txt:717) static member tcReturnTypesForUnionMustBeSameAsType() = (885, GetStringFunc("tcReturnTypesForUnionMustBeSameAsType",",,,") ) /// This is not a valid value for an enumeration literal - /// (Originally from ..\FSComp.txt:719) + /// (Originally from ..\FSComp.txt:718) static member tcInvalidEnumerationLiteral() = (886, GetStringFunc("tcInvalidEnumerationLiteral",",,,") ) /// The type '%s' is not an interface type - /// (Originally from ..\FSComp.txt:720) + /// (Originally from ..\FSComp.txt:719) static member tcTypeIsNotInterfaceType1(a0 : System.String) = (887, GetStringFunc("tcTypeIsNotInterfaceType1",",,,%s,,,") a0) /// Duplicate specification of an interface - /// (Originally from ..\FSComp.txt:721) + /// (Originally from ..\FSComp.txt:720) static member tcDuplicateSpecOfInterface() = (888, GetStringFunc("tcDuplicateSpecOfInterface",",,,") ) /// A field/val declaration is not permitted here - /// (Originally from ..\FSComp.txt:722) + /// (Originally from ..\FSComp.txt:721) static member tcFieldValIllegalHere() = (889, GetStringFunc("tcFieldValIllegalHere",",,,") ) /// A inheritance declaration is not permitted here - /// (Originally from ..\FSComp.txt:723) + /// (Originally from ..\FSComp.txt:722) static member tcInheritIllegalHere() = (890, GetStringFunc("tcInheritIllegalHere",",,,") ) /// This declaration opens the module '%s', which is marked as 'RequireQualifiedAccess'. Adjust your code to use qualified references to the elements of the module instead, e.g. 'List.map' instead of 'map'. This change will ensure that your code is robust as new constructs are added to libraries. - /// (Originally from ..\FSComp.txt:724) + /// (Originally from ..\FSComp.txt:723) static member tcModuleRequiresQualifiedAccess(a0 : System.String) = (892, GetStringFunc("tcModuleRequiresQualifiedAccess",",,,%s,,,") a0) /// This declaration opens the namespace or module '%s' through a partially qualified path. Adjust this code to use the full path of the namespace. This change will make your code more robust as new constructs are added to the F# and CLI libraries. - /// (Originally from ..\FSComp.txt:725) + /// (Originally from ..\FSComp.txt:724) static member tcOpenUsedWithPartiallyQualifiedPath(a0 : System.String) = (893, GetStringFunc("tcOpenUsedWithPartiallyQualifiedPath",",,,%s,,,") a0) /// Local class bindings cannot be marked inline. Consider lifting the definition out of the class or else do not mark it as inline. - /// (Originally from ..\FSComp.txt:726) + /// (Originally from ..\FSComp.txt:725) static member tcLocalClassBindingsCannotBeInline() = (894, GetStringFunc("tcLocalClassBindingsCannotBeInline",",,,") ) /// Type abbreviations cannot have members - /// (Originally from ..\FSComp.txt:727) + /// (Originally from ..\FSComp.txt:726) static member tcTypeAbbreviationsMayNotHaveMembers() = (895, GetStringFunc("tcTypeAbbreviationsMayNotHaveMembers",",,,") ) /// As of F# 4.1, the accessibility of type abbreviations is checked at compile-time. Consider changing the accessibility of the type abbreviation. Ignoring this warning might lead to runtime errors. - /// (Originally from ..\FSComp.txt:728) + /// (Originally from ..\FSComp.txt:727) static member tcTypeAbbreviationsCheckedAtCompileTime() = (GetStringFunc("tcTypeAbbreviationsCheckedAtCompileTime",",,,") ) /// Enumerations cannot have members - /// (Originally from ..\FSComp.txt:729) + /// (Originally from ..\FSComp.txt:728) static member tcEnumerationsMayNotHaveMembers() = (896, GetStringFunc("tcEnumerationsMayNotHaveMembers",",,,") ) /// Measure declarations may have only static members - /// (Originally from ..\FSComp.txt:730) + /// (Originally from ..\FSComp.txt:729) static member tcMeasureDeclarationsRequireStaticMembers() = (897, GetStringFunc("tcMeasureDeclarationsRequireStaticMembers",",,,") ) /// Structs cannot contain 'do' bindings because the default constructor for structs would not execute these bindings - /// (Originally from ..\FSComp.txt:731) + /// (Originally from ..\FSComp.txt:730) static member tcStructsMayNotContainDoBindings() = (GetStringFunc("tcStructsMayNotContainDoBindings",",,,") ) /// Structs cannot contain value definitions because the default constructor for structs will not execute these bindings. Consider adding additional arguments to the primary constructor for the type. - /// (Originally from ..\FSComp.txt:732) + /// (Originally from ..\FSComp.txt:731) static member tcStructsMayNotContainLetBindings() = (901, GetStringFunc("tcStructsMayNotContainLetBindings",",,,") ) /// Static value definitions may only be used in types with a primary constructor. Consider adding arguments to the type definition, e.g. 'type X(args) = ...'. - /// (Originally from ..\FSComp.txt:733) + /// (Originally from ..\FSComp.txt:732) static member tcStaticLetBindingsRequireClassesWithImplicitConstructors() = (902, GetStringFunc("tcStaticLetBindingsRequireClassesWithImplicitConstructors",",,,") ) /// Measure declarations may have only static members: constructors are not available - /// (Originally from ..\FSComp.txt:734) + /// (Originally from ..\FSComp.txt:733) static member tcMeasureDeclarationsRequireStaticMembersNotConstructors() = (904, GetStringFunc("tcMeasureDeclarationsRequireStaticMembersNotConstructors",",,,") ) /// A member and a local class binding both have the name '%s' - /// (Originally from ..\FSComp.txt:735) + /// (Originally from ..\FSComp.txt:734) static member tcMemberAndLocalClassBindingHaveSameName(a0 : System.String) = (905, GetStringFunc("tcMemberAndLocalClassBindingHaveSameName",",,,%s,,,") a0) /// Type abbreviations cannot have interface declarations - /// (Originally from ..\FSComp.txt:736) + /// (Originally from ..\FSComp.txt:735) static member tcTypeAbbreviationsCannotHaveInterfaceDeclaration() = (906, GetStringFunc("tcTypeAbbreviationsCannotHaveInterfaceDeclaration",",,,") ) /// Enumerations cannot have interface declarations - /// (Originally from ..\FSComp.txt:737) + /// (Originally from ..\FSComp.txt:736) static member tcEnumerationsCannotHaveInterfaceDeclaration() = (907, GetStringFunc("tcEnumerationsCannotHaveInterfaceDeclaration",",,,") ) /// This type is not an interface type - /// (Originally from ..\FSComp.txt:738) + /// (Originally from ..\FSComp.txt:737) static member tcTypeIsNotInterfaceType0() = (908, GetStringFunc("tcTypeIsNotInterfaceType0",",,,") ) /// All implemented interfaces should be declared on the initial declaration of the type - /// (Originally from ..\FSComp.txt:739) + /// (Originally from ..\FSComp.txt:738) static member tcAllImplementedInterfacesShouldBeDeclared() = (909, GetStringFunc("tcAllImplementedInterfacesShouldBeDeclared",",,,") ) /// A default implementation of this interface has already been added because the explicit implementation of the interface was not specified at the definition of the type - /// (Originally from ..\FSComp.txt:740) + /// (Originally from ..\FSComp.txt:739) static member tcDefaultImplementationForInterfaceHasAlreadyBeenAdded() = (910, GetStringFunc("tcDefaultImplementationForInterfaceHasAlreadyBeenAdded",",,,") ) /// This member is not permitted in an interface implementation - /// (Originally from ..\FSComp.txt:741) + /// (Originally from ..\FSComp.txt:740) static member tcMemberNotPermittedInInterfaceImplementation() = (911, GetStringFunc("tcMemberNotPermittedInInterfaceImplementation",",,,") ) /// This declaration element is not permitted in an augmentation - /// (Originally from ..\FSComp.txt:742) + /// (Originally from ..\FSComp.txt:741) static member tcDeclarationElementNotPermittedInAugmentation() = (912, GetStringFunc("tcDeclarationElementNotPermittedInAugmentation",",,,") ) /// Types cannot contain nested type definitions - /// (Originally from ..\FSComp.txt:743) + /// (Originally from ..\FSComp.txt:742) static member tcTypesCannotContainNestedTypes() = (913, GetStringFunc("tcTypesCannotContainNestedTypes",",,,") ) /// type, exception or module - /// (Originally from ..\FSComp.txt:744) + /// (Originally from ..\FSComp.txt:743) static member tcTypeExceptionOrModule() = (GetStringFunc("tcTypeExceptionOrModule",",,,") ) /// type or module - /// (Originally from ..\FSComp.txt:745) + /// (Originally from ..\FSComp.txt:744) static member tcTypeOrModule() = (GetStringFunc("tcTypeOrModule",",,,") ) /// The struct, record or union type '%s' implements the interface 'System.IStructuralEquatable' explicitly. Apply the 'CustomEquality' attribute to the type. - /// (Originally from ..\FSComp.txt:746) + /// (Originally from ..\FSComp.txt:745) static member tcImplementsIStructuralEquatableExplicitly(a0 : System.String) = (914, GetStringFunc("tcImplementsIStructuralEquatableExplicitly",",,,%s,,,") a0) /// The struct, record or union type '%s' implements the interface 'System.IEquatable<_>' explicitly. Apply the 'CustomEquality' attribute to the type and provide a consistent implementation of the non-generic override 'System.Object.Equals(obj)'. - /// (Originally from ..\FSComp.txt:747) + /// (Originally from ..\FSComp.txt:746) static member tcImplementsIEquatableExplicitly(a0 : System.String) = (915, GetStringFunc("tcImplementsIEquatableExplicitly",",,,%s,,,") a0) /// Explicit type specifications cannot be used for exception constructors - /// (Originally from ..\FSComp.txt:748) + /// (Originally from ..\FSComp.txt:747) static member tcExplicitTypeSpecificationCannotBeUsedForExceptionConstructors() = (916, GetStringFunc("tcExplicitTypeSpecificationCannotBeUsedForExceptionConstructors",",,,") ) /// Exception abbreviations should not have argument lists - /// (Originally from ..\FSComp.txt:749) + /// (Originally from ..\FSComp.txt:748) static member tcExceptionAbbreviationsShouldNotHaveArgumentList() = (917, GetStringFunc("tcExceptionAbbreviationsShouldNotHaveArgumentList",",,,") ) /// Abbreviations for Common IL exceptions cannot take arguments - /// (Originally from ..\FSComp.txt:750) + /// (Originally from ..\FSComp.txt:749) static member tcAbbreviationsFordotNetExceptionsCannotTakeArguments() = (918, GetStringFunc("tcAbbreviationsFordotNetExceptionsCannotTakeArguments",",,,") ) /// Exception abbreviations must refer to existing exceptions or F# types deriving from System.Exception - /// (Originally from ..\FSComp.txt:751) + /// (Originally from ..\FSComp.txt:750) static member tcExceptionAbbreviationsMustReferToValidExceptions() = (919, GetStringFunc("tcExceptionAbbreviationsMustReferToValidExceptions",",,,") ) /// Abbreviations for Common IL exception types must have a matching object constructor - /// (Originally from ..\FSComp.txt:752) + /// (Originally from ..\FSComp.txt:751) static member tcAbbreviationsFordotNetExceptionsMustHaveMatchingObjectConstructor() = (920, GetStringFunc("tcAbbreviationsFordotNetExceptionsMustHaveMatchingObjectConstructor",",,,") ) /// Not an exception - /// (Originally from ..\FSComp.txt:753) + /// (Originally from ..\FSComp.txt:752) static member tcNotAnException() = (921, GetStringFunc("tcNotAnException",",,,") ) /// Invalid module name - /// (Originally from ..\FSComp.txt:755) + /// (Originally from ..\FSComp.txt:754) static member tcInvalidModuleName() = (924, GetStringFunc("tcInvalidModuleName",",,,") ) /// Invalid type extension - /// (Originally from ..\FSComp.txt:756) + /// (Originally from ..\FSComp.txt:755) static member tcInvalidTypeExtension() = (925, GetStringFunc("tcInvalidTypeExtension",",,,") ) /// The attributes of this type specify multiple kinds for the type - /// (Originally from ..\FSComp.txt:757) + /// (Originally from ..\FSComp.txt:756) static member tcAttributesOfTypeSpecifyMultipleKindsForType() = (926, GetStringFunc("tcAttributesOfTypeSpecifyMultipleKindsForType",",,,") ) /// The kind of the type specified by its attributes does not match the kind implied by its definition - /// (Originally from ..\FSComp.txt:758) + /// (Originally from ..\FSComp.txt:757) static member tcKindOfTypeSpecifiedDoesNotMatchDefinition() = (927, GetStringFunc("tcKindOfTypeSpecifiedDoesNotMatchDefinition",",,,") ) /// Measure definitions cannot have type parameters - /// (Originally from ..\FSComp.txt:759) + /// (Originally from ..\FSComp.txt:758) static member tcMeasureDefinitionsCannotHaveTypeParameters() = (928, GetStringFunc("tcMeasureDefinitionsCannotHaveTypeParameters",",,,") ) /// This type requires a definition - /// (Originally from ..\FSComp.txt:760) + /// (Originally from ..\FSComp.txt:759) static member tcTypeRequiresDefinition() = (929, GetStringFunc("tcTypeRequiresDefinition",",,,") ) /// This type abbreviation has one or more declared type parameters that do not appear in the type being abbreviated. Type abbreviations must use all declared type parameters in the type being abbreviated. Consider removing one or more type parameters, or use a concrete type definition that wraps an underlying type, such as 'type C<'a> = C of ...'. - /// (Originally from ..\FSComp.txt:761) + /// (Originally from ..\FSComp.txt:760) static member tcTypeAbbreviationHasTypeParametersMissingOnType() = (GetStringFunc("tcTypeAbbreviationHasTypeParametersMissingOnType",",,,") ) /// Structs, interfaces, enums and delegates cannot inherit from other types - /// (Originally from ..\FSComp.txt:762) + /// (Originally from ..\FSComp.txt:761) static member tcStructsInterfacesEnumsDelegatesMayNotInheritFromOtherTypes() = (931, GetStringFunc("tcStructsInterfacesEnumsDelegatesMayNotInheritFromOtherTypes",",,,") ) /// Types cannot inherit from multiple concrete types - /// (Originally from ..\FSComp.txt:763) + /// (Originally from ..\FSComp.txt:762) static member tcTypesCannotInheritFromMultipleConcreteTypes() = (932, GetStringFunc("tcTypesCannotInheritFromMultipleConcreteTypes",",,,") ) /// Records, union, abbreviations and struct types cannot have the 'AllowNullLiteral' attribute - /// (Originally from ..\FSComp.txt:764) + /// (Originally from ..\FSComp.txt:763) static member tcRecordsUnionsAbbreviationsStructsMayNotHaveAllowNullLiteralAttribute() = (934, GetStringFunc("tcRecordsUnionsAbbreviationsStructsMayNotHaveAllowNullLiteralAttribute",",,,") ) /// Types with the 'AllowNullLiteral' attribute may only inherit from or implement types which also allow the use of the null literal - /// (Originally from ..\FSComp.txt:765) + /// (Originally from ..\FSComp.txt:764) static member tcAllowNullTypesMayOnlyInheritFromAllowNullTypes() = (935, GetStringFunc("tcAllowNullTypesMayOnlyInheritFromAllowNullTypes",",,,") ) /// Generic types cannot be given the 'StructLayout' attribute - /// (Originally from ..\FSComp.txt:766) + /// (Originally from ..\FSComp.txt:765) static member tcGenericTypesCannotHaveStructLayout() = (936, GetStringFunc("tcGenericTypesCannotHaveStructLayout",",,,") ) /// Only structs and classes without primary constructors may be given the 'StructLayout' attribute - /// (Originally from ..\FSComp.txt:767) + /// (Originally from ..\FSComp.txt:766) static member tcOnlyStructsCanHaveStructLayout() = (937, GetStringFunc("tcOnlyStructsCanHaveStructLayout",",,,") ) /// The representation of this type is hidden by the signature. It must be given an attribute such as [], [] or [] to indicate the characteristics of the type. - /// (Originally from ..\FSComp.txt:768) + /// (Originally from ..\FSComp.txt:767) static member tcRepresentationOfTypeHiddenBySignature() = (938, GetStringFunc("tcRepresentationOfTypeHiddenBySignature",",,,") ) /// Only classes may be given the 'AbstractClass' attribute - /// (Originally from ..\FSComp.txt:769) + /// (Originally from ..\FSComp.txt:768) static member tcOnlyClassesCanHaveAbstract() = (939, GetStringFunc("tcOnlyClassesCanHaveAbstract",",,,") ) /// Only types representing units-of-measure may be given the 'Measure' attribute - /// (Originally from ..\FSComp.txt:770) + /// (Originally from ..\FSComp.txt:769) static member tcOnlyTypesRepresentingUnitsOfMeasureCanHaveMeasure() = (940, GetStringFunc("tcOnlyTypesRepresentingUnitsOfMeasureCanHaveMeasure",",,,") ) /// Accessibility modifiers are not permitted on overrides or interface implementations - /// (Originally from ..\FSComp.txt:771) + /// (Originally from ..\FSComp.txt:770) static member tcOverridesCannotHaveVisibilityDeclarations() = (941, GetStringFunc("tcOverridesCannotHaveVisibilityDeclarations",",,,") ) /// Discriminated union types are always sealed - /// (Originally from ..\FSComp.txt:772) + /// (Originally from ..\FSComp.txt:771) static member tcTypesAreAlwaysSealedDU() = (942, GetStringFunc("tcTypesAreAlwaysSealedDU",",,,") ) /// Record types are always sealed - /// (Originally from ..\FSComp.txt:773) + /// (Originally from ..\FSComp.txt:772) static member tcTypesAreAlwaysSealedRecord() = (942, GetStringFunc("tcTypesAreAlwaysSealedRecord",",,,") ) /// Assembly code types are always sealed - /// (Originally from ..\FSComp.txt:774) + /// (Originally from ..\FSComp.txt:773) static member tcTypesAreAlwaysSealedAssemblyCode() = (942, GetStringFunc("tcTypesAreAlwaysSealedAssemblyCode",",,,") ) /// Struct types are always sealed - /// (Originally from ..\FSComp.txt:775) + /// (Originally from ..\FSComp.txt:774) static member tcTypesAreAlwaysSealedStruct() = (942, GetStringFunc("tcTypesAreAlwaysSealedStruct",",,,") ) /// Delegate types are always sealed - /// (Originally from ..\FSComp.txt:776) + /// (Originally from ..\FSComp.txt:775) static member tcTypesAreAlwaysSealedDelegate() = (942, GetStringFunc("tcTypesAreAlwaysSealedDelegate",",,,") ) /// Enum types are always sealed - /// (Originally from ..\FSComp.txt:777) + /// (Originally from ..\FSComp.txt:776) static member tcTypesAreAlwaysSealedEnum() = (942, GetStringFunc("tcTypesAreAlwaysSealedEnum",",,,") ) /// Interface types and delegate types cannot contain fields - /// (Originally from ..\FSComp.txt:778) + /// (Originally from ..\FSComp.txt:777) static member tcInterfaceTypesAndDelegatesCannotContainFields() = (943, GetStringFunc("tcInterfaceTypesAndDelegatesCannotContainFields",",,,") ) /// Abbreviated types cannot be given the 'Sealed' attribute - /// (Originally from ..\FSComp.txt:779) + /// (Originally from ..\FSComp.txt:778) static member tcAbbreviatedTypesCannotBeSealed() = (944, GetStringFunc("tcAbbreviatedTypesCannotBeSealed",",,,") ) /// Cannot inherit a sealed type - /// (Originally from ..\FSComp.txt:780) + /// (Originally from ..\FSComp.txt:779) static member tcCannotInheritFromSealedType() = (945, GetStringFunc("tcCannotInheritFromSealedType",",,,") ) /// Cannot inherit from interface type. Use interface ... with instead. - /// (Originally from ..\FSComp.txt:781) + /// (Originally from ..\FSComp.txt:780) static member tcCannotInheritFromInterfaceType() = (946, GetStringFunc("tcCannotInheritFromInterfaceType",",,,") ) /// Struct types cannot contain abstract members - /// (Originally from ..\FSComp.txt:782) + /// (Originally from ..\FSComp.txt:781) static member tcStructTypesCannotContainAbstractMembers() = (947, GetStringFunc("tcStructTypesCannotContainAbstractMembers",",,,") ) /// Interface types cannot be sealed - /// (Originally from ..\FSComp.txt:783) + /// (Originally from ..\FSComp.txt:782) static member tcInterfaceTypesCannotBeSealed() = (948, GetStringFunc("tcInterfaceTypesCannotBeSealed",",,,") ) /// Delegate specifications must be of the form 'typ -> typ' - /// (Originally from ..\FSComp.txt:784) + /// (Originally from ..\FSComp.txt:783) static member tcInvalidDelegateSpecification() = (949, GetStringFunc("tcInvalidDelegateSpecification",",,,") ) /// Delegate specifications must not be curried types. Use 'typ * ... * typ -> typ' for multi-argument delegates, and 'typ -> (typ -> typ)' for delegates returning function values. - /// (Originally from ..\FSComp.txt:785) + /// (Originally from ..\FSComp.txt:784) static member tcDelegatesCannotBeCurried() = (950, GetStringFunc("tcDelegatesCannotBeCurried",",,,") ) /// Literal enumerations must have type int, uint, int16, uint16, int64, uint64, byte, sbyte or char - /// (Originally from ..\FSComp.txt:786) + /// (Originally from ..\FSComp.txt:785) static member tcInvalidTypeForLiteralEnumeration() = (951, GetStringFunc("tcInvalidTypeForLiteralEnumeration",",,,") ) /// This type definition involves an immediate cyclic reference through an abbreviation - /// (Originally from ..\FSComp.txt:788) + /// (Originally from ..\FSComp.txt:787) static member tcTypeDefinitionIsCyclic() = (953, GetStringFunc("tcTypeDefinitionIsCyclic",",,,") ) /// This type definition involves an immediate cyclic reference through a struct field or inheritance relation - /// (Originally from ..\FSComp.txt:789) + /// (Originally from ..\FSComp.txt:788) static member tcTypeDefinitionIsCyclicThroughInheritance() = (954, GetStringFunc("tcTypeDefinitionIsCyclicThroughInheritance",",,,") ) /// The syntax 'type X with ...' is reserved for augmentations. Types whose representations are hidden but which have members are now declared in signatures using 'type X = ...'. You may also need to add the '[] attribute to the type definition in the signature - /// (Originally from ..\FSComp.txt:790) + /// (Originally from ..\FSComp.txt:789) static member tcReservedSyntaxForAugmentation() = (GetStringFunc("tcReservedSyntaxForAugmentation",",,,") ) /// Members that extend interface, delegate or enum types must be placed in a module separate to the definition of the type. This module must either have the AutoOpen attribute or be opened explicitly by client code to bring the extension members into scope. - /// (Originally from ..\FSComp.txt:791) + /// (Originally from ..\FSComp.txt:790) static member tcMembersThatExtendInterfaceMustBePlacedInSeparateModule() = (956, GetStringFunc("tcMembersThatExtendInterfaceMustBePlacedInSeparateModule",",,,") ) /// One or more of the declared type parameters for this type extension have a missing or wrong type constraint not matching the original type constraints on '%s' - /// (Originally from ..\FSComp.txt:792) + /// (Originally from ..\FSComp.txt:791) static member tcDeclaredTypeParametersForExtensionDoNotMatchOriginal(a0 : System.String) = (957, GetStringFunc("tcDeclaredTypeParametersForExtensionDoNotMatchOriginal",",,,%s,,,") a0) /// Type definitions may only have one 'inherit' specification and it must be the first declaration - /// (Originally from ..\FSComp.txt:793) + /// (Originally from ..\FSComp.txt:792) static member tcTypeDefinitionsWithImplicitConstructionMustHaveOneInherit() = (959, GetStringFunc("tcTypeDefinitionsWithImplicitConstructionMustHaveOneInherit",",,,") ) /// 'let' and 'do' bindings must come before member and interface definitions in type definitions - /// (Originally from ..\FSComp.txt:794) + /// (Originally from ..\FSComp.txt:793) static member tcTypeDefinitionsWithImplicitConstructionMustHaveLocalBindingsBeforeMembers() = (960, GetStringFunc("tcTypeDefinitionsWithImplicitConstructionMustHaveLocalBindingsBeforeMembers",",,,") ) /// This 'inherit' declaration specifies the inherited type but no arguments. Consider supplying arguments, e.g. 'inherit BaseType(args)'. - /// (Originally from ..\FSComp.txt:795) + /// (Originally from ..\FSComp.txt:794) static member tcInheritDeclarationMissingArguments() = (961, GetStringFunc("tcInheritDeclarationMissingArguments",",,,") ) /// This 'inherit' declaration has arguments, but is not in a type with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'. - /// (Originally from ..\FSComp.txt:796) + /// (Originally from ..\FSComp.txt:795) static member tcInheritConstructionCallNotPartOfImplicitSequence() = (962, GetStringFunc("tcInheritConstructionCallNotPartOfImplicitSequence",",,,") ) /// This definition may only be used in a type with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'. - /// (Originally from ..\FSComp.txt:797) + /// (Originally from ..\FSComp.txt:796) static member tcLetAndDoRequiresImplicitConstructionSequence() = (963, GetStringFunc("tcLetAndDoRequiresImplicitConstructionSequence",",,,") ) /// Type abbreviations cannot have augmentations - /// (Originally from ..\FSComp.txt:798) + /// (Originally from ..\FSComp.txt:797) static member tcTypeAbbreviationsCannotHaveAugmentations() = (964, GetStringFunc("tcTypeAbbreviationsCannotHaveAugmentations",",,,") ) /// The path '%s' is a namespace. A module abbreviation may not abbreviate a namespace. - /// (Originally from ..\FSComp.txt:799) + /// (Originally from ..\FSComp.txt:798) static member tcModuleAbbreviationForNamespace(a0 : System.String) = (965, GetStringFunc("tcModuleAbbreviationForNamespace",",,,%s,,,") a0) /// The type '%s' is used in an invalid way. A value prior to '%s' has an inferred type involving '%s', which is an invalid forward reference. - /// (Originally from ..\FSComp.txt:800) + /// (Originally from ..\FSComp.txt:799) static member tcTypeUsedInInvalidWay(a0 : System.String, a1 : System.String, a2 : System.String) = (966, GetStringFunc("tcTypeUsedInInvalidWay",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The member '%s' is used in an invalid way. A use of '%s' has been inferred prior to the definition of '%s', which is an invalid forward reference. - /// (Originally from ..\FSComp.txt:801) + /// (Originally from ..\FSComp.txt:800) static member tcMemberUsedInInvalidWay(a0 : System.String, a1 : System.String, a2 : System.String) = (967, GetStringFunc("tcMemberUsedInInvalidWay",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The attribute 'AutoOpen(\"%s\")' in the assembly '%s' did not refer to a valid module or namespace in that assembly and has been ignored - /// (Originally from ..\FSComp.txt:804) + /// (Originally from ..\FSComp.txt:803) static member tcAttributeAutoOpenWasIgnored(a0 : System.String, a1 : System.String) = (970, GetStringFunc("tcAttributeAutoOpenWasIgnored",",,,%s,,,%s,,,") a0 a1) /// Undefined value '%s' - /// (Originally from ..\FSComp.txt:805) + /// (Originally from ..\FSComp.txt:804) static member ilUndefinedValue(a0 : System.String) = (971, GetStringFunc("ilUndefinedValue",",,,%s,,,") a0) /// Label %s not found - /// (Originally from ..\FSComp.txt:806) + /// (Originally from ..\FSComp.txt:805) static member ilLabelNotFound(a0 : System.String) = (972, GetStringFunc("ilLabelNotFound",",,,%s,,,") a0) /// Incorrect number of type arguments to local call - /// (Originally from ..\FSComp.txt:807) + /// (Originally from ..\FSComp.txt:806) static member ilIncorrectNumberOfTypeArguments() = (973, GetStringFunc("ilIncorrectNumberOfTypeArguments",",,,") ) /// Dynamic invocation of %s is not supported - /// (Originally from ..\FSComp.txt:808) + /// (Originally from ..\FSComp.txt:807) static member ilDynamicInvocationNotSupported(a0 : System.String) = (GetStringFunc("ilDynamicInvocationNotSupported",",,,%s,,,") a0) /// Taking the address of a literal field is invalid - /// (Originally from ..\FSComp.txt:809) + /// (Originally from ..\FSComp.txt:808) static member ilAddressOfLiteralFieldIsInvalid() = (975, GetStringFunc("ilAddressOfLiteralFieldIsInvalid",",,,") ) /// This operation involves taking the address of a value '%s' represented using a local variable or other special representation. This is invalid. - /// (Originally from ..\FSComp.txt:810) + /// (Originally from ..\FSComp.txt:809) static member ilAddressOfValueHereIsInvalid(a0 : System.String) = (976, GetStringFunc("ilAddressOfValueHereIsInvalid",",,,%s,,,") a0) /// Custom marshallers cannot be specified in F# code. Consider using a C# helper function. - /// (Originally from ..\FSComp.txt:811) + /// (Originally from ..\FSComp.txt:810) static member ilCustomMarshallersCannotBeUsedInFSharp() = (980, GetStringFunc("ilCustomMarshallersCannotBeUsedInFSharp",",,,") ) /// The MarshalAs attribute could not be decoded - /// (Originally from ..\FSComp.txt:812) + /// (Originally from ..\FSComp.txt:811) static member ilMarshalAsAttributeCannotBeDecoded() = (981, GetStringFunc("ilMarshalAsAttributeCannotBeDecoded",",,,") ) /// The signature for this external function contains type parameters. Constrain the argument and return types to indicate the types of the corresponding C function. - /// (Originally from ..\FSComp.txt:813) + /// (Originally from ..\FSComp.txt:812) static member ilSignatureForExternalFunctionContainsTypeParameters() = (982, GetStringFunc("ilSignatureForExternalFunctionContainsTypeParameters",",,,") ) /// The DllImport attribute could not be decoded - /// (Originally from ..\FSComp.txt:814) + /// (Originally from ..\FSComp.txt:813) static member ilDllImportAttributeCouldNotBeDecoded() = (983, GetStringFunc("ilDllImportAttributeCouldNotBeDecoded",",,,") ) /// Literal fields cannot be set - /// (Originally from ..\FSComp.txt:815) + /// (Originally from ..\FSComp.txt:814) static member ilLiteralFieldsCannotBeSet() = (984, GetStringFunc("ilLiteralFieldsCannotBeSet",",,,") ) /// GenSetStorage: %s was represented as a static method but was not an appropriate lambda expression - /// (Originally from ..\FSComp.txt:816) + /// (Originally from ..\FSComp.txt:815) static member ilStaticMethodIsNotLambda(a0 : System.String) = (985, GetStringFunc("ilStaticMethodIsNotLambda",",,,%s,,,") a0) /// Mutable variables cannot escape their method - /// (Originally from ..\FSComp.txt:817) + /// (Originally from ..\FSComp.txt:816) static member ilMutableVariablesCannotEscapeMethod() = (986, GetStringFunc("ilMutableVariablesCannotEscapeMethod",",,,") ) /// Compiler error: unexpected unrealized value - /// (Originally from ..\FSComp.txt:818) + /// (Originally from ..\FSComp.txt:817) static member ilUnexpectedUnrealizedValue() = (987, GetStringFunc("ilUnexpectedUnrealizedValue",",,,") ) /// Main module of program is empty: nothing will happen when it is run - /// (Originally from ..\FSComp.txt:819) + /// (Originally from ..\FSComp.txt:818) static member ilMainModuleEmpty() = (988, GetStringFunc("ilMainModuleEmpty",",,,") ) /// This type cannot be used for a literal field - /// (Originally from ..\FSComp.txt:820) + /// (Originally from ..\FSComp.txt:819) static member ilTypeCannotBeUsedForLiteralField() = (989, GetStringFunc("ilTypeCannotBeUsedForLiteralField",",,,") ) /// Unexpected GetSet annotation on a property - /// (Originally from ..\FSComp.txt:821) + /// (Originally from ..\FSComp.txt:820) static member ilUnexpectedGetSetAnnotation() = (990, GetStringFunc("ilUnexpectedGetSetAnnotation",",,,") ) /// The FieldOffset attribute could not be decoded - /// (Originally from ..\FSComp.txt:822) + /// (Originally from ..\FSComp.txt:821) static member ilFieldOffsetAttributeCouldNotBeDecoded() = (991, GetStringFunc("ilFieldOffsetAttributeCouldNotBeDecoded",",,,") ) /// The StructLayout attribute could not be decoded - /// (Originally from ..\FSComp.txt:823) + /// (Originally from ..\FSComp.txt:822) static member ilStructLayoutAttributeCouldNotBeDecoded() = (992, GetStringFunc("ilStructLayoutAttributeCouldNotBeDecoded",",,,") ) /// The DefaultAugmentation attribute could not be decoded - /// (Originally from ..\FSComp.txt:824) + /// (Originally from ..\FSComp.txt:823) static member ilDefaultAugmentationAttributeCouldNotBeDecoded() = (993, GetStringFunc("ilDefaultAugmentationAttributeCouldNotBeDecoded",",,,") ) /// Reflected definitions cannot contain uses of the prefix splice operator '%%' - /// (Originally from ..\FSComp.txt:825) + /// (Originally from ..\FSComp.txt:824) static member ilReflectedDefinitionsCannotUseSliceOperator() = (994, GetStringFunc("ilReflectedDefinitionsCannotUseSliceOperator",",,,") ) /// Problem with codepage '%d': %s - /// (Originally from ..\FSComp.txt:826) + /// (Originally from ..\FSComp.txt:825) static member optsProblemWithCodepage(a0 : System.Int32, a1 : System.String) = (1000, GetStringFunc("optsProblemWithCodepage",",,,%d,,,%s,,,") a0 a1) /// Copyright (c) Microsoft Corporation. All Rights Reserved. - /// (Originally from ..\FSComp.txt:827) + /// (Originally from ..\FSComp.txt:826) static member optsCopyright() = (GetStringFunc("optsCopyright",",,,") ) /// Freely distributed under the MIT Open Source License. https://github.com/Microsoft/visualfsharp/blob/master/License.txt - /// (Originally from ..\FSComp.txt:828) + /// (Originally from ..\FSComp.txt:827) static member optsCopyrightCommunity() = (GetStringFunc("optsCopyrightCommunity",",,,") ) /// Name of the output file (Short form: -o) - /// (Originally from ..\FSComp.txt:829) + /// (Originally from ..\FSComp.txt:828) static member optsNameOfOutputFile() = (GetStringFunc("optsNameOfOutputFile",",,,") ) /// Build a console executable - /// (Originally from ..\FSComp.txt:830) + /// (Originally from ..\FSComp.txt:829) static member optsBuildConsole() = (GetStringFunc("optsBuildConsole",",,,") ) /// Build a Windows executable - /// (Originally from ..\FSComp.txt:831) + /// (Originally from ..\FSComp.txt:830) static member optsBuildWindows() = (GetStringFunc("optsBuildWindows",",,,") ) /// Build a library (Short form: -a) - /// (Originally from ..\FSComp.txt:832) + /// (Originally from ..\FSComp.txt:831) static member optsBuildLibrary() = (GetStringFunc("optsBuildLibrary",",,,") ) /// Build a module that can be added to another assembly - /// (Originally from ..\FSComp.txt:833) + /// (Originally from ..\FSComp.txt:832) static member optsBuildModule() = (GetStringFunc("optsBuildModule",",,,") ) /// Delay-sign the assembly using only the public portion of the strong name key - /// (Originally from ..\FSComp.txt:834) + /// (Originally from ..\FSComp.txt:833) static member optsDelaySign() = (GetStringFunc("optsDelaySign",",,,") ) /// Public-sign the assembly using only the public portion of the strong name key, and mark the assembly as signed - /// (Originally from ..\FSComp.txt:835) + /// (Originally from ..\FSComp.txt:834) static member optsPublicSign() = (GetStringFunc("optsPublicSign",",,,") ) /// Write the xmldoc of the assembly to the given file - /// (Originally from ..\FSComp.txt:836) + /// (Originally from ..\FSComp.txt:835) static member optsWriteXml() = (GetStringFunc("optsWriteXml",",,,") ) /// Specify a strong name key file - /// (Originally from ..\FSComp.txt:837) + /// (Originally from ..\FSComp.txt:836) static member optsStrongKeyFile() = (GetStringFunc("optsStrongKeyFile",",,,") ) /// Specify a strong name key container - /// (Originally from ..\FSComp.txt:838) + /// (Originally from ..\FSComp.txt:837) static member optsStrongKeyContainer() = (GetStringFunc("optsStrongKeyContainer",",,,") ) /// Limit which platforms this code can run on: x86, Itanium, x64, anycpu32bitpreferred, or anycpu. The default is anycpu. - /// (Originally from ..\FSComp.txt:839) + /// (Originally from ..\FSComp.txt:838) static member optsPlatform() = (GetStringFunc("optsPlatform",",,,") ) /// Only include optimization information essential for implementing inlined constructs. Inhibits cross-module inlining but improves binary compatibility. - /// (Originally from ..\FSComp.txt:840) + /// (Originally from ..\FSComp.txt:839) static member optsNoOpt() = (GetStringFunc("optsNoOpt",",,,") ) /// Don't add a resource to the generated assembly containing F#-specific metadata - /// (Originally from ..\FSComp.txt:841) + /// (Originally from ..\FSComp.txt:840) static member optsNoInterface() = (GetStringFunc("optsNoInterface",",,,") ) /// Print the inferred interface of the assembly to a file - /// (Originally from ..\FSComp.txt:842) + /// (Originally from ..\FSComp.txt:841) static member optsSig() = (GetStringFunc("optsSig",",,,") ) /// Reference an assembly (Short form: -r) - /// (Originally from ..\FSComp.txt:843) + /// (Originally from ..\FSComp.txt:842) static member optsReference() = (GetStringFunc("optsReference",",,,") ) /// Specify a Win32 resource file (.res) - /// (Originally from ..\FSComp.txt:844) + /// (Originally from ..\FSComp.txt:843) static member optsWin32res() = (GetStringFunc("optsWin32res",",,,") ) /// Specify a Win32 manifest file - /// (Originally from ..\FSComp.txt:845) + /// (Originally from ..\FSComp.txt:844) static member optsWin32manifest() = (GetStringFunc("optsWin32manifest",",,,") ) /// Do not include the default Win32 manifest - /// (Originally from ..\FSComp.txt:846) + /// (Originally from ..\FSComp.txt:845) static member optsNowin32manifest() = (GetStringFunc("optsNowin32manifest",",,,") ) /// Embed all source files in the portable PDB file - /// (Originally from ..\FSComp.txt:847) + /// (Originally from ..\FSComp.txt:846) static member optsEmbedAllSource() = (GetStringFunc("optsEmbedAllSource",",,,") ) /// Embed specific source files in the portable PDB file - /// (Originally from ..\FSComp.txt:848) + /// (Originally from ..\FSComp.txt:847) static member optsEmbedSource() = (GetStringFunc("optsEmbedSource",",,,") ) /// Source link information file to embed in the portable PDB file - /// (Originally from ..\FSComp.txt:849) + /// (Originally from ..\FSComp.txt:848) static member optsSourceLink() = (GetStringFunc("optsSourceLink",",,,") ) /// --embed switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - /// (Originally from ..\FSComp.txt:850) + /// (Originally from ..\FSComp.txt:849) static member optsEmbeddedSourceRequirePortablePDBs() = (1501, GetStringFunc("optsEmbeddedSourceRequirePortablePDBs",",,,") ) /// --sourcelink switch only supported when emitting a Portable PDB (--debug:portable or --debug:embedded) - /// (Originally from ..\FSComp.txt:851) + /// (Originally from ..\FSComp.txt:850) static member optsSourceLinkRequirePortablePDBs() = (1502, GetStringFunc("optsSourceLinkRequirePortablePDBs",",,,") ) /// Source file is too large to embed in a portable PDB - /// (Originally from ..\FSComp.txt:852) + /// (Originally from ..\FSComp.txt:851) static member srcFileTooLarge() = (GetStringFunc("srcFileTooLarge",",,,") ) /// Embed the specified managed resource - /// (Originally from ..\FSComp.txt:853) + /// (Originally from ..\FSComp.txt:852) static member optsResource() = (GetStringFunc("optsResource",",,,") ) /// Link the specified resource to this assembly where the resinfo format is [,[,public|private]] - /// (Originally from ..\FSComp.txt:854) + /// (Originally from ..\FSComp.txt:853) static member optsLinkresource() = (GetStringFunc("optsLinkresource",",,,") ) /// Emit debug information (Short form: -g) - /// (Originally from ..\FSComp.txt:855) + /// (Originally from ..\FSComp.txt:854) static member optsDebugPM() = (GetStringFunc("optsDebugPM",",,,") ) /// Specify debugging type: full, portable, embedded, pdbonly. ('%s' is the default if no debuggging type specified and enables attaching a debugger to a running program, 'portable' is a cross-platform format, 'embedded' is a cross-platform format embedded into the output file). - /// (Originally from ..\FSComp.txt:856) + /// (Originally from ..\FSComp.txt:855) static member optsDebug(a0 : System.String) = (GetStringFunc("optsDebug",",,,%s,,,") a0) /// Enable optimizations (Short form: -O) - /// (Originally from ..\FSComp.txt:857) + /// (Originally from ..\FSComp.txt:856) static member optsOptimize() = (GetStringFunc("optsOptimize",",,,") ) /// Enable or disable tailcalls - /// (Originally from ..\FSComp.txt:858) + /// (Originally from ..\FSComp.txt:857) static member optsTailcalls() = (GetStringFunc("optsTailcalls",",,,") ) /// Produce a deterministic assembly (including module version GUID and timestamp) - /// (Originally from ..\FSComp.txt:859) + /// (Originally from ..\FSComp.txt:858) static member optsDeterministic() = (GetStringFunc("optsDeterministic",",,,") ) /// Enable or disable cross-module optimizations - /// (Originally from ..\FSComp.txt:860) + /// (Originally from ..\FSComp.txt:859) static member optsCrossoptimize() = (GetStringFunc("optsCrossoptimize",",,,") ) /// Report all warnings as errors - /// (Originally from ..\FSComp.txt:861) + /// (Originally from ..\FSComp.txt:860) static member optsWarnaserrorPM() = (GetStringFunc("optsWarnaserrorPM",",,,") ) /// Report specific warnings as errors - /// (Originally from ..\FSComp.txt:862) + /// (Originally from ..\FSComp.txt:861) static member optsWarnaserror() = (GetStringFunc("optsWarnaserror",",,,") ) /// Set a warning level (0-5) - /// (Originally from ..\FSComp.txt:863) + /// (Originally from ..\FSComp.txt:862) static member optsWarn() = (GetStringFunc("optsWarn",",,,") ) /// Disable specific warning messages - /// (Originally from ..\FSComp.txt:864) + /// (Originally from ..\FSComp.txt:863) static member optsNowarn() = (GetStringFunc("optsNowarn",",,,") ) /// Enable specific warnings that may be off by default - /// (Originally from ..\FSComp.txt:865) + /// (Originally from ..\FSComp.txt:864) static member optsWarnOn() = (GetStringFunc("optsWarnOn",",,,") ) /// Generate overflow checks - /// (Originally from ..\FSComp.txt:866) + /// (Originally from ..\FSComp.txt:865) static member optsChecked() = (GetStringFunc("optsChecked",",,,") ) /// Define conditional compilation symbols (Short form: -d) - /// (Originally from ..\FSComp.txt:867) + /// (Originally from ..\FSComp.txt:866) static member optsDefine() = (GetStringFunc("optsDefine",",,,") ) /// Ignore ML compatibility warnings - /// (Originally from ..\FSComp.txt:868) + /// (Originally from ..\FSComp.txt:867) static member optsMlcompatibility() = (GetStringFunc("optsMlcompatibility",",,,") ) /// Suppress compiler copyright message - /// (Originally from ..\FSComp.txt:869) + /// (Originally from ..\FSComp.txt:868) static member optsNologo() = (GetStringFunc("optsNologo",",,,") ) /// Display this usage message (Short form: -?) - /// (Originally from ..\FSComp.txt:870) + /// (Originally from ..\FSComp.txt:869) static member optsHelp() = (GetStringFunc("optsHelp",",,,") ) /// Read response file for more options - /// (Originally from ..\FSComp.txt:871) + /// (Originally from ..\FSComp.txt:870) static member optsResponseFile() = (GetStringFunc("optsResponseFile",",,,") ) /// Specify the codepage used to read source files - /// (Originally from ..\FSComp.txt:872) + /// (Originally from ..\FSComp.txt:871) static member optsCodepage() = (GetStringFunc("optsCodepage",",,,") ) /// Output messages in UTF-8 encoding - /// (Originally from ..\FSComp.txt:873) + /// (Originally from ..\FSComp.txt:872) static member optsUtf8output() = (GetStringFunc("optsUtf8output",",,,") ) /// Output messages with fully qualified paths - /// (Originally from ..\FSComp.txt:874) + /// (Originally from ..\FSComp.txt:873) static member optsFullpaths() = (GetStringFunc("optsFullpaths",",,,") ) /// Specify a directory for the include path which is used to resolve source files and assemblies (Short form: -I) - /// (Originally from ..\FSComp.txt:875) + /// (Originally from ..\FSComp.txt:874) static member optsLib() = (GetStringFunc("optsLib",",,,") ) /// Base address for the library to be built - /// (Originally from ..\FSComp.txt:876) + /// (Originally from ..\FSComp.txt:875) static member optsBaseaddress() = (GetStringFunc("optsBaseaddress",",,,") ) /// Do not reference the default CLI assemblies by default - /// (Originally from ..\FSComp.txt:877) + /// (Originally from ..\FSComp.txt:876) static member optsNoframework() = (GetStringFunc("optsNoframework",",,,") ) /// Statically link the F# library and all referenced DLLs that depend on it into the assembly being generated - /// (Originally from ..\FSComp.txt:878) + /// (Originally from ..\FSComp.txt:877) static member optsStandalone() = (GetStringFunc("optsStandalone",",,,") ) /// Statically link the given assembly and all referenced DLLs that depend on this assembly. Use an assembly name e.g. mylib, not a DLL name. - /// (Originally from ..\FSComp.txt:879) + /// (Originally from ..\FSComp.txt:878) static member optsStaticlink() = (GetStringFunc("optsStaticlink",",,,") ) /// Use a resident background compilation service to improve compiler startup times. - /// (Originally from ..\FSComp.txt:880) + /// (Originally from ..\FSComp.txt:879) static member optsResident() = (GetStringFunc("optsResident",",,,") ) /// Name the output debug file - /// (Originally from ..\FSComp.txt:881) + /// (Originally from ..\FSComp.txt:880) static member optsPdb() = (GetStringFunc("optsPdb",",,,") ) /// Resolve assembly references using directory-based rules rather than MSBuild resolution - /// (Originally from ..\FSComp.txt:882) + /// (Originally from ..\FSComp.txt:881) static member optsSimpleresolution() = (GetStringFunc("optsSimpleresolution",",,,") ) /// Unrecognized target '%s', expected 'exe', 'winexe', 'library' or 'module' - /// (Originally from ..\FSComp.txt:883) + /// (Originally from ..\FSComp.txt:882) static member optsUnrecognizedTarget(a0 : System.String) = (1048, GetStringFunc("optsUnrecognizedTarget",",,,%s,,,") a0) /// Unrecognized debug type '%s', expected 'pdbonly' or 'full' - /// (Originally from ..\FSComp.txt:884) + /// (Originally from ..\FSComp.txt:883) static member optsUnrecognizedDebugType(a0 : System.String) = (1049, GetStringFunc("optsUnrecognizedDebugType",",,,%s,,,") a0) /// Invalid warning level '%d' - /// (Originally from ..\FSComp.txt:885) + /// (Originally from ..\FSComp.txt:884) static member optsInvalidWarningLevel(a0 : System.Int32) = (1050, GetStringFunc("optsInvalidWarningLevel",",,,%d,,,") a0) /// Short form of '%s' - /// (Originally from ..\FSComp.txt:886) + /// (Originally from ..\FSComp.txt:885) static member optsShortFormOf(a0 : System.String) = (GetStringFunc("optsShortFormOf",",,,%s,,,") a0) /// The command-line option '--cliroot' has been deprecated. Use an explicit reference to a specific copy of mscorlib.dll instead. - /// (Originally from ..\FSComp.txt:887) + /// (Originally from ..\FSComp.txt:886) static member optsClirootDeprecatedMsg() = (GetStringFunc("optsClirootDeprecatedMsg",",,,") ) /// Use to override where the compiler looks for mscorlib.dll and framework components - /// (Originally from ..\FSComp.txt:888) + /// (Originally from ..\FSComp.txt:887) static member optsClirootDescription() = (GetStringFunc("optsClirootDescription",",,,") ) /// - OUTPUT FILES - - /// (Originally from ..\FSComp.txt:889) + /// (Originally from ..\FSComp.txt:888) static member optsHelpBannerOutputFiles() = (GetStringFunc("optsHelpBannerOutputFiles",",,,") ) /// - INPUT FILES - - /// (Originally from ..\FSComp.txt:890) + /// (Originally from ..\FSComp.txt:889) static member optsHelpBannerInputFiles() = (GetStringFunc("optsHelpBannerInputFiles",",,,") ) /// - RESOURCES - - /// (Originally from ..\FSComp.txt:891) + /// (Originally from ..\FSComp.txt:890) static member optsHelpBannerResources() = (GetStringFunc("optsHelpBannerResources",",,,") ) /// - CODE GENERATION - - /// (Originally from ..\FSComp.txt:892) + /// (Originally from ..\FSComp.txt:891) static member optsHelpBannerCodeGen() = (GetStringFunc("optsHelpBannerCodeGen",",,,") ) /// - ADVANCED - - /// (Originally from ..\FSComp.txt:893) + /// (Originally from ..\FSComp.txt:892) static member optsHelpBannerAdvanced() = (GetStringFunc("optsHelpBannerAdvanced",",,,") ) /// - MISCELLANEOUS - - /// (Originally from ..\FSComp.txt:894) + /// (Originally from ..\FSComp.txt:893) static member optsHelpBannerMisc() = (GetStringFunc("optsHelpBannerMisc",",,,") ) /// - LANGUAGE - - /// (Originally from ..\FSComp.txt:895) + /// (Originally from ..\FSComp.txt:894) static member optsHelpBannerLanguage() = (GetStringFunc("optsHelpBannerLanguage",",,,") ) /// - ERRORS AND WARNINGS - - /// (Originally from ..\FSComp.txt:896) + /// (Originally from ..\FSComp.txt:895) static member optsHelpBannerErrsAndWarns() = (GetStringFunc("optsHelpBannerErrsAndWarns",",,,") ) /// Unknown --test argument: '%s' - /// (Originally from ..\FSComp.txt:897) + /// (Originally from ..\FSComp.txt:896) static member optsUnknownArgumentToTheTestSwitch(a0 : System.String) = (1063, GetStringFunc("optsUnknownArgumentToTheTestSwitch",",,,%s,,,") a0) /// Unrecognized platform '%s', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu' - /// (Originally from ..\FSComp.txt:898) + /// (Originally from ..\FSComp.txt:897) static member optsUnknownPlatform(a0 : System.String) = (1064, GetStringFunc("optsUnknownPlatform",",,,%s,,,") a0) /// The command-line option '%s' is for test purposes only - /// (Originally from ..\FSComp.txt:899) + /// (Originally from ..\FSComp.txt:898) static member optsInternalNoDescription(a0 : System.String) = (GetStringFunc("optsInternalNoDescription",",,,%s,,,") a0) /// The command-line option '%s' has been deprecated - /// (Originally from ..\FSComp.txt:900) + /// (Originally from ..\FSComp.txt:899) static member optsDCLONoDescription(a0 : System.String) = (GetStringFunc("optsDCLONoDescription",",,,%s,,,") a0) /// The command-line option '%s' has been deprecated. Use '%s' instead. - /// (Originally from ..\FSComp.txt:901) + /// (Originally from ..\FSComp.txt:900) static member optsDCLODeprecatedSuggestAlternative(a0 : System.String, a1 : System.String) = (GetStringFunc("optsDCLODeprecatedSuggestAlternative",",,,%s,,,%s,,,") a0 a1) /// The command-line option '%s' has been deprecated. HTML document generation is now part of the F# Power Pack, via the tool FsHtmlDoc.exe. - /// (Originally from ..\FSComp.txt:902) + /// (Originally from ..\FSComp.txt:901) static member optsDCLOHtmlDoc(a0 : System.String) = (GetStringFunc("optsDCLOHtmlDoc",",,,%s,,,") a0) /// Output warning and error messages in color - /// (Originally from ..\FSComp.txt:903) + /// (Originally from ..\FSComp.txt:902) static member optsConsoleColors() = (GetStringFunc("optsConsoleColors",",,,") ) /// Enable high-entropy ASLR - /// (Originally from ..\FSComp.txt:904) + /// (Originally from ..\FSComp.txt:903) static member optsUseHighEntropyVA() = (GetStringFunc("optsUseHighEntropyVA",",,,") ) /// Specify subsystem version of this assembly - /// (Originally from ..\FSComp.txt:905) + /// (Originally from ..\FSComp.txt:904) static member optsSubSystemVersion() = (GetStringFunc("optsSubSystemVersion",",,,") ) /// Specify target framework profile of this assembly. Valid values are mscorlib, netcore or netstandard. Default - mscorlib - /// (Originally from ..\FSComp.txt:906) + /// (Originally from ..\FSComp.txt:905) static member optsTargetProfile() = (GetStringFunc("optsTargetProfile",",,,") ) /// Emit debug information in quotations - /// (Originally from ..\FSComp.txt:907) + /// (Originally from ..\FSComp.txt:906) static member optsEmitDebugInfoInQuotations() = (GetStringFunc("optsEmitDebugInfoInQuotations",",,,") ) /// Specify the preferred output language culture name (e.g. es-ES, ja-JP) - /// (Originally from ..\FSComp.txt:908) + /// (Originally from ..\FSComp.txt:907) static member optsPreferredUiLang() = (GetStringFunc("optsPreferredUiLang",",,,") ) /// Don't copy FSharp.Core.dll along the produced binaries - /// (Originally from ..\FSComp.txt:909) + /// (Originally from ..\FSComp.txt:908) static member optsNoCopyFsharpCore() = (GetStringFunc("optsNoCopyFsharpCore",",,,") ) /// Invalid version '%s' for '--subsystemversion'. The version must be 4.00 or greater. - /// (Originally from ..\FSComp.txt:910) + /// (Originally from ..\FSComp.txt:909) static member optsInvalidSubSystemVersion(a0 : System.String) = (1051, GetStringFunc("optsInvalidSubSystemVersion",",,,%s,,,") a0) /// Invalid value '%s' for '--targetprofile', valid values are 'mscorlib', 'netcore' or 'netstandard'. - /// (Originally from ..\FSComp.txt:911) + /// (Originally from ..\FSComp.txt:910) static member optsInvalidTargetProfile(a0 : System.String) = (1052, GetStringFunc("optsInvalidTargetProfile",",,,%s,,,") a0) /// Full name - /// (Originally from ..\FSComp.txt:912) + /// (Originally from ..\FSComp.txt:911) static member typeInfoFullName() = (GetStringFunc("typeInfoFullName",",,,") ) /// and %d other overloads - /// (Originally from ..\FSComp.txt:916) + /// (Originally from ..\FSComp.txt:915) static member typeInfoOtherOverloads(a0 : System.Int32) = (GetStringFunc("typeInfoOtherOverloads",",,,%d,,,") a0) /// union case - /// (Originally from ..\FSComp.txt:917) + /// (Originally from ..\FSComp.txt:916) static member typeInfoUnionCase() = (GetStringFunc("typeInfoUnionCase",",,,") ) /// active pattern result - /// (Originally from ..\FSComp.txt:918) + /// (Originally from ..\FSComp.txt:917) static member typeInfoActivePatternResult() = (GetStringFunc("typeInfoActivePatternResult",",,,") ) /// active recognizer - /// (Originally from ..\FSComp.txt:919) + /// (Originally from ..\FSComp.txt:918) static member typeInfoActiveRecognizer() = (GetStringFunc("typeInfoActiveRecognizer",",,,") ) /// field - /// (Originally from ..\FSComp.txt:920) + /// (Originally from ..\FSComp.txt:919) static member typeInfoField() = (GetStringFunc("typeInfoField",",,,") ) /// event - /// (Originally from ..\FSComp.txt:921) + /// (Originally from ..\FSComp.txt:920) static member typeInfoEvent() = (GetStringFunc("typeInfoEvent",",,,") ) /// property - /// (Originally from ..\FSComp.txt:922) + /// (Originally from ..\FSComp.txt:921) static member typeInfoProperty() = (GetStringFunc("typeInfoProperty",",,,") ) /// extension - /// (Originally from ..\FSComp.txt:923) + /// (Originally from ..\FSComp.txt:922) static member typeInfoExtension() = (GetStringFunc("typeInfoExtension",",,,") ) /// custom operation - /// (Originally from ..\FSComp.txt:924) + /// (Originally from ..\FSComp.txt:923) static member typeInfoCustomOperation() = (GetStringFunc("typeInfoCustomOperation",",,,") ) /// argument - /// (Originally from ..\FSComp.txt:925) + /// (Originally from ..\FSComp.txt:924) static member typeInfoArgument() = (GetStringFunc("typeInfoArgument",",,,") ) /// anonymous record field - /// (Originally from ..\FSComp.txt:926) + /// (Originally from ..\FSComp.txt:925) static member typeInfoAnonRecdField() = (GetStringFunc("typeInfoAnonRecdField",",,,") ) /// patvar - /// (Originally from ..\FSComp.txt:927) + /// (Originally from ..\FSComp.txt:926) static member typeInfoPatternVariable() = (GetStringFunc("typeInfoPatternVariable",",,,") ) /// namespace - /// (Originally from ..\FSComp.txt:928) + /// (Originally from ..\FSComp.txt:927) static member typeInfoNamespace() = (GetStringFunc("typeInfoNamespace",",,,") ) /// module - /// (Originally from ..\FSComp.txt:929) + /// (Originally from ..\FSComp.txt:928) static member typeInfoModule() = (GetStringFunc("typeInfoModule",",,,") ) /// namespace/module - /// (Originally from ..\FSComp.txt:930) + /// (Originally from ..\FSComp.txt:929) static member typeInfoNamespaceOrModule() = (GetStringFunc("typeInfoNamespaceOrModule",",,,") ) /// from %s - /// (Originally from ..\FSComp.txt:931) + /// (Originally from ..\FSComp.txt:930) static member typeInfoFromFirst(a0 : System.String) = (GetStringFunc("typeInfoFromFirst",",,,%s,,,") a0) /// also from %s - /// (Originally from ..\FSComp.txt:932) + /// (Originally from ..\FSComp.txt:931) static member typeInfoFromNext(a0 : System.String) = (GetStringFunc("typeInfoFromNext",",,,%s,,,") a0) /// generated property - /// (Originally from ..\FSComp.txt:933) + /// (Originally from ..\FSComp.txt:932) static member typeInfoGeneratedProperty() = (GetStringFunc("typeInfoGeneratedProperty",",,,") ) /// generated type - /// (Originally from ..\FSComp.txt:934) + /// (Originally from ..\FSComp.txt:933) static member typeInfoGeneratedType() = (GetStringFunc("typeInfoGeneratedType",",,,") ) /// Found by AssemblyFolders registry key - /// (Originally from ..\FSComp.txt:935) + /// (Originally from ..\FSComp.txt:934) static member assemblyResolutionFoundByAssemblyFoldersKey() = (GetStringFunc("assemblyResolutionFoundByAssemblyFoldersKey",",,,") ) /// Found by AssemblyFoldersEx registry key - /// (Originally from ..\FSComp.txt:936) + /// (Originally from ..\FSComp.txt:935) static member assemblyResolutionFoundByAssemblyFoldersExKey() = (GetStringFunc("assemblyResolutionFoundByAssemblyFoldersExKey",",,,") ) /// .NET Framework - /// (Originally from ..\FSComp.txt:937) + /// (Originally from ..\FSComp.txt:936) static member assemblyResolutionNetFramework() = (GetStringFunc("assemblyResolutionNetFramework",",,,") ) /// Global Assembly Cache - /// (Originally from ..\FSComp.txt:938) + /// (Originally from ..\FSComp.txt:937) static member assemblyResolutionGAC() = (GetStringFunc("assemblyResolutionGAC",",,,") ) /// Recursive class hierarchy in type '%s' - /// (Originally from ..\FSComp.txt:939) + /// (Originally from ..\FSComp.txt:938) static member recursiveClassHierarchy(a0 : System.String) = (1089, GetStringFunc("recursiveClassHierarchy",",,,%s,,,") a0) /// Invalid recursive reference to an abstract slot - /// (Originally from ..\FSComp.txt:940) + /// (Originally from ..\FSComp.txt:939) static member InvalidRecursiveReferenceToAbstractSlot() = (1090, GetStringFunc("InvalidRecursiveReferenceToAbstractSlot",",,,") ) /// The event '%s' has a non-standard type. If this event is declared in another CLI language, you may need to access this event using the explicit %s and %s methods for the event. If this event is declared in F#, make the type of the event an instantiation of either 'IDelegateEvent<_>' or 'IEvent<_,_>'. - /// (Originally from ..\FSComp.txt:941) + /// (Originally from ..\FSComp.txt:940) static member eventHasNonStandardType(a0 : System.String, a1 : System.String, a2 : System.String) = (1091, GetStringFunc("eventHasNonStandardType",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The type '%s' is not accessible from this code location - /// (Originally from ..\FSComp.txt:942) + /// (Originally from ..\FSComp.txt:941) static member typeIsNotAccessible(a0 : System.String) = (1092, GetStringFunc("typeIsNotAccessible",",,,%s,,,") a0) /// The union cases or fields of the type '%s' are not accessible from this code location - /// (Originally from ..\FSComp.txt:943) + /// (Originally from ..\FSComp.txt:942) static member unionCasesAreNotAccessible(a0 : System.String) = (1093, GetStringFunc("unionCasesAreNotAccessible",",,,%s,,,") a0) /// The value '%s' is not accessible from this code location - /// (Originally from ..\FSComp.txt:944) + /// (Originally from ..\FSComp.txt:943) static member valueIsNotAccessible(a0 : System.String) = (1094, GetStringFunc("valueIsNotAccessible",",,,%s,,,") a0) /// The union case '%s' is not accessible from this code location - /// (Originally from ..\FSComp.txt:945) + /// (Originally from ..\FSComp.txt:944) static member unionCaseIsNotAccessible(a0 : System.String) = (1095, GetStringFunc("unionCaseIsNotAccessible",",,,%s,,,") a0) /// The record, struct or class field '%s' is not accessible from this code location - /// (Originally from ..\FSComp.txt:946) + /// (Originally from ..\FSComp.txt:945) static member fieldIsNotAccessible(a0 : System.String) = (1096, GetStringFunc("fieldIsNotAccessible",",,,%s,,,") a0) /// The struct or class field '%s' is not accessible from this code location - /// (Originally from ..\FSComp.txt:947) + /// (Originally from ..\FSComp.txt:946) static member structOrClassFieldIsNotAccessible(a0 : System.String) = (1097, GetStringFunc("structOrClassFieldIsNotAccessible",",,,%s,,,") a0) /// This construct is experimental - /// (Originally from ..\FSComp.txt:948) + /// (Originally from ..\FSComp.txt:947) static member experimentalConstruct() = (GetStringFunc("experimentalConstruct",",,,") ) /// No Invoke methods found for delegate type - /// (Originally from ..\FSComp.txt:949) + /// (Originally from ..\FSComp.txt:948) static member noInvokeMethodsFound() = (1099, GetStringFunc("noInvokeMethodsFound",",,,") ) /// More than one Invoke method found for delegate type - /// (Originally from ..\FSComp.txt:950) + /// (Originally from ..\FSComp.txt:949) static member moreThanOneInvokeMethodFound() = (GetStringFunc("moreThanOneInvokeMethodFound",",,,") ) /// Delegates are not allowed to have curried signatures - /// (Originally from ..\FSComp.txt:951) + /// (Originally from ..\FSComp.txt:950) static member delegatesNotAllowedToHaveCurriedSignatures() = (1101, GetStringFunc("delegatesNotAllowedToHaveCurriedSignatures",",,,") ) /// Unexpected Expr.TyChoose - /// (Originally from ..\FSComp.txt:952) + /// (Originally from ..\FSComp.txt:951) static member tlrUnexpectedTExpr() = (1102, GetStringFunc("tlrUnexpectedTExpr",",,,") ) /// Note: Lambda-lifting optimizations have not been applied because of the use of this local constrained generic function as a first class value. Adding type constraints may resolve this condition. - /// (Originally from ..\FSComp.txt:953) + /// (Originally from ..\FSComp.txt:952) static member tlrLambdaLiftingOptimizationsNotApplied() = (1103, GetStringFunc("tlrLambdaLiftingOptimizationsNotApplied",",,,") ) /// Identifiers containing '@' are reserved for use in F# code generation - /// (Originally from ..\FSComp.txt:954) + /// (Originally from ..\FSComp.txt:953) static member lexhlpIdentifiersContainingAtSymbolReserved() = (1104, GetStringFunc("lexhlpIdentifiersContainingAtSymbolReserved",",,,") ) /// The identifier '%s' is reserved for future use by F# - /// (Originally from ..\FSComp.txt:955) + /// (Originally from ..\FSComp.txt:954) static member lexhlpIdentifierReserved(a0 : System.String) = (GetStringFunc("lexhlpIdentifierReserved",",,,%s,,,") a0) /// Missing variable '%s' - /// (Originally from ..\FSComp.txt:956) + /// (Originally from ..\FSComp.txt:955) static member patcMissingVariable(a0 : System.String) = (1106, GetStringFunc("patcMissingVariable",",,,%s,,,") a0) /// Partial active patterns may only generate one result - /// (Originally from ..\FSComp.txt:957) + /// (Originally from ..\FSComp.txt:956) static member patcPartialActivePatternsGenerateOneResult() = (1107, GetStringFunc("patcPartialActivePatternsGenerateOneResult",",,,") ) /// The type '%s' is required here and is unavailable. You must add a reference to assembly '%s'. - /// (Originally from ..\FSComp.txt:958) + /// (Originally from ..\FSComp.txt:957) static member impTypeRequiredUnavailable(a0 : System.String, a1 : System.String) = (1108, GetStringFunc("impTypeRequiredUnavailable",",,,%s,,,%s,,,") a0 a1) /// A reference to the type '%s' in assembly '%s' was found, but the type could not be found in that assembly - /// (Originally from ..\FSComp.txt:959) + /// (Originally from ..\FSComp.txt:958) static member impReferencedTypeCouldNotBeFoundInAssembly(a0 : System.String, a1 : System.String) = (1109, GetStringFunc("impReferencedTypeCouldNotBeFoundInAssembly",",,,%s,,,%s,,,") a0 a1) /// Internal error or badly formed metadata: not enough type parameters were in scope while importing - /// (Originally from ..\FSComp.txt:960) + /// (Originally from ..\FSComp.txt:959) static member impNotEnoughTypeParamsInScopeWhileImporting() = (1110, GetStringFunc("impNotEnoughTypeParamsInScopeWhileImporting",",,,") ) /// A reference to the DLL %s is required by assembly %s. The imported type %s is located in the first assembly and could not be resolved. - /// (Originally from ..\FSComp.txt:961) + /// (Originally from ..\FSComp.txt:960) static member impReferenceToDllRequiredByAssembly(a0 : System.String, a1 : System.String, a2 : System.String) = (1111, GetStringFunc("impReferenceToDllRequiredByAssembly",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// An imported assembly uses the type '%s' but that type is not public - /// (Originally from ..\FSComp.txt:962) + /// (Originally from ..\FSComp.txt:961) static member impImportedAssemblyUsesNotPublicType(a0 : System.String) = (1112, GetStringFunc("impImportedAssemblyUsesNotPublicType",",,,%s,,,") a0) /// The value '%s' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible - /// (Originally from ..\FSComp.txt:963) + /// (Originally from ..\FSComp.txt:962) static member optValueMarkedInlineButIncomplete(a0 : System.String) = (1113, GetStringFunc("optValueMarkedInlineButIncomplete",",,,%s,,,") a0) /// The value '%s' was marked inline but was not bound in the optimization environment - /// (Originally from ..\FSComp.txt:964) + /// (Originally from ..\FSComp.txt:963) static member optValueMarkedInlineButWasNotBoundInTheOptEnv(a0 : System.String) = (1114, GetStringFunc("optValueMarkedInlineButWasNotBoundInTheOptEnv",",,,%s,,,") a0) /// Local value %s not found during optimization - /// (Originally from ..\FSComp.txt:965) + /// (Originally from ..\FSComp.txt:964) static member optLocalValueNotFoundDuringOptimization(a0 : System.String) = (1115, GetStringFunc("optLocalValueNotFoundDuringOptimization",",,,%s,,,") a0) /// A value marked as 'inline' has an unexpected value - /// (Originally from ..\FSComp.txt:966) + /// (Originally from ..\FSComp.txt:965) static member optValueMarkedInlineHasUnexpectedValue() = (1116, GetStringFunc("optValueMarkedInlineHasUnexpectedValue",",,,") ) /// A value marked as 'inline' could not be inlined - /// (Originally from ..\FSComp.txt:967) + /// (Originally from ..\FSComp.txt:966) static member optValueMarkedInlineCouldNotBeInlined() = (1117, GetStringFunc("optValueMarkedInlineCouldNotBeInlined",",,,") ) /// Failed to inline the value '%s' marked 'inline', perhaps because a recursive value was marked 'inline' - /// (Originally from ..\FSComp.txt:968) + /// (Originally from ..\FSComp.txt:967) static member optFailedToInlineValue(a0 : System.String) = (1118, GetStringFunc("optFailedToInlineValue",",,,%s,,,") a0) /// Recursive ValValue %s - /// (Originally from ..\FSComp.txt:969) + /// (Originally from ..\FSComp.txt:968) static member optRecursiveValValue(a0 : System.String) = (1119, GetStringFunc("optRecursiveValValue",",,,%s,,,") a0) /// The indentation of this 'in' token is incorrect with respect to the corresponding 'let' - /// (Originally from ..\FSComp.txt:970) + /// (Originally from ..\FSComp.txt:969) static member lexfltIncorrentIndentationOfIn() = (GetStringFunc("lexfltIncorrentIndentationOfIn",",,,") ) /// Possible incorrect indentation: this token is offside of context started at position %s. Try indenting this token further or using standard formatting conventions. - /// (Originally from ..\FSComp.txt:971) + /// (Originally from ..\FSComp.txt:970) static member lexfltTokenIsOffsideOfContextStartedEarlier(a0 : System.String) = (GetStringFunc("lexfltTokenIsOffsideOfContextStartedEarlier",",,,%s,,,") a0) /// The '|' tokens separating rules of this pattern match are misaligned by one column. Consider realigning your code or using further indentation. - /// (Originally from ..\FSComp.txt:972) + /// (Originally from ..\FSComp.txt:971) static member lexfltSeparatorTokensOfPatternMatchMisaligned() = (GetStringFunc("lexfltSeparatorTokensOfPatternMatchMisaligned",",,,") ) /// Invalid module/expression/type - /// (Originally from ..\FSComp.txt:973) + /// (Originally from ..\FSComp.txt:972) static member nrInvalidModuleExprType() = (1123, GetStringFunc("nrInvalidModuleExprType",",,,") ) /// Multiple types exist called '%s', taking different numbers of generic parameters. Provide a type instantiation to disambiguate the type resolution, e.g. '%s'. - /// (Originally from ..\FSComp.txt:974) + /// (Originally from ..\FSComp.txt:973) static member nrTypeInstantiationNeededToDisambiguateTypesWithSameName(a0 : System.String, a1 : System.String) = (1124, GetStringFunc("nrTypeInstantiationNeededToDisambiguateTypesWithSameName",",,,%s,,,%s,,,") a0 a1) /// The instantiation of the generic type '%s' is missing and can't be inferred from the arguments or return type of this member. Consider providing a type instantiation when accessing this type, e.g. '%s'. - /// (Originally from ..\FSComp.txt:975) + /// (Originally from ..\FSComp.txt:974) static member nrTypeInstantiationIsMissingAndCouldNotBeInferred(a0 : System.String, a1 : System.String) = (1125, GetStringFunc("nrTypeInstantiationIsMissingAndCouldNotBeInferred",",,,%s,,,%s,,,") a0 a1) /// 'global' may only be used as the first name in a qualified path - /// (Originally from ..\FSComp.txt:976) + /// (Originally from ..\FSComp.txt:975) static member nrGlobalUsedOnlyAsFirstName() = (1126, GetStringFunc("nrGlobalUsedOnlyAsFirstName",",,,") ) /// This is not a constructor or literal, or a constructor is being used incorrectly - /// (Originally from ..\FSComp.txt:977) + /// (Originally from ..\FSComp.txt:976) static member nrIsNotConstructorOrLiteral() = (1127, GetStringFunc("nrIsNotConstructorOrLiteral",",,,") ) /// Unexpected empty long identifier - /// (Originally from ..\FSComp.txt:978) + /// (Originally from ..\FSComp.txt:977) static member nrUnexpectedEmptyLongId() = (1128, GetStringFunc("nrUnexpectedEmptyLongId",",,,") ) /// The record type '%s' does not contain a label '%s'. - /// (Originally from ..\FSComp.txt:979) + /// (Originally from ..\FSComp.txt:978) static member nrRecordDoesNotContainSuchLabel(a0 : System.String, a1 : System.String) = (1129, GetStringFunc("nrRecordDoesNotContainSuchLabel",",,,%s,,,%s,,,") a0 a1) /// Invalid field label - /// (Originally from ..\FSComp.txt:980) + /// (Originally from ..\FSComp.txt:979) static member nrInvalidFieldLabel() = (1130, GetStringFunc("nrInvalidFieldLabel",",,,") ) /// Invalid expression '%s' - /// (Originally from ..\FSComp.txt:981) + /// (Originally from ..\FSComp.txt:980) static member nrInvalidExpression(a0 : System.String) = (1132, GetStringFunc("nrInvalidExpression",",,,%s,,,") a0) /// No constructors are available for the type '%s' - /// (Originally from ..\FSComp.txt:982) + /// (Originally from ..\FSComp.txt:981) static member nrNoConstructorsAvailableForType(a0 : System.String) = (1133, GetStringFunc("nrNoConstructorsAvailableForType",",,,%s,,,") a0) /// The union type for union case '%s' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('%s') in the name you are using. - /// (Originally from ..\FSComp.txt:983) + /// (Originally from ..\FSComp.txt:982) static member nrUnionTypeNeedsQualifiedAccess(a0 : System.String, a1 : System.String) = (1134, GetStringFunc("nrUnionTypeNeedsQualifiedAccess",",,,%s,,,%s,,,") a0 a1) /// The record type for the record field '%s' was defined with the RequireQualifiedAccessAttribute. Include the name of the record type ('%s') in the name you are using. - /// (Originally from ..\FSComp.txt:984) + /// (Originally from ..\FSComp.txt:983) static member nrRecordTypeNeedsQualifiedAccess(a0 : System.String, a1 : System.String) = (1135, GetStringFunc("nrRecordTypeNeedsQualifiedAccess",",,,%s,,,%s,,,") a0 a1) /// Unexpected error creating debug information file '%s' - /// (Originally from ..\FSComp.txt:985) + /// (Originally from ..\FSComp.txt:984) static member ilwriteErrorCreatingPdb(a0 : System.String) = (1136, GetStringFunc("ilwriteErrorCreatingPdb",",,,%s,,,") a0) /// This number is outside the allowable range for this integer type - /// (Originally from ..\FSComp.txt:986) + /// (Originally from ..\FSComp.txt:985) static member lexOutsideIntegerRange() = (1138, GetStringFunc("lexOutsideIntegerRange",",,,") ) /// '%s' is not permitted as a character in operator names and is reserved for future use - /// (Originally from ..\FSComp.txt:990) + /// (Originally from ..\FSComp.txt:989) static member lexCharNotAllowedInOperatorNames(a0 : System.String) = (GetStringFunc("lexCharNotAllowedInOperatorNames",",,,%s,,,") a0) /// Unexpected character '%s' - /// (Originally from ..\FSComp.txt:991) + /// (Originally from ..\FSComp.txt:990) static member lexUnexpectedChar(a0 : System.String) = (GetStringFunc("lexUnexpectedChar",",,,%s,,,") a0) /// This byte array literal contains characters that do not encode as a single byte - /// (Originally from ..\FSComp.txt:992) + /// (Originally from ..\FSComp.txt:991) static member lexByteArrayCannotEncode() = (1140, GetStringFunc("lexByteArrayCannotEncode",",,,") ) /// Identifiers followed by '%s' are reserved for future use - /// (Originally from ..\FSComp.txt:993) + /// (Originally from ..\FSComp.txt:992) static member lexIdentEndInMarkReserved(a0 : System.String) = (1141, GetStringFunc("lexIdentEndInMarkReserved",",,,%s,,,") a0) /// This number is outside the allowable range for 8-bit signed integers - /// (Originally from ..\FSComp.txt:994) + /// (Originally from ..\FSComp.txt:993) static member lexOutsideEightBitSigned() = (1142, GetStringFunc("lexOutsideEightBitSigned",",,,") ) /// This number is outside the allowable range for hexadecimal 8-bit signed integers - /// (Originally from ..\FSComp.txt:995) + /// (Originally from ..\FSComp.txt:994) static member lexOutsideEightBitSignedHex() = (1143, GetStringFunc("lexOutsideEightBitSignedHex",",,,") ) /// This number is outside the allowable range for 8-bit unsigned integers - /// (Originally from ..\FSComp.txt:996) + /// (Originally from ..\FSComp.txt:995) static member lexOutsideEightBitUnsigned() = (1144, GetStringFunc("lexOutsideEightBitUnsigned",",,,") ) /// This number is outside the allowable range for 16-bit signed integers - /// (Originally from ..\FSComp.txt:997) + /// (Originally from ..\FSComp.txt:996) static member lexOutsideSixteenBitSigned() = (1145, GetStringFunc("lexOutsideSixteenBitSigned",",,,") ) /// This number is outside the allowable range for 16-bit unsigned integers - /// (Originally from ..\FSComp.txt:998) + /// (Originally from ..\FSComp.txt:997) static member lexOutsideSixteenBitUnsigned() = (1146, GetStringFunc("lexOutsideSixteenBitUnsigned",",,,") ) /// This number is outside the allowable range for 32-bit signed integers - /// (Originally from ..\FSComp.txt:999) + /// (Originally from ..\FSComp.txt:998) static member lexOutsideThirtyTwoBitSigned() = (1147, GetStringFunc("lexOutsideThirtyTwoBitSigned",",,,") ) /// This number is outside the allowable range for 32-bit unsigned integers - /// (Originally from ..\FSComp.txt:1000) + /// (Originally from ..\FSComp.txt:999) static member lexOutsideThirtyTwoBitUnsigned() = (1148, GetStringFunc("lexOutsideThirtyTwoBitUnsigned",",,,") ) /// This number is outside the allowable range for 64-bit signed integers - /// (Originally from ..\FSComp.txt:1001) + /// (Originally from ..\FSComp.txt:1000) static member lexOutsideSixtyFourBitSigned() = (1149, GetStringFunc("lexOutsideSixtyFourBitSigned",",,,") ) /// This number is outside the allowable range for 64-bit unsigned integers - /// (Originally from ..\FSComp.txt:1002) + /// (Originally from ..\FSComp.txt:1001) static member lexOutsideSixtyFourBitUnsigned() = (1150, GetStringFunc("lexOutsideSixtyFourBitUnsigned",",,,") ) /// This number is outside the allowable range for signed native integers - /// (Originally from ..\FSComp.txt:1003) + /// (Originally from ..\FSComp.txt:1002) static member lexOutsideNativeSigned() = (1151, GetStringFunc("lexOutsideNativeSigned",",,,") ) /// This number is outside the allowable range for unsigned native integers - /// (Originally from ..\FSComp.txt:1004) + /// (Originally from ..\FSComp.txt:1003) static member lexOutsideNativeUnsigned() = (1152, GetStringFunc("lexOutsideNativeUnsigned",",,,") ) /// Invalid floating point number - /// (Originally from ..\FSComp.txt:1005) + /// (Originally from ..\FSComp.txt:1004) static member lexInvalidFloat() = (1153, GetStringFunc("lexInvalidFloat",",,,") ) /// This number is outside the allowable range for decimal literals - /// (Originally from ..\FSComp.txt:1006) + /// (Originally from ..\FSComp.txt:1005) static member lexOusideDecimal() = (1154, GetStringFunc("lexOusideDecimal",",,,") ) /// This number is outside the allowable range for 32-bit floats - /// (Originally from ..\FSComp.txt:1007) + /// (Originally from ..\FSComp.txt:1006) static member lexOusideThirtyTwoBitFloat() = (1155, GetStringFunc("lexOusideThirtyTwoBitFloat",",,,") ) /// This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0b0001 (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger). - /// (Originally from ..\FSComp.txt:1008) + /// (Originally from ..\FSComp.txt:1007) static member lexInvalidNumericLiteral() = (1156, GetStringFunc("lexInvalidNumericLiteral",",,,") ) /// This is not a valid byte literal - /// (Originally from ..\FSComp.txt:1009) + /// (Originally from ..\FSComp.txt:1008) static member lexInvalidByteLiteral() = (1157, GetStringFunc("lexInvalidByteLiteral",",,,") ) /// This is not a valid character literal - /// (Originally from ..\FSComp.txt:1010) + /// (Originally from ..\FSComp.txt:1009) static member lexInvalidCharLiteral() = (1158, GetStringFunc("lexInvalidCharLiteral",",,,") ) /// This Unicode encoding is only valid in string literals - /// (Originally from ..\FSComp.txt:1011) + /// (Originally from ..\FSComp.txt:1010) static member lexThisUnicodeOnlyInStringLiterals() = (1159, GetStringFunc("lexThisUnicodeOnlyInStringLiterals",",,,") ) /// This token is reserved for future use - /// (Originally from ..\FSComp.txt:1012) + /// (Originally from ..\FSComp.txt:1011) static member lexTokenReserved() = (1160, GetStringFunc("lexTokenReserved",",,,") ) /// TABs are not allowed in F# code unless the #indent \"off\" option is used - /// (Originally from ..\FSComp.txt:1013) + /// (Originally from ..\FSComp.txt:1012) static member lexTabsNotAllowed() = (1161, GetStringFunc("lexTabsNotAllowed",",,,") ) /// Invalid line number: '%s' - /// (Originally from ..\FSComp.txt:1014) + /// (Originally from ..\FSComp.txt:1013) static member lexInvalidLineNumber(a0 : System.String) = (1162, GetStringFunc("lexInvalidLineNumber",",,,%s,,,") a0) /// #if directive must appear as the first non-whitespace character on a line - /// (Originally from ..\FSComp.txt:1015) + /// (Originally from ..\FSComp.txt:1014) static member lexHashIfMustBeFirst() = (1163, GetStringFunc("lexHashIfMustBeFirst",",,,") ) /// #else has no matching #if - /// (Originally from ..\FSComp.txt:1016) + /// (Originally from ..\FSComp.txt:1015) static member lexHashElseNoMatchingIf() = (GetStringFunc("lexHashElseNoMatchingIf",",,,") ) /// #endif required for #else - /// (Originally from ..\FSComp.txt:1017) + /// (Originally from ..\FSComp.txt:1016) static member lexHashEndifRequiredForElse() = (GetStringFunc("lexHashEndifRequiredForElse",",,,") ) /// #else directive must appear as the first non-whitespace character on a line - /// (Originally from ..\FSComp.txt:1018) + /// (Originally from ..\FSComp.txt:1017) static member lexHashElseMustBeFirst() = (1166, GetStringFunc("lexHashElseMustBeFirst",",,,") ) /// #endif has no matching #if - /// (Originally from ..\FSComp.txt:1019) + /// (Originally from ..\FSComp.txt:1018) static member lexHashEndingNoMatchingIf() = (GetStringFunc("lexHashEndingNoMatchingIf",",,,") ) /// #endif directive must appear as the first non-whitespace character on a line - /// (Originally from ..\FSComp.txt:1020) + /// (Originally from ..\FSComp.txt:1019) static member lexHashEndifMustBeFirst() = (1168, GetStringFunc("lexHashEndifMustBeFirst",",,,") ) /// #if directive should be immediately followed by an identifier - /// (Originally from ..\FSComp.txt:1021) + /// (Originally from ..\FSComp.txt:1020) static member lexHashIfMustHaveIdent() = (1169, GetStringFunc("lexHashIfMustHaveIdent",",,,") ) /// Syntax error. Wrong nested #endif, unexpected tokens before it. - /// (Originally from ..\FSComp.txt:1022) + /// (Originally from ..\FSComp.txt:1021) static member lexWrongNestedHashEndif() = (1170, GetStringFunc("lexWrongNestedHashEndif",",,,") ) /// #! may only appear as the first line at the start of a file. - /// (Originally from ..\FSComp.txt:1023) + /// (Originally from ..\FSComp.txt:1022) static member lexHashBangMustBeFirstInFile() = (GetStringFunc("lexHashBangMustBeFirstInFile",",,,") ) /// Expected single line comment or end of line - /// (Originally from ..\FSComp.txt:1024) + /// (Originally from ..\FSComp.txt:1023) static member pplexExpectedSingleLineComment() = (1171, GetStringFunc("pplexExpectedSingleLineComment",",,,") ) /// Infix operator member '%s' has no arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ... - /// (Originally from ..\FSComp.txt:1025) + /// (Originally from ..\FSComp.txt:1024) static member memberOperatorDefinitionWithNoArguments(a0 : System.String) = (1172, GetStringFunc("memberOperatorDefinitionWithNoArguments",",,,%s,,,") a0) /// Infix operator member '%s' has %d initial argument(s). Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ... - /// (Originally from ..\FSComp.txt:1026) + /// (Originally from ..\FSComp.txt:1025) static member memberOperatorDefinitionWithNonPairArgument(a0 : System.String, a1 : System.Int32) = (1173, GetStringFunc("memberOperatorDefinitionWithNonPairArgument",",,,%s,,,%d,,,") a0 a1) /// Infix operator member '%s' has extra curried arguments. Expected a tuple of 2 arguments, e.g. static member (+) (x,y) = ... - /// (Originally from ..\FSComp.txt:1027) + /// (Originally from ..\FSComp.txt:1026) static member memberOperatorDefinitionWithCurriedArguments(a0 : System.String) = (1174, GetStringFunc("memberOperatorDefinitionWithCurriedArguments",",,,%s,,,") a0) /// All record, union and struct types in FSharp.Core.dll must be explicitly labelled with 'StructuralComparison' or 'NoComparison' - /// (Originally from ..\FSComp.txt:1028) + /// (Originally from ..\FSComp.txt:1027) static member tcFSharpCoreRequiresExplicit() = (1175, GetStringFunc("tcFSharpCoreRequiresExplicit",",,,") ) /// The struct, record or union type '%s' has the 'StructuralComparison' attribute but the type parameter '%s' does not satisfy the 'comparison' constraint. Consider adding the 'comparison' constraint to the type parameter - /// (Originally from ..\FSComp.txt:1029) + /// (Originally from ..\FSComp.txt:1028) static member tcStructuralComparisonNotSatisfied1(a0 : System.String, a1 : System.String) = (1176, GetStringFunc("tcStructuralComparisonNotSatisfied1",",,,%s,,,%s,,,") a0 a1) /// The struct, record or union type '%s' has the 'StructuralComparison' attribute but the component type '%s' does not satisfy the 'comparison' constraint - /// (Originally from ..\FSComp.txt:1030) + /// (Originally from ..\FSComp.txt:1029) static member tcStructuralComparisonNotSatisfied2(a0 : System.String, a1 : System.String) = (1177, GetStringFunc("tcStructuralComparisonNotSatisfied2",",,,%s,,,%s,,,") a0 a1) /// The struct, record or union type '%s' is not structurally comparable because the type parameter %s does not satisfy the 'comparison' constraint. Consider adding the 'NoComparison' attribute to the type '%s' to clarify that the type is not comparable - /// (Originally from ..\FSComp.txt:1031) + /// (Originally from ..\FSComp.txt:1030) static member tcNoComparisonNeeded1(a0 : System.String, a1 : System.String, a2 : System.String) = (1178, GetStringFunc("tcNoComparisonNeeded1",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The struct, record or union type '%s' is not structurally comparable because the type '%s' does not satisfy the 'comparison' constraint. Consider adding the 'NoComparison' attribute to the type '%s' to clarify that the type is not comparable - /// (Originally from ..\FSComp.txt:1032) + /// (Originally from ..\FSComp.txt:1031) static member tcNoComparisonNeeded2(a0 : System.String, a1 : System.String, a2 : System.String) = (1178, GetStringFunc("tcNoComparisonNeeded2",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The struct, record or union type '%s' does not support structural equality because the type parameter %s does not satisfy the 'equality' constraint. Consider adding the 'NoEquality' attribute to the type '%s' to clarify that the type does not support structural equality - /// (Originally from ..\FSComp.txt:1033) + /// (Originally from ..\FSComp.txt:1032) static member tcNoEqualityNeeded1(a0 : System.String, a1 : System.String, a2 : System.String) = (1178, GetStringFunc("tcNoEqualityNeeded1",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The struct, record or union type '%s' does not support structural equality because the type '%s' does not satisfy the 'equality' constraint. Consider adding the 'NoEquality' attribute to the type '%s' to clarify that the type does not support structural equality - /// (Originally from ..\FSComp.txt:1034) + /// (Originally from ..\FSComp.txt:1033) static member tcNoEqualityNeeded2(a0 : System.String, a1 : System.String, a2 : System.String) = (1178, GetStringFunc("tcNoEqualityNeeded2",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The struct, record or union type '%s' has the 'StructuralEquality' attribute but the type parameter '%s' does not satisfy the 'equality' constraint. Consider adding the 'equality' constraint to the type parameter - /// (Originally from ..\FSComp.txt:1035) + /// (Originally from ..\FSComp.txt:1034) static member tcStructuralEqualityNotSatisfied1(a0 : System.String, a1 : System.String) = (1179, GetStringFunc("tcStructuralEqualityNotSatisfied1",",,,%s,,,%s,,,") a0 a1) /// The struct, record or union type '%s' has the 'StructuralEquality' attribute but the component type '%s' does not satisfy the 'equality' constraint - /// (Originally from ..\FSComp.txt:1036) + /// (Originally from ..\FSComp.txt:1035) static member tcStructuralEqualityNotSatisfied2(a0 : System.String, a1 : System.String) = (1180, GetStringFunc("tcStructuralEqualityNotSatisfied2",",,,%s,,,%s,,,") a0 a1) /// Each argument of the primary constructor for a struct must be given a type, for example 'type S(x1:int, x2: int) = ...'. These arguments determine the fields of the struct. - /// (Originally from ..\FSComp.txt:1037) + /// (Originally from ..\FSComp.txt:1036) static member tcStructsMustDeclareTypesOfImplicitCtorArgsExplicitly() = (1181, GetStringFunc("tcStructsMustDeclareTypesOfImplicitCtorArgsExplicitly",",,,") ) /// The value '%s' is unused - /// (Originally from ..\FSComp.txt:1038) + /// (Originally from ..\FSComp.txt:1037) static member chkUnusedValue(a0 : System.String) = (1182, GetStringFunc("chkUnusedValue",",,,%s,,,") a0) /// The recursive object reference '%s' is unused. The presence of a recursive object reference adds runtime initialization checks to members in this and derived types. Consider removing this recursive object reference. - /// (Originally from ..\FSComp.txt:1039) + /// (Originally from ..\FSComp.txt:1038) static member chkUnusedThisVariable(a0 : System.String) = (1183, GetStringFunc("chkUnusedThisVariable",",,,%s,,,") a0) /// A getter property may have at most one argument group - /// (Originally from ..\FSComp.txt:1040) + /// (Originally from ..\FSComp.txt:1039) static member parsGetterAtMostOneArgument() = (1184, GetStringFunc("parsGetterAtMostOneArgument",",,,") ) /// A setter property may have at most two argument groups - /// (Originally from ..\FSComp.txt:1041) + /// (Originally from ..\FSComp.txt:1040) static member parsSetterAtMostTwoArguments() = (1185, GetStringFunc("parsSetterAtMostTwoArguments",",,,") ) /// Invalid property getter or setter - /// (Originally from ..\FSComp.txt:1042) + /// (Originally from ..\FSComp.txt:1041) static member parsInvalidProperty() = (1186, GetStringFunc("parsInvalidProperty",",,,") ) /// An indexer property must be given at least one argument - /// (Originally from ..\FSComp.txt:1043) + /// (Originally from ..\FSComp.txt:1042) static member parsIndexerPropertyRequiresAtLeastOneArgument() = (1187, GetStringFunc("parsIndexerPropertyRequiresAtLeastOneArgument",",,,") ) /// This operation accesses a mutable top-level value defined in another assembly in an unsupported way. The value cannot be accessed through its address. Consider copying the expression to a mutable local, e.g. 'let mutable x = ...', and if necessary assigning the value back after the completion of the operation - /// (Originally from ..\FSComp.txt:1044) + /// (Originally from ..\FSComp.txt:1043) static member tastInvalidAddressOfMutableAcrossAssemblyBoundary() = (1188, GetStringFunc("tastInvalidAddressOfMutableAcrossAssemblyBoundary",",,,") ) /// Remove spaces between the type name and type parameter, e.g. \"type C<'T>\", not type \"C <'T>\". Type parameters must be placed directly adjacent to the type name. - /// (Originally from ..\FSComp.txt:1045) + /// (Originally from ..\FSComp.txt:1044) static member parsNonAdjacentTypars() = (1189, GetStringFunc("parsNonAdjacentTypars",",,,") ) /// Remove spaces between the type name and type parameter, e.g. \"C<'T>\", not \"C <'T>\". Type parameters must be placed directly adjacent to the type name. - /// (Originally from ..\FSComp.txt:1046) + /// (Originally from ..\FSComp.txt:1045) static member parsNonAdjacentTyargs() = (1190, GetStringFunc("parsNonAdjacentTyargs",",,,") ) /// The use of the type syntax 'int C' and 'C ' is not permitted here. Consider adjusting this type to be written in the form 'C' - /// (Originally from ..\FSComp.txt:1047) + /// (Originally from ..\FSComp.txt:1046) static member parsNonAtomicType() = (GetStringFunc("parsNonAtomicType",",,,") ) /// The module/namespace '%s' from compilation unit '%s' did not contain the module/namespace '%s' - /// (Originally from ..\FSComp.txt:1050) + /// (Originally from ..\FSComp.txt:1049) static member tastUndefinedItemRefModuleNamespace(a0 : System.String, a1 : System.String, a2 : System.String) = (1193, GetStringFunc("tastUndefinedItemRefModuleNamespace",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The module/namespace '%s' from compilation unit '%s' did not contain the val '%s' - /// (Originally from ..\FSComp.txt:1051) + /// (Originally from ..\FSComp.txt:1050) static member tastUndefinedItemRefVal(a0 : System.String, a1 : System.String, a2 : System.String) = (1194, GetStringFunc("tastUndefinedItemRefVal",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The module/namespace '%s' from compilation unit '%s' did not contain the namespace, module or type '%s' - /// (Originally from ..\FSComp.txt:1052) + /// (Originally from ..\FSComp.txt:1051) static member tastUndefinedItemRefModuleNamespaceType(a0 : System.String, a1 : System.String, a2 : System.String) = (1195, GetStringFunc("tastUndefinedItemRefModuleNamespaceType",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The 'UseNullAsTrueValue' attribute flag may only be used with union types that have one nullary case and at least one non-nullary case - /// (Originally from ..\FSComp.txt:1053) + /// (Originally from ..\FSComp.txt:1052) static member tcInvalidUseNullAsTrueValue() = (1196, GetStringFunc("tcInvalidUseNullAsTrueValue",",,,") ) /// The parameter '%s' was inferred to have byref type. Parameters of byref type must be given an explicit type annotation, e.g. 'x1: byref'. When used, a byref parameter is implicitly dereferenced. - /// (Originally from ..\FSComp.txt:1054) + /// (Originally from ..\FSComp.txt:1053) static member tcParameterInferredByref(a0 : System.String) = (1197, GetStringFunc("tcParameterInferredByref",",,,%s,,,") a0) /// The generic member '%s' has been used at a non-uniform instantiation prior to this program point. Consider reordering the members so this member occurs first. Alternatively, specify the full type of the member explicitly, including argument types, return type and any additional generic parameters and constraints. - /// (Originally from ..\FSComp.txt:1055) + /// (Originally from ..\FSComp.txt:1054) static member tcNonUniformMemberUse(a0 : System.String) = (1198, GetStringFunc("tcNonUniformMemberUse",",,,%s,,,") a0) /// The attribute '%s' appears in both the implementation and the signature, but the attribute arguments differ. Only the attribute from the signature will be included in the compiled code. - /// (Originally from ..\FSComp.txt:1056) + /// (Originally from ..\FSComp.txt:1055) static member tcAttribArgsDiffer(a0 : System.String) = (1200, GetStringFunc("tcAttribArgsDiffer",",,,%s,,,") a0) /// Cannot call an abstract base member: '%s' - /// (Originally from ..\FSComp.txt:1057) + /// (Originally from ..\FSComp.txt:1056) static member tcCannotCallAbstractBaseMember(a0 : System.String) = (1201, GetStringFunc("tcCannotCallAbstractBaseMember",",,,%s,,,") a0) /// Could not resolve the ambiguity in the use of a generic construct with an 'unmanaged' constraint at or near this position - /// (Originally from ..\FSComp.txt:1058) + /// (Originally from ..\FSComp.txt:1057) static member typrelCannotResolveAmbiguityInUnmanaged() = (1202, GetStringFunc("typrelCannotResolveAmbiguityInUnmanaged",",,,") ) /// This construct is for ML compatibility. %s. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'. - /// (Originally from ..\FSComp.txt:1061) + /// (Originally from ..\FSComp.txt:1060) static member mlCompatMessage(a0 : System.String) = (GetStringFunc("mlCompatMessage",",,,%s,,,") a0) /// The type '%s' has been marked as having an Explicit layout, but the field '%s' has not been marked with the 'FieldOffset' attribute - /// (Originally from ..\FSComp.txt:1063) + /// (Originally from ..\FSComp.txt:1062) static member ilFieldDoesNotHaveValidOffsetForStructureLayout(a0 : System.String, a1 : System.String) = (1206, GetStringFunc("ilFieldDoesNotHaveValidOffsetForStructureLayout",",,,%s,,,%s,,,") a0 a1) /// Interfaces inherited by other interfaces should be declared using 'inherit ...' instead of 'interface ...' - /// (Originally from ..\FSComp.txt:1064) + /// (Originally from ..\FSComp.txt:1063) static member tcInterfacesShouldUseInheritNotInterface() = (1207, GetStringFunc("tcInterfacesShouldUseInheritNotInterface",",,,") ) /// Invalid prefix operator - /// (Originally from ..\FSComp.txt:1065) + /// (Originally from ..\FSComp.txt:1064) static member parsInvalidPrefixOperator() = (1208, GetStringFunc("parsInvalidPrefixOperator",",,,") ) /// Invalid operator definition. Prefix operator definitions must use a valid prefix operator name. - /// (Originally from ..\FSComp.txt:1066) + /// (Originally from ..\FSComp.txt:1065) static member parsInvalidPrefixOperatorDefinition() = (1208, GetStringFunc("parsInvalidPrefixOperatorDefinition",",,,") ) /// The file extensions '.ml' and '.mli' are for ML compatibility - /// (Originally from ..\FSComp.txt:1067) + /// (Originally from ..\FSComp.txt:1066) static member buildCompilingExtensionIsForML() = (GetStringFunc("buildCompilingExtensionIsForML",",,,") ) /// Consider using a file with extension '.ml' or '.mli' instead - /// (Originally from ..\FSComp.txt:1068) + /// (Originally from ..\FSComp.txt:1067) static member lexIndentOffForML() = (GetStringFunc("lexIndentOffForML",",,,") ) /// Active pattern '%s' is not a function - /// (Originally from ..\FSComp.txt:1069) + /// (Originally from ..\FSComp.txt:1068) static member activePatternIdentIsNotFunctionTyped(a0 : System.String) = (1209, GetStringFunc("activePatternIdentIsNotFunctionTyped",",,,%s,,,") a0) /// Active pattern '%s' has a result type containing type variables that are not determined by the input. The common cause is a when a result case is not mentioned, e.g. 'let (|A|B|) (x:int) = A x'. This can be fixed with a type constraint, e.g. 'let (|A|B|) (x:int) : Choice = A x' - /// (Originally from ..\FSComp.txt:1070) + /// (Originally from ..\FSComp.txt:1069) static member activePatternChoiceHasFreeTypars(a0 : System.String) = (1210, GetStringFunc("activePatternChoiceHasFreeTypars",",,,%s,,,") a0) /// The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit) - /// (Originally from ..\FSComp.txt:1071) + /// (Originally from ..\FSComp.txt:1070) static member ilFieldHasOffsetForSequentialLayout() = (1211, GetStringFunc("ilFieldHasOffsetForSequentialLayout",",,,") ) /// Optional arguments must come at the end of the argument list, after any non-optional arguments - /// (Originally from ..\FSComp.txt:1072) + /// (Originally from ..\FSComp.txt:1071) static member tcOptionalArgsMustComeAfterNonOptionalArgs() = (1212, GetStringFunc("tcOptionalArgsMustComeAfterNonOptionalArgs",",,,") ) /// Attribute 'System.Diagnostics.ConditionalAttribute' is only valid on methods or attribute classes - /// (Originally from ..\FSComp.txt:1073) + /// (Originally from ..\FSComp.txt:1072) static member tcConditionalAttributeUsage() = (1213, GetStringFunc("tcConditionalAttributeUsage",",,,") ) /// Extension members cannot provide operator overloads. Consider defining the operator as part of the type definition instead. - /// (Originally from ..\FSComp.txt:1075) + /// (Originally from ..\FSComp.txt:1074) static member tcMemberOperatorDefinitionInExtrinsic() = (1215, GetStringFunc("tcMemberOperatorDefinitionInExtrinsic",",,,") ) /// The name of the MDB file must be .mdb. The --pdb option will be ignored. - /// (Originally from ..\FSComp.txt:1076) + /// (Originally from ..\FSComp.txt:1075) static member ilwriteMDBFileNameCannotBeChangedWarning() = (1216, GetStringFunc("ilwriteMDBFileNameCannotBeChangedWarning",",,,") ) /// MDB generation failed. Could not find compatible member %s - /// (Originally from ..\FSComp.txt:1077) + /// (Originally from ..\FSComp.txt:1076) static member ilwriteMDBMemberMissing(a0 : System.String) = (1217, GetStringFunc("ilwriteMDBMemberMissing",",,,%s,,,") a0) /// Cannot generate MDB debug information. Failed to load the 'MonoSymbolWriter' type from the 'Mono.CompilerServices.SymbolWriter.dll' assembly. - /// (Originally from ..\FSComp.txt:1078) + /// (Originally from ..\FSComp.txt:1077) static member ilwriteErrorCreatingMdb() = (1218, GetStringFunc("ilwriteErrorCreatingMdb",",,,") ) /// The union case named '%s' conflicts with the generated type '%s' - /// (Originally from ..\FSComp.txt:1079) + /// (Originally from ..\FSComp.txt:1078) static member tcUnionCaseNameConflictsWithGeneratedType(a0 : System.String, a1 : System.String) = (1219, GetStringFunc("tcUnionCaseNameConflictsWithGeneratedType",",,,%s,,,%s,,,") a0 a1) /// ReflectedDefinitionAttribute may not be applied to an instance member on a struct type, because the instance member takes an implicit 'this' byref parameter - /// (Originally from ..\FSComp.txt:1080) + /// (Originally from ..\FSComp.txt:1079) static member chkNoReflectedDefinitionOnStructMember() = (1220, GetStringFunc("chkNoReflectedDefinitionOnStructMember",",,,") ) /// DLLImport bindings must be static members in a class or function definitions in a module - /// (Originally from ..\FSComp.txt:1081) + /// (Originally from ..\FSComp.txt:1080) static member tcDllImportNotAllowed() = (1221, GetStringFunc("tcDllImportNotAllowed",",,,") ) /// When mscorlib.dll or FSharp.Core.dll is explicitly referenced the %s option must also be passed - /// (Originally from ..\FSComp.txt:1082) + /// (Originally from ..\FSComp.txt:1081) static member buildExplicitCoreLibRequiresNoFramework(a0 : System.String) = (1222, GetStringFunc("buildExplicitCoreLibRequiresNoFramework",",,,%s,,,") a0) /// FSharp.Core.sigdata not found alongside FSharp.Core. File expected in %s. Consider upgrading to a more recent version of FSharp.Core, where this file is no longer be required. - /// (Originally from ..\FSComp.txt:1083) + /// (Originally from ..\FSComp.txt:1082) static member buildExpectedSigdataFile(a0 : System.String) = (1223, GetStringFunc("buildExpectedSigdataFile",",,,%s,,,") a0) /// File '%s' not found alongside FSharp.Core. File expected in %s. Consider upgrading to a more recent version of FSharp.Core, where this file is no longer be required. - /// (Originally from ..\FSComp.txt:1084) + /// (Originally from ..\FSComp.txt:1083) static member buildExpectedFileAlongSideFSharpCore(a0 : System.String, a1 : System.String) = (1225, GetStringFunc("buildExpectedFileAlongSideFSharpCore",",,,%s,,,%s,,,") a0 a1) /// Filename '%s' contains invalid character '%s' - /// (Originally from ..\FSComp.txt:1085) + /// (Originally from ..\FSComp.txt:1084) static member buildUnexpectedFileNameCharacter(a0 : System.String, a1 : System.String) = (1227, GetStringFunc("buildUnexpectedFileNameCharacter",",,,%s,,,%s,,,") a0 a1) /// 'use!' bindings must be of the form 'use! = ' - /// (Originally from ..\FSComp.txt:1086) + /// (Originally from ..\FSComp.txt:1085) static member tcInvalidUseBangBinding() = (1228, GetStringFunc("tcInvalidUseBangBinding",",,,") ) /// Inner generic functions are not permitted in quoted expressions. Consider adding some type constraints until this function is no longer generic. - /// (Originally from ..\FSComp.txt:1087) + /// (Originally from ..\FSComp.txt:1086) static member crefNoInnerGenericsInQuotations() = (1230, GetStringFunc("crefNoInnerGenericsInQuotations",",,,") ) /// The type '%s' is not a valid enumerator type , i.e. does not have a 'MoveNext()' method returning a bool, and a 'Current' property - /// (Originally from ..\FSComp.txt:1088) + /// (Originally from ..\FSComp.txt:1087) static member tcEnumTypeCannotBeEnumerated(a0 : System.String) = (1231, GetStringFunc("tcEnumTypeCannotBeEnumerated",",,,%s,,,") a0) /// End of file in triple-quote string begun at or before here - /// (Originally from ..\FSComp.txt:1089) + /// (Originally from ..\FSComp.txt:1088) static member parsEofInTripleQuoteString() = (1232, GetStringFunc("parsEofInTripleQuoteString",",,,") ) /// End of file in triple-quote string embedded in comment begun at or before here - /// (Originally from ..\FSComp.txt:1090) + /// (Originally from ..\FSComp.txt:1089) static member parsEofInTripleQuoteStringInComment() = (1233, GetStringFunc("parsEofInTripleQuoteStringInComment",",,,") ) /// This type test or downcast will ignore the unit-of-measure '%s' - /// (Originally from ..\FSComp.txt:1091) + /// (Originally from ..\FSComp.txt:1090) static member tcTypeTestLosesMeasures(a0 : System.String) = (1240, GetStringFunc("tcTypeTestLosesMeasures",",,,%s,,,") a0) /// Expected type argument or static argument - /// (Originally from ..\FSComp.txt:1092) + /// (Originally from ..\FSComp.txt:1091) static member parsMissingTypeArgs() = (1241, GetStringFunc("parsMissingTypeArgs",",,,") ) /// Unmatched '<'. Expected closing '>' - /// (Originally from ..\FSComp.txt:1093) + /// (Originally from ..\FSComp.txt:1092) static member parsMissingGreaterThan() = (1242, GetStringFunc("parsMissingGreaterThan",",,,") ) /// Unexpected quotation operator '<@' in type definition. If you intend to pass a verbatim string as a static argument to a type provider, put a space between the '<' and '@' characters. - /// (Originally from ..\FSComp.txt:1094) + /// (Originally from ..\FSComp.txt:1093) static member parsUnexpectedQuotationOperatorInTypeAliasDidYouMeanVerbatimString() = (1243, GetStringFunc("parsUnexpectedQuotationOperatorInTypeAliasDidYouMeanVerbatimString",",,,") ) /// Attempted to parse this as an operator name, but failed - /// (Originally from ..\FSComp.txt:1095) + /// (Originally from ..\FSComp.txt:1094) static member parsErrorParsingAsOperatorName() = (1244, GetStringFunc("parsErrorParsingAsOperatorName",",,,") ) /// \U%s is not a valid Unicode character escape sequence - /// (Originally from ..\FSComp.txt:1096) + /// (Originally from ..\FSComp.txt:1095) static member lexInvalidUnicodeLiteral(a0 : System.String) = (1245, GetStringFunc("lexInvalidUnicodeLiteral",",,,%s,,,") a0) /// '%s' must be applied to an argument of type '%s', but has been applied to an argument of type '%s' - /// (Originally from ..\FSComp.txt:1097) + /// (Originally from ..\FSComp.txt:1096) static member tcCallerInfoWrongType(a0 : System.String, a1 : System.String, a2 : System.String) = (1246, GetStringFunc("tcCallerInfoWrongType",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// '%s' can only be applied to optional arguments - /// (Originally from ..\FSComp.txt:1098) + /// (Originally from ..\FSComp.txt:1097) static member tcCallerInfoNotOptional(a0 : System.String) = (1247, GetStringFunc("tcCallerInfoNotOptional",",,,%s,,,") a0) /// The specified .NET Framework version '%s' is not supported. Please specify a value from the enumeration Microsoft.Build.Utilities.TargetDotNetFrameworkVersion. - /// (Originally from ..\FSComp.txt:1100) + /// (Originally from ..\FSComp.txt:1099) static member toolLocationHelperUnsupportedFrameworkVersion(a0 : System.String) = (1300, GetStringFunc("toolLocationHelperUnsupportedFrameworkVersion",",,,%s,,,") a0) /// Invalid Magic value in CLR Header - /// (Originally from ..\FSComp.txt:1104) + /// (Originally from ..\FSComp.txt:1103) static member ilSignInvalidMagicValue() = (1301, GetStringFunc("ilSignInvalidMagicValue",",,,") ) /// Bad image format - /// (Originally from ..\FSComp.txt:1105) + /// (Originally from ..\FSComp.txt:1104) static member ilSignBadImageFormat() = (1302, GetStringFunc("ilSignBadImageFormat",",,,") ) /// Private key expected - /// (Originally from ..\FSComp.txt:1106) + /// (Originally from ..\FSComp.txt:1105) static member ilSignPrivateKeyExpected() = (1303, GetStringFunc("ilSignPrivateKeyExpected",",,,") ) /// RSA key expected - /// (Originally from ..\FSComp.txt:1107) + /// (Originally from ..\FSComp.txt:1106) static member ilSignRsaKeyExpected() = (1304, GetStringFunc("ilSignRsaKeyExpected",",,,") ) /// Invalid bit Length - /// (Originally from ..\FSComp.txt:1108) + /// (Originally from ..\FSComp.txt:1107) static member ilSignInvalidBitLen() = (1305, GetStringFunc("ilSignInvalidBitLen",",,,") ) /// Invalid RSAParameters structure - '{0}' expected - /// (Originally from ..\FSComp.txt:1109) + /// (Originally from ..\FSComp.txt:1108) static member ilSignInvalidRSAParams() = (1306, GetStringFunc("ilSignInvalidRSAParams",",,,") ) /// Invalid algId - 'Exponent' expected - /// (Originally from ..\FSComp.txt:1110) + /// (Originally from ..\FSComp.txt:1109) static member ilSignInvalidAlgId() = (1307, GetStringFunc("ilSignInvalidAlgId",",,,") ) /// Invalid signature size - /// (Originally from ..\FSComp.txt:1111) + /// (Originally from ..\FSComp.txt:1110) static member ilSignInvalidSignatureSize() = (1308, GetStringFunc("ilSignInvalidSignatureSize",",,,") ) /// No signature directory - /// (Originally from ..\FSComp.txt:1112) + /// (Originally from ..\FSComp.txt:1111) static member ilSignNoSignatureDirectory() = (1309, GetStringFunc("ilSignNoSignatureDirectory",",,,") ) /// Invalid Public Key blob - /// (Originally from ..\FSComp.txt:1113) + /// (Originally from ..\FSComp.txt:1112) static member ilSignInvalidPKBlob() = (1310, GetStringFunc("ilSignInvalidPKBlob",",,,") ) /// Exiting - too many errors - /// (Originally from ..\FSComp.txt:1115) + /// (Originally from ..\FSComp.txt:1114) static member fscTooManyErrors() = (GetStringFunc("fscTooManyErrors",",,,") ) /// The documentation file has no .xml suffix - /// (Originally from ..\FSComp.txt:1116) + /// (Originally from ..\FSComp.txt:1115) static member docfileNoXmlSuffix() = (2001, GetStringFunc("docfileNoXmlSuffix",",,,") ) /// No implementation files specified - /// (Originally from ..\FSComp.txt:1117) + /// (Originally from ..\FSComp.txt:1116) static member fscNoImplementationFiles() = (2002, GetStringFunc("fscNoImplementationFiles",",,,") ) /// The attribute %s specified version '%s', but this value is invalid and has been ignored - /// (Originally from ..\FSComp.txt:1118) + /// (Originally from ..\FSComp.txt:1117) static member fscBadAssemblyVersion(a0 : System.String, a1 : System.String) = (2003, GetStringFunc("fscBadAssemblyVersion",",,,%s,,,%s,,,") a0 a1) /// Conflicting options specified: 'win32manifest' and 'win32res'. Only one of these can be used. - /// (Originally from ..\FSComp.txt:1119) + /// (Originally from ..\FSComp.txt:1118) static member fscTwoResourceManifests() = (2004, GetStringFunc("fscTwoResourceManifests",",,,") ) /// The code in assembly '%s' makes uses of quotation literals. Static linking may not include components that make use of quotation literals unless all assemblies are compiled with at least F# 4.0. - /// (Originally from ..\FSComp.txt:1120) + /// (Originally from ..\FSComp.txt:1119) static member fscQuotationLiteralsStaticLinking(a0 : System.String) = (2005, GetStringFunc("fscQuotationLiteralsStaticLinking",",,,%s,,,") a0) /// Code in this assembly makes uses of quotation literals. Static linking may not include components that make use of quotation literals unless all assemblies are compiled with at least F# 4.0. - /// (Originally from ..\FSComp.txt:1121) + /// (Originally from ..\FSComp.txt:1120) static member fscQuotationLiteralsStaticLinking0() = (2006, GetStringFunc("fscQuotationLiteralsStaticLinking0",",,,") ) /// Static linking may not include a .EXE - /// (Originally from ..\FSComp.txt:1122) + /// (Originally from ..\FSComp.txt:1121) static member fscStaticLinkingNoEXE() = (2007, GetStringFunc("fscStaticLinkingNoEXE",",,,") ) /// Static linking may not include a mixed managed/unmanaged DLL - /// (Originally from ..\FSComp.txt:1123) + /// (Originally from ..\FSComp.txt:1122) static member fscStaticLinkingNoMixedDLL() = (2008, GetStringFunc("fscStaticLinkingNoMixedDLL",",,,") ) /// Ignoring mixed managed/unmanaged assembly '%s' during static linking - /// (Originally from ..\FSComp.txt:1124) + /// (Originally from ..\FSComp.txt:1123) static member fscIgnoringMixedWhenLinking(a0 : System.String) = (2009, GetStringFunc("fscIgnoringMixedWhenLinking",",,,%s,,,") a0) /// Assembly '%s' was referenced transitively and the assembly could not be resolved automatically. Static linking will assume this DLL has no dependencies on the F# library or other statically linked DLLs. Consider adding an explicit reference to this DLL. - /// (Originally from ..\FSComp.txt:1125) + /// (Originally from ..\FSComp.txt:1124) static member fscAssumeStaticLinkContainsNoDependencies(a0 : System.String) = (2011, GetStringFunc("fscAssumeStaticLinkContainsNoDependencies",",,,%s,,,") a0) /// Assembly '%s' not found in dependency set of target binary. Statically linked roots should be specified using an assembly name, without a DLL or EXE extension. If this assembly was referenced explicitly then it is possible the assembly was not actually required by the generated binary, in which case it should not be statically linked. - /// (Originally from ..\FSComp.txt:1126) + /// (Originally from ..\FSComp.txt:1125) static member fscAssemblyNotFoundInDependencySet(a0 : System.String) = (2012, GetStringFunc("fscAssemblyNotFoundInDependencySet",",,,%s,,,") a0) /// The key file '%s' could not be opened - /// (Originally from ..\FSComp.txt:1127) + /// (Originally from ..\FSComp.txt:1126) static member fscKeyFileCouldNotBeOpened(a0 : System.String) = (2013, GetStringFunc("fscKeyFileCouldNotBeOpened",",,,%s,,,") a0) /// A problem occurred writing the binary '%s': %s - /// (Originally from ..\FSComp.txt:1128) + /// (Originally from ..\FSComp.txt:1127) static member fscProblemWritingBinary(a0 : System.String, a1 : System.String) = (2014, GetStringFunc("fscProblemWritingBinary",",,,%s,,,%s,,,") a0 a1) /// The 'AssemblyVersionAttribute' has been ignored because a version was given using a command line option - /// (Originally from ..\FSComp.txt:1129) + /// (Originally from ..\FSComp.txt:1128) static member fscAssemblyVersionAttributeIgnored() = (2015, GetStringFunc("fscAssemblyVersionAttributeIgnored",",,,") ) /// Error emitting 'System.Reflection.AssemblyCultureAttribute' attribute -- 'Executables cannot be satellite assemblies, Culture should always be empty' - /// (Originally from ..\FSComp.txt:1130) + /// (Originally from ..\FSComp.txt:1129) static member fscAssemblyCultureAttributeError() = (2016, GetStringFunc("fscAssemblyCultureAttributeError",",,,") ) /// Option '--delaysign' overrides attribute 'System.Reflection.AssemblyDelaySignAttribute' given in a source file or added module - /// (Originally from ..\FSComp.txt:1131) + /// (Originally from ..\FSComp.txt:1130) static member fscDelaySignWarning() = (2017, GetStringFunc("fscDelaySignWarning",",,,") ) /// Option '--keyfile' overrides attribute 'System.Reflection.AssemblyKeyFileAttribute' given in a source file or added module - /// (Originally from ..\FSComp.txt:1132) + /// (Originally from ..\FSComp.txt:1131) static member fscKeyFileWarning() = (2018, GetStringFunc("fscKeyFileWarning",",,,") ) /// Option '--keycontainer' overrides attribute 'System.Reflection.AssemblyNameAttribute' given in a source file or added module - /// (Originally from ..\FSComp.txt:1133) + /// (Originally from ..\FSComp.txt:1132) static member fscKeyNameWarning() = (2019, GetStringFunc("fscKeyNameWarning",",,,") ) /// The assembly '%s' is listed on the command line. Assemblies should be referenced using a command line flag such as '-r'. - /// (Originally from ..\FSComp.txt:1134) + /// (Originally from ..\FSComp.txt:1133) static member fscReferenceOnCommandLine(a0 : System.String) = (2020, GetStringFunc("fscReferenceOnCommandLine",",,,%s,,,") a0) /// The resident compilation service was not used because a problem occured in communicating with the server. - /// (Originally from ..\FSComp.txt:1135) + /// (Originally from ..\FSComp.txt:1134) static member fscRemotingError() = (2021, GetStringFunc("fscRemotingError",",,,") ) /// Problem with filename '%s': Illegal characters in path. - /// (Originally from ..\FSComp.txt:1136) + /// (Originally from ..\FSComp.txt:1135) static member pathIsInvalid(a0 : System.String) = (2022, GetStringFunc("pathIsInvalid",",,,%s,,,") a0) /// Passing a .resx file (%s) as a source file to the compiler is deprecated. Use resgen.exe to transform the .resx file into a .resources file to pass as a --resource option. If you are using MSBuild, this can be done via an item in the .fsproj project file. - /// (Originally from ..\FSComp.txt:1137) + /// (Originally from ..\FSComp.txt:1136) static member fscResxSourceFileDeprecated(a0 : System.String) = (2023, GetStringFunc("fscResxSourceFileDeprecated",",,,%s,,,") a0) /// Static linking may not be used on an assembly referencing mscorlib (e.g. a .NET Framework assembly) when generating an assembly that references System.Runtime (e.g. a .NET Core or Portable assembly). - /// (Originally from ..\FSComp.txt:1138) + /// (Originally from ..\FSComp.txt:1137) static member fscStaticLinkingNoProfileMismatches() = (2024, GetStringFunc("fscStaticLinkingNoProfileMismatches",",,,") ) /// An %s specified version '%s', but this value is a wildcard, and you have requested a deterministic build, these are in conflict. - /// (Originally from ..\FSComp.txt:1139) + /// (Originally from ..\FSComp.txt:1138) static member fscAssemblyWildcardAndDeterminism(a0 : System.String, a1 : System.String) = (2025, GetStringFunc("fscAssemblyWildcardAndDeterminism",",,,%s,,,%s,,,") a0 a1) /// Determinstic builds only support portable PDBs (--debug:portable or --debug:embedded) - /// (Originally from ..\FSComp.txt:1140) + /// (Originally from ..\FSComp.txt:1139) static member fscDeterministicDebugRequiresPortablePdb() = (2026, GetStringFunc("fscDeterministicDebugRequiresPortablePdb",",,,") ) /// Character '%s' is not allowed in provided namespace name '%s' - /// (Originally from ..\FSComp.txt:1141) + /// (Originally from ..\FSComp.txt:1140) static member etIllegalCharactersInNamespaceName(a0 : System.String, a1 : System.String) = (3000, GetStringFunc("etIllegalCharactersInNamespaceName",",,,%s,,,%s,,,") a0 a1) /// The provided type '%s' returned a member with a null or empty member name - /// (Originally from ..\FSComp.txt:1142) + /// (Originally from ..\FSComp.txt:1141) static member etNullOrEmptyMemberName(a0 : System.String) = (3001, GetStringFunc("etNullOrEmptyMemberName",",,,%s,,,") a0) /// The provided type '%s' returned a null member - /// (Originally from ..\FSComp.txt:1143) + /// (Originally from ..\FSComp.txt:1142) static member etNullMember(a0 : System.String) = (3002, GetStringFunc("etNullMember",",,,%s,,,") a0) /// The provided type '%s' member info '%s' has null declaring type - /// (Originally from ..\FSComp.txt:1144) + /// (Originally from ..\FSComp.txt:1143) static member etNullMemberDeclaringType(a0 : System.String, a1 : System.String) = (3003, GetStringFunc("etNullMemberDeclaringType",",,,%s,,,%s,,,") a0 a1) /// The provided type '%s' has member '%s' which has declaring type '%s'. Expected declaring type to be the same as provided type. - /// (Originally from ..\FSComp.txt:1145) + /// (Originally from ..\FSComp.txt:1144) static member etNullMemberDeclaringTypeDifferentFromProvidedType(a0 : System.String, a1 : System.String, a2 : System.String) = (3004, GetStringFunc("etNullMemberDeclaringTypeDifferentFromProvidedType",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Referenced assembly '%s' has assembly level attribute '%s' but no public type provider classes were found - /// (Originally from ..\FSComp.txt:1146) + /// (Originally from ..\FSComp.txt:1145) static member etHostingAssemblyFoundWithoutHosts(a0 : System.String, a1 : System.String) = (3005, GetStringFunc("etHostingAssemblyFoundWithoutHosts",",,,%s,,,%s,,,") a0 a1) /// Type '%s' from type provider '%s' has an empty namespace. Use 'null' for the global namespace. - /// (Originally from ..\FSComp.txt:1147) + /// (Originally from ..\FSComp.txt:1146) static member etEmptyNamespaceOfTypeNotAllowed(a0 : System.String, a1 : System.String) = (3006, GetStringFunc("etEmptyNamespaceOfTypeNotAllowed",",,,%s,,,%s,,,") a0 a1) /// Empty namespace found from the type provider '%s'. Use 'null' for the global namespace. - /// (Originally from ..\FSComp.txt:1148) + /// (Originally from ..\FSComp.txt:1147) static member etEmptyNamespaceNotAllowed(a0 : System.String) = (3007, GetStringFunc("etEmptyNamespaceNotAllowed",",,,%s,,,") a0) /// Provided type '%s' has 'IsGenericType' as true, but generic types are not supported. - /// (Originally from ..\FSComp.txt:1149) + /// (Originally from ..\FSComp.txt:1148) static member etMustNotBeGeneric(a0 : System.String) = (3011, GetStringFunc("etMustNotBeGeneric",",,,%s,,,") a0) /// Provided type '%s' has 'IsArray' as true, but array types are not supported. - /// (Originally from ..\FSComp.txt:1150) + /// (Originally from ..\FSComp.txt:1149) static member etMustNotBeAnArray(a0 : System.String) = (3013, GetStringFunc("etMustNotBeAnArray",",,,%s,,,") a0) /// Invalid member '%s' on provided type '%s'. Provided type members must be public, and not be generic, virtual, or abstract. - /// (Originally from ..\FSComp.txt:1151) + /// (Originally from ..\FSComp.txt:1150) static member etMethodHasRequirements(a0 : System.String, a1 : System.String) = (3014, GetStringFunc("etMethodHasRequirements",",,,%s,,,%s,,,") a0 a1) /// Invalid member '%s' on provided type '%s'. Only properties, methods and constructors are allowed - /// (Originally from ..\FSComp.txt:1152) + /// (Originally from ..\FSComp.txt:1151) static member etUnsupportedMemberKind(a0 : System.String, a1 : System.String) = (3015, GetStringFunc("etUnsupportedMemberKind",",,,%s,,,%s,,,") a0 a1) /// Property '%s' on provided type '%s' has CanRead=true but there was no value from GetGetMethod() - /// (Originally from ..\FSComp.txt:1153) + /// (Originally from ..\FSComp.txt:1152) static member etPropertyCanReadButHasNoGetter(a0 : System.String, a1 : System.String) = (3016, GetStringFunc("etPropertyCanReadButHasNoGetter",",,,%s,,,%s,,,") a0 a1) /// Property '%s' on provided type '%s' has CanRead=false but GetGetMethod() returned a method - /// (Originally from ..\FSComp.txt:1154) + /// (Originally from ..\FSComp.txt:1153) static member etPropertyHasGetterButNoCanRead(a0 : System.String, a1 : System.String) = (3017, GetStringFunc("etPropertyHasGetterButNoCanRead",",,,%s,,,%s,,,") a0 a1) /// Property '%s' on provided type '%s' has CanWrite=true but there was no value from GetSetMethod() - /// (Originally from ..\FSComp.txt:1155) + /// (Originally from ..\FSComp.txt:1154) static member etPropertyCanWriteButHasNoSetter(a0 : System.String, a1 : System.String) = (3018, GetStringFunc("etPropertyCanWriteButHasNoSetter",",,,%s,,,%s,,,") a0 a1) /// Property '%s' on provided type '%s' has CanWrite=false but GetSetMethod() returned a method - /// (Originally from ..\FSComp.txt:1156) + /// (Originally from ..\FSComp.txt:1155) static member etPropertyHasSetterButNoCanWrite(a0 : System.String, a1 : System.String) = (3019, GetStringFunc("etPropertyHasSetterButNoCanWrite",",,,%s,,,%s,,,") a0 a1) /// One or more errors seen during provided type setup - /// (Originally from ..\FSComp.txt:1157) + /// (Originally from ..\FSComp.txt:1156) static member etOneOrMoreErrorsSeenDuringExtensionTypeSetting() = (3020, GetStringFunc("etOneOrMoreErrorsSeenDuringExtensionTypeSetting",",,,") ) /// Unexpected exception from provided type '%s' member '%s': %s - /// (Originally from ..\FSComp.txt:1158) + /// (Originally from ..\FSComp.txt:1157) static member etUnexpectedExceptionFromProvidedTypeMember(a0 : System.String, a1 : System.String, a2 : System.String) = (3021, GetStringFunc("etUnexpectedExceptionFromProvidedTypeMember",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Unsupported constant type '%s'. Quotations provided by type providers can only contain simple constants. The implementation of the type provider may need to be adjusted by moving a value declared outside a provided quotation literal to be a 'let' binding inside the quotation literal. - /// (Originally from ..\FSComp.txt:1159) + /// (Originally from ..\FSComp.txt:1158) static member etUnsupportedConstantType(a0 : System.String) = (3022, GetStringFunc("etUnsupportedConstantType",",,,%s,,,") a0) /// Unsupported expression '%s' from type provider. If you are the author of this type provider, consider adjusting it to provide a different provided expression. - /// (Originally from ..\FSComp.txt:1160) + /// (Originally from ..\FSComp.txt:1159) static member etUnsupportedProvidedExpression(a0 : System.String) = (3025, GetStringFunc("etUnsupportedProvidedExpression",",,,%s,,,") a0) /// Expected provided type named '%s' but provided type has 'Name' with value '%s' - /// (Originally from ..\FSComp.txt:1161) + /// (Originally from ..\FSComp.txt:1160) static member etProvidedTypeHasUnexpectedName(a0 : System.String, a1 : System.String) = (3028, GetStringFunc("etProvidedTypeHasUnexpectedName",",,,%s,,,%s,,,") a0 a1) /// Event '%s' on provided type '%s' has no value from GetAddMethod() - /// (Originally from ..\FSComp.txt:1162) + /// (Originally from ..\FSComp.txt:1161) static member etEventNoAdd(a0 : System.String, a1 : System.String) = (3029, GetStringFunc("etEventNoAdd",",,,%s,,,%s,,,") a0 a1) /// Event '%s' on provided type '%s' has no value from GetRemoveMethod() - /// (Originally from ..\FSComp.txt:1163) + /// (Originally from ..\FSComp.txt:1162) static member etEventNoRemove(a0 : System.String, a1 : System.String) = (3030, GetStringFunc("etEventNoRemove",",,,%s,,,%s,,,") a0 a1) /// Assembly attribute '%s' refers to a designer assembly '%s' which cannot be loaded or doesn't exist. %s - /// (Originally from ..\FSComp.txt:1164) + /// (Originally from ..\FSComp.txt:1163) static member etProviderHasWrongDesignerAssembly(a0 : System.String, a1 : System.String, a2 : System.String) = (3031, GetStringFunc("etProviderHasWrongDesignerAssembly",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The type provider does not have a valid constructor. A constructor taking either no arguments or one argument of type 'TypeProviderConfig' was expected. - /// (Originally from ..\FSComp.txt:1165) + /// (Originally from ..\FSComp.txt:1164) static member etProviderDoesNotHaveValidConstructor() = (3032, GetStringFunc("etProviderDoesNotHaveValidConstructor",",,,") ) /// The type provider '%s' reported an error: %s - /// (Originally from ..\FSComp.txt:1166) + /// (Originally from ..\FSComp.txt:1165) static member etProviderError(a0 : System.String, a1 : System.String) = (3033, GetStringFunc("etProviderError",",,,%s,,,%s,,,") a0 a1) /// The type provider '%s' used an invalid parameter in the ParameterExpression: %s - /// (Originally from ..\FSComp.txt:1167) + /// (Originally from ..\FSComp.txt:1166) static member etIncorrectParameterExpression(a0 : System.String, a1 : System.String) = (3034, GetStringFunc("etIncorrectParameterExpression",",,,%s,,,%s,,,") a0 a1) /// The type provider '%s' provided a method with a name '%s' and metadata token '%d', which is not reported among its methods of its declaring type '%s' - /// (Originally from ..\FSComp.txt:1168) + /// (Originally from ..\FSComp.txt:1167) static member etIncorrectProvidedMethod(a0 : System.String, a1 : System.String, a2 : System.Int32, a3 : System.String) = (3035, GetStringFunc("etIncorrectProvidedMethod",",,,%s,,,%s,,,%d,,,%s,,,") a0 a1 a2 a3) /// The type provider '%s' provided a constructor which is not reported among the constructors of its declaring type '%s' - /// (Originally from ..\FSComp.txt:1169) + /// (Originally from ..\FSComp.txt:1168) static member etIncorrectProvidedConstructor(a0 : System.String, a1 : System.String) = (3036, GetStringFunc("etIncorrectProvidedConstructor",",,,%s,,,%s,,,") a0 a1) /// A direct reference to the generated type '%s' is not permitted. Instead, use a type definition, e.g. 'type TypeAlias = '. This indicates that a type provider adds generated types to your assembly. - /// (Originally from ..\FSComp.txt:1170) + /// (Originally from ..\FSComp.txt:1169) static member etDirectReferenceToGeneratedTypeNotAllowed(a0 : System.String) = (3039, GetStringFunc("etDirectReferenceToGeneratedTypeNotAllowed",",,,%s,,,") a0) /// Expected provided type with path '%s' but provided type has path '%s' - /// (Originally from ..\FSComp.txt:1171) + /// (Originally from ..\FSComp.txt:1170) static member etProvidedTypeHasUnexpectedPath(a0 : System.String, a1 : System.String) = (3041, GetStringFunc("etProvidedTypeHasUnexpectedPath",",,,%s,,,%s,,,") a0 a1) /// Unexpected 'null' return value from provided type '%s' member '%s' - /// (Originally from ..\FSComp.txt:1172) + /// (Originally from ..\FSComp.txt:1171) static member etUnexpectedNullFromProvidedTypeMember(a0 : System.String, a1 : System.String) = (3042, GetStringFunc("etUnexpectedNullFromProvidedTypeMember",",,,%s,,,%s,,,") a0 a1) /// Unexpected exception from member '%s' of provided type '%s' member '%s': %s - /// (Originally from ..\FSComp.txt:1173) + /// (Originally from ..\FSComp.txt:1172) static member etUnexpectedExceptionFromProvidedMemberMember(a0 : System.String, a1 : System.String, a2 : System.String, a3 : System.String) = (3043, GetStringFunc("etUnexpectedExceptionFromProvidedMemberMember",",,,%s,,,%s,,,%s,,,%s,,,") a0 a1 a2 a3) /// Nested provided types do not take static arguments or generic parameters - /// (Originally from ..\FSComp.txt:1174) + /// (Originally from ..\FSComp.txt:1173) static member etNestedProvidedTypesDoNotTakeStaticArgumentsOrGenericParameters() = (3044, GetStringFunc("etNestedProvidedTypesDoNotTakeStaticArgumentsOrGenericParameters",",,,") ) /// Invalid static argument to provided type. Expected an argument of kind '%s'. - /// (Originally from ..\FSComp.txt:1175) + /// (Originally from ..\FSComp.txt:1174) static member etInvalidStaticArgument(a0 : System.String) = (3045, GetStringFunc("etInvalidStaticArgument",",,,%s,,,") a0) /// An error occured applying the static arguments to a provided type - /// (Originally from ..\FSComp.txt:1176) + /// (Originally from ..\FSComp.txt:1175) static member etErrorApplyingStaticArgumentsToType() = (3046, GetStringFunc("etErrorApplyingStaticArgumentsToType",",,,") ) /// Unknown static argument kind '%s' when resolving a reference to a provided type or method '%s' - /// (Originally from ..\FSComp.txt:1177) + /// (Originally from ..\FSComp.txt:1176) static member etUnknownStaticArgumentKind(a0 : System.String, a1 : System.String) = (3047, GetStringFunc("etUnknownStaticArgumentKind",",,,%s,,,%s,,,") a0 a1) /// invalid namespace for provided type - /// (Originally from ..\FSComp.txt:1178) + /// (Originally from ..\FSComp.txt:1177) static member invalidNamespaceForProvidedType() = (GetStringFunc("invalidNamespaceForProvidedType",",,,") ) /// invalid full name for provided type - /// (Originally from ..\FSComp.txt:1179) + /// (Originally from ..\FSComp.txt:1178) static member invalidFullNameForProvidedType() = (GetStringFunc("invalidFullNameForProvidedType",",,,") ) /// The type provider returned 'null', which is not a valid return value from '%s' - /// (Originally from ..\FSComp.txt:1181) + /// (Originally from ..\FSComp.txt:1180) static member etProviderReturnedNull(a0 : System.String) = (3051, GetStringFunc("etProviderReturnedNull",",,,%s,,,") a0) /// The type provider constructor has thrown an exception: %s - /// (Originally from ..\FSComp.txt:1182) + /// (Originally from ..\FSComp.txt:1181) static member etTypeProviderConstructorException(a0 : System.String) = (3053, GetStringFunc("etTypeProviderConstructorException",",,,%s,,,") a0) /// Type provider '%s' returned null from GetInvokerExpression. - /// (Originally from ..\FSComp.txt:1183) + /// (Originally from ..\FSComp.txt:1182) static member etNullProvidedExpression(a0 : System.String) = (3056, GetStringFunc("etNullProvidedExpression",",,,%s,,,") a0) /// The type provider '%s' returned an invalid type from 'ApplyStaticArguments'. A type with name '%s' was expected, but a type with name '%s' was returned. - /// (Originally from ..\FSComp.txt:1184) + /// (Originally from ..\FSComp.txt:1183) static member etProvidedAppliedTypeHadWrongName(a0 : System.String, a1 : System.String, a2 : System.String) = (3057, GetStringFunc("etProvidedAppliedTypeHadWrongName",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// The type provider '%s' returned an invalid method from 'ApplyStaticArgumentsForMethod'. A method with name '%s' was expected, but a method with name '%s' was returned. - /// (Originally from ..\FSComp.txt:1185) + /// (Originally from ..\FSComp.txt:1184) static member etProvidedAppliedMethodHadWrongName(a0 : System.String, a1 : System.String, a2 : System.String) = (3058, GetStringFunc("etProvidedAppliedMethodHadWrongName",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// This type test or downcast will erase the provided type '%s' to the type '%s' - /// (Originally from ..\FSComp.txt:1186) + /// (Originally from ..\FSComp.txt:1185) static member tcTypeTestLossy(a0 : System.String, a1 : System.String) = (3060, GetStringFunc("tcTypeTestLossy",",,,%s,,,%s,,,") a0 a1) /// This downcast will erase the provided type '%s' to the type '%s'. - /// (Originally from ..\FSComp.txt:1187) + /// (Originally from ..\FSComp.txt:1186) static member tcTypeCastErased(a0 : System.String, a1 : System.String) = (3061, GetStringFunc("tcTypeCastErased",",,,%s,,,%s,,,") a0 a1) /// This type test with a provided type '%s' is not allowed because this provided type will be erased to '%s' at runtime. - /// (Originally from ..\FSComp.txt:1188) + /// (Originally from ..\FSComp.txt:1187) static member tcTypeTestErased(a0 : System.String, a1 : System.String) = (3062, GetStringFunc("tcTypeTestErased",",,,%s,,,%s,,,") a0 a1) /// Cannot inherit from erased provided type - /// (Originally from ..\FSComp.txt:1189) + /// (Originally from ..\FSComp.txt:1188) static member tcCannotInheritFromErasedType() = (3063, GetStringFunc("tcCannotInheritFromErasedType",",,,") ) /// Assembly '%s' hase TypeProviderAssembly attribute with invalid value '%s'. The value should be a valid assembly name - /// (Originally from ..\FSComp.txt:1190) + /// (Originally from ..\FSComp.txt:1189) static member etInvalidTypeProviderAssemblyName(a0 : System.String, a1 : System.String) = (3065, GetStringFunc("etInvalidTypeProviderAssemblyName",",,,%s,,,%s,,,") a0 a1) /// Invalid member name. Members may not have name '.ctor' or '.cctor' - /// (Originally from ..\FSComp.txt:1191) + /// (Originally from ..\FSComp.txt:1190) static member tcInvalidMemberNameCtor() = (3066, GetStringFunc("tcInvalidMemberNameCtor",",,,") ) /// The function or member '%s' is used in a way that requires further type annotations at its definition to ensure consistency of inferred types. The inferred signature is '%s'. - /// (Originally from ..\FSComp.txt:1192) + /// (Originally from ..\FSComp.txt:1191) static member tcInferredGenericTypeGivesRiseToInconsistency(a0 : System.String, a1 : System.String) = (3068, GetStringFunc("tcInferredGenericTypeGivesRiseToInconsistency",",,,%s,,,%s,,,") a0 a1) /// The number of type arguments did not match: '%d' given, '%d' expected. This may be related to a previously reported error. - /// (Originally from ..\FSComp.txt:1193) + /// (Originally from ..\FSComp.txt:1192) static member tcInvalidTypeArgumentCount(a0 : System.Int32, a1 : System.Int32) = (3069, GetStringFunc("tcInvalidTypeArgumentCount",",,,%d,,,%d,,,") a0 a1) /// Cannot override inherited member '%s' because it is sealed - /// (Originally from ..\FSComp.txt:1194) + /// (Originally from ..\FSComp.txt:1193) static member tcCannotOverrideSealedMethod(a0 : System.String) = (3070, GetStringFunc("tcCannotOverrideSealedMethod",",,,%s,,,") a0) /// The type provider '%s' reported an error in the context of provided type '%s', member '%s'. The error: %s - /// (Originally from ..\FSComp.txt:1195) + /// (Originally from ..\FSComp.txt:1194) static member etProviderErrorWithContext(a0 : System.String, a1 : System.String, a2 : System.String, a3 : System.String) = (3071, GetStringFunc("etProviderErrorWithContext",",,,%s,,,%s,,,%s,,,%s,,,") a0 a1 a2 a3) /// An exception occurred when accessing the '%s' of a provided type: %s - /// (Originally from ..\FSComp.txt:1196) + /// (Originally from ..\FSComp.txt:1195) static member etProvidedTypeWithNameException(a0 : System.String, a1 : System.String) = (3072, GetStringFunc("etProvidedTypeWithNameException",",,,%s,,,%s,,,") a0 a1) /// The '%s' of a provided type was null or empty. - /// (Originally from ..\FSComp.txt:1197) + /// (Originally from ..\FSComp.txt:1196) static member etProvidedTypeWithNullOrEmptyName(a0 : System.String) = (3073, GetStringFunc("etProvidedTypeWithNullOrEmptyName",",,,%s,,,") a0) /// Character '%s' is not allowed in provided type name '%s' - /// (Originally from ..\FSComp.txt:1198) + /// (Originally from ..\FSComp.txt:1197) static member etIllegalCharactersInTypeName(a0 : System.String, a1 : System.String) = (3075, GetStringFunc("etIllegalCharactersInTypeName",",,,%s,,,%s,,,") a0 a1) /// In queries, '%s' must use a simple pattern - /// (Originally from ..\FSComp.txt:1199) + /// (Originally from ..\FSComp.txt:1198) static member tcJoinMustUseSimplePattern(a0 : System.String) = (3077, GetStringFunc("tcJoinMustUseSimplePattern",",,,%s,,,") a0) /// A custom query operation for '%s' is required but not specified - /// (Originally from ..\FSComp.txt:1200) + /// (Originally from ..\FSComp.txt:1199) static member tcMissingCustomOperation(a0 : System.String) = (3078, GetStringFunc("tcMissingCustomOperation",",,,%s,,,") a0) /// Named static arguments must come after all unnamed static arguments - /// (Originally from ..\FSComp.txt:1201) + /// (Originally from ..\FSComp.txt:1200) static member etBadUnnamedStaticArgs() = (3080, GetStringFunc("etBadUnnamedStaticArgs",",,,") ) /// The static parameter '%s' of the provided type or method '%s' requires a value. Static parameters to type providers may be optionally specified using named arguments, e.g. '%s<%s=...>'. - /// (Originally from ..\FSComp.txt:1202) + /// (Originally from ..\FSComp.txt:1201) static member etStaticParameterRequiresAValue(a0 : System.String, a1 : System.String, a2 : System.String, a3 : System.String) = (3081, GetStringFunc("etStaticParameterRequiresAValue",",,,%s,,,%s,,,%s,,,%s,,,") a0 a1 a2 a3) /// No static parameter exists with name '%s' - /// (Originally from ..\FSComp.txt:1203) + /// (Originally from ..\FSComp.txt:1202) static member etNoStaticParameterWithName(a0 : System.String) = (3082, GetStringFunc("etNoStaticParameterWithName",",,,%s,,,") a0) /// The static parameter '%s' has already been given a value - /// (Originally from ..\FSComp.txt:1204) + /// (Originally from ..\FSComp.txt:1203) static member etStaticParameterAlreadyHasValue(a0 : System.String) = (3083, GetStringFunc("etStaticParameterAlreadyHasValue",",,,%s,,,") a0) /// Multiple static parameters exist with name '%s' - /// (Originally from ..\FSComp.txt:1205) + /// (Originally from ..\FSComp.txt:1204) static member etMultipleStaticParameterWithName(a0 : System.String) = (3084, GetStringFunc("etMultipleStaticParameterWithName",",,,%s,,,") a0) /// A custom operation may not be used in conjunction with a non-value or recursive 'let' binding in another part of this computation expression - /// (Originally from ..\FSComp.txt:1206) + /// (Originally from ..\FSComp.txt:1205) static member tcCustomOperationMayNotBeUsedInConjunctionWithNonSimpleLetBindings() = (3085, GetStringFunc("tcCustomOperationMayNotBeUsedInConjunctionWithNonSimpleLetBindings",",,,") ) /// A custom operation may not be used in conjunction with 'use', 'try/with', 'try/finally', 'if/then/else' or 'match' operators within this computation expression - /// (Originally from ..\FSComp.txt:1207) + /// (Originally from ..\FSComp.txt:1206) static member tcCustomOperationMayNotBeUsedHere() = (3086, GetStringFunc("tcCustomOperationMayNotBeUsedHere",",,,") ) /// The custom operation '%s' refers to a method which is overloaded. The implementations of custom operations may not be overloaded. - /// (Originally from ..\FSComp.txt:1208) + /// (Originally from ..\FSComp.txt:1207) static member tcCustomOperationMayNotBeOverloaded(a0 : System.String) = (3087, GetStringFunc("tcCustomOperationMayNotBeOverloaded",",,,%s,,,") a0) /// An if/then/else expression may not be used within queries. Consider using either an if/then expression, or use a sequence expression instead. - /// (Originally from ..\FSComp.txt:1209) + /// (Originally from ..\FSComp.txt:1208) static member tcIfThenElseMayNotBeUsedWithinQueries() = (3090, GetStringFunc("tcIfThenElseMayNotBeUsedWithinQueries",",,,") ) /// Invalid argument to 'methodhandleof' during codegen - /// (Originally from ..\FSComp.txt:1210) + /// (Originally from ..\FSComp.txt:1209) static member ilxgenUnexpectedArgumentToMethodHandleOfDuringCodegen() = (3091, GetStringFunc("ilxgenUnexpectedArgumentToMethodHandleOfDuringCodegen",",,,") ) /// A reference to a provided type was missing a value for the static parameter '%s'. You may need to recompile one or more referenced assemblies. - /// (Originally from ..\FSComp.txt:1211) + /// (Originally from ..\FSComp.txt:1210) static member etProvidedTypeReferenceMissingArgument(a0 : System.String) = (3092, GetStringFunc("etProvidedTypeReferenceMissingArgument",",,,%s,,,") a0) /// A reference to a provided type had an invalid value '%s' for a static parameter. You may need to recompile one or more referenced assemblies. - /// (Originally from ..\FSComp.txt:1212) + /// (Originally from ..\FSComp.txt:1211) static member etProvidedTypeReferenceInvalidText(a0 : System.String) = (3093, GetStringFunc("etProvidedTypeReferenceInvalidText",",,,%s,,,") a0) /// '%s' is not used correctly. This is a custom operation in this query or computation expression. - /// (Originally from ..\FSComp.txt:1213) + /// (Originally from ..\FSComp.txt:1212) static member tcCustomOperationNotUsedCorrectly(a0 : System.String) = (3095, GetStringFunc("tcCustomOperationNotUsedCorrectly",",,,%s,,,") a0) /// '%s' is not used correctly. Usage: %s. This is a custom operation in this query or computation expression. - /// (Originally from ..\FSComp.txt:1214) + /// (Originally from ..\FSComp.txt:1213) static member tcCustomOperationNotUsedCorrectly2(a0 : System.String, a1 : System.String) = (3095, GetStringFunc("tcCustomOperationNotUsedCorrectly2",",,,%s,,,%s,,,") a0 a1) /// %s var in collection %s (outerKey = innerKey). Note that parentheses are required after '%s' - /// (Originally from ..\FSComp.txt:1215) + /// (Originally from ..\FSComp.txt:1214) static member customOperationTextLikeJoin(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("customOperationTextLikeJoin",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// %s var in collection %s (outerKey = innerKey) into group. Note that parentheses are required after '%s' - /// (Originally from ..\FSComp.txt:1216) + /// (Originally from ..\FSComp.txt:1215) static member customOperationTextLikeGroupJoin(a0 : System.String, a1 : System.String, a2 : System.String) = (GetStringFunc("customOperationTextLikeGroupJoin",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// %s var in collection - /// (Originally from ..\FSComp.txt:1217) + /// (Originally from ..\FSComp.txt:1216) static member customOperationTextLikeZip(a0 : System.String) = (GetStringFunc("customOperationTextLikeZip",",,,%s,,,") a0) /// '%s' must be followed by a variable name. Usage: %s. - /// (Originally from ..\FSComp.txt:1218) + /// (Originally from ..\FSComp.txt:1217) static member tcBinaryOperatorRequiresVariable(a0 : System.String, a1 : System.String) = (3096, GetStringFunc("tcBinaryOperatorRequiresVariable",",,,%s,,,%s,,,") a0 a1) /// Incorrect syntax for '%s'. Usage: %s. - /// (Originally from ..\FSComp.txt:1219) + /// (Originally from ..\FSComp.txt:1218) static member tcOperatorIncorrectSyntax(a0 : System.String, a1 : System.String) = (3097, GetStringFunc("tcOperatorIncorrectSyntax",",,,%s,,,%s,,,") a0 a1) /// '%s' must come after a 'for' selection clause and be followed by the rest of the query. Syntax: ... %s ... - /// (Originally from ..\FSComp.txt:1220) + /// (Originally from ..\FSComp.txt:1219) static member tcBinaryOperatorRequiresBody(a0 : System.String, a1 : System.String) = (3098, GetStringFunc("tcBinaryOperatorRequiresBody",",,,%s,,,%s,,,") a0 a1) /// '%s' is used with an incorrect number of arguments. This is a custom operation in this query or computation expression. Expected %d argument(s), but given %d. - /// (Originally from ..\FSComp.txt:1221) + /// (Originally from ..\FSComp.txt:1220) static member tcCustomOperationHasIncorrectArgCount(a0 : System.String, a1 : System.Int32, a2 : System.Int32) = (3099, GetStringFunc("tcCustomOperationHasIncorrectArgCount",",,,%s,,,%d,,,%d,,,") a0 a1 a2) /// Expected an expression after this point - /// (Originally from ..\FSComp.txt:1222) + /// (Originally from ..\FSComp.txt:1221) static member parsExpectedExpressionAfterToken() = (3100, GetStringFunc("parsExpectedExpressionAfterToken",",,,") ) /// Expected a type after this point - /// (Originally from ..\FSComp.txt:1223) + /// (Originally from ..\FSComp.txt:1222) static member parsExpectedTypeAfterToken() = (3101, GetStringFunc("parsExpectedTypeAfterToken",",,,") ) /// Unmatched '[<'. Expected closing '>]' - /// (Originally from ..\FSComp.txt:1224) + /// (Originally from ..\FSComp.txt:1223) static member parsUnmatchedLBrackLess() = (3102, GetStringFunc("parsUnmatchedLBrackLess",",,,") ) /// Unexpected end of input in 'match' expression. Expected 'match with | -> | -> ...'. - /// (Originally from ..\FSComp.txt:1225) + /// (Originally from ..\FSComp.txt:1224) static member parsUnexpectedEndOfFileMatch() = (3103, GetStringFunc("parsUnexpectedEndOfFileMatch",",,,") ) /// Unexpected end of input in 'try' expression. Expected 'try with ' or 'try finally '. - /// (Originally from ..\FSComp.txt:1226) + /// (Originally from ..\FSComp.txt:1225) static member parsUnexpectedEndOfFileTry() = (3104, GetStringFunc("parsUnexpectedEndOfFileTry",",,,") ) /// Unexpected end of input in 'while' expression. Expected 'while do '. - /// (Originally from ..\FSComp.txt:1227) + /// (Originally from ..\FSComp.txt:1226) static member parsUnexpectedEndOfFileWhile() = (3105, GetStringFunc("parsUnexpectedEndOfFileWhile",",,,") ) /// Unexpected end of input in 'for' expression. Expected 'for in do '. - /// (Originally from ..\FSComp.txt:1228) + /// (Originally from ..\FSComp.txt:1227) static member parsUnexpectedEndOfFileFor() = (3106, GetStringFunc("parsUnexpectedEndOfFileFor",",,,") ) /// Unexpected end of input in 'match' or 'try' expression - /// (Originally from ..\FSComp.txt:1229) + /// (Originally from ..\FSComp.txt:1228) static member parsUnexpectedEndOfFileWith() = (3107, GetStringFunc("parsUnexpectedEndOfFileWith",",,,") ) /// Unexpected end of input in 'then' branch of conditional expression. Expected 'if then ' or 'if then else '. - /// (Originally from ..\FSComp.txt:1230) + /// (Originally from ..\FSComp.txt:1229) static member parsUnexpectedEndOfFileThen() = (3108, GetStringFunc("parsUnexpectedEndOfFileThen",",,,") ) /// Unexpected end of input in 'else' branch of conditional expression. Expected 'if then ' or 'if then else '. - /// (Originally from ..\FSComp.txt:1231) + /// (Originally from ..\FSComp.txt:1230) static member parsUnexpectedEndOfFileElse() = (3109, GetStringFunc("parsUnexpectedEndOfFileElse",",,,") ) /// Unexpected end of input in body of lambda expression. Expected 'fun ... -> '. - /// (Originally from ..\FSComp.txt:1232) + /// (Originally from ..\FSComp.txt:1231) static member parsUnexpectedEndOfFileFunBody() = (3110, GetStringFunc("parsUnexpectedEndOfFileFunBody",",,,") ) /// Unexpected end of input in type arguments - /// (Originally from ..\FSComp.txt:1233) + /// (Originally from ..\FSComp.txt:1232) static member parsUnexpectedEndOfFileTypeArgs() = (3111, GetStringFunc("parsUnexpectedEndOfFileTypeArgs",",,,") ) /// Unexpected end of input in type signature - /// (Originally from ..\FSComp.txt:1234) + /// (Originally from ..\FSComp.txt:1233) static member parsUnexpectedEndOfFileTypeSignature() = (3112, GetStringFunc("parsUnexpectedEndOfFileTypeSignature",",,,") ) /// Unexpected end of input in type definition - /// (Originally from ..\FSComp.txt:1235) + /// (Originally from ..\FSComp.txt:1234) static member parsUnexpectedEndOfFileTypeDefinition() = (3113, GetStringFunc("parsUnexpectedEndOfFileTypeDefinition",",,,") ) /// Unexpected end of input in object members - /// (Originally from ..\FSComp.txt:1236) + /// (Originally from ..\FSComp.txt:1235) static member parsUnexpectedEndOfFileObjectMembers() = (3114, GetStringFunc("parsUnexpectedEndOfFileObjectMembers",",,,") ) /// Unexpected end of input in value, function or member definition - /// (Originally from ..\FSComp.txt:1237) + /// (Originally from ..\FSComp.txt:1236) static member parsUnexpectedEndOfFileDefinition() = (3115, GetStringFunc("parsUnexpectedEndOfFileDefinition",",,,") ) /// Unexpected end of input in expression - /// (Originally from ..\FSComp.txt:1238) + /// (Originally from ..\FSComp.txt:1237) static member parsUnexpectedEndOfFileExpression() = (3116, GetStringFunc("parsUnexpectedEndOfFileExpression",",,,") ) /// Unexpected end of type. Expected a name after this point. - /// (Originally from ..\FSComp.txt:1239) + /// (Originally from ..\FSComp.txt:1238) static member parsExpectedNameAfterToken() = (3117, GetStringFunc("parsExpectedNameAfterToken",",,,") ) /// Incomplete value or function definition. If this is in an expression, the body of the expression must be indented to the same column as the 'let' keyword. - /// (Originally from ..\FSComp.txt:1240) + /// (Originally from ..\FSComp.txt:1239) static member parsUnmatchedLet() = (3118, GetStringFunc("parsUnmatchedLet",",,,") ) /// Incomplete value definition. If this is in an expression, the body of the expression must be indented to the same column as the 'let!' keyword. - /// (Originally from ..\FSComp.txt:1241) + /// (Originally from ..\FSComp.txt:1240) static member parsUnmatchedLetBang() = (3119, GetStringFunc("parsUnmatchedLetBang",",,,") ) /// Incomplete value definition. If this is in an expression, the body of the expression must be indented to the same column as the 'use!' keyword. - /// (Originally from ..\FSComp.txt:1242) + /// (Originally from ..\FSComp.txt:1241) static member parsUnmatchedUseBang() = (3120, GetStringFunc("parsUnmatchedUseBang",",,,") ) /// Incomplete value definition. If this is in an expression, the body of the expression must be indented to the same column as the 'use' keyword. - /// (Originally from ..\FSComp.txt:1243) + /// (Originally from ..\FSComp.txt:1242) static member parsUnmatchedUse() = (3121, GetStringFunc("parsUnmatchedUse",",,,") ) /// Missing 'do' in 'while' expression. Expected 'while do '. - /// (Originally from ..\FSComp.txt:1244) + /// (Originally from ..\FSComp.txt:1243) static member parsWhileDoExpected() = (3122, GetStringFunc("parsWhileDoExpected",",,,") ) /// Missing 'do' in 'for' expression. Expected 'for in do '. - /// (Originally from ..\FSComp.txt:1245) + /// (Originally from ..\FSComp.txt:1244) static member parsForDoExpected() = (3123, GetStringFunc("parsForDoExpected",",,,") ) /// Invalid join relation in '%s'. Expected 'expr expr', where is =, =?, ?= or ?=?. - /// (Originally from ..\FSComp.txt:1246) + /// (Originally from ..\FSComp.txt:1245) static member tcInvalidRelationInJoin(a0 : System.String) = (3125, GetStringFunc("tcInvalidRelationInJoin",",,,%s,,,") a0) /// Calls - /// (Originally from ..\FSComp.txt:1247) + /// (Originally from ..\FSComp.txt:1246) static member typeInfoCallsWord() = (GetStringFunc("typeInfoCallsWord",",,,") ) /// Invalid number of generic arguments to type '%s' in provided type. Expected '%d' arguments, given '%d'. - /// (Originally from ..\FSComp.txt:1248) + /// (Originally from ..\FSComp.txt:1247) static member impInvalidNumberOfGenericArguments(a0 : System.String, a1 : System.Int32, a2 : System.Int32) = (3126, GetStringFunc("impInvalidNumberOfGenericArguments",",,,%s,,,%d,,,%d,,,") a0 a1 a2) /// Invalid value '%s' for unit-of-measure parameter '%s' - /// (Originally from ..\FSComp.txt:1249) + /// (Originally from ..\FSComp.txt:1248) static member impInvalidMeasureArgument1(a0 : System.String, a1 : System.String) = (3127, GetStringFunc("impInvalidMeasureArgument1",",,,%s,,,%s,,,") a0 a1) /// Invalid value unit-of-measure parameter '%s' - /// (Originally from ..\FSComp.txt:1250) + /// (Originally from ..\FSComp.txt:1249) static member impInvalidMeasureArgument2(a0 : System.String) = (3127, GetStringFunc("impInvalidMeasureArgument2",",,,%s,,,") a0) /// Property '%s' on provided type '%s' is neither readable nor writable as it has CanRead=false and CanWrite=false - /// (Originally from ..\FSComp.txt:1251) + /// (Originally from ..\FSComp.txt:1250) static member etPropertyNeedsCanWriteOrCanRead(a0 : System.String, a1 : System.String) = (3128, GetStringFunc("etPropertyNeedsCanWriteOrCanRead",",,,%s,,,%s,,,") a0 a1) /// A use of 'into' must be followed by the remainder of the computation - /// (Originally from ..\FSComp.txt:1252) + /// (Originally from ..\FSComp.txt:1251) static member tcIntoNeedsRestOfQuery() = (3129, GetStringFunc("tcIntoNeedsRestOfQuery",",,,") ) /// The operator '%s' does not accept the use of 'into' - /// (Originally from ..\FSComp.txt:1253) + /// (Originally from ..\FSComp.txt:1252) static member tcOperatorDoesntAcceptInto(a0 : System.String) = (3130, GetStringFunc("tcOperatorDoesntAcceptInto",",,,%s,,,") a0) /// The definition of the custom operator '%s' does not use a valid combination of attribute flags - /// (Originally from ..\FSComp.txt:1254) + /// (Originally from ..\FSComp.txt:1253) static member tcCustomOperationInvalid(a0 : System.String) = (3131, GetStringFunc("tcCustomOperationInvalid",",,,%s,,,") a0) /// This type definition may not have the 'CLIMutable' attribute. Only record types may have this attribute. - /// (Originally from ..\FSComp.txt:1255) + /// (Originally from ..\FSComp.txt:1254) static member tcThisTypeMayNotHaveACLIMutableAttribute() = (3132, GetStringFunc("tcThisTypeMayNotHaveACLIMutableAttribute",",,,") ) /// 'member val' definitions are only permitted in types with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'. - /// (Originally from ..\FSComp.txt:1256) + /// (Originally from ..\FSComp.txt:1255) static member tcAutoPropertyRequiresImplicitConstructionSequence() = (3133, GetStringFunc("tcAutoPropertyRequiresImplicitConstructionSequence",",,,") ) /// Property definitions may not be declared mutable. To indicate that this property can be set, use 'member val PropertyName = expr with get,set'. - /// (Originally from ..\FSComp.txt:1257) + /// (Originally from ..\FSComp.txt:1256) static member parsMutableOnAutoPropertyShouldBeGetSet() = (3134, GetStringFunc("parsMutableOnAutoPropertyShouldBeGetSet",",,,") ) /// To indicate that this property can be set, use 'member val PropertyName = expr with get,set'. - /// (Originally from ..\FSComp.txt:1258) + /// (Originally from ..\FSComp.txt:1257) static member parsMutableOnAutoPropertyShouldBeGetSetNotJustSet() = (3135, GetStringFunc("parsMutableOnAutoPropertyShouldBeGetSetNotJustSet",",,,") ) /// Type '%s' is illegal because in byref, T cannot contain byref types. - /// (Originally from ..\FSComp.txt:1259) + /// (Originally from ..\FSComp.txt:1258) static member chkNoByrefsOfByrefs(a0 : System.String) = (3136, GetStringFunc("chkNoByrefsOfByrefs",",,,%s,,,") a0) /// F# supports array ranks between 1 and 32. The value %d is not allowed. - /// (Originally from ..\FSComp.txt:1260) + /// (Originally from ..\FSComp.txt:1259) static member tastopsMaxArrayThirtyTwo(a0 : System.Int32) = (3138, GetStringFunc("tastopsMaxArrayThirtyTwo",",,,%d,,,") a0) /// In queries, use the form 'for x in n .. m do ...' for ranging over integers - /// (Originally from ..\FSComp.txt:1261) + /// (Originally from ..\FSComp.txt:1260) static member tcNoIntegerForLoopInQuery() = (3139, GetStringFunc("tcNoIntegerForLoopInQuery",",,,") ) /// 'while' expressions may not be used in queries - /// (Originally from ..\FSComp.txt:1262) + /// (Originally from ..\FSComp.txt:1261) static member tcNoWhileInQuery() = (3140, GetStringFunc("tcNoWhileInQuery",",,,") ) /// 'try/finally' expressions may not be used in queries - /// (Originally from ..\FSComp.txt:1263) + /// (Originally from ..\FSComp.txt:1262) static member tcNoTryFinallyInQuery() = (3141, GetStringFunc("tcNoTryFinallyInQuery",",,,") ) /// 'use' expressions may not be used in queries - /// (Originally from ..\FSComp.txt:1264) + /// (Originally from ..\FSComp.txt:1263) static member tcUseMayNotBeUsedInQueries() = (3142, GetStringFunc("tcUseMayNotBeUsedInQueries",",,,") ) /// 'let!', 'use!' and 'do!' expressions may not be used in queries - /// (Originally from ..\FSComp.txt:1265) + /// (Originally from ..\FSComp.txt:1264) static member tcBindMayNotBeUsedInQueries() = (3143, GetStringFunc("tcBindMayNotBeUsedInQueries",",,,") ) /// 'return' and 'return!' may not be used in queries - /// (Originally from ..\FSComp.txt:1266) + /// (Originally from ..\FSComp.txt:1265) static member tcReturnMayNotBeUsedInQueries() = (3144, GetStringFunc("tcReturnMayNotBeUsedInQueries",",,,") ) /// 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. - /// (Originally from ..\FSComp.txt:1267) + /// (Originally from ..\FSComp.txt:1266) static member tcUnrecognizedQueryOperator() = (3145, GetStringFunc("tcUnrecognizedQueryOperator",",,,") ) /// 'try/with' expressions may not be used in queries - /// (Originally from ..\FSComp.txt:1268) + /// (Originally from ..\FSComp.txt:1267) static member tcTryWithMayNotBeUsedInQueries() = (3146, GetStringFunc("tcTryWithMayNotBeUsedInQueries",",,,") ) /// This 'let' definition may not be used in a query. Only simple value definitions may be used in queries. - /// (Originally from ..\FSComp.txt:1269) + /// (Originally from ..\FSComp.txt:1268) static member tcNonSimpleLetBindingInQuery() = (3147, GetStringFunc("tcNonSimpleLetBindingInQuery",",,,") ) /// Too many static parameters. Expected at most %d parameters, but got %d unnamed and %d named parameters. - /// (Originally from ..\FSComp.txt:1270) + /// (Originally from ..\FSComp.txt:1269) static member etTooManyStaticParameters(a0 : System.Int32, a1 : System.Int32, a2 : System.Int32) = (3148, GetStringFunc("etTooManyStaticParameters",",,,%d,,,%d,,,%d,,,") a0 a1 a2) /// Invalid provided literal value '%s' - /// (Originally from ..\FSComp.txt:1271) + /// (Originally from ..\FSComp.txt:1270) static member infosInvalidProvidedLiteralValue(a0 : System.String) = (3149, GetStringFunc("infosInvalidProvidedLiteralValue",",,,%s,,,") a0) /// The 'anycpu32bitpreferred' platform can only be used with EXE targets. You must use 'anycpu' instead. - /// (Originally from ..\FSComp.txt:1272) + /// (Originally from ..\FSComp.txt:1271) static member invalidPlatformTarget() = (3150, GetStringFunc("invalidPlatformTarget",",,,") ) /// This member, function or value declaration may not be declared 'inline' - /// (Originally from ..\FSComp.txt:1273) + /// (Originally from ..\FSComp.txt:1272) static member tcThisValueMayNotBeInlined() = (3151, GetStringFunc("tcThisValueMayNotBeInlined",",,,") ) /// The provider '%s' returned a non-generated type '%s' in the context of a set of generated types. Consider adjusting the type provider to only return generated types. - /// (Originally from ..\FSComp.txt:1274) + /// (Originally from ..\FSComp.txt:1273) static member etErasedTypeUsedInGeneration(a0 : System.String, a1 : System.String) = (3152, GetStringFunc("etErasedTypeUsedInGeneration",",,,%s,,,%s,,,") a0 a1) /// Arguments to query operators may require parentheses, e.g. 'where (x > y)' or 'groupBy (x.Length / 10)' - /// (Originally from ..\FSComp.txt:1275) + /// (Originally from ..\FSComp.txt:1274) static member tcUnrecognizedQueryBinaryOperator() = (3153, GetStringFunc("tcUnrecognizedQueryBinaryOperator",",,,") ) /// A quotation may not involve an assignment to or taking the address of a captured local variable - /// (Originally from ..\FSComp.txt:1276) + /// (Originally from ..\FSComp.txt:1275) static member crefNoSetOfHole() = (3155, GetStringFunc("crefNoSetOfHole",",,,") ) /// + 1 overload - /// (Originally from ..\FSComp.txt:1277) + /// (Originally from ..\FSComp.txt:1276) static member nicePrintOtherOverloads1() = (GetStringFunc("nicePrintOtherOverloads1",",,,") ) /// + %d overloads - /// (Originally from ..\FSComp.txt:1278) + /// (Originally from ..\FSComp.txt:1277) static member nicePrintOtherOverloadsN(a0 : System.Int32) = (GetStringFunc("nicePrintOtherOverloadsN",",,,%d,,,") a0) /// Erased to - /// (Originally from ..\FSComp.txt:1279) + /// (Originally from ..\FSComp.txt:1278) static member erasedTo() = (GetStringFunc("erasedTo",",,,") ) /// Unexpected token '%s' or incomplete expression - /// (Originally from ..\FSComp.txt:1280) + /// (Originally from ..\FSComp.txt:1279) static member parsUnfinishedExpression(a0 : System.String) = (3156, GetStringFunc("parsUnfinishedExpression",",,,%s,,,") a0) /// Cannot find code target for this attribute, possibly because the code after the attribute is incomplete. - /// (Originally from ..\FSComp.txt:1281) + /// (Originally from ..\FSComp.txt:1280) static member parsAttributeOnIncompleteCode() = (3158, GetStringFunc("parsAttributeOnIncompleteCode",",,,") ) /// Type name cannot be empty. - /// (Originally from ..\FSComp.txt:1282) + /// (Originally from ..\FSComp.txt:1281) static member parsTypeNameCannotBeEmpty() = (3159, GetStringFunc("parsTypeNameCannotBeEmpty",",,,") ) /// Problem reading assembly '%s': %s - /// (Originally from ..\FSComp.txt:1283) + /// (Originally from ..\FSComp.txt:1282) static member buildProblemReadingAssembly(a0 : System.String, a1 : System.String) = (3160, GetStringFunc("buildProblemReadingAssembly",",,,%s,,,%s,,,") a0 a1) /// Invalid provided field. Provided fields of erased provided types must be literals. - /// (Originally from ..\FSComp.txt:1284) + /// (Originally from ..\FSComp.txt:1283) static member tcTPFieldMustBeLiteral() = (3161, GetStringFunc("tcTPFieldMustBeLiteral",",,,") ) /// (loading description...) - /// (Originally from ..\FSComp.txt:1285) + /// (Originally from ..\FSComp.txt:1284) static member loadingDescription() = (GetStringFunc("loadingDescription",",,,") ) /// (description unavailable...) - /// (Originally from ..\FSComp.txt:1286) + /// (Originally from ..\FSComp.txt:1285) static member descriptionUnavailable() = (GetStringFunc("descriptionUnavailable",",,,") ) /// A type variable has been constrained by multiple different class types. A type variable may only have one class constraint. - /// (Originally from ..\FSComp.txt:1287) + /// (Originally from ..\FSComp.txt:1286) static member chkTyparMultipleClassConstraints() = (3162, GetStringFunc("chkTyparMultipleClassConstraints",",,,") ) /// 'match' expressions may not be used in queries - /// (Originally from ..\FSComp.txt:1288) + /// (Originally from ..\FSComp.txt:1287) static member tcMatchMayNotBeUsedWithQuery() = (3163, GetStringFunc("tcMatchMayNotBeUsedWithQuery",",,,") ) /// Infix operator member '%s' has %d initial argument(s). Expected a tuple of 3 arguments - /// (Originally from ..\FSComp.txt:1289) + /// (Originally from ..\FSComp.txt:1288) static member memberOperatorDefinitionWithNonTripleArgument(a0 : System.String, a1 : System.Int32) = (3164, GetStringFunc("memberOperatorDefinitionWithNonTripleArgument",",,,%s,,,%d,,,") a0 a1) /// The operator '%s' cannot be resolved. Consider opening the module 'Microsoft.FSharp.Linq.NullableOperators'. - /// (Originally from ..\FSComp.txt:1290) + /// (Originally from ..\FSComp.txt:1289) static member cannotResolveNullableOperators(a0 : System.String) = (3165, GetStringFunc("cannotResolveNullableOperators",",,,%s,,,") a0) /// '%s' must be followed by 'in'. Usage: %s. - /// (Originally from ..\FSComp.txt:1291) + /// (Originally from ..\FSComp.txt:1290) static member tcOperatorRequiresIn(a0 : System.String, a1 : System.String) = (3167, GetStringFunc("tcOperatorRequiresIn",",,,%s,,,%s,,,") a0 a1) /// Neither 'member val' nor 'override val' definitions are permitted in object expressions. - /// (Originally from ..\FSComp.txt:1292) + /// (Originally from ..\FSComp.txt:1291) static member parsIllegalMemberVarInObjectImplementation() = (3168, GetStringFunc("parsIllegalMemberVarInObjectImplementation",",,,") ) /// Copy-and-update record expressions must include at least one field. - /// (Originally from ..\FSComp.txt:1293) + /// (Originally from ..\FSComp.txt:1292) static member tcEmptyCopyAndUpdateRecordInvalid() = (3169, GetStringFunc("tcEmptyCopyAndUpdateRecordInvalid",",,,") ) /// '_' cannot be used as field name - /// (Originally from ..\FSComp.txt:1294) + /// (Originally from ..\FSComp.txt:1293) static member parsUnderscoreInvalidFieldName() = (3170, GetStringFunc("parsUnderscoreInvalidFieldName",",,,") ) /// The provided types generated by this use of a type provider may not be used from other F# assemblies and should be marked internal or private. Consider using 'type internal TypeName = ...' or 'type private TypeName = ...'. - /// (Originally from ..\FSComp.txt:1295) + /// (Originally from ..\FSComp.txt:1294) static member tcGeneratedTypesShouldBeInternalOrPrivate() = (3171, GetStringFunc("tcGeneratedTypesShouldBeInternalOrPrivate",",,,") ) /// A property's getter and setter must have the same type. Property '%s' has getter of type '%s' but setter of type '%s'. - /// (Originally from ..\FSComp.txt:1296) + /// (Originally from ..\FSComp.txt:1295) static member chkGetterAndSetterHaveSamePropertyType(a0 : System.String, a1 : System.String, a2 : System.String) = (3172, GetStringFunc("chkGetterAndSetterHaveSamePropertyType",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// Array method '%s' is supplied by the runtime and cannot be directly used in code. For operations with array elements consider using family of GetArray/SetArray functions from LanguagePrimitives.IntrinsicFunctions module. - /// (Originally from ..\FSComp.txt:1297) + /// (Originally from ..\FSComp.txt:1296) static member tcRuntimeSuppliedMethodCannotBeUsedInUserCode(a0 : System.String) = (3173, GetStringFunc("tcRuntimeSuppliedMethodCannotBeUsedInUserCode",",,,%s,,,") a0) /// The union case '%s' does not have a field named '%s'. - /// (Originally from ..\FSComp.txt:1298) + /// (Originally from ..\FSComp.txt:1297) static member tcUnionCaseConstructorDoesNotHaveFieldWithGivenName(a0 : System.String, a1 : System.String) = (3174, GetStringFunc("tcUnionCaseConstructorDoesNotHaveFieldWithGivenName",",,,%s,,,%s,,,") a0 a1) /// The exception '%s' does not have a field named '%s'. - /// (Originally from ..\FSComp.txt:1299) + /// (Originally from ..\FSComp.txt:1298) static member tcExceptionConstructorDoesNotHaveFieldWithGivenName(a0 : System.String, a1 : System.String) = (3174, GetStringFunc("tcExceptionConstructorDoesNotHaveFieldWithGivenName",",,,%s,,,%s,,,") a0 a1) /// Active patterns do not have fields. This syntax is invalid. - /// (Originally from ..\FSComp.txt:1300) + /// (Originally from ..\FSComp.txt:1299) static member tcActivePatternsDoNotHaveFields() = (3174, GetStringFunc("tcActivePatternsDoNotHaveFields",",,,") ) /// The constructor does not have a field named '%s'. - /// (Originally from ..\FSComp.txt:1301) + /// (Originally from ..\FSComp.txt:1300) static member tcConstructorDoesNotHaveFieldWithGivenName(a0 : System.String) = (3174, GetStringFunc("tcConstructorDoesNotHaveFieldWithGivenName",",,,%s,,,") a0) /// Union case/exception field '%s' cannot be used more than once. - /// (Originally from ..\FSComp.txt:1302) + /// (Originally from ..\FSComp.txt:1301) static member tcUnionCaseFieldCannotBeUsedMoreThanOnce(a0 : System.String) = (3175, GetStringFunc("tcUnionCaseFieldCannotBeUsedMoreThanOnce",",,,%s,,,") a0) /// Named field '%s' is used more than once. - /// (Originally from ..\FSComp.txt:1303) + /// (Originally from ..\FSComp.txt:1302) static member tcFieldNameIsUsedModeThanOnce(a0 : System.String) = (3176, GetStringFunc("tcFieldNameIsUsedModeThanOnce",",,,%s,,,") a0) /// Named field '%s' conflicts with autogenerated name for anonymous field. - /// (Originally from ..\FSComp.txt:1304) + /// (Originally from ..\FSComp.txt:1303) static member tcFieldNameConflictsWithGeneratedNameForAnonymousField(a0 : System.String) = (3176, GetStringFunc("tcFieldNameConflictsWithGeneratedNameForAnonymousField",",,,%s,,,") a0) /// This literal expression or attribute argument results in an arithmetic overflow. - /// (Originally from ..\FSComp.txt:1305) + /// (Originally from ..\FSComp.txt:1304) static member tastConstantExpressionOverflow() = (3177, GetStringFunc("tastConstantExpressionOverflow",",,,") ) /// This is not valid literal expression. The [] attribute will be ignored. - /// (Originally from ..\FSComp.txt:1306) + /// (Originally from ..\FSComp.txt:1305) static member tcIllegalStructTypeForConstantExpression() = (3178, GetStringFunc("tcIllegalStructTypeForConstantExpression",",,,") ) /// System.Runtime.InteropServices assembly is required to use UnknownWrapper\DispatchWrapper classes. - /// (Originally from ..\FSComp.txt:1307) + /// (Originally from ..\FSComp.txt:1306) static member fscSystemRuntimeInteropServicesIsRequired() = (3179, GetStringFunc("fscSystemRuntimeInteropServicesIsRequired",",,,") ) /// The mutable local '%s' is implicitly allocated as a reference cell because it has been captured by a closure. This warning is for informational purposes only to indicate where implicit allocations are performed. - /// (Originally from ..\FSComp.txt:1308) + /// (Originally from ..\FSComp.txt:1307) static member abImplicitHeapAllocation(a0 : System.String) = (3180, GetStringFunc("abImplicitHeapAllocation",",,,%s,,,") a0) /// A type provider implemented GetStaticParametersForMethod, but ApplyStaticArgumentsForMethod was not implemented or invalid - /// (Originally from ..\FSComp.txt:1309) + /// (Originally from ..\FSComp.txt:1308) static member estApplyStaticArgumentsForMethodNotImplemented() = (GetStringFunc("estApplyStaticArgumentsForMethodNotImplemented",",,,") ) /// An error occured applying the static arguments to a provided method - /// (Originally from ..\FSComp.txt:1310) + /// (Originally from ..\FSComp.txt:1309) static member etErrorApplyingStaticArgumentsToMethod() = (3181, GetStringFunc("etErrorApplyingStaticArgumentsToMethod",",,,") ) /// Unexpected character '%s' in preprocessor expression - /// (Originally from ..\FSComp.txt:1311) + /// (Originally from ..\FSComp.txt:1310) static member pplexUnexpectedChar(a0 : System.String) = (3182, GetStringFunc("pplexUnexpectedChar",",,,%s,,,") a0) /// Unexpected token '%s' in preprocessor expression - /// (Originally from ..\FSComp.txt:1312) + /// (Originally from ..\FSComp.txt:1311) static member ppparsUnexpectedToken(a0 : System.String) = (3183, GetStringFunc("ppparsUnexpectedToken",",,,%s,,,") a0) /// Incomplete preprocessor expression - /// (Originally from ..\FSComp.txt:1313) + /// (Originally from ..\FSComp.txt:1312) static member ppparsIncompleteExpression() = (3184, GetStringFunc("ppparsIncompleteExpression",",,,") ) /// Missing token '%s' in preprocessor expression - /// (Originally from ..\FSComp.txt:1314) + /// (Originally from ..\FSComp.txt:1313) static member ppparsMissingToken(a0 : System.String) = (3185, GetStringFunc("ppparsMissingToken",",,,%s,,,") a0) /// An error occurred while reading the F# metadata node at position %d in table '%s' of assembly '%s'. The node had no matching declaration. Please report this warning. You may need to recompile the F# assembly you are using. - /// (Originally from ..\FSComp.txt:1315) + /// (Originally from ..\FSComp.txt:1314) static member pickleMissingDefinition(a0 : System.Int32, a1 : System.String, a2 : System.String) = (3186, GetStringFunc("pickleMissingDefinition",",,,%d,,,%s,,,%s,,,") a0 a1 a2) /// Type inference caused the type variable %s to escape its scope. Consider adding an explicit type parameter declaration or adjusting your code to be less generic. - /// (Originally from ..\FSComp.txt:1316) + /// (Originally from ..\FSComp.txt:1315) static member checkNotSufficientlyGenericBecauseOfScope(a0 : System.String) = (3187, GetStringFunc("checkNotSufficientlyGenericBecauseOfScope",",,,%s,,,") a0) /// Type inference caused an inference type variable to escape its scope. Consider adding type annotations to make your code less generic. - /// (Originally from ..\FSComp.txt:1317) + /// (Originally from ..\FSComp.txt:1316) static member checkNotSufficientlyGenericBecauseOfScopeAnon() = (3188, GetStringFunc("checkNotSufficientlyGenericBecauseOfScopeAnon",",,,") ) /// Redundant arguments are being ignored in function '%s'. Expected %d but got %d arguments. - /// (Originally from ..\FSComp.txt:1318) + /// (Originally from ..\FSComp.txt:1317) static member checkRaiseFamilyFunctionArgumentCount(a0 : System.String, a1 : System.Int32, a2 : System.Int32) = (3189, GetStringFunc("checkRaiseFamilyFunctionArgumentCount",",,,%s,,,%d,,,%d,,,") a0 a1 a2) /// Lowercase literal '%s' is being shadowed by a new pattern with the same name. Only uppercase and module-prefixed literals can be used as named patterns. - /// (Originally from ..\FSComp.txt:1319) + /// (Originally from ..\FSComp.txt:1318) static member checkLowercaseLiteralBindingInPattern(a0 : System.String) = (3190, GetStringFunc("checkLowercaseLiteralBindingInPattern",",,,%s,,,") a0) /// This literal pattern does not take arguments - /// (Originally from ..\FSComp.txt:1320) + /// (Originally from ..\FSComp.txt:1319) static member tcLiteralDoesNotTakeArguments() = (3191, GetStringFunc("tcLiteralDoesNotTakeArguments",",,,") ) /// Constructors are not permitted as extension members - they must be defined as part of the original definition of the type - /// (Originally from ..\FSComp.txt:1321) + /// (Originally from ..\FSComp.txt:1320) static member tcConstructorsIllegalInAugmentation() = (3192, GetStringFunc("tcConstructorsIllegalInAugmentation",",,,") ) /// Invalid response file '%s' ( '%s' ) - /// (Originally from ..\FSComp.txt:1322) + /// (Originally from ..\FSComp.txt:1321) static member optsInvalidResponseFile(a0 : System.String, a1 : System.String) = (3193, GetStringFunc("optsInvalidResponseFile",",,,%s,,,%s,,,") a0 a1) /// Response file '%s' not found in '%s' - /// (Originally from ..\FSComp.txt:1323) + /// (Originally from ..\FSComp.txt:1322) static member optsResponseFileNotFound(a0 : System.String, a1 : System.String) = (3194, GetStringFunc("optsResponseFileNotFound",",,,%s,,,%s,,,") a0 a1) /// Response file name '%s' is empty, contains invalid characters, has a drive specification without an absolute path, or is too long - /// (Originally from ..\FSComp.txt:1324) + /// (Originally from ..\FSComp.txt:1323) static member optsResponseFileNameInvalid(a0 : System.String) = (3195, GetStringFunc("optsResponseFileNameInvalid",",,,%s,,,") a0) /// Cannot find FSharp.Core.dll in compiler's directory - /// (Originally from ..\FSComp.txt:1325) + /// (Originally from ..\FSComp.txt:1324) static member fsharpCoreNotFoundToBeCopied() = (3196, GetStringFunc("fsharpCoreNotFoundToBeCopied",",,,") ) /// One tuple type is a struct tuple, the other is a reference tuple - /// (Originally from ..\FSComp.txt:1326) + /// (Originally from ..\FSComp.txt:1325) static member tcTupleStructMismatch() = (GetStringFunc("tcTupleStructMismatch",",,,") ) /// This provided method requires static parameters - /// (Originally from ..\FSComp.txt:1327) + /// (Originally from ..\FSComp.txt:1326) static member etMissingStaticArgumentsToMethod() = (3197, GetStringFunc("etMissingStaticArgumentsToMethod",",,,") ) /// The conversion from %s to %s is a compile-time safe upcast, not a downcast. Consider using 'upcast' instead of 'downcast'. - /// (Originally from ..\FSComp.txt:1328) + /// (Originally from ..\FSComp.txt:1327) static member considerUpcast(a0 : System.String, a1 : System.String) = (3198, GetStringFunc("considerUpcast",",,,%s,,,%s,,,") a0 a1) /// The conversion from %s to %s is a compile-time safe upcast, not a downcast. Consider using the :> (upcast) operator instead of the :?> (downcast) operator. - /// (Originally from ..\FSComp.txt:1329) + /// (Originally from ..\FSComp.txt:1328) static member considerUpcastOperator(a0 : System.String, a1 : System.String) = (3198, GetStringFunc("considerUpcastOperator",",,,%s,,,%s,,,") a0 a1) /// The 'rec' on this module is implied by an outer 'rec' declaration and is being ignored - /// (Originally from ..\FSComp.txt:1330) + /// (Originally from ..\FSComp.txt:1329) static member tcRecImplied() = (3199, GetStringFunc("tcRecImplied",",,,") ) /// In a recursive declaration group, 'open' declarations must come first in each module - /// (Originally from ..\FSComp.txt:1331) + /// (Originally from ..\FSComp.txt:1330) static member tcOpenFirstInMutRec() = (3200, GetStringFunc("tcOpenFirstInMutRec",",,,") ) /// In a recursive declaration group, module abbreviations must come after all 'open' declarations and before other declarations - /// (Originally from ..\FSComp.txt:1332) + /// (Originally from ..\FSComp.txt:1331) static member tcModuleAbbrevFirstInMutRec() = (3201, GetStringFunc("tcModuleAbbrevFirstInMutRec",",,,") ) /// This declaration is not supported in recursive declaration groups - /// (Originally from ..\FSComp.txt:1333) + /// (Originally from ..\FSComp.txt:1332) static member tcUnsupportedMutRecDecl() = (3202, GetStringFunc("tcUnsupportedMutRecDecl",",,,") ) /// Invalid use of 'rec' keyword - /// (Originally from ..\FSComp.txt:1334) + /// (Originally from ..\FSComp.txt:1333) static member parsInvalidUseOfRec() = (3203, GetStringFunc("parsInvalidUseOfRec",",,,") ) /// If a union type has more than one case and is a struct, then all fields within the union type must be given unique names. - /// (Originally from ..\FSComp.txt:1335) + /// (Originally from ..\FSComp.txt:1334) static member tcStructUnionMultiCaseDistinctFields() = (3204, GetStringFunc("tcStructUnionMultiCaseDistinctFields",",,,") ) /// The CallerMemberNameAttribute applied to parameter '%s' will have no effect. It is overridden by the CallerFilePathAttribute. - /// (Originally from ..\FSComp.txt:1336) + /// (Originally from ..\FSComp.txt:1335) static member CallerMemberNameIsOverriden(a0 : System.String) = (3206, GetStringFunc("CallerMemberNameIsOverriden",",,,%s,,,") a0) /// Invalid use of 'fixed'. 'fixed' may only be used in a declaration of the form 'use x = fixed expr' where the expression is an array, the address of a field, the address of an array element or a string' - /// (Originally from ..\FSComp.txt:1337) + /// (Originally from ..\FSComp.txt:1336) static member tcFixedNotAllowed() = (3207, GetStringFunc("tcFixedNotAllowed",",,,") ) /// Could not find method System.Runtime.CompilerServices.OffsetToStringData in references when building 'fixed' expression. - /// (Originally from ..\FSComp.txt:1338) + /// (Originally from ..\FSComp.txt:1337) static member tcCouldNotFindOffsetToStringData() = (3208, GetStringFunc("tcCouldNotFindOffsetToStringData",",,,") ) /// The address of the variable '%s' or a related expression cannot be used at this point. This is to ensure the address of the local value does not escape its scope. - /// (Originally from ..\FSComp.txt:1339) + /// (Originally from ..\FSComp.txt:1338) static member chkNoByrefAddressOfLocal(a0 : System.String) = (3209, GetStringFunc("chkNoByrefAddressOfLocal",",,,%s,,,") a0) /// %s is an active pattern and cannot be treated as a discriminated union case with named fields. - /// (Originally from ..\FSComp.txt:1340) + /// (Originally from ..\FSComp.txt:1339) static member tcNamedActivePattern(a0 : System.String) = (3210, GetStringFunc("tcNamedActivePattern",",,,%s,,,") a0) /// The default value does not have the same type as the argument. The DefaultParameterValue attribute and any Optional attribute will be ignored. Note: 'null' needs to be annotated with the correct type, e.g. 'DefaultParameterValue(null:obj)'. - /// (Originally from ..\FSComp.txt:1341) + /// (Originally from ..\FSComp.txt:1340) static member DefaultParameterValueNotAppropriateForArgument() = (3211, GetStringFunc("DefaultParameterValueNotAppropriateForArgument",",,,") ) /// The system type '%s' was required but no referenced system DLL contained this type - /// (Originally from ..\FSComp.txt:1342) + /// (Originally from ..\FSComp.txt:1341) static member tcGlobalsSystemTypeNotFound(a0 : System.String) = (GetStringFunc("tcGlobalsSystemTypeNotFound",",,,%s,,,") a0) /// The member '%s' matches multiple overloads of the same method.\nPlease restrict it to one of the following:%s. - /// (Originally from ..\FSComp.txt:1343) + /// (Originally from ..\FSComp.txt:1342) static member typrelMemberHasMultiplePossibleDispatchSlots(a0 : System.String, a1 : System.String) = (3213, GetStringFunc("typrelMemberHasMultiplePossibleDispatchSlots",",,,%s,,,%s,,,") a0 a1) /// Method or object constructor '%s' is not static - /// (Originally from ..\FSComp.txt:1344) + /// (Originally from ..\FSComp.txt:1343) static member methodIsNotStatic(a0 : System.String) = (3214, GetStringFunc("methodIsNotStatic",",,,%s,,,") a0) /// Unexpected symbol '=' in expression. Did you intend to use 'for x in y .. z do' instead? - /// (Originally from ..\FSComp.txt:1345) + /// (Originally from ..\FSComp.txt:1344) static member parsUnexpectedSymbolEqualsInsteadOfIn() = (3215, GetStringFunc("parsUnexpectedSymbolEqualsInsteadOfIn",",,,") ) /// Two anonymous record types are from different assemblies '%s' and '%s' - /// (Originally from ..\FSComp.txt:1346) + /// (Originally from ..\FSComp.txt:1345) static member tcAnonRecdCcuMismatch(a0 : System.String, a1 : System.String) = (GetStringFunc("tcAnonRecdCcuMismatch",",,,%s,,,%s,,,") a0 a1) /// Two anonymous record types have mismatched sets of field names '%s' and '%s' - /// (Originally from ..\FSComp.txt:1347) + /// (Originally from ..\FSComp.txt:1346) static member tcAnonRecdFieldNameMismatch(a0 : System.String, a1 : System.String) = (GetStringFunc("tcAnonRecdFieldNameMismatch",",,,%s,,,%s,,,") a0 a1) - /// Indicates a method that either has no implementation in the type in which it is declared or that is virtual and has a default implementation. + /// Expression does not have a name. + /// (Originally from ..\FSComp.txt:1347) + static member expressionHasNoName() = (3216, GetStringFunc("expressionHasNoName",",,,") ) + /// First-class uses of the 'nameof' operator is not permitted. /// (Originally from ..\FSComp.txt:1348) + static member chkNoFirstClassNameOf() = (3217, GetStringFunc("chkNoFirstClassNameOf",",,,") ) + /// Indicates a method that either has no implementation in the type in which it is declared or that is virtual and has a default implementation. + /// (Originally from ..\FSComp.txt:1349) static member keywordDescriptionAbstract() = (GetStringFunc("keywordDescriptionAbstract",",,,") ) /// Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - /// (Originally from ..\FSComp.txt:1349) + /// (Originally from ..\FSComp.txt:1350) static member keyworkDescriptionAnd() = (GetStringFunc("keyworkDescriptionAnd",",,,") ) /// Used to give the current class object an object name. Also used to give a name to a whole pattern within a pattern match. - /// (Originally from ..\FSComp.txt:1350) + /// (Originally from ..\FSComp.txt:1351) static member keywordDescriptionAs() = (GetStringFunc("keywordDescriptionAs",",,,") ) /// Used to verify code during debugging. - /// (Originally from ..\FSComp.txt:1351) + /// (Originally from ..\FSComp.txt:1352) static member keywordDescriptionAssert() = (GetStringFunc("keywordDescriptionAssert",",,,") ) /// Used as the name of the base class object. - /// (Originally from ..\FSComp.txt:1352) + /// (Originally from ..\FSComp.txt:1353) static member keywordDescriptionBase() = (GetStringFunc("keywordDescriptionBase",",,,") ) /// In verbose syntax, indicates the start of a code block. - /// (Originally from ..\FSComp.txt:1353) + /// (Originally from ..\FSComp.txt:1354) static member keywordDescriptionBegin() = (GetStringFunc("keywordDescriptionBegin",",,,") ) /// In verbose syntax, indicates the start of a class definition. - /// (Originally from ..\FSComp.txt:1354) + /// (Originally from ..\FSComp.txt:1355) static member keywordDescriptionClass() = (GetStringFunc("keywordDescriptionClass",",,,") ) /// Indicates an implementation of an abstract method; used together with an abstract method declaration to create a virtual method. - /// (Originally from ..\FSComp.txt:1355) + /// (Originally from ..\FSComp.txt:1356) static member keywordDescriptionDefault() = (GetStringFunc("keywordDescriptionDefault",",,,") ) /// Used to declare a delegate. - /// (Originally from ..\FSComp.txt:1356) + /// (Originally from ..\FSComp.txt:1357) static member keywordDescriptionDelegate() = (GetStringFunc("keywordDescriptionDelegate",",,,") ) /// Used in looping constructs or to execute imperative code. - /// (Originally from ..\FSComp.txt:1357) + /// (Originally from ..\FSComp.txt:1358) static member keywordDescriptionDo() = (GetStringFunc("keywordDescriptionDo",",,,") ) /// In verbose syntax, indicates the end of a block of code in a looping expression. - /// (Originally from ..\FSComp.txt:1358) + /// (Originally from ..\FSComp.txt:1359) static member keywordDescriptionDone() = (GetStringFunc("keywordDescriptionDone",",,,") ) /// Used to convert to a type that is lower in the inheritance chain. - /// (Originally from ..\FSComp.txt:1359) + /// (Originally from ..\FSComp.txt:1360) static member keywordDescriptionDowncast() = (GetStringFunc("keywordDescriptionDowncast",",,,") ) /// In a for expression, used when counting in reverse. - /// (Originally from ..\FSComp.txt:1360) + /// (Originally from ..\FSComp.txt:1361) static member keywordDescriptionDownto() = (GetStringFunc("keywordDescriptionDownto",",,,") ) /// Used in conditional branching. A short form of else if. - /// (Originally from ..\FSComp.txt:1361) + /// (Originally from ..\FSComp.txt:1362) static member keywordDescriptionElif() = (GetStringFunc("keywordDescriptionElif",",,,") ) /// Used in conditional branching. - /// (Originally from ..\FSComp.txt:1362) + /// (Originally from ..\FSComp.txt:1363) static member keywordDescriptionElse() = (GetStringFunc("keywordDescriptionElse",",,,") ) /// In type definitions and type extensions, indicates the end of a section of member definitions. In verbose syntax, used to specify the end of a code block that starts with the begin keyword. - /// (Originally from ..\FSComp.txt:1363) + /// (Originally from ..\FSComp.txt:1364) static member keywordDescriptionEnd() = (GetStringFunc("keywordDescriptionEnd",",,,") ) /// Used to declare an exception type. - /// (Originally from ..\FSComp.txt:1364) + /// (Originally from ..\FSComp.txt:1365) static member keywordDescriptionException() = (GetStringFunc("keywordDescriptionException",",,,") ) /// Indicates that a declared program element is defined in another binary or assembly. - /// (Originally from ..\FSComp.txt:1365) + /// (Originally from ..\FSComp.txt:1366) static member keywordDescriptionExtern() = (GetStringFunc("keywordDescriptionExtern",",,,") ) /// Used as a Boolean literal. - /// (Originally from ..\FSComp.txt:1366) + /// (Originally from ..\FSComp.txt:1367) static member keywordDescriptionTrueFalse() = (GetStringFunc("keywordDescriptionTrueFalse",",,,") ) /// Used together with try to introduce a block of code that executes regardless of whether an exception occurs. - /// (Originally from ..\FSComp.txt:1367) + /// (Originally from ..\FSComp.txt:1368) static member keywordDescriptionFinally() = (GetStringFunc("keywordDescriptionFinally",",,,") ) /// Used in looping constructs. - /// (Originally from ..\FSComp.txt:1368) + /// (Originally from ..\FSComp.txt:1369) static member keywordDescriptionFor() = (GetStringFunc("keywordDescriptionFor",",,,") ) /// Used in lambda expressions, also known as anonymous functions. - /// (Originally from ..\FSComp.txt:1369) + /// (Originally from ..\FSComp.txt:1370) static member keywordDescriptionFun() = (GetStringFunc("keywordDescriptionFun",",,,") ) /// Used as a shorter alternative to the fun keyword and a match expression in a lambda expression that has pattern matching on a single argument. - /// (Originally from ..\FSComp.txt:1370) + /// (Originally from ..\FSComp.txt:1371) static member keywordDescriptionFunction() = (GetStringFunc("keywordDescriptionFunction",",,,") ) /// Used to reference the top-level .NET namespace. - /// (Originally from ..\FSComp.txt:1371) + /// (Originally from ..\FSComp.txt:1372) static member keywordDescriptionGlobal() = (GetStringFunc("keywordDescriptionGlobal",",,,") ) /// Used in conditional branching constructs. - /// (Originally from ..\FSComp.txt:1372) + /// (Originally from ..\FSComp.txt:1373) static member keywordDescriptionIf() = (GetStringFunc("keywordDescriptionIf",",,,") ) /// Used for sequence expressions and, in verbose syntax, to separate expressions from bindings. - /// (Originally from ..\FSComp.txt:1373) + /// (Originally from ..\FSComp.txt:1374) static member keywordDescriptionIn() = (GetStringFunc("keywordDescriptionIn",",,,") ) /// Used to specify a base class or base interface. - /// (Originally from ..\FSComp.txt:1374) + /// (Originally from ..\FSComp.txt:1375) static member keywordDescriptionInherit() = (GetStringFunc("keywordDescriptionInherit",",,,") ) /// Used to indicate a function that should be integrated directly into the caller's code. - /// (Originally from ..\FSComp.txt:1375) + /// (Originally from ..\FSComp.txt:1376) static member keywordDescriptionInline() = (GetStringFunc("keywordDescriptionInline",",,,") ) /// Used to declare and implement interfaces. - /// (Originally from ..\FSComp.txt:1376) + /// (Originally from ..\FSComp.txt:1377) static member keywordDescriptionInterface() = (GetStringFunc("keywordDescriptionInterface",",,,") ) /// Used to specify that a member is visible inside an assembly but not outside it. - /// (Originally from ..\FSComp.txt:1377) + /// (Originally from ..\FSComp.txt:1378) static member keywordDescriptionInternal() = (GetStringFunc("keywordDescriptionInternal",",,,") ) /// Used to specify a computation that is to be performed only when a result is needed. - /// (Originally from ..\FSComp.txt:1378) + /// (Originally from ..\FSComp.txt:1379) static member keywordDescriptionLazy() = (GetStringFunc("keywordDescriptionLazy",",,,") ) /// Used to associate, or bind, a name to a value or function. - /// (Originally from ..\FSComp.txt:1379) + /// (Originally from ..\FSComp.txt:1380) static member keywordDescriptionLet() = (GetStringFunc("keywordDescriptionLet",",,,") ) /// Used in computation expressions to bind a name to the result of another computation expression. - /// (Originally from ..\FSComp.txt:1380) + /// (Originally from ..\FSComp.txt:1381) static member keywordDescriptionLetBang() = (GetStringFunc("keywordDescriptionLetBang",",,,") ) /// Used to branch by comparing a value to a pattern. - /// (Originally from ..\FSComp.txt:1381) + /// (Originally from ..\FSComp.txt:1382) static member keywordDescriptionMatch() = (GetStringFunc("keywordDescriptionMatch",",,,") ) /// Used in computation expressions to pattern match directly over the result of another computation expression. - /// (Originally from ..\FSComp.txt:1382) + /// (Originally from ..\FSComp.txt:1383) static member keywordDescriptionMatchBang() = (GetStringFunc("keywordDescriptionMatchBang",",,,") ) /// Used to declare a property or method in an object type. - /// (Originally from ..\FSComp.txt:1383) + /// (Originally from ..\FSComp.txt:1384) static member keywordDescriptionMember() = (GetStringFunc("keywordDescriptionMember",",,,") ) /// Used to associate a name with a group of related types, values, and functions, to logically separate it from other code. - /// (Originally from ..\FSComp.txt:1384) + /// (Originally from ..\FSComp.txt:1385) static member keywordDescriptionModule() = (GetStringFunc("keywordDescriptionModule",",,,") ) /// Used to declare a variable, that is, a value that can be changed. - /// (Originally from ..\FSComp.txt:1385) + /// (Originally from ..\FSComp.txt:1386) static member keywordDescriptionMutable() = (GetStringFunc("keywordDescriptionMutable",",,,") ) /// Used to associate a name with a group of related types and modules, to logically separate it from other code. - /// (Originally from ..\FSComp.txt:1386) + /// (Originally from ..\FSComp.txt:1387) static member keywordDescriptionNamespace() = (GetStringFunc("keywordDescriptionNamespace",",,,") ) /// Used to declare, define, or invoke a constructor that creates or that can create an object. Also used in generic parameter constraints to indicate that a type must have a certain constructor. - /// (Originally from ..\FSComp.txt:1387) + /// (Originally from ..\FSComp.txt:1388) static member keywordDescriptionNew() = (GetStringFunc("keywordDescriptionNew",",,,") ) /// Not actually a keyword. However, not struct in combination is used as a generic parameter constraint. - /// (Originally from ..\FSComp.txt:1388) + /// (Originally from ..\FSComp.txt:1389) static member keywordDescriptionNot() = (GetStringFunc("keywordDescriptionNot",",,,") ) /// Indicates the absence of an object. Also used in generic parameter constraints. - /// (Originally from ..\FSComp.txt:1389) + /// (Originally from ..\FSComp.txt:1390) static member keywordDescriptionNull() = (GetStringFunc("keywordDescriptionNull",",,,") ) /// Used in discriminated unions to indicate the type of categories of values, and in delegate and exception declarations. - /// (Originally from ..\FSComp.txt:1390) + /// (Originally from ..\FSComp.txt:1391) static member keywordDescriptionOf() = (GetStringFunc("keywordDescriptionOf",",,,") ) /// Used to make the contents of a namespace or module available without qualification. - /// (Originally from ..\FSComp.txt:1391) + /// (Originally from ..\FSComp.txt:1392) static member keywordDescriptionOpen() = (GetStringFunc("keywordDescriptionOpen",",,,") ) /// Used with Boolean conditions as a Boolean or operator. Equivalent to ||. Also used in member constraints. - /// (Originally from ..\FSComp.txt:1392) + /// (Originally from ..\FSComp.txt:1393) static member keywordDescriptionOr() = (GetStringFunc("keywordDescriptionOr",",,,") ) /// Used to implement a version of an abstract or virtual method that differs from the base version. - /// (Originally from ..\FSComp.txt:1393) + /// (Originally from ..\FSComp.txt:1394) static member keywordDescriptionOverride() = (GetStringFunc("keywordDescriptionOverride",",,,") ) /// Restricts access to a member to code in the same type or module. - /// (Originally from ..\FSComp.txt:1394) + /// (Originally from ..\FSComp.txt:1395) static member keywordDescriptionPrivate() = (GetStringFunc("keywordDescriptionPrivate",",,,") ) /// Allows access to a member from outside the type. - /// (Originally from ..\FSComp.txt:1395) + /// (Originally from ..\FSComp.txt:1396) static member keywordDescriptionPublic() = (GetStringFunc("keywordDescriptionPublic",",,,") ) /// Used to indicate that a function is recursive. - /// (Originally from ..\FSComp.txt:1396) + /// (Originally from ..\FSComp.txt:1397) static member keywordDescriptionRec() = (GetStringFunc("keywordDescriptionRec",",,,") ) /// Used to provide a value for the result of the containing computation expression. - /// (Originally from ..\FSComp.txt:1397) + /// (Originally from ..\FSComp.txt:1398) static member keywordDescriptionReturn() = (GetStringFunc("keywordDescriptionReturn",",,,") ) /// Used to provide a value for the result of the containing computation expression, where that value itself comes from the result another computation expression. - /// (Originally from ..\FSComp.txt:1398) + /// (Originally from ..\FSComp.txt:1399) static member keywordDescriptionReturnBang() = (GetStringFunc("keywordDescriptionReturnBang",",,,") ) /// Used in query expressions to specify what fields or columns to extract. Note that this is a contextual keyword, which means that it is not actually a reserved word and it only acts like a keyword in appropriate context. - /// (Originally from ..\FSComp.txt:1399) + /// (Originally from ..\FSComp.txt:1400) static member keywordDescriptionSelect() = (GetStringFunc("keywordDescriptionSelect",",,,") ) /// Used to indicate a method or property that can be called without an instance of a type, or a value member that is shared among all instances of a type. - /// (Originally from ..\FSComp.txt:1400) + /// (Originally from ..\FSComp.txt:1401) static member keywordDescriptionStatic() = (GetStringFunc("keywordDescriptionStatic",",,,") ) /// Used to declare a structure type. Also used in generic parameter constraints. Used for OCaml compatibility in module definitions. - /// (Originally from ..\FSComp.txt:1401) + /// (Originally from ..\FSComp.txt:1402) static member keywordDescriptionStruct() = (GetStringFunc("keywordDescriptionStruct",",,,") ) /// Used in conditional expressions. Also used to perform side effects after object construction. - /// (Originally from ..\FSComp.txt:1402) + /// (Originally from ..\FSComp.txt:1403) static member keywordDescriptionThen() = (GetStringFunc("keywordDescriptionThen",",,,") ) /// Used in for loops to indicate a range. - /// (Originally from ..\FSComp.txt:1403) + /// (Originally from ..\FSComp.txt:1404) static member keywordDescriptionTo() = (GetStringFunc("keywordDescriptionTo",",,,") ) /// Used to introduce a block of code that might generate an exception. Used together with with or finally. - /// (Originally from ..\FSComp.txt:1404) + /// (Originally from ..\FSComp.txt:1405) static member keywordDescriptionTry() = (GetStringFunc("keywordDescriptionTry",",,,") ) /// Used to declare a class, record, structure, discriminated union, enumeration type, unit of measure, or type abbreviation. - /// (Originally from ..\FSComp.txt:1405) + /// (Originally from ..\FSComp.txt:1406) static member keywordDescriptionType() = (GetStringFunc("keywordDescriptionType",",,,") ) /// Used to convert to a type that is higher in the inheritance chain. - /// (Originally from ..\FSComp.txt:1406) - static member keywordDescriptionUpcast() = (GetStringFunc("keywordDescriptionUpcast",",,,") ) - /// Used instead of let for values that implement IDisposable" /// (Originally from ..\FSComp.txt:1407) + static member keywordDescriptionUpcast() = (GetStringFunc("keywordDescriptionUpcast",",,,") ) + /// Used instead of let for values that implement IDisposable + /// (Originally from ..\FSComp.txt:1408) static member keywordDescriptionUse() = (GetStringFunc("keywordDescriptionUse",",,,") ) /// Used instead of let! in computation expressions for computation expression results that implement IDisposable. - /// (Originally from ..\FSComp.txt:1408) + /// (Originally from ..\FSComp.txt:1409) static member keywordDescriptionUseBang() = (GetStringFunc("keywordDescriptionUseBang",",,,") ) /// Used in a signature to indicate a value, or in a type to declare a member, in limited situations. - /// (Originally from ..\FSComp.txt:1409) + /// (Originally from ..\FSComp.txt:1410) static member keywordDescriptionVal() = (GetStringFunc("keywordDescriptionVal",",,,") ) /// Indicates the .NET void type. Used when interoperating with other .NET languages. - /// (Originally from ..\FSComp.txt:1410) + /// (Originally from ..\FSComp.txt:1411) static member keywordDescriptionVoid() = (GetStringFunc("keywordDescriptionVoid",",,,") ) /// Used for Boolean conditions (when guards) on pattern matches and to introduce a constraint clause for a generic type parameter. - /// (Originally from ..\FSComp.txt:1411) + /// (Originally from ..\FSComp.txt:1412) static member keywordDescriptionWhen() = (GetStringFunc("keywordDescriptionWhen",",,,") ) /// Introduces a looping construct. - /// (Originally from ..\FSComp.txt:1412) + /// (Originally from ..\FSComp.txt:1413) static member keywordDescriptionWhile() = (GetStringFunc("keywordDescriptionWhile",",,,") ) /// Used together with the match keyword in pattern matching expressions. Also used in object expressions, record copying expressions, and type extensions to introduce member definitions, and to introduce exception handlers. - /// (Originally from ..\FSComp.txt:1413) + /// (Originally from ..\FSComp.txt:1414) static member keywordDescriptionWith() = (GetStringFunc("keywordDescriptionWith",",,,") ) /// Used in a sequence expression to produce a value for a sequence. - /// (Originally from ..\FSComp.txt:1414) + /// (Originally from ..\FSComp.txt:1415) static member keywordDescriptionYield() = (GetStringFunc("keywordDescriptionYield",",,,") ) /// Used in a computation expression to append the result of a given computation expression to a collection of results for the containing computation expression. - /// (Originally from ..\FSComp.txt:1415) + /// (Originally from ..\FSComp.txt:1416) static member keywordDescriptionYieldBang() = (GetStringFunc("keywordDescriptionYieldBang",",,,") ) /// In function types, delimits arguments and return values. Yields an expression (in sequence expressions); equivalent to the yield keyword. Used in match expressions - /// (Originally from ..\FSComp.txt:1416) + /// (Originally from ..\FSComp.txt:1417) static member keywordDescriptionRightArrow() = (GetStringFunc("keywordDescriptionRightArrow",",,,") ) /// Assigns a value to a variable. - /// (Originally from ..\FSComp.txt:1417) + /// (Originally from ..\FSComp.txt:1418) static member keywordDescriptionLeftArrow() = (GetStringFunc("keywordDescriptionLeftArrow",",,,") ) /// Converts a type to type that is higher in the hierarchy. - /// (Originally from ..\FSComp.txt:1418) + /// (Originally from ..\FSComp.txt:1419) static member keywordDescriptionCast() = (GetStringFunc("keywordDescriptionCast",",,,") ) /// Converts a type to a type that is lower in the hierarchy. - /// (Originally from ..\FSComp.txt:1419) + /// (Originally from ..\FSComp.txt:1420) static member keywordDescriptionDynamicCast() = (GetStringFunc("keywordDescriptionDynamicCast",",,,") ) /// Delimits a typed code quotation. - /// (Originally from ..\FSComp.txt:1420) + /// (Originally from ..\FSComp.txt:1421) static member keywordDescriptionTypedQuotation() = (GetStringFunc("keywordDescriptionTypedQuotation",",,,") ) /// Delimits a untyped code quotation. - /// (Originally from ..\FSComp.txt:1421) + /// (Originally from ..\FSComp.txt:1422) static member keywordDescriptionUntypedQuotation() = (GetStringFunc("keywordDescriptionUntypedQuotation",",,,") ) /// %s '%s' not found in assembly '%s'. A possible cause may be a version incompatibility. You may need to explicitly reference the correct version of this assembly to allow all referenced components to use the correct version. - /// (Originally from ..\FSComp.txt:1422) + /// (Originally from ..\FSComp.txt:1423) static member itemNotFoundDuringDynamicCodeGen(a0 : System.String, a1 : System.String, a2 : System.String) = (3216, GetStringFunc("itemNotFoundDuringDynamicCodeGen",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// %s '%s' not found in type '%s' from assembly '%s'. A possible cause may be a version incompatibility. You may need to explicitly reference the correct version of this assembly to allow all referenced components to use the correct version. - /// (Originally from ..\FSComp.txt:1423) + /// (Originally from ..\FSComp.txt:1424) static member itemNotFoundInTypeDuringDynamicCodeGen(a0 : System.String, a1 : System.String, a2 : System.String, a3 : System.String) = (3216, GetStringFunc("itemNotFoundInTypeDuringDynamicCodeGen",",,,%s,,,%s,,,%s,,,%s,,,") a0 a1 a2 a3) /// is - /// (Originally from ..\FSComp.txt:1424) + /// (Originally from ..\FSComp.txt:1425) static member descriptionWordIs() = (GetStringFunc("descriptionWordIs",",,,") ) /// This value is not a function and cannot be applied. - /// (Originally from ..\FSComp.txt:1425) + /// (Originally from ..\FSComp.txt:1426) static member notAFunction() = (GetStringFunc("notAFunction",",,,") ) /// This value is not a function and cannot be applied. Did you intend to access the indexer via %s.[index] instead? - /// (Originally from ..\FSComp.txt:1426) + /// (Originally from ..\FSComp.txt:1427) static member notAFunctionButMaybeIndexerWithName(a0 : System.String) = (GetStringFunc("notAFunctionButMaybeIndexerWithName",",,,%s,,,") a0) /// This expression is not a function and cannot be applied. Did you intend to access the indexer via expr.[index] instead? - /// (Originally from ..\FSComp.txt:1427) + /// (Originally from ..\FSComp.txt:1428) static member notAFunctionButMaybeIndexer() = (GetStringFunc("notAFunctionButMaybeIndexer",",,,") ) /// - /// (Originally from ..\FSComp.txt:1428) + /// (Originally from ..\FSComp.txt:1429) static member notAFunctionButMaybeIndexerErrorCode() = (3217, GetStringFunc("notAFunctionButMaybeIndexerErrorCode",",,,") ) /// This value is not a function and cannot be applied. Did you forget to terminate a declaration? - /// (Originally from ..\FSComp.txt:1429) + /// (Originally from ..\FSComp.txt:1430) static member notAFunctionButMaybeDeclaration() = (GetStringFunc("notAFunctionButMaybeDeclaration",",,,") ) /// The argument names in the signature '%s' and implementation '%s' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - /// (Originally from ..\FSComp.txt:1430) + /// (Originally from ..\FSComp.txt:1431) static member ArgumentsInSigAndImplMismatch(a0 : System.String, a1 : System.String) = (3218, GetStringFunc("ArgumentsInSigAndImplMismatch",",,,%s,,,%s,,,") a0 a1) /// An error occurred while reading the F# metadata of assembly '%s'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. - /// (Originally from ..\FSComp.txt:1431) + /// (Originally from ..\FSComp.txt:1432) static member pickleUnexpectedNonZero(a0 : System.String) = (3219, GetStringFunc("pickleUnexpectedNonZero",",,,%s,,,") a0) /// This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. - /// (Originally from ..\FSComp.txt:1432) + /// (Originally from ..\FSComp.txt:1433) static member tcTupleMemberNotNormallyUsed() = (3220, GetStringFunc("tcTupleMemberNotNormallyUsed",",,,") ) /// This expression returns a value of type '%s' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'. - /// (Originally from ..\FSComp.txt:1433) + /// (Originally from ..\FSComp.txt:1434) static member implicitlyDiscardedInSequenceExpression(a0 : System.String) = (3221, GetStringFunc("implicitlyDiscardedInSequenceExpression",",,,%s,,,") a0) /// This expression returns a value of type '%s' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield!'. - /// (Originally from ..\FSComp.txt:1434) + /// (Originally from ..\FSComp.txt:1435) static member implicitlyDiscardedSequenceInSequenceExpression(a0 : System.String) = (3222, GetStringFunc("implicitlyDiscardedSequenceInSequenceExpression",",,,%s,,,") a0) /// The file '%s' changed on disk unexpectedly, please reload. - /// (Originally from ..\FSComp.txt:1435) + /// (Originally from ..\FSComp.txt:1436) static member ilreadFileChanged(a0 : System.String) = (3223, GetStringFunc("ilreadFileChanged",",,,%s,,,") a0) /// The byref pointer is readonly, so this write is not permitted. - /// (Originally from ..\FSComp.txt:1436) + /// (Originally from ..\FSComp.txt:1437) static member writeToReadOnlyByref() = (3224, GetStringFunc("writeToReadOnlyByref",",,,") ) /// A ReadOnly attribute has been applied to a struct type with a mutable field. - /// (Originally from ..\FSComp.txt:1437) + /// (Originally from ..\FSComp.txt:1438) static member readOnlyAttributeOnStructWithMutableField() = (3225, GetStringFunc("readOnlyAttributeOnStructWithMutableField",",,,") ) /// A byref pointer returned by a function or method is implicitly dereferenced as of F# 4.5. To acquire the return value as a pointer, use the address-of operator, e.g. '&f(x)' or '&obj.Method(arg1, arg2)'. - /// (Originally from ..\FSComp.txt:1438) + /// (Originally from ..\FSComp.txt:1439) static member tcByrefReturnImplicitlyDereferenced() = (3226, GetStringFunc("tcByrefReturnImplicitlyDereferenced",",,,") ) /// A type annotated with IsByRefLike must also be a struct. Consider adding the [] attribute to the type. - /// (Originally from ..\FSComp.txt:1439) + /// (Originally from ..\FSComp.txt:1440) static member tcByRefLikeNotStruct() = (3227, GetStringFunc("tcByRefLikeNotStruct",",,,") ) /// The address of a value returned from the expression cannot be used at this point. This is to ensure the address of the local value does not escape its scope. - /// (Originally from ..\FSComp.txt:1440) + /// (Originally from ..\FSComp.txt:1441) static member chkNoByrefAddressOfValueFromExpression() = (3228, GetStringFunc("chkNoByrefAddressOfValueFromExpression",",,,") ) /// This value can't be assigned because the target '%s' may refer to non-stack-local memory, while the expression being assigned is assessed to potentially refer to stack-local memory. This is to help prevent pointers to stack-bound memory escaping their scope. - /// (Originally from ..\FSComp.txt:1441) + /// (Originally from ..\FSComp.txt:1442) static member chkNoWriteToLimitedSpan(a0 : System.String) = (3229, GetStringFunc("chkNoWriteToLimitedSpan",",,,%s,,,") a0) /// A value defined in a module must be mutable in order to take its address, e.g. 'let mutable x = ...' - /// (Originally from ..\FSComp.txt:1442) + /// (Originally from ..\FSComp.txt:1443) static member tastValueMustBeLocal() = (3230, GetStringFunc("tastValueMustBeLocal",",,,") ) /// A type annotated with IsReadOnly must also be a struct. Consider adding the [] attribute to the type. - /// (Originally from ..\FSComp.txt:1443) + /// (Originally from ..\FSComp.txt:1444) static member tcIsReadOnlyNotStruct() = (3231, GetStringFunc("tcIsReadOnlyNotStruct",",,,") ) /// Struct members cannot return the address of fields of the struct by reference - /// (Originally from ..\FSComp.txt:1444) + /// (Originally from ..\FSComp.txt:1445) static member chkStructsMayNotReturnAddressesOfContents() = (3232, GetStringFunc("chkStructsMayNotReturnAddressesOfContents",",,,") ) /// The function or method call cannot be used at this point, because one argument that is a byref of a non-stack-local Span or IsByRefLike type is used with another argument that is a stack-local Span or IsByRefLike type. This is to ensure the address of the local value does not escape its scope. - /// (Originally from ..\FSComp.txt:1445) + /// (Originally from ..\FSComp.txt:1446) static member chkNoByrefLikeFunctionCall() = (3233, GetStringFunc("chkNoByrefLikeFunctionCall",",,,") ) /// The Span or IsByRefLike variable '%s' cannot be used at this point. This is to ensure the address of the local value does not escape its scope. - /// (Originally from ..\FSComp.txt:1446) + /// (Originally from ..\FSComp.txt:1447) static member chkNoSpanLikeVariable(a0 : System.String) = (3234, GetStringFunc("chkNoSpanLikeVariable",",,,%s,,,") a0) /// A Span or IsByRefLike value returned from the expression cannot be used at ths point. This is to ensure the address of the local value does not escape its scope. - /// (Originally from ..\FSComp.txt:1447) + /// (Originally from ..\FSComp.txt:1448) static member chkNoSpanLikeValueFromExpression() = (3235, GetStringFunc("chkNoSpanLikeValueFromExpression",",,,") ) /// Cannot take the address of the value returned from the expression. Assign the returned value to a let-bound value before taking the address. - /// (Originally from ..\FSComp.txt:1448) + /// (Originally from ..\FSComp.txt:1449) static member tastCantTakeAddressOfExpression() = (3236, GetStringFunc("tastCantTakeAddressOfExpression",",,,") ) /// Cannot call the byref extension method '%s. The first parameter requires the value to be mutable or a non-readonly byref type. - /// (Originally from ..\FSComp.txt:1449) + /// (Originally from ..\FSComp.txt:1450) static member tcCannotCallExtensionMethodInrefToByref(a0 : System.String) = (3237, GetStringFunc("tcCannotCallExtensionMethodInrefToByref",",,,%s,,,") a0) /// Byref types are not allowed to have optional type extensions. - /// (Originally from ..\FSComp.txt:1450) + /// (Originally from ..\FSComp.txt:1451) static member tcByrefsMayNotHaveTypeExtensions() = (3238, GetStringFunc("tcByrefsMayNotHaveTypeExtensions",",,,") ) /// Cannot partially apply the extension method '%s' because the first parameter is a byref type. - /// (Originally from ..\FSComp.txt:1451) + /// (Originally from ..\FSComp.txt:1452) static member tcCannotPartiallyApplyExtensionMethodForByref(a0 : System.String) = (3239, GetStringFunc("tcCannotPartiallyApplyExtensionMethodForByref",",,,%s,,,") a0) /// This type does not inherit Attribute, it will not work correctly with other .NET languages. - /// (Originally from ..\FSComp.txt:1452) + /// (Originally from ..\FSComp.txt:1453) static member tcTypeDoesNotInheritAttribute() = (3242, GetStringFunc("tcTypeDoesNotInheritAttribute",",,,") ) /// Invalid anonymous record expression - /// (Originally from ..\FSComp.txt:1453) + /// (Originally from ..\FSComp.txt:1454) static member parsInvalidAnonRecdExpr() = (3243, GetStringFunc("parsInvalidAnonRecdExpr",",,,") ) /// Invalid anonymous record type - /// (Originally from ..\FSComp.txt:1454) + /// (Originally from ..\FSComp.txt:1455) static member parsInvalidAnonRecdType() = (3244, GetStringFunc("parsInvalidAnonRecdType",",,,") ) /// The input to a copy-and-update expression that creates an anonymous record must be either an anonymous record or a record - /// (Originally from ..\FSComp.txt:1455) + /// (Originally from ..\FSComp.txt:1456) static member tcCopyAndUpdateNeedsRecordType() = (3245, GetStringFunc("tcCopyAndUpdateNeedsRecordType",",,,") ) /// The parameter '%s' has an invalid type '%s'. This is not permitted by the rules of Common IL. - /// (Originally from ..\FSComp.txt:1456) + /// (Originally from ..\FSComp.txt:1457) static member chkInvalidFunctionParameterType(a0 : System.String, a1 : System.String) = (3300, GetStringFunc("chkInvalidFunctionParameterType",",,,%s,,,%s,,,") a0 a1) /// The function or method has an invalid return type '%s'. This is not permitted by the rules of Common IL. - /// (Originally from ..\FSComp.txt:1457) + /// (Originally from ..\FSComp.txt:1458) static member chkInvalidFunctionReturnType(a0 : System.String) = (3301, GetStringFunc("chkInvalidFunctionReturnType",",,,%s,,,") a0) /// Call this method once to validate that all known resources are valid; throws if not @@ -4445,7 +4438,6 @@ type internal SR private() = ignore(GetString("buildInvalidAssemblyName")) ignore(GetString("buildInvalidPrivacy")) ignore(GetString("buildMultipleReferencesNotAllowed")) - ignore(GetString("buildCouldNotReadVersionInfoFromMscorlib")) ignore(GetString("buildCannotReadAssembly")) ignore(GetString("buildAssemblyResolutionFailed")) ignore(GetString("buildImplicitModuleIsNotLegalIdentifier")) @@ -5720,6 +5712,8 @@ type internal SR private() = ignore(GetString("parsUnexpectedSymbolEqualsInsteadOfIn")) ignore(GetString("tcAnonRecdCcuMismatch")) ignore(GetString("tcAnonRecdFieldNameMismatch")) + ignore(GetString("expressionHasNoName")) + ignore(GetString("chkNoFirstClassNameOf")) ignore(GetString("keywordDescriptionAbstract")) ignore(GetString("keyworkDescriptionAnd")) ignore(GetString("keywordDescriptionAs")) diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx b/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx index 4985923a95..01abfe54e3 100644 --- a/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx +++ b/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx @@ -246,9 +246,6 @@ Multiple references to '{0}.dll' are not permitted - - Could not read version from mscorlib.dll - Unable to read assembly '{0}' @@ -4071,6 +4068,12 @@ Two anonymous record types have mismatched sets of field names '{0}' and '{1}' + + Expression does not have a name. + + + First-class uses of the 'nameof' operator is not permitted. + Indicates a method that either has no implementation in the type in which it is declared or that is virtual and has a default implementation. @@ -4249,7 +4252,7 @@ Used to convert to a type that is higher in the inheritance chain. - Used instead of let for values that implement IDisposable" + Used instead of let for values that implement IDisposable Used instead of let! in computation expressions for computation expression results that implement IDisposable. From 93ccbbe0e840273610b0bc4a426ec1b0878755f8 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 13 Mar 2019 12:50:27 +0000 Subject: [PATCH 043/286] update error codes, FSComp.fs and XLF --- .../FSharp.Compiler.Private/FSComp.fs | 232 +++++++++--------- .../FSharp.Compiler.Private/FSComp.resx | 12 +- src/fsharp/FSComp.txt | 4 +- .../NameOf/E_NameOfAdditionExpr.fs | 2 +- .../NameOf/E_NameOfAppliedFunction.fs | 2 +- .../NameOf/E_NameOfAsAFunction.fs | 2 +- .../NameOf/E_NameOfDictLookup.fs | 2 +- .../NameOf/E_NameOfIntConst.fs | 2 +- .../NameOf/E_NameOfIntegerAppliedFunction.fs | 2 +- .../E_NameOfParameterAppliedFunction.fs | 2 +- .../E_NameOfPartiallyAppliedFunction.fs | 2 +- .../NameOf/E_NameOfStringConst.fs | 2 +- .../NameOf/E_NameOfWithPipe.fs | 2 +- 13 files changed, 134 insertions(+), 134 deletions(-) diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs b/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs index 1784224723..281ff5bc35 100644 --- a/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs +++ b/src/buildfromsource/FSharp.Compiler.Private/FSComp.fs @@ -4056,336 +4056,336 @@ type internal SR private() = /// Two anonymous record types have mismatched sets of field names '%s' and '%s' /// (Originally from ..\FSComp.txt:1346) static member tcAnonRecdFieldNameMismatch(a0 : System.String, a1 : System.String) = (GetStringFunc("tcAnonRecdFieldNameMismatch",",,,%s,,,%s,,,") a0 a1) - /// Expression does not have a name. - /// (Originally from ..\FSComp.txt:1347) - static member expressionHasNoName() = (3216, GetStringFunc("expressionHasNoName",",,,") ) - /// First-class uses of the 'nameof' operator is not permitted. - /// (Originally from ..\FSComp.txt:1348) - static member chkNoFirstClassNameOf() = (3217, GetStringFunc("chkNoFirstClassNameOf",",,,") ) /// Indicates a method that either has no implementation in the type in which it is declared or that is virtual and has a default implementation. - /// (Originally from ..\FSComp.txt:1349) + /// (Originally from ..\FSComp.txt:1347) static member keywordDescriptionAbstract() = (GetStringFunc("keywordDescriptionAbstract",",,,") ) /// Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters. - /// (Originally from ..\FSComp.txt:1350) + /// (Originally from ..\FSComp.txt:1348) static member keyworkDescriptionAnd() = (GetStringFunc("keyworkDescriptionAnd",",,,") ) /// Used to give the current class object an object name. Also used to give a name to a whole pattern within a pattern match. - /// (Originally from ..\FSComp.txt:1351) + /// (Originally from ..\FSComp.txt:1349) static member keywordDescriptionAs() = (GetStringFunc("keywordDescriptionAs",",,,") ) /// Used to verify code during debugging. - /// (Originally from ..\FSComp.txt:1352) + /// (Originally from ..\FSComp.txt:1350) static member keywordDescriptionAssert() = (GetStringFunc("keywordDescriptionAssert",",,,") ) /// Used as the name of the base class object. - /// (Originally from ..\FSComp.txt:1353) + /// (Originally from ..\FSComp.txt:1351) static member keywordDescriptionBase() = (GetStringFunc("keywordDescriptionBase",",,,") ) /// In verbose syntax, indicates the start of a code block. - /// (Originally from ..\FSComp.txt:1354) + /// (Originally from ..\FSComp.txt:1352) static member keywordDescriptionBegin() = (GetStringFunc("keywordDescriptionBegin",",,,") ) /// In verbose syntax, indicates the start of a class definition. - /// (Originally from ..\FSComp.txt:1355) + /// (Originally from ..\FSComp.txt:1353) static member keywordDescriptionClass() = (GetStringFunc("keywordDescriptionClass",",,,") ) /// Indicates an implementation of an abstract method; used together with an abstract method declaration to create a virtual method. - /// (Originally from ..\FSComp.txt:1356) + /// (Originally from ..\FSComp.txt:1354) static member keywordDescriptionDefault() = (GetStringFunc("keywordDescriptionDefault",",,,") ) /// Used to declare a delegate. - /// (Originally from ..\FSComp.txt:1357) + /// (Originally from ..\FSComp.txt:1355) static member keywordDescriptionDelegate() = (GetStringFunc("keywordDescriptionDelegate",",,,") ) /// Used in looping constructs or to execute imperative code. - /// (Originally from ..\FSComp.txt:1358) + /// (Originally from ..\FSComp.txt:1356) static member keywordDescriptionDo() = (GetStringFunc("keywordDescriptionDo",",,,") ) /// In verbose syntax, indicates the end of a block of code in a looping expression. - /// (Originally from ..\FSComp.txt:1359) + /// (Originally from ..\FSComp.txt:1357) static member keywordDescriptionDone() = (GetStringFunc("keywordDescriptionDone",",,,") ) /// Used to convert to a type that is lower in the inheritance chain. - /// (Originally from ..\FSComp.txt:1360) + /// (Originally from ..\FSComp.txt:1358) static member keywordDescriptionDowncast() = (GetStringFunc("keywordDescriptionDowncast",",,,") ) /// In a for expression, used when counting in reverse. - /// (Originally from ..\FSComp.txt:1361) + /// (Originally from ..\FSComp.txt:1359) static member keywordDescriptionDownto() = (GetStringFunc("keywordDescriptionDownto",",,,") ) /// Used in conditional branching. A short form of else if. - /// (Originally from ..\FSComp.txt:1362) + /// (Originally from ..\FSComp.txt:1360) static member keywordDescriptionElif() = (GetStringFunc("keywordDescriptionElif",",,,") ) /// Used in conditional branching. - /// (Originally from ..\FSComp.txt:1363) + /// (Originally from ..\FSComp.txt:1361) static member keywordDescriptionElse() = (GetStringFunc("keywordDescriptionElse",",,,") ) /// In type definitions and type extensions, indicates the end of a section of member definitions. In verbose syntax, used to specify the end of a code block that starts with the begin keyword. - /// (Originally from ..\FSComp.txt:1364) + /// (Originally from ..\FSComp.txt:1362) static member keywordDescriptionEnd() = (GetStringFunc("keywordDescriptionEnd",",,,") ) /// Used to declare an exception type. - /// (Originally from ..\FSComp.txt:1365) + /// (Originally from ..\FSComp.txt:1363) static member keywordDescriptionException() = (GetStringFunc("keywordDescriptionException",",,,") ) /// Indicates that a declared program element is defined in another binary or assembly. - /// (Originally from ..\FSComp.txt:1366) + /// (Originally from ..\FSComp.txt:1364) static member keywordDescriptionExtern() = (GetStringFunc("keywordDescriptionExtern",",,,") ) /// Used as a Boolean literal. - /// (Originally from ..\FSComp.txt:1367) + /// (Originally from ..\FSComp.txt:1365) static member keywordDescriptionTrueFalse() = (GetStringFunc("keywordDescriptionTrueFalse",",,,") ) /// Used together with try to introduce a block of code that executes regardless of whether an exception occurs. - /// (Originally from ..\FSComp.txt:1368) + /// (Originally from ..\FSComp.txt:1366) static member keywordDescriptionFinally() = (GetStringFunc("keywordDescriptionFinally",",,,") ) /// Used in looping constructs. - /// (Originally from ..\FSComp.txt:1369) + /// (Originally from ..\FSComp.txt:1367) static member keywordDescriptionFor() = (GetStringFunc("keywordDescriptionFor",",,,") ) /// Used in lambda expressions, also known as anonymous functions. - /// (Originally from ..\FSComp.txt:1370) + /// (Originally from ..\FSComp.txt:1368) static member keywordDescriptionFun() = (GetStringFunc("keywordDescriptionFun",",,,") ) /// Used as a shorter alternative to the fun keyword and a match expression in a lambda expression that has pattern matching on a single argument. - /// (Originally from ..\FSComp.txt:1371) + /// (Originally from ..\FSComp.txt:1369) static member keywordDescriptionFunction() = (GetStringFunc("keywordDescriptionFunction",",,,") ) /// Used to reference the top-level .NET namespace. - /// (Originally from ..\FSComp.txt:1372) + /// (Originally from ..\FSComp.txt:1370) static member keywordDescriptionGlobal() = (GetStringFunc("keywordDescriptionGlobal",",,,") ) /// Used in conditional branching constructs. - /// (Originally from ..\FSComp.txt:1373) + /// (Originally from ..\FSComp.txt:1371) static member keywordDescriptionIf() = (GetStringFunc("keywordDescriptionIf",",,,") ) /// Used for sequence expressions and, in verbose syntax, to separate expressions from bindings. - /// (Originally from ..\FSComp.txt:1374) + /// (Originally from ..\FSComp.txt:1372) static member keywordDescriptionIn() = (GetStringFunc("keywordDescriptionIn",",,,") ) /// Used to specify a base class or base interface. - /// (Originally from ..\FSComp.txt:1375) + /// (Originally from ..\FSComp.txt:1373) static member keywordDescriptionInherit() = (GetStringFunc("keywordDescriptionInherit",",,,") ) /// Used to indicate a function that should be integrated directly into the caller's code. - /// (Originally from ..\FSComp.txt:1376) + /// (Originally from ..\FSComp.txt:1374) static member keywordDescriptionInline() = (GetStringFunc("keywordDescriptionInline",",,,") ) /// Used to declare and implement interfaces. - /// (Originally from ..\FSComp.txt:1377) + /// (Originally from ..\FSComp.txt:1375) static member keywordDescriptionInterface() = (GetStringFunc("keywordDescriptionInterface",",,,") ) /// Used to specify that a member is visible inside an assembly but not outside it. - /// (Originally from ..\FSComp.txt:1378) + /// (Originally from ..\FSComp.txt:1376) static member keywordDescriptionInternal() = (GetStringFunc("keywordDescriptionInternal",",,,") ) /// Used to specify a computation that is to be performed only when a result is needed. - /// (Originally from ..\FSComp.txt:1379) + /// (Originally from ..\FSComp.txt:1377) static member keywordDescriptionLazy() = (GetStringFunc("keywordDescriptionLazy",",,,") ) /// Used to associate, or bind, a name to a value or function. - /// (Originally from ..\FSComp.txt:1380) + /// (Originally from ..\FSComp.txt:1378) static member keywordDescriptionLet() = (GetStringFunc("keywordDescriptionLet",",,,") ) /// Used in computation expressions to bind a name to the result of another computation expression. - /// (Originally from ..\FSComp.txt:1381) + /// (Originally from ..\FSComp.txt:1379) static member keywordDescriptionLetBang() = (GetStringFunc("keywordDescriptionLetBang",",,,") ) /// Used to branch by comparing a value to a pattern. - /// (Originally from ..\FSComp.txt:1382) + /// (Originally from ..\FSComp.txt:1380) static member keywordDescriptionMatch() = (GetStringFunc("keywordDescriptionMatch",",,,") ) /// Used in computation expressions to pattern match directly over the result of another computation expression. - /// (Originally from ..\FSComp.txt:1383) + /// (Originally from ..\FSComp.txt:1381) static member keywordDescriptionMatchBang() = (GetStringFunc("keywordDescriptionMatchBang",",,,") ) /// Used to declare a property or method in an object type. - /// (Originally from ..\FSComp.txt:1384) + /// (Originally from ..\FSComp.txt:1382) static member keywordDescriptionMember() = (GetStringFunc("keywordDescriptionMember",",,,") ) /// Used to associate a name with a group of related types, values, and functions, to logically separate it from other code. - /// (Originally from ..\FSComp.txt:1385) + /// (Originally from ..\FSComp.txt:1383) static member keywordDescriptionModule() = (GetStringFunc("keywordDescriptionModule",",,,") ) /// Used to declare a variable, that is, a value that can be changed. - /// (Originally from ..\FSComp.txt:1386) + /// (Originally from ..\FSComp.txt:1384) static member keywordDescriptionMutable() = (GetStringFunc("keywordDescriptionMutable",",,,") ) /// Used to associate a name with a group of related types and modules, to logically separate it from other code. - /// (Originally from ..\FSComp.txt:1387) + /// (Originally from ..\FSComp.txt:1385) static member keywordDescriptionNamespace() = (GetStringFunc("keywordDescriptionNamespace",",,,") ) /// Used to declare, define, or invoke a constructor that creates or that can create an object. Also used in generic parameter constraints to indicate that a type must have a certain constructor. - /// (Originally from ..\FSComp.txt:1388) + /// (Originally from ..\FSComp.txt:1386) static member keywordDescriptionNew() = (GetStringFunc("keywordDescriptionNew",",,,") ) /// Not actually a keyword. However, not struct in combination is used as a generic parameter constraint. - /// (Originally from ..\FSComp.txt:1389) + /// (Originally from ..\FSComp.txt:1387) static member keywordDescriptionNot() = (GetStringFunc("keywordDescriptionNot",",,,") ) /// Indicates the absence of an object. Also used in generic parameter constraints. - /// (Originally from ..\FSComp.txt:1390) + /// (Originally from ..\FSComp.txt:1388) static member keywordDescriptionNull() = (GetStringFunc("keywordDescriptionNull",",,,") ) /// Used in discriminated unions to indicate the type of categories of values, and in delegate and exception declarations. - /// (Originally from ..\FSComp.txt:1391) + /// (Originally from ..\FSComp.txt:1389) static member keywordDescriptionOf() = (GetStringFunc("keywordDescriptionOf",",,,") ) /// Used to make the contents of a namespace or module available without qualification. - /// (Originally from ..\FSComp.txt:1392) + /// (Originally from ..\FSComp.txt:1390) static member keywordDescriptionOpen() = (GetStringFunc("keywordDescriptionOpen",",,,") ) /// Used with Boolean conditions as a Boolean or operator. Equivalent to ||. Also used in member constraints. - /// (Originally from ..\FSComp.txt:1393) + /// (Originally from ..\FSComp.txt:1391) static member keywordDescriptionOr() = (GetStringFunc("keywordDescriptionOr",",,,") ) /// Used to implement a version of an abstract or virtual method that differs from the base version. - /// (Originally from ..\FSComp.txt:1394) + /// (Originally from ..\FSComp.txt:1392) static member keywordDescriptionOverride() = (GetStringFunc("keywordDescriptionOverride",",,,") ) /// Restricts access to a member to code in the same type or module. - /// (Originally from ..\FSComp.txt:1395) + /// (Originally from ..\FSComp.txt:1393) static member keywordDescriptionPrivate() = (GetStringFunc("keywordDescriptionPrivate",",,,") ) /// Allows access to a member from outside the type. - /// (Originally from ..\FSComp.txt:1396) + /// (Originally from ..\FSComp.txt:1394) static member keywordDescriptionPublic() = (GetStringFunc("keywordDescriptionPublic",",,,") ) /// Used to indicate that a function is recursive. - /// (Originally from ..\FSComp.txt:1397) + /// (Originally from ..\FSComp.txt:1395) static member keywordDescriptionRec() = (GetStringFunc("keywordDescriptionRec",",,,") ) /// Used to provide a value for the result of the containing computation expression. - /// (Originally from ..\FSComp.txt:1398) + /// (Originally from ..\FSComp.txt:1396) static member keywordDescriptionReturn() = (GetStringFunc("keywordDescriptionReturn",",,,") ) /// Used to provide a value for the result of the containing computation expression, where that value itself comes from the result another computation expression. - /// (Originally from ..\FSComp.txt:1399) + /// (Originally from ..\FSComp.txt:1397) static member keywordDescriptionReturnBang() = (GetStringFunc("keywordDescriptionReturnBang",",,,") ) /// Used in query expressions to specify what fields or columns to extract. Note that this is a contextual keyword, which means that it is not actually a reserved word and it only acts like a keyword in appropriate context. - /// (Originally from ..\FSComp.txt:1400) + /// (Originally from ..\FSComp.txt:1398) static member keywordDescriptionSelect() = (GetStringFunc("keywordDescriptionSelect",",,,") ) /// Used to indicate a method or property that can be called without an instance of a type, or a value member that is shared among all instances of a type. - /// (Originally from ..\FSComp.txt:1401) + /// (Originally from ..\FSComp.txt:1399) static member keywordDescriptionStatic() = (GetStringFunc("keywordDescriptionStatic",",,,") ) /// Used to declare a structure type. Also used in generic parameter constraints. Used for OCaml compatibility in module definitions. - /// (Originally from ..\FSComp.txt:1402) + /// (Originally from ..\FSComp.txt:1400) static member keywordDescriptionStruct() = (GetStringFunc("keywordDescriptionStruct",",,,") ) /// Used in conditional expressions. Also used to perform side effects after object construction. - /// (Originally from ..\FSComp.txt:1403) + /// (Originally from ..\FSComp.txt:1401) static member keywordDescriptionThen() = (GetStringFunc("keywordDescriptionThen",",,,") ) /// Used in for loops to indicate a range. - /// (Originally from ..\FSComp.txt:1404) + /// (Originally from ..\FSComp.txt:1402) static member keywordDescriptionTo() = (GetStringFunc("keywordDescriptionTo",",,,") ) /// Used to introduce a block of code that might generate an exception. Used together with with or finally. - /// (Originally from ..\FSComp.txt:1405) + /// (Originally from ..\FSComp.txt:1403) static member keywordDescriptionTry() = (GetStringFunc("keywordDescriptionTry",",,,") ) /// Used to declare a class, record, structure, discriminated union, enumeration type, unit of measure, or type abbreviation. - /// (Originally from ..\FSComp.txt:1406) + /// (Originally from ..\FSComp.txt:1404) static member keywordDescriptionType() = (GetStringFunc("keywordDescriptionType",",,,") ) /// Used to convert to a type that is higher in the inheritance chain. - /// (Originally from ..\FSComp.txt:1407) + /// (Originally from ..\FSComp.txt:1405) static member keywordDescriptionUpcast() = (GetStringFunc("keywordDescriptionUpcast",",,,") ) /// Used instead of let for values that implement IDisposable - /// (Originally from ..\FSComp.txt:1408) + /// (Originally from ..\FSComp.txt:1406) static member keywordDescriptionUse() = (GetStringFunc("keywordDescriptionUse",",,,") ) /// Used instead of let! in computation expressions for computation expression results that implement IDisposable. - /// (Originally from ..\FSComp.txt:1409) + /// (Originally from ..\FSComp.txt:1407) static member keywordDescriptionUseBang() = (GetStringFunc("keywordDescriptionUseBang",",,,") ) /// Used in a signature to indicate a value, or in a type to declare a member, in limited situations. - /// (Originally from ..\FSComp.txt:1410) + /// (Originally from ..\FSComp.txt:1408) static member keywordDescriptionVal() = (GetStringFunc("keywordDescriptionVal",",,,") ) /// Indicates the .NET void type. Used when interoperating with other .NET languages. - /// (Originally from ..\FSComp.txt:1411) + /// (Originally from ..\FSComp.txt:1409) static member keywordDescriptionVoid() = (GetStringFunc("keywordDescriptionVoid",",,,") ) /// Used for Boolean conditions (when guards) on pattern matches and to introduce a constraint clause for a generic type parameter. - /// (Originally from ..\FSComp.txt:1412) + /// (Originally from ..\FSComp.txt:1410) static member keywordDescriptionWhen() = (GetStringFunc("keywordDescriptionWhen",",,,") ) /// Introduces a looping construct. - /// (Originally from ..\FSComp.txt:1413) + /// (Originally from ..\FSComp.txt:1411) static member keywordDescriptionWhile() = (GetStringFunc("keywordDescriptionWhile",",,,") ) /// Used together with the match keyword in pattern matching expressions. Also used in object expressions, record copying expressions, and type extensions to introduce member definitions, and to introduce exception handlers. - /// (Originally from ..\FSComp.txt:1414) + /// (Originally from ..\FSComp.txt:1412) static member keywordDescriptionWith() = (GetStringFunc("keywordDescriptionWith",",,,") ) /// Used in a sequence expression to produce a value for a sequence. - /// (Originally from ..\FSComp.txt:1415) + /// (Originally from ..\FSComp.txt:1413) static member keywordDescriptionYield() = (GetStringFunc("keywordDescriptionYield",",,,") ) /// Used in a computation expression to append the result of a given computation expression to a collection of results for the containing computation expression. - /// (Originally from ..\FSComp.txt:1416) + /// (Originally from ..\FSComp.txt:1414) static member keywordDescriptionYieldBang() = (GetStringFunc("keywordDescriptionYieldBang",",,,") ) /// In function types, delimits arguments and return values. Yields an expression (in sequence expressions); equivalent to the yield keyword. Used in match expressions - /// (Originally from ..\FSComp.txt:1417) + /// (Originally from ..\FSComp.txt:1415) static member keywordDescriptionRightArrow() = (GetStringFunc("keywordDescriptionRightArrow",",,,") ) /// Assigns a value to a variable. - /// (Originally from ..\FSComp.txt:1418) + /// (Originally from ..\FSComp.txt:1416) static member keywordDescriptionLeftArrow() = (GetStringFunc("keywordDescriptionLeftArrow",",,,") ) /// Converts a type to type that is higher in the hierarchy. - /// (Originally from ..\FSComp.txt:1419) + /// (Originally from ..\FSComp.txt:1417) static member keywordDescriptionCast() = (GetStringFunc("keywordDescriptionCast",",,,") ) /// Converts a type to a type that is lower in the hierarchy. - /// (Originally from ..\FSComp.txt:1420) + /// (Originally from ..\FSComp.txt:1418) static member keywordDescriptionDynamicCast() = (GetStringFunc("keywordDescriptionDynamicCast",",,,") ) /// Delimits a typed code quotation. - /// (Originally from ..\FSComp.txt:1421) + /// (Originally from ..\FSComp.txt:1419) static member keywordDescriptionTypedQuotation() = (GetStringFunc("keywordDescriptionTypedQuotation",",,,") ) /// Delimits a untyped code quotation. - /// (Originally from ..\FSComp.txt:1422) + /// (Originally from ..\FSComp.txt:1420) static member keywordDescriptionUntypedQuotation() = (GetStringFunc("keywordDescriptionUntypedQuotation",",,,") ) /// %s '%s' not found in assembly '%s'. A possible cause may be a version incompatibility. You may need to explicitly reference the correct version of this assembly to allow all referenced components to use the correct version. - /// (Originally from ..\FSComp.txt:1423) + /// (Originally from ..\FSComp.txt:1421) static member itemNotFoundDuringDynamicCodeGen(a0 : System.String, a1 : System.String, a2 : System.String) = (3216, GetStringFunc("itemNotFoundDuringDynamicCodeGen",",,,%s,,,%s,,,%s,,,") a0 a1 a2) /// %s '%s' not found in type '%s' from assembly '%s'. A possible cause may be a version incompatibility. You may need to explicitly reference the correct version of this assembly to allow all referenced components to use the correct version. - /// (Originally from ..\FSComp.txt:1424) + /// (Originally from ..\FSComp.txt:1422) static member itemNotFoundInTypeDuringDynamicCodeGen(a0 : System.String, a1 : System.String, a2 : System.String, a3 : System.String) = (3216, GetStringFunc("itemNotFoundInTypeDuringDynamicCodeGen",",,,%s,,,%s,,,%s,,,%s,,,") a0 a1 a2 a3) /// is - /// (Originally from ..\FSComp.txt:1425) + /// (Originally from ..\FSComp.txt:1423) static member descriptionWordIs() = (GetStringFunc("descriptionWordIs",",,,") ) /// This value is not a function and cannot be applied. - /// (Originally from ..\FSComp.txt:1426) + /// (Originally from ..\FSComp.txt:1424) static member notAFunction() = (GetStringFunc("notAFunction",",,,") ) /// This value is not a function and cannot be applied. Did you intend to access the indexer via %s.[index] instead? - /// (Originally from ..\FSComp.txt:1427) + /// (Originally from ..\FSComp.txt:1425) static member notAFunctionButMaybeIndexerWithName(a0 : System.String) = (GetStringFunc("notAFunctionButMaybeIndexerWithName",",,,%s,,,") a0) /// This expression is not a function and cannot be applied. Did you intend to access the indexer via expr.[index] instead? - /// (Originally from ..\FSComp.txt:1428) + /// (Originally from ..\FSComp.txt:1426) static member notAFunctionButMaybeIndexer() = (GetStringFunc("notAFunctionButMaybeIndexer",",,,") ) /// - /// (Originally from ..\FSComp.txt:1429) + /// (Originally from ..\FSComp.txt:1427) static member notAFunctionButMaybeIndexerErrorCode() = (3217, GetStringFunc("notAFunctionButMaybeIndexerErrorCode",",,,") ) /// This value is not a function and cannot be applied. Did you forget to terminate a declaration? - /// (Originally from ..\FSComp.txt:1430) + /// (Originally from ..\FSComp.txt:1428) static member notAFunctionButMaybeDeclaration() = (GetStringFunc("notAFunctionButMaybeDeclaration",",,,") ) /// The argument names in the signature '%s' and implementation '%s' do not match. The argument name from the signature file will be used. This may cause problems when debugging or profiling. - /// (Originally from ..\FSComp.txt:1431) + /// (Originally from ..\FSComp.txt:1429) static member ArgumentsInSigAndImplMismatch(a0 : System.String, a1 : System.String) = (3218, GetStringFunc("ArgumentsInSigAndImplMismatch",",,,%s,,,%s,,,") a0 a1) /// An error occurred while reading the F# metadata of assembly '%s'. A reserved construct was utilized. You may need to upgrade your F# compiler or use an earlier version of the assembly that doesn't make use of a specific construct. - /// (Originally from ..\FSComp.txt:1432) + /// (Originally from ..\FSComp.txt:1430) static member pickleUnexpectedNonZero(a0 : System.String) = (3219, GetStringFunc("pickleUnexpectedNonZero",",,,%s,,,") a0) /// This method or property is not normally used from F# code, use an explicit tuple pattern for deconstruction instead. - /// (Originally from ..\FSComp.txt:1433) + /// (Originally from ..\FSComp.txt:1431) static member tcTupleMemberNotNormallyUsed() = (3220, GetStringFunc("tcTupleMemberNotNormallyUsed",",,,") ) /// This expression returns a value of type '%s' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'. - /// (Originally from ..\FSComp.txt:1434) + /// (Originally from ..\FSComp.txt:1432) static member implicitlyDiscardedInSequenceExpression(a0 : System.String) = (3221, GetStringFunc("implicitlyDiscardedInSequenceExpression",",,,%s,,,") a0) /// This expression returns a value of type '%s' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield!'. - /// (Originally from ..\FSComp.txt:1435) + /// (Originally from ..\FSComp.txt:1433) static member implicitlyDiscardedSequenceInSequenceExpression(a0 : System.String) = (3222, GetStringFunc("implicitlyDiscardedSequenceInSequenceExpression",",,,%s,,,") a0) /// The file '%s' changed on disk unexpectedly, please reload. - /// (Originally from ..\FSComp.txt:1436) + /// (Originally from ..\FSComp.txt:1434) static member ilreadFileChanged(a0 : System.String) = (3223, GetStringFunc("ilreadFileChanged",",,,%s,,,") a0) /// The byref pointer is readonly, so this write is not permitted. - /// (Originally from ..\FSComp.txt:1437) + /// (Originally from ..\FSComp.txt:1435) static member writeToReadOnlyByref() = (3224, GetStringFunc("writeToReadOnlyByref",",,,") ) /// A ReadOnly attribute has been applied to a struct type with a mutable field. - /// (Originally from ..\FSComp.txt:1438) + /// (Originally from ..\FSComp.txt:1436) static member readOnlyAttributeOnStructWithMutableField() = (3225, GetStringFunc("readOnlyAttributeOnStructWithMutableField",",,,") ) /// A byref pointer returned by a function or method is implicitly dereferenced as of F# 4.5. To acquire the return value as a pointer, use the address-of operator, e.g. '&f(x)' or '&obj.Method(arg1, arg2)'. - /// (Originally from ..\FSComp.txt:1439) + /// (Originally from ..\FSComp.txt:1437) static member tcByrefReturnImplicitlyDereferenced() = (3226, GetStringFunc("tcByrefReturnImplicitlyDereferenced",",,,") ) /// A type annotated with IsByRefLike must also be a struct. Consider adding the [] attribute to the type. - /// (Originally from ..\FSComp.txt:1440) + /// (Originally from ..\FSComp.txt:1438) static member tcByRefLikeNotStruct() = (3227, GetStringFunc("tcByRefLikeNotStruct",",,,") ) /// The address of a value returned from the expression cannot be used at this point. This is to ensure the address of the local value does not escape its scope. - /// (Originally from ..\FSComp.txt:1441) + /// (Originally from ..\FSComp.txt:1439) static member chkNoByrefAddressOfValueFromExpression() = (3228, GetStringFunc("chkNoByrefAddressOfValueFromExpression",",,,") ) /// This value can't be assigned because the target '%s' may refer to non-stack-local memory, while the expression being assigned is assessed to potentially refer to stack-local memory. This is to help prevent pointers to stack-bound memory escaping their scope. - /// (Originally from ..\FSComp.txt:1442) + /// (Originally from ..\FSComp.txt:1440) static member chkNoWriteToLimitedSpan(a0 : System.String) = (3229, GetStringFunc("chkNoWriteToLimitedSpan",",,,%s,,,") a0) /// A value defined in a module must be mutable in order to take its address, e.g. 'let mutable x = ...' - /// (Originally from ..\FSComp.txt:1443) + /// (Originally from ..\FSComp.txt:1441) static member tastValueMustBeLocal() = (3230, GetStringFunc("tastValueMustBeLocal",",,,") ) /// A type annotated with IsReadOnly must also be a struct. Consider adding the [] attribute to the type. - /// (Originally from ..\FSComp.txt:1444) + /// (Originally from ..\FSComp.txt:1442) static member tcIsReadOnlyNotStruct() = (3231, GetStringFunc("tcIsReadOnlyNotStruct",",,,") ) /// Struct members cannot return the address of fields of the struct by reference - /// (Originally from ..\FSComp.txt:1445) + /// (Originally from ..\FSComp.txt:1443) static member chkStructsMayNotReturnAddressesOfContents() = (3232, GetStringFunc("chkStructsMayNotReturnAddressesOfContents",",,,") ) /// The function or method call cannot be used at this point, because one argument that is a byref of a non-stack-local Span or IsByRefLike type is used with another argument that is a stack-local Span or IsByRefLike type. This is to ensure the address of the local value does not escape its scope. - /// (Originally from ..\FSComp.txt:1446) + /// (Originally from ..\FSComp.txt:1444) static member chkNoByrefLikeFunctionCall() = (3233, GetStringFunc("chkNoByrefLikeFunctionCall",",,,") ) /// The Span or IsByRefLike variable '%s' cannot be used at this point. This is to ensure the address of the local value does not escape its scope. - /// (Originally from ..\FSComp.txt:1447) + /// (Originally from ..\FSComp.txt:1445) static member chkNoSpanLikeVariable(a0 : System.String) = (3234, GetStringFunc("chkNoSpanLikeVariable",",,,%s,,,") a0) /// A Span or IsByRefLike value returned from the expression cannot be used at ths point. This is to ensure the address of the local value does not escape its scope. - /// (Originally from ..\FSComp.txt:1448) + /// (Originally from ..\FSComp.txt:1446) static member chkNoSpanLikeValueFromExpression() = (3235, GetStringFunc("chkNoSpanLikeValueFromExpression",",,,") ) /// Cannot take the address of the value returned from the expression. Assign the returned value to a let-bound value before taking the address. - /// (Originally from ..\FSComp.txt:1449) + /// (Originally from ..\FSComp.txt:1447) static member tastCantTakeAddressOfExpression() = (3236, GetStringFunc("tastCantTakeAddressOfExpression",",,,") ) /// Cannot call the byref extension method '%s. The first parameter requires the value to be mutable or a non-readonly byref type. - /// (Originally from ..\FSComp.txt:1450) + /// (Originally from ..\FSComp.txt:1448) static member tcCannotCallExtensionMethodInrefToByref(a0 : System.String) = (3237, GetStringFunc("tcCannotCallExtensionMethodInrefToByref",",,,%s,,,") a0) /// Byref types are not allowed to have optional type extensions. - /// (Originally from ..\FSComp.txt:1451) + /// (Originally from ..\FSComp.txt:1449) static member tcByrefsMayNotHaveTypeExtensions() = (3238, GetStringFunc("tcByrefsMayNotHaveTypeExtensions",",,,") ) /// Cannot partially apply the extension method '%s' because the first parameter is a byref type. - /// (Originally from ..\FSComp.txt:1452) + /// (Originally from ..\FSComp.txt:1450) static member tcCannotPartiallyApplyExtensionMethodForByref(a0 : System.String) = (3239, GetStringFunc("tcCannotPartiallyApplyExtensionMethodForByref",",,,%s,,,") a0) /// This type does not inherit Attribute, it will not work correctly with other .NET languages. - /// (Originally from ..\FSComp.txt:1453) + /// (Originally from ..\FSComp.txt:1451) static member tcTypeDoesNotInheritAttribute() = (3242, GetStringFunc("tcTypeDoesNotInheritAttribute",",,,") ) /// Invalid anonymous record expression - /// (Originally from ..\FSComp.txt:1454) + /// (Originally from ..\FSComp.txt:1452) static member parsInvalidAnonRecdExpr() = (3243, GetStringFunc("parsInvalidAnonRecdExpr",",,,") ) /// Invalid anonymous record type - /// (Originally from ..\FSComp.txt:1455) + /// (Originally from ..\FSComp.txt:1453) static member parsInvalidAnonRecdType() = (3244, GetStringFunc("parsInvalidAnonRecdType",",,,") ) /// The input to a copy-and-update expression that creates an anonymous record must be either an anonymous record or a record - /// (Originally from ..\FSComp.txt:1456) + /// (Originally from ..\FSComp.txt:1454) static member tcCopyAndUpdateNeedsRecordType() = (3245, GetStringFunc("tcCopyAndUpdateNeedsRecordType",",,,") ) + /// Expression does not have a name. + /// (Originally from ..\FSComp.txt:1455) + static member expressionHasNoName() = (3250, GetStringFunc("expressionHasNoName",",,,") ) + /// First-class uses of the 'nameof' operator is not permitted. + /// (Originally from ..\FSComp.txt:1456) + static member chkNoFirstClassNameOf() = (3251, GetStringFunc("chkNoFirstClassNameOf",",,,") ) /// The parameter '%s' has an invalid type '%s'. This is not permitted by the rules of Common IL. /// (Originally from ..\FSComp.txt:1457) static member chkInvalidFunctionParameterType(a0 : System.String, a1 : System.String) = (3300, GetStringFunc("chkInvalidFunctionParameterType",",,,%s,,,%s,,,") a0 a1) @@ -5712,8 +5712,6 @@ type internal SR private() = ignore(GetString("parsUnexpectedSymbolEqualsInsteadOfIn")) ignore(GetString("tcAnonRecdCcuMismatch")) ignore(GetString("tcAnonRecdFieldNameMismatch")) - ignore(GetString("expressionHasNoName")) - ignore(GetString("chkNoFirstClassNameOf")) ignore(GetString("keywordDescriptionAbstract")) ignore(GetString("keyworkDescriptionAnd")) ignore(GetString("keywordDescriptionAs")) @@ -5822,6 +5820,8 @@ type internal SR private() = ignore(GetString("parsInvalidAnonRecdExpr")) ignore(GetString("parsInvalidAnonRecdType")) ignore(GetString("tcCopyAndUpdateNeedsRecordType")) + ignore(GetString("expressionHasNoName")) + ignore(GetString("chkNoFirstClassNameOf")) ignore(GetString("chkInvalidFunctionParameterType")) ignore(GetString("chkInvalidFunctionReturnType")) () diff --git a/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx b/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx index 01abfe54e3..84a2836c02 100644 --- a/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx +++ b/src/buildfromsource/FSharp.Compiler.Private/FSComp.resx @@ -4068,12 +4068,6 @@ Two anonymous record types have mismatched sets of field names '{0}' and '{1}' - - Expression does not have a name. - - - First-class uses of the 'nameof' operator is not permitted. - Indicates a method that either has no implementation in the type in which it is declared or that is virtual and has a default implementation. @@ -4399,6 +4393,12 @@ The input to a copy-and-update expression that creates an anonymous record must be either an anonymous record or a record + + Expression does not have a name. + + + First-class uses of the 'nameof' operator is not permitted. + The parameter '{0}' has an invalid type '{1}'. This is not permitted by the rules of Common IL. diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index b7203e1504..a0c31a774e 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1344,8 +1344,6 @@ tcGlobalsSystemTypeNotFound,"The system type '%s' was required but no referenced 3215,parsUnexpectedSymbolEqualsInsteadOfIn,"Unexpected symbol '=' in expression. Did you intend to use 'for x in y .. z do' instead?" tcAnonRecdCcuMismatch,"Two anonymous record types are from different assemblies '%s' and '%s'" tcAnonRecdFieldNameMismatch,"Two anonymous record types have mismatched sets of field names '%s' and '%s'" -3216,expressionHasNoName,"Expression does not have a name." -3217,chkNoFirstClassNameOf,"First-class uses of the 'nameof' operator is not permitted." keywordDescriptionAbstract,"Indicates a method that either has no implementation in the type in which it is declared or that is virtual and has a default implementation." keyworkDescriptionAnd,"Used in mutually recursive bindings, in property declarations, and with multiple constraints on generic parameters." keywordDescriptionAs,"Used to give the current class object an object name. Also used to give a name to a whole pattern within a pattern match." @@ -1454,5 +1452,7 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl 3243,parsInvalidAnonRecdExpr,"Invalid anonymous record expression" 3244,parsInvalidAnonRecdType,"Invalid anonymous record type" 3245,tcCopyAndUpdateNeedsRecordType,"The input to a copy-and-update expression that creates an anonymous record must be either an anonymous record or a record" +3250,expressionHasNoName,"Expression does not have a name." +3251,chkNoFirstClassNameOf,"First-class uses of the 'nameof' operator is not permitted." 3300,chkInvalidFunctionParameterType,"The parameter '%s' has an invalid type '%s'. This is not permitted by the rules of Common IL." 3301,chkInvalidFunctionReturnType,"The function or method has an invalid return type '%s'. This is not permitted by the rules of Common IL." diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs index e0ea446400..2fd34fa161 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAdditionExpr.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const string -//Expression does not have a name. +//Expression does not have a name. let x = nameof(1+2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs index 40b57503e2..666ba1453f 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//Expression does not have a name. +//Expression does not have a name. let f() = 1 let x = nameof(f()) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs index 76acc5a4bb..a9acc46819 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof can't be used as a function. -//First-class uses of the 'nameof' operator is not permitted +//First-class uses of the 'nameof' operator is not permitted let f = nameof diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs index 1ae13ab859..988863a0e1 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfDictLookup.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on dictionary lookup -//Expression does not have a name. +//Expression does not have a name. let dict = new System.Collections.Generic.Dictionary() let b = nameof(dict.[2]) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs index 727c9ec3b8..9a2487e534 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntConst.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const int -//Expression does not have a name. +//Expression does not have a name. let x = nameof 1 diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs index ad8d0e5426..303bd2b9a3 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfIntegerAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//Expression does not have a name. +//Expression does not have a name. let f x = 1 * x let x = nameof(f 2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs index 1793de15bc..252e867c91 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfParameterAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on applied functions -//Expression does not have a name. +//Expression does not have a name. let f x y = x y let z x = 1 * x diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs index ca993e87e0..be11b22a6a 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfPartiallyAppliedFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on partially applied functions -//Expression does not have a name. +//Expression does not have a name. let f x y = y * x let x = nameof(f 2) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs index 2d7428c0c4..f901f6f72f 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfStringConst.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof doesn't work on const string -//Expression does not have a name. +//Expression does not have a name. let x = nameof "string" diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs index cae86f5ea0..086a3c252b 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof can't be used as a function. -//First-class uses of the 'nameof' operator is not permitted. +//First-class uses of the 'nameof' operator is not permitted. let curriedFunction x y = x * y let b = curriedFunction |> nameof From 4b915986709f804b406c128979dc4f6a7202e6a5 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 13 Mar 2019 18:25:09 +0000 Subject: [PATCH 044/286] fix test --- tests/fsharpqa/Source/Warnings/EqualsInsteadOfInInForLoop.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharpqa/Source/Warnings/EqualsInsteadOfInInForLoop.fs b/tests/fsharpqa/Source/Warnings/EqualsInsteadOfInInForLoop.fs index 064b69e1ee..4100e205a5 100644 --- a/tests/fsharpqa/Source/Warnings/EqualsInsteadOfInInForLoop.fs +++ b/tests/fsharpqa/Source/Warnings/EqualsInsteadOfInInForLoop.fs @@ -1,5 +1,5 @@ // #Warnings -//Unexpected symbol '=' in expression. Did you intend to use 'for x in y .. z do' instead? +//Unexpected symbol '=' in expression. Did you intend to use 'for x in y .. z do' instead? for i = 0 .. 100 do () From 23d7a641c7b364cb24cc148ac569a2d610f6b9a1 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 22 Mar 2019 11:33:57 +0000 Subject: [PATCH 045/286] merge master --- tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj index fff111f538..5aaf71caa3 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj @@ -94,12 +94,6 @@ - - - - - - From 6e7e3c4c71a45930227f26c77fdf1de96d9df82c Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 27 Mar 2019 11:57:03 +0000 Subject: [PATCH 046/286] us proto build on mac and linux --- eng/build.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eng/build.sh b/eng/build.sh index d814dcd04d..c00b144a85 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -217,6 +217,13 @@ function BuildSolution { cp $artifacts_dir/bin/fslex/$bootstrap_config/netcoreapp2.0/* $bootstrap_dir cp $artifacts_dir/bin/fsyacc/$bootstrap_config/netcoreapp2.0/* $bootstrap_dir + MSBuild "$repo_root/proto.proj" \ + /restore \ + /p:Configuration=$bootstrap_config \ + /t:Build + + cp $artifacts_dir/bin/fsc/$bootstrap_config/netcoreapp2.0/* $bootstrap_dir + # do real build MSBuild $toolset_build_proj \ $bl \ @@ -230,6 +237,7 @@ function BuildSolution { /p:Publish=$publish \ /p:UseRoslynAnalyzers=$enable_analyzers \ /p:ContinuousIntegrationBuild=$ci \ + /p:BootstrapBuildPath="$bootstrap_dir" \ /p:QuietRestore=$quiet_restore \ /p:QuietRestoreBinaryLog="$binary_log" \ $properties From 21b46ca77579b652830322812b35cc9eb2159267 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 27 Mar 2019 11:57:03 +0000 Subject: [PATCH 047/286] us proto build on mac and linux --- eng/build.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eng/build.sh b/eng/build.sh index d814dcd04d..c00b144a85 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -217,6 +217,13 @@ function BuildSolution { cp $artifacts_dir/bin/fslex/$bootstrap_config/netcoreapp2.0/* $bootstrap_dir cp $artifacts_dir/bin/fsyacc/$bootstrap_config/netcoreapp2.0/* $bootstrap_dir + MSBuild "$repo_root/proto.proj" \ + /restore \ + /p:Configuration=$bootstrap_config \ + /t:Build + + cp $artifacts_dir/bin/fsc/$bootstrap_config/netcoreapp2.0/* $bootstrap_dir + # do real build MSBuild $toolset_build_proj \ $bl \ @@ -230,6 +237,7 @@ function BuildSolution { /p:Publish=$publish \ /p:UseRoslynAnalyzers=$enable_analyzers \ /p:ContinuousIntegrationBuild=$ci \ + /p:BootstrapBuildPath="$bootstrap_dir" \ /p:QuietRestore=$quiet_restore \ /p:QuietRestoreBinaryLog="$binary_log" \ $properties From 39ec26ad4f68b5530675418212fce6fd8e26cd12 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 27 Mar 2019 13:24:28 +0000 Subject: [PATCH 048/286] build right proto on unix --- proto.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto.proj b/proto.proj index c60f17d842..1d707586ea 100644 --- a/proto.proj +++ b/proto.proj @@ -8,7 +8,7 @@ TargetFramework=net46 - TargetFramework=netcoreapp2.1 + TargetFramework=netstandard2.0 TargetFramework=net46 From 4b5119790bf826bdef59ff4984fb67753f28c15d Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 27 Mar 2019 13:24:28 +0000 Subject: [PATCH 049/286] build right proto on unix --- proto.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto.proj b/proto.proj index c60f17d842..1d707586ea 100644 --- a/proto.proj +++ b/proto.proj @@ -8,7 +8,7 @@ TargetFramework=net46 - TargetFramework=netcoreapp2.1 + TargetFramework=netstandard2.0 TargetFramework=net46 From 7cc99ca04b475f2fa3c53b03474e2f2fa085a0f1 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 28 Mar 2019 11:46:15 +0000 Subject: [PATCH 050/286] fix build to really use proto --- eng/build-utils.ps1 | 4 ++-- eng/build.sh | 14 ++++++++------ fcs/build.fsx | 8 +++++--- src/fsharp/ExtensionTyping.fs | 4 ++-- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index 845169db12..d4f2b625f2 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -242,8 +242,8 @@ function Make-BootstrapBuild() { # prepare FsLex and Fsyacc Run-MSBuild "$RepoRoot\src\buildtools\buildtools.proj" "/restore /t:Build" -logFileName "BuildTools" -configuration $bootstrapConfiguration - Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\netcoreapp2.0\*" -Destination $dir - Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\netcoreapp2.0\*" -Destination $dir + Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\$coreclrTargetFramework\*" -Destination $dir + Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\$coreclrTargetFramework\*" -Destination $dir # prepare compiler $projectPath = "$RepoRoot\proto.proj" diff --git a/eng/build.sh b/eng/build.sh index c00b144a85..bae5b6a45f 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -205,6 +205,8 @@ function BuildSolution { quiet_restore=true fi + coreclr_target_framework=netcoreapp2.0 + # build bootstrap tools bootstrap_config=Proto MSBuild "$repo_root/src/buildtools/buildtools.proj" \ @@ -214,15 +216,15 @@ function BuildSolution { bootstrap_dir=$artifacts_dir/Bootstrap mkdir -p "$bootstrap_dir" - cp $artifacts_dir/bin/fslex/$bootstrap_config/netcoreapp2.0/* $bootstrap_dir - cp $artifacts_dir/bin/fsyacc/$bootstrap_config/netcoreapp2.0/* $bootstrap_dir + cp $artifacts_dir/bin/fslex/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir + cp $artifacts_dir/bin/fsyacc/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir MSBuild "$repo_root/proto.proj" \ /restore \ /p:Configuration=$bootstrap_config \ /t:Build - cp $artifacts_dir/bin/fsc/$bootstrap_config/netcoreapp2.0/* $bootstrap_dir + cp $artifacts_dir/bin/fsc/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir # do real build MSBuild $toolset_build_proj \ @@ -248,9 +250,9 @@ InitializeDotNetCli $restore BuildSolution if [[ "$test_core_clr" == true ]]; then - TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj" --targetframework netcoreapp2.0 - TestUsingNUnit --testproject "$repo_root/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj" --targetframework netcoreapp2.0 - TestUsingNUnit --testproject "$repo_root/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj" --targetframework netcoreapp2.0 + TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj" --targetframework $coreclr_target_framework + TestUsingNUnit --testproject "$repo_root/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj" --targetframework $coreclr_target_framework + TestUsingNUnit --testproject "$repo_root/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj" --targetframework $coreclr_target_framework fi ExitWithExitCode 0 diff --git a/fcs/build.fsx b/fcs/build.fsx index 50735795d8..58262f7c40 100644 --- a/fcs/build.fsx +++ b/fcs/build.fsx @@ -24,6 +24,8 @@ let isMono = false // Utilities // -------------------------------------------------------------------------------------- +let coreclrTargetFramework = "netcoreapp2.0" + let dotnetExePath = // Build.cmd normally downloads a dotnet cli to: \artifacts\toolset\dotnet // check if there is one there to avoid downloading an additional one here @@ -92,13 +94,13 @@ Target "BuildVersion" (fun _ -> Target "Build" (fun _ -> runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto" - let fslexPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fslex/Proto/netcoreapp2.0/fslex.dll" - let fsyaccPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fsyacc/Proto/netcoreapp2.0/fsyacc.dll" + let fslexPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fslex/Proto/" + coreclrTargetFramework + "/fslex.dll" + let fsyaccPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fsyacc/Proto/" + coreclrTargetFramework + "/fsyacc.dll" runDotnet __SOURCE_DIRECTORY__ (sprintf "build FSharp.Compiler.Service.sln -v n -c Release /p:FsLexPath=%s /p:FsYaccPath=%s" fslexPath fsyaccPath) ) Target "Test" (fun _ -> - // This project file is used for the netcoreapp2.0 tests to work out reference sets + // This project file is used for the tests to work out reference sets runDotnet __SOURCE_DIRECTORY__ "build ../tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj -v n /restore /p:DisableCompilerRedirection=true" // Now run the tests diff --git a/src/fsharp/ExtensionTyping.fs b/src/fsharp/ExtensionTyping.fs index 9bf54e3be7..cd0dfdbd2e 100755 --- a/src/fsharp/ExtensionTyping.fs +++ b/src/fsharp/ExtensionTyping.fs @@ -45,9 +45,9 @@ module internal ExtensionTyping = // Detect the host tooling context let toolingCompatibleVersions() = if typeof.Assembly.GetName().Name = "mscorlib" then - [ "net461"; "net452"; "net451"; "net45"; "netstandard2.0"] + [ "net48"; "net472"; "net471"; "net47"; "net462"; "net461"; "net452"; "net451"; "net45"; "netstandard2.0"] elif typeof.Assembly.GetName().Name = "System.Private.CoreLib" then - [ "netcoreapp2.0"; "netstandard2.0"] + [ "netcoreapp2.1"; "netcoreapp2.0"; "netstandard2.0"] else System.Diagnostics.Debug.Assert(false, "Couldn't determine runtime tooling context, assuming it supports at least .NET Standard 2.0") [ "netstandard2.0"] From c15c030bb9ac7246e29ae93e82fb77bfdc5d5090 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 28 Mar 2019 12:38:15 +0000 Subject: [PATCH 051/286] fix build --- eng/build-utils.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index d4f2b625f2..845169db12 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -242,8 +242,8 @@ function Make-BootstrapBuild() { # prepare FsLex and Fsyacc Run-MSBuild "$RepoRoot\src\buildtools\buildtools.proj" "/restore /t:Build" -logFileName "BuildTools" -configuration $bootstrapConfiguration - Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\$coreclrTargetFramework\*" -Destination $dir - Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\$coreclrTargetFramework\*" -Destination $dir + Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\netcoreapp2.0\*" -Destination $dir + Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\netcoreapp2.0\*" -Destination $dir # prepare compiler $projectPath = "$RepoRoot\proto.proj" From 9d61ee7e4ef40267ecb178212a6193caf42aedc1 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 28 Mar 2019 17:39:22 +0000 Subject: [PATCH 052/286] update tfms for type providers --- .../ProductVersion.fs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs index fe95e82a97..462f621941 100644 --- a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs +++ b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs @@ -93,21 +93,21 @@ module TypeProviderDesignTimeComponentLoading = let ``check tooling paths for type provider design time component loading`` () = let expected = [ -#if NET46 // only available on net46 - Path.Combine("typeproviders", "fsharp41", "net461") - Path.Combine("tools", "fsharp41", "net461") - Path.Combine("typeproviders", "fsharp41", "net452") - Path.Combine("tools", "fsharp41", "net452") - Path.Combine("typeproviders", "fsharp41", "net451") - Path.Combine("tools", "fsharp41", "net451") - Path.Combine("typeproviders", "fsharp41", "net45") - Path.Combine("tools", "fsharp41", "net45") -#else // only available on netcoreapp2.0 - Path.Combine("typeproviders", "fsharp41", "netcoreapp2.0") - Path.Combine("tools", "fsharp41", "netcoreapp2.0") -#endif // available in both - Path.Combine("typeproviders", "fsharp41", "netstandard2.0") - Path.Combine("tools", "fsharp41", "netstandard2.0") +#if NET46 + // only searched when executing on .NET Framework + for tfm in ["net48"; "net472"; "net471"; "net47"; "net462"; "net461"; "net452"; "net451"; "net45"] do + yield Path.Combine("typeproviders", "fsharp41", tfm) + yield Path.Combine("tools", "fsharp41", tfm) +#else + // only searched when executing on .NET Core + for tfm in ["netcoreapp2.1"; "netcoreapp2.0"] do + yield Path.Combine("typeproviders", "fsharp41", tfm) + yield Path.Combine("tools", "fsharp41", tfm) +#endif + // always searched + for tfm in ["netstandard2.0"] do + yield Path.Combine("typeproviders", "fsharp41", tfm) + yield Path.Combine("tools", "fsharp41", tfm) ] let actual = FSharp.Compiler.ExtensionTyping.toolingCompatiblePaths() printfn "actual = %A" actual From 08d89c70db7bb6f96586613caab69bd634a27120 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 28 Mar 2019 19:25:02 +0000 Subject: [PATCH 053/286] verbose build --- .vsts-pr.yaml | 6 +++--- eng/Build.ps1 | 1 + eng/build.sh | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.vsts-pr.yaml b/.vsts-pr.yaml index b7d3862888..b0186db4e1 100644 --- a/.vsts-pr.yaml +++ b/.vsts-pr.yaml @@ -11,7 +11,7 @@ jobs: _configuration: Release _testKind: testcoreclr steps: - - script: ./eng/cibuild.sh --configuration $(_configuration) --$(_testKind) + - script: ./eng/cibuild.sh --configuration $(_configuration) --$(_testKind) --verbosity normal - task: PublishBuildArtifacts@1 displayName: Publish Build Logs inputs: @@ -55,7 +55,7 @@ jobs: _configuration: Release _testKind: testcoreclr steps: - - script: ./eng/cibuild.sh --configuration $(_configuration) --$(_testKind) + - script: ./eng/cibuild.sh --configuration $(_configuration) --$(_testKind) --verbosity normal - task: PublishBuildArtifacts@1 displayName: Publish Build Logs inputs: @@ -108,7 +108,7 @@ jobs: _configuration: Release _testKind: testVs steps: - - script: eng\CIBuild.cmd -configuration $(_configuration) -$(_testKind) + - script: eng\CIBuild.cmd -configuration $(_configuration) -$(_testKind) -verbosity normal - task: PublishBuildArtifacts@1 displayName: Publish Build Logs inputs: diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 04afc1b1d4..72a664f171 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -157,6 +157,7 @@ function BuildSolution() { /p:QuietRestore=$quietRestore ` /p:QuietRestoreBinaryLog=$binaryLog ` /p:TestTargetFrameworks=$testTargetFrameworks ` + /v:$verbosity ` $suppressExtensionDeployment ` @properties } diff --git a/eng/build.sh b/eng/build.sh index bae5b6a45f..a7c055e7ca 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -211,6 +211,7 @@ function BuildSolution { bootstrap_config=Proto MSBuild "$repo_root/src/buildtools/buildtools.proj" \ /restore \ + /v:$verbosity \ /p:Configuration=$bootstrap_config \ /t:Build @@ -221,6 +222,7 @@ function BuildSolution { MSBuild "$repo_root/proto.proj" \ /restore \ + /v:$verbosity \ /p:Configuration=$bootstrap_config \ /t:Build @@ -229,6 +231,7 @@ function BuildSolution { # do real build MSBuild $toolset_build_proj \ $bl \ + /v:$verbosity \ /p:Configuration=$configuration \ /p:Projects="$projects" \ /p:RepoRoot="$repo_root" \ From 088951b942cc7ab1e81a3804b6f87407b46b7c15 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 28 Mar 2019 21:28:32 +0000 Subject: [PATCH 054/286] try to fix build --- FSharpBuild.Directory.Build.props | 4 ++-- eng/Build.ps1 | 1 - eng/build-utils.ps1 | 4 ---- eng/build.sh | 1 - fcs/Directory.Build.props | 4 ---- 5 files changed, 2 insertions(+), 12 deletions(-) diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index 31d2430129..93b66901c8 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -12,7 +12,7 @@ $(RepoRoot)src $(ArtifactsDir)\SymStore $(ArtifactsDir)\Bootstrap - $(ArtifactsDir)/fsc/Proto/netcoreapp2.1 + $(ArtifactsDir)/bin/fsc/Proto/netcoreapp2.1 4.4.0 1182;0025;$(WarningsAsErrors) @@ -80,7 +80,7 @@ - + $(ProtoOutputPath)\Microsoft.FSharp.Targets $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.props $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 87d0873dec..46219f4bd5 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -155,7 +155,6 @@ function BuildSolution() { /p:Publish=$publish ` /p:ContinuousIntegrationBuild=$ci ` /p:OfficialBuildId=$officialBuildId ` - /p:BootstrapBuildPath=$bootstrapDir ` /p:QuietRestore=$quietRestore ` /p:QuietRestoreBinaryLog=$binaryLog ` /p:TestTargetFrameworks=$testTargetFrameworks ` diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index c76c9421c1..5f5f744171 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -216,10 +216,6 @@ function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string] $args += " /p:ContinuousIntegrationBuild=true" } - if ($bootstrapDir -ne "") { - $args += " /p:BootstrapBuildPath=$bootstrapDir" - } - $args += " $buildArgs" $args += " $projectFilePath" $args += " $properties" diff --git a/eng/build.sh b/eng/build.sh index a7c055e7ca..34cc7cf496 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -242,7 +242,6 @@ function BuildSolution { /p:Publish=$publish \ /p:UseRoslynAnalyzers=$enable_analyzers \ /p:ContinuousIntegrationBuild=$ci \ - /p:BootstrapBuildPath="$bootstrap_dir" \ /p:QuietRestore=$quiet_restore \ /p:QuietRestoreBinaryLog="$binary_log" \ $properties diff --git a/fcs/Directory.Build.props b/fcs/Directory.Build.props index 3179fe221f..99ac310b2a 100644 --- a/fcs/Directory.Build.props +++ b/fcs/Directory.Build.props @@ -20,8 +20,4 @@ true - - - $(ArtifactsBinDir)\FSharp.Build\Proto\net46 - From 9c93ac19ed2476668570566679e9b5c24125d3b9 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 28 Mar 2019 21:36:13 +0000 Subject: [PATCH 055/286] don't rebuild proto --- eng/build.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/eng/build.sh b/eng/build.sh index 34cc7cf496..47e6e57e39 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -216,17 +216,19 @@ function BuildSolution { /t:Build bootstrap_dir=$artifacts_dir/Bootstrap - mkdir -p "$bootstrap_dir" - cp $artifacts_dir/bin/fslex/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir - cp $artifacts_dir/bin/fsyacc/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir + if [ ! -d "$bootstrap_dir" ]; then + mkdir -p "$bootstrap_dir" + cp $artifacts_dir/bin/fslex/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir + cp $artifacts_dir/bin/fsyacc/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir - MSBuild "$repo_root/proto.proj" \ - /restore \ - /v:$verbosity \ - /p:Configuration=$bootstrap_config \ - /t:Build + MSBuild "$repo_root/proto.proj" \ + /restore \ + /v:$verbosity \ + /p:Configuration=$bootstrap_config \ + /t:Build - cp $artifacts_dir/bin/fsc/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir + cp $artifacts_dir/bin/fsc/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir + fi # do real build MSBuild $toolset_build_proj \ From ddd0ac7e57bad7b66c7ef6c5eb50cf92f5d87421 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 28 Mar 2019 21:44:55 +0000 Subject: [PATCH 056/286] trim list --- src/fsharp/ExtensionTyping.fs | 2 +- tests/FSharp.Compiler.UnitTests/ProductVersion.fs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/ExtensionTyping.fs b/src/fsharp/ExtensionTyping.fs index cd0dfdbd2e..97c4feddbc 100755 --- a/src/fsharp/ExtensionTyping.fs +++ b/src/fsharp/ExtensionTyping.fs @@ -45,7 +45,7 @@ module internal ExtensionTyping = // Detect the host tooling context let toolingCompatibleVersions() = if typeof.Assembly.GetName().Name = "mscorlib" then - [ "net48"; "net472"; "net471"; "net47"; "net462"; "net461"; "net452"; "net451"; "net45"; "netstandard2.0"] + [ "net471"; "net47"; "net462"; "net461"; "net452"; "net451"; "net45"; "netstandard2.0"] elif typeof.Assembly.GetName().Name = "System.Private.CoreLib" then [ "netcoreapp2.1"; "netcoreapp2.0"; "netstandard2.0"] else diff --git a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs index 462f621941..77ff2e60d3 100644 --- a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs +++ b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs @@ -95,7 +95,7 @@ module TypeProviderDesignTimeComponentLoading = [ #if NET46 // only searched when executing on .NET Framework - for tfm in ["net48"; "net472"; "net471"; "net47"; "net462"; "net461"; "net452"; "net451"; "net45"] do + for tfm in ["net471"; "net47"; "net462"; "net461"; "net452"; "net451"; "net45"] do yield Path.Combine("typeproviders", "fsharp41", tfm) yield Path.Combine("tools", "fsharp41", tfm) #else From 67717f86770cd66a9863f16369a5c19423959575 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 28 Mar 2019 22:00:10 +0000 Subject: [PATCH 057/286] disable proto compiler for fslex/fsyacc --- FSharpBuild.Directory.Build.props | 2 +- eng/build.sh | 17 +++++++++-------- fcs/Directory.Build.props | 2 +- fcs/build.fsx | 8 ++++---- src/buildtools/buildtools.proj | 1 + 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index 93b66901c8..9d1161037b 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -80,7 +80,7 @@ - + $(ProtoOutputPath)\Microsoft.FSharp.Targets $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.props $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets diff --git a/eng/build.sh b/eng/build.sh index 47e6e57e39..540866dbb1 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -209,18 +209,19 @@ function BuildSolution { # build bootstrap tools bootstrap_config=Proto - MSBuild "$repo_root/src/buildtools/buildtools.proj" \ - /restore \ - /v:$verbosity \ - /p:Configuration=$bootstrap_config \ - /t:Build - bootstrap_dir=$artifacts_dir/Bootstrap - if [ ! -d "$bootstrap_dir" ]; then + if [ ! -d "$bootstrap_dir/fslex.dll" ]; then + MSBuild "$repo_root/src/buildtools/buildtools.proj" \ + /restore \ + /v:$verbosity \ + /p:Configuration=$bootstrap_config \ + /t:Build + mkdir -p "$bootstrap_dir" cp $artifacts_dir/bin/fslex/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir cp $artifacts_dir/bin/fsyacc/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir - + fi + if [ ! -d "$bootstrap_dir/fsc.exe" ]; then MSBuild "$repo_root/proto.proj" \ /restore \ /v:$verbosity \ diff --git a/fcs/Directory.Build.props b/fcs/Directory.Build.props index 99ac310b2a..e09dc41a67 100644 --- a/fcs/Directory.Build.props +++ b/fcs/Directory.Build.props @@ -17,7 +17,7 @@ $(ArtifactsDir)\obj $(ArtifactsBinDir)\fcs $(ArtifactsObjDir)\fcs - true + true diff --git a/fcs/build.fsx b/fcs/build.fsx index 58262f7c40..7807d278ae 100644 --- a/fcs/build.fsx +++ b/fcs/build.fsx @@ -24,7 +24,7 @@ let isMono = false // Utilities // -------------------------------------------------------------------------------------- -let coreclrTargetFramework = "netcoreapp2.0" +let fslexyaccTargetFramework = "netcoreapp2.0" let dotnetExePath = // Build.cmd normally downloads a dotnet cli to: \artifacts\toolset\dotnet @@ -94,14 +94,14 @@ Target "BuildVersion" (fun _ -> Target "Build" (fun _ -> runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto" - let fslexPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fslex/Proto/" + coreclrTargetFramework + "/fslex.dll" - let fsyaccPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fsyacc/Proto/" + coreclrTargetFramework + "/fsyacc.dll" + let fslexPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fslex/Proto/" + fslexyaccTargetFramework + "/fslex.dll" + let fsyaccPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fsyacc/Proto/" + fslexyaccTargetFramework + "/fsyacc.dll" runDotnet __SOURCE_DIRECTORY__ (sprintf "build FSharp.Compiler.Service.sln -v n -c Release /p:FsLexPath=%s /p:FsYaccPath=%s" fslexPath fsyaccPath) ) Target "Test" (fun _ -> // This project file is used for the tests to work out reference sets - runDotnet __SOURCE_DIRECTORY__ "build ../tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj -v n /restore /p:DisableCompilerRedirection=true" + runDotnet __SOURCE_DIRECTORY__ "build ../tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj -v n /restore /p:DisableProtoCompiler=true" // Now run the tests let logFilePath = Path.Combine(__SOURCE_DIRECTORY__, "..", "artifacts", "TestResults", "Release", "FSharp.Compiler.Service.Test.xml") diff --git a/src/buildtools/buildtools.proj b/src/buildtools/buildtools.proj index 593f086dd0..4e6e42a27b 100644 --- a/src/buildtools/buildtools.proj +++ b/src/buildtools/buildtools.proj @@ -2,6 +2,7 @@ Debug + true From 2eb152834ad0ae8710b699b2e6725bae696c0d94 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 28 Mar 2019 23:01:44 +0000 Subject: [PATCH 058/286] fix build --- FSharpBuild.Directory.Build.props | 2 +- src/buildtools/buildtools.proj | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index 9d1161037b..bdb8c36c39 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -80,7 +80,7 @@ - + $(ProtoOutputPath)\Microsoft.FSharp.Targets $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.props $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets diff --git a/src/buildtools/buildtools.proj b/src/buildtools/buildtools.proj index 4e6e42a27b..9e7f671a35 100644 --- a/src/buildtools/buildtools.proj +++ b/src/buildtools/buildtools.proj @@ -11,23 +11,23 @@ - + - + - + - + - + From 713b40fb376d316ffe318046b51ab3787af8b2d0 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 01:07:07 +0000 Subject: [PATCH 059/286] add buildtools props file instead --- src/buildtools/buildtools.proj | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/buildtools/buildtools.proj b/src/buildtools/buildtools.proj index 9e7f671a35..593f086dd0 100644 --- a/src/buildtools/buildtools.proj +++ b/src/buildtools/buildtools.proj @@ -2,7 +2,6 @@ Debug - true @@ -11,23 +10,23 @@ - + - + - + - + - + From feebc9936100b70ea9f23febe2516285d67dc4d0 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 01:23:36 +0000 Subject: [PATCH 060/286] add missing file --- src/buildtools/Directory.Build.props | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/buildtools/Directory.Build.props diff --git a/src/buildtools/Directory.Build.props b/src/buildtools/Directory.Build.props new file mode 100644 index 0000000000..a2a60f76a9 --- /dev/null +++ b/src/buildtools/Directory.Build.props @@ -0,0 +1,7 @@ + + + + true + + + From 385c4d938ad267fc7285767178aea6c72616d6e5 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 02:16:05 +0000 Subject: [PATCH 061/286] proto --- src/buildtools/buildtools.proj | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/buildtools/buildtools.proj b/src/buildtools/buildtools.proj index 593f086dd0..d96cf6a8d8 100644 --- a/src/buildtools/buildtools.proj +++ b/src/buildtools/buildtools.proj @@ -2,7 +2,8 @@ Debug - + true + @@ -10,23 +11,23 @@ - + - + - + - + - + From 9b4ff938774a7dde85e4aac3cab66d29b83fa3de Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 02:18:25 +0000 Subject: [PATCH 062/286] proto --- src/buildtools/Directory.Build.props | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 src/buildtools/Directory.Build.props diff --git a/src/buildtools/Directory.Build.props b/src/buildtools/Directory.Build.props deleted file mode 100644 index a2a60f76a9..0000000000 --- a/src/buildtools/Directory.Build.props +++ /dev/null @@ -1,7 +0,0 @@ - - - - true - - - From 40bb2de5d8e7ef359469e44adee0818d3cd00065 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 02:41:20 +0000 Subject: [PATCH 063/286] simplify --- FSharpBuild.Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index bdb8c36c39..9d1161037b 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -80,7 +80,7 @@ - + $(ProtoOutputPath)\Microsoft.FSharp.Targets $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.props $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets From 2f96a634333c1a0ea4fde0b7d84cc252a21b1183 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 02:46:49 +0000 Subject: [PATCH 064/286] more --- FSharpTests.Directory.Build.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index 6c298fe442..5509812197 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -33,8 +33,8 @@ <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'net40'">net46 - <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netstandard2.0 - <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\FSharp.Build\$(Configuration)\$(_FSharpBuildTargetFramework) + <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netcoreapp2.1 + <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\fcs\$(Configuration)\$(_FSharpBuildTargetFramework) $(_FSharpBuildBinPath)\FSharp.Build.dll From 266d69569a86d8d216427c92cf3467dc7dbc3fd5 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 02:50:36 +0000 Subject: [PATCH 065/286] more --- eng/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/build.sh b/eng/build.sh index 540866dbb1..82908aadaf 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -210,7 +210,7 @@ function BuildSolution { # build bootstrap tools bootstrap_config=Proto bootstrap_dir=$artifacts_dir/Bootstrap - if [ ! -d "$bootstrap_dir/fslex.dll" ]; then + if [ ! -e "$bootstrap_dir/fslex.dll" ]; then MSBuild "$repo_root/src/buildtools/buildtools.proj" \ /restore \ /v:$verbosity \ @@ -221,7 +221,7 @@ function BuildSolution { cp $artifacts_dir/bin/fslex/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir cp $artifacts_dir/bin/fsyacc/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir fi - if [ ! -d "$bootstrap_dir/fsc.exe" ]; then + if [ ! -e "$bootstrap_dir/fsc.exe" ]; then MSBuild "$repo_root/proto.proj" \ /restore \ /v:$verbosity \ From 0f3ddebff891eae19dd0c6e8dc5287b6539aa854 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 03:03:50 +0000 Subject: [PATCH 066/286] more --- eng/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/build.sh b/eng/build.sh index 82908aadaf..c01740d0ac 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -210,7 +210,7 @@ function BuildSolution { # build bootstrap tools bootstrap_config=Proto bootstrap_dir=$artifacts_dir/Bootstrap - if [ ! -e "$bootstrap_dir/fslex.dll" ]; then + if [ ! -f "$bootstrap_dir/fslex.dll" ]; then MSBuild "$repo_root/src/buildtools/buildtools.proj" \ /restore \ /v:$verbosity \ @@ -221,7 +221,7 @@ function BuildSolution { cp $artifacts_dir/bin/fslex/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir cp $artifacts_dir/bin/fsyacc/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir fi - if [ ! -e "$bootstrap_dir/fsc.exe" ]; then + if [ ! -f "$bootstrap_dir/fsc.exe" ]; then MSBuild "$repo_root/proto.proj" \ /restore \ /v:$verbosity \ From 7e7fbf04e9697b64dd21b7ee0e5836e5adc45d87 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 03:10:52 +0000 Subject: [PATCH 067/286] proto --- eng/build.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eng/build.sh b/eng/build.sh index c01740d0ac..d624578d48 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -13,6 +13,7 @@ usage() echo " --binaryLog Create MSBuild binary log (short: -bl)" echo "" echo "Actions:" + echo " --bootstrap Force the build of the bootstrap compiler" echo " --restore Restore projects required to build (short: -r)" echo " --build Build all projects (short: -b)" echo " --rebuild Rebuild all projects" @@ -54,6 +55,7 @@ test_core_clr=false configuration="Debug" verbosity='minimal' binary_log=false +force_bootstrap=false ci=false skip_analyzers=false prepare_machine=false @@ -88,6 +90,9 @@ while [[ $# > 0 ]]; do --binarylog|-bl) binary_log=true ;; + --bootstrap) + force_bootstrap=true + ;; --restore|-r) restore=true ;; @@ -210,6 +215,9 @@ function BuildSolution { # build bootstrap tools bootstrap_config=Proto bootstrap_dir=$artifacts_dir/Bootstrap + if [ $force_bootstrap == "true" ]; then + rm -fr $bootstrap_dir + fi if [ ! -f "$bootstrap_dir/fslex.dll" ]; then MSBuild "$repo_root/src/buildtools/buildtools.proj" \ /restore \ From 6b20514444df10a69e2deaa6a7bc7aeca4786a33 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 03:21:54 +0000 Subject: [PATCH 068/286] try revert --- FSharpTests.Directory.Build.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index 5509812197..6c298fe442 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -33,8 +33,8 @@ <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'net40'">net46 - <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netcoreapp2.1 - <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\fcs\$(Configuration)\$(_FSharpBuildTargetFramework) + <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netstandard2.0 + <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\FSharp.Build\$(Configuration)\$(_FSharpBuildTargetFramework) $(_FSharpBuildBinPath)\FSharp.Build.dll From 28cdc002d5ec49c9f92b6872a731f2d04cdcbbc5 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 03:27:50 +0000 Subject: [PATCH 069/286] proto --- FSharpTests.Directory.Build.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index 6c298fe442..5509812197 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -33,8 +33,8 @@ <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'net40'">net46 - <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netstandard2.0 - <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\FSharp.Build\$(Configuration)\$(_FSharpBuildTargetFramework) + <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netcoreapp2.1 + <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\fcs\$(Configuration)\$(_FSharpBuildTargetFramework) $(_FSharpBuildBinPath)\FSharp.Build.dll From 44472076a1b24044bec83c95f6eb9da87674bd12 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 11:41:19 +0000 Subject: [PATCH 070/286] try again --- eng/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.sh b/eng/build.sh index d624578d48..2a0550e088 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -215,7 +215,7 @@ function BuildSolution { # build bootstrap tools bootstrap_config=Proto bootstrap_dir=$artifacts_dir/Bootstrap - if [ $force_bootstrap == "true" ]; then + if [[ "$force_bootstrap" == true ]]; then rm -fr $bootstrap_dir fi if [ ! -f "$bootstrap_dir/fslex.dll" ]; then From 6563fa3c903ae68250bb77cd62c68130f4db7510 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 11:43:50 +0000 Subject: [PATCH 071/286] try again --- eng/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/build.sh b/eng/build.sh index 2a0550e088..a89ea576db 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -45,7 +45,7 @@ while [[ -h "$source" ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -restore=false +restore=true build=false rebuild=false pack=false From f1056d7d1c7952fb5c8abb0d015b54f6b9001b4c Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 11:54:11 +0000 Subject: [PATCH 072/286] disable node reuse --- eng/build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/eng/build.sh b/eng/build.sh index a89ea576db..f3e5149ef9 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -209,9 +209,11 @@ function BuildSolution { if [[ "$ci" != true ]]; then quiet_restore=true fi - coreclr_target_framework=netcoreapp2.0 + # Node reuse fails because multiple different versions of FSharp.Build.dll get loaded into MSBuild nodes + node_reuse=false + # build bootstrap tools bootstrap_config=Proto bootstrap_dir=$artifacts_dir/Bootstrap From ea11aaefca210f5c9588df07b9bb5d767c413028 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 13:32:53 +0000 Subject: [PATCH 073/286] fix tests --- FSharpTests.Directory.Build.props | 2 +- eng/build.sh | 12 ++++++------ src/scripts/scriptlib.fsx | 4 ---- tests/fsharp/single-test.fs | 4 +++- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index 5509812197..f2e1653a83 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -34,7 +34,7 @@ <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'net40'">net46 <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netcoreapp2.1 - <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\fcs\$(Configuration)\$(_FSharpBuildTargetFramework) + <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\$(_FSharpBuildTargetFramework) $(_FSharpBuildBinPath)\FSharp.Build.dll diff --git a/eng/build.sh b/eng/build.sh index f3e5149ef9..43803435b5 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -209,7 +209,7 @@ function BuildSolution { if [[ "$ci" != true ]]; then quiet_restore=true fi - coreclr_target_framework=netcoreapp2.0 + fslexyacc_target_framework=netcoreapp2.0 # Node reuse fails because multiple different versions of FSharp.Build.dll get loaded into MSBuild nodes node_reuse=false @@ -228,8 +228,8 @@ function BuildSolution { /t:Build mkdir -p "$bootstrap_dir" - cp $artifacts_dir/bin/fslex/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir - cp $artifacts_dir/bin/fsyacc/$bootstrap_config/$coreclr_target_framework/* $bootstrap_dir + cp $artifacts_dir/bin/fslex/$bootstrap_config/$fslexyacc_target_framework/* $bootstrap_dir + cp $artifacts_dir/bin/fsyacc/$bootstrap_config/$fslexyacc_target_framework/* $bootstrap_dir fi if [ ! -f "$bootstrap_dir/fsc.exe" ]; then MSBuild "$repo_root/proto.proj" \ @@ -265,9 +265,9 @@ InitializeDotNetCli $restore BuildSolution if [[ "$test_core_clr" == true ]]; then - TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj" --targetframework $coreclr_target_framework - TestUsingNUnit --testproject "$repo_root/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj" --targetframework $coreclr_target_framework - TestUsingNUnit --testproject "$repo_root/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj" --targetframework $coreclr_target_framework + TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj" --targetframework netcoreapp2.0 + TestUsingNUnit --testproject "$repo_root/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj" --targetframework netcoreapp2.0 + TestUsingNUnit --testproject "$repo_root/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj" --targetframework netcoreapp2.0 fi ExitWithExitCode 0 diff --git a/src/scripts/scriptlib.fsx b/src/scripts/scriptlib.fsx index f5f9276c49..ce9ac2e3cc 100644 --- a/src/scripts/scriptlib.fsx +++ b/src/scripts/scriptlib.fsx @@ -108,12 +108,8 @@ module Scripting = processInfo.UseShellExecute <- false processInfo.WorkingDirectory <- workDir -#if !NET46 - ignore envs // work out what to do about this -#else envs |> Map.iter (fun k v -> processInfo.EnvironmentVariables.[k] <- v) -#endif let p = new Process() p.EnableRaisingEvents <- true diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index b0a24ccb8e..614183b319 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -219,7 +219,8 @@ let singleTestBuildAndRunCore cfg copyFiles p = let projectBody = generateProjectArtifacts pc targetFramework cfg.BUILD_CONFIG emitFile projectFileName projectBody use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - exec { cfg with Directory = directory } cfg.DotNetExe (sprintf "run -f %s" targetFramework) + printfn "executeFsc: cfg.DotNetExe = %s" cfg.DotNetExe + exec { cfg with Directory = directory } cfg.DotNetExe "help" // (sprintf "run -f %s" targetFramework) testOkFile.CheckExists() executeFsc compilerType targetFramework else @@ -229,6 +230,7 @@ let singleTestBuildAndRunCore cfg copyFiles p = let projectBody = generateProjectArtifacts pc targetFramework cfg.BUILD_CONFIG emitFile projectFileName projectBody use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) + printfn "executeFsi: cfg.DotNetExe = %s" cfg.DotNetExe exec { cfg with Directory = directory } cfg.DotNetExe "build /t:RunFSharpScript" testOkFile.CheckExists() executeFsi compilerType targetFramework From 3456f484a1d18c636ea028cebff5ffdbb545ac78 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 23:05:00 +0000 Subject: [PATCH 074/286] revert diagnostic --- tests/fsharp/single-test.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index 614183b319..c2c8f512d7 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -220,7 +220,7 @@ let singleTestBuildAndRunCore cfg copyFiles p = emitFile projectFileName projectBody use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) printfn "executeFsc: cfg.DotNetExe = %s" cfg.DotNetExe - exec { cfg with Directory = directory } cfg.DotNetExe "help" // (sprintf "run -f %s" targetFramework) + exec { cfg with Directory = directory } cfg.DotNetExe (sprintf "run -f %s" targetFramework) testOkFile.CheckExists() executeFsc compilerType targetFramework else From b3209daa882b37f993073940e32a108c9a23b81b Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 23:27:18 +0000 Subject: [PATCH 075/286] revert some changes --- src/fsharp/ExtensionTyping.fs | 4 +-- src/scripts/scriptlib.fsx | 4 +++ .../ProductVersion.fs | 30 +++++++++---------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/fsharp/ExtensionTyping.fs b/src/fsharp/ExtensionTyping.fs index 97c4feddbc..9bf54e3be7 100755 --- a/src/fsharp/ExtensionTyping.fs +++ b/src/fsharp/ExtensionTyping.fs @@ -45,9 +45,9 @@ module internal ExtensionTyping = // Detect the host tooling context let toolingCompatibleVersions() = if typeof.Assembly.GetName().Name = "mscorlib" then - [ "net471"; "net47"; "net462"; "net461"; "net452"; "net451"; "net45"; "netstandard2.0"] + [ "net461"; "net452"; "net451"; "net45"; "netstandard2.0"] elif typeof.Assembly.GetName().Name = "System.Private.CoreLib" then - [ "netcoreapp2.1"; "netcoreapp2.0"; "netstandard2.0"] + [ "netcoreapp2.0"; "netstandard2.0"] else System.Diagnostics.Debug.Assert(false, "Couldn't determine runtime tooling context, assuming it supports at least .NET Standard 2.0") [ "netstandard2.0"] diff --git a/src/scripts/scriptlib.fsx b/src/scripts/scriptlib.fsx index ce9ac2e3cc..f5f9276c49 100644 --- a/src/scripts/scriptlib.fsx +++ b/src/scripts/scriptlib.fsx @@ -108,8 +108,12 @@ module Scripting = processInfo.UseShellExecute <- false processInfo.WorkingDirectory <- workDir +#if !NET46 + ignore envs // work out what to do about this +#else envs |> Map.iter (fun k v -> processInfo.EnvironmentVariables.[k] <- v) +#endif let p = new Process() p.EnableRaisingEvents <- true diff --git a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs index 77ff2e60d3..fe95e82a97 100644 --- a/tests/FSharp.Compiler.UnitTests/ProductVersion.fs +++ b/tests/FSharp.Compiler.UnitTests/ProductVersion.fs @@ -93,21 +93,21 @@ module TypeProviderDesignTimeComponentLoading = let ``check tooling paths for type provider design time component loading`` () = let expected = [ -#if NET46 - // only searched when executing on .NET Framework - for tfm in ["net471"; "net47"; "net462"; "net461"; "net452"; "net451"; "net45"] do - yield Path.Combine("typeproviders", "fsharp41", tfm) - yield Path.Combine("tools", "fsharp41", tfm) -#else - // only searched when executing on .NET Core - for tfm in ["netcoreapp2.1"; "netcoreapp2.0"] do - yield Path.Combine("typeproviders", "fsharp41", tfm) - yield Path.Combine("tools", "fsharp41", tfm) -#endif - // always searched - for tfm in ["netstandard2.0"] do - yield Path.Combine("typeproviders", "fsharp41", tfm) - yield Path.Combine("tools", "fsharp41", tfm) +#if NET46 // only available on net46 + Path.Combine("typeproviders", "fsharp41", "net461") + Path.Combine("tools", "fsharp41", "net461") + Path.Combine("typeproviders", "fsharp41", "net452") + Path.Combine("tools", "fsharp41", "net452") + Path.Combine("typeproviders", "fsharp41", "net451") + Path.Combine("tools", "fsharp41", "net451") + Path.Combine("typeproviders", "fsharp41", "net45") + Path.Combine("tools", "fsharp41", "net45") +#else // only available on netcoreapp2.0 + Path.Combine("typeproviders", "fsharp41", "netcoreapp2.0") + Path.Combine("tools", "fsharp41", "netcoreapp2.0") +#endif // available in both + Path.Combine("typeproviders", "fsharp41", "netstandard2.0") + Path.Combine("tools", "fsharp41", "netstandard2.0") ] let actual = FSharp.Compiler.ExtensionTyping.toolingCompatiblePaths() printfn "actual = %A" actual From 4ea47055a9360ee0eb15d0e0db888539ead3003d Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 23:28:08 +0000 Subject: [PATCH 076/286] revert some changes --- tests/fsharp/single-test.fs | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index c2c8f512d7..b0a24ccb8e 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -219,7 +219,6 @@ let singleTestBuildAndRunCore cfg copyFiles p = let projectBody = generateProjectArtifacts pc targetFramework cfg.BUILD_CONFIG emitFile projectFileName projectBody use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - printfn "executeFsc: cfg.DotNetExe = %s" cfg.DotNetExe exec { cfg with Directory = directory } cfg.DotNetExe (sprintf "run -f %s" targetFramework) testOkFile.CheckExists() executeFsc compilerType targetFramework @@ -230,7 +229,6 @@ let singleTestBuildAndRunCore cfg copyFiles p = let projectBody = generateProjectArtifacts pc targetFramework cfg.BUILD_CONFIG emitFile projectFileName projectBody use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - printfn "executeFsi: cfg.DotNetExe = %s" cfg.DotNetExe exec { cfg with Directory = directory } cfg.DotNetExe "build /t:RunFSharpScript" testOkFile.CheckExists() executeFsi compilerType targetFramework From 4f522a2b78d9db333b98e3c65228f747d2c75120 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 29 Mar 2019 23:48:06 +0000 Subject: [PATCH 077/286] try again --- FSharpTests.Directory.Build.props | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index f2e1653a83..d62503cea9 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -33,8 +33,12 @@ <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'net40'">net46 + <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netstandard2.0 + <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\FSharp.Build\$(Configuration)\$(_FSharpBuildTargetFramework) + $(_FSharpBuildBinPath)\FSharp.Build.dll From 47179ce0ec52f689c516ee1046b46e94729e46f3 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Sun, 31 Mar 2019 14:45:40 +0100 Subject: [PATCH 078/286] fix merge --- FSharpBuild.Directory.Build.props | 2 +- FSharpTests.Directory.Build.props | 4 ---- fcs/Directory.Build.props | 6 +++++- fcs/build.fsx | 10 ++++------ .../FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj | 7 ++++++- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index 9d1161037b..1d456ec2d7 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -80,7 +80,7 @@ - + $(ProtoOutputPath)\Microsoft.FSharp.Targets $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.props $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index d62503cea9..6c298fe442 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -35,10 +35,6 @@ <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'net40'">net46 <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netstandard2.0 <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\FSharp.Build\$(Configuration)\$(_FSharpBuildTargetFramework) - $(_FSharpBuildBinPath)\FSharp.Build.dll diff --git a/fcs/Directory.Build.props b/fcs/Directory.Build.props index e09dc41a67..3179fe221f 100644 --- a/fcs/Directory.Build.props +++ b/fcs/Directory.Build.props @@ -17,7 +17,11 @@ $(ArtifactsDir)\obj $(ArtifactsBinDir)\fcs $(ArtifactsObjDir)\fcs - true + true + + + $(ArtifactsBinDir)\FSharp.Build\Proto\net46 + diff --git a/fcs/build.fsx b/fcs/build.fsx index d03f9664fe..d1d575c4f7 100644 --- a/fcs/build.fsx +++ b/fcs/build.fsx @@ -24,8 +24,6 @@ let isMono = false // Utilities // -------------------------------------------------------------------------------------- -let fslexyaccTargetFramework = "netcoreapp2.0" - let dotnetExePath = // Build.cmd normally downloads a dotnet cli to: \artifacts\toolset\dotnet // check if there is one there to avoid downloading an additional one here @@ -94,14 +92,14 @@ Target "BuildVersion" (fun _ -> Target "Build" (fun _ -> runDotnet __SOURCE_DIRECTORY__ "build ../src/buildtools/buildtools.proj -v n -c Proto" - let fslexPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fslex/Proto/" + fslexyaccTargetFramework + "/fslex.dll" - let fsyaccPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fsyacc/Proto/" + fslexyaccTargetFramework + "/fsyacc.dll" + let fslexPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fslex/Proto/netcoreapp2.0/fslex.dll" + let fsyaccPath = __SOURCE_DIRECTORY__ + "/../artifacts/bin/fsyacc/Proto/netcoreapp2.0/fsyacc.dll" runDotnet __SOURCE_DIRECTORY__ (sprintf "build FSharp.Compiler.Service.sln -v n -c Release /p:FsLexPath=%s /p:FsYaccPath=%s" fslexPath fsyaccPath) ) Target "Test" (fun _ -> - // This project file is used for the tests to work out reference sets - runDotnet __SOURCE_DIRECTORY__ "build ../tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj -v n /restore /p:DisableProtoCompiler=true" + // This project file is used for the netcoreapp2.0 tests to work out reference sets + runDotnet __SOURCE_DIRECTORY__ "build ../tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard2_0/Sample_NETCoreSDK_FSharp_Library_netstandard2_0.fsproj -v n /restore /p:DisableCompilerRedirection=true" // Now run the tests let logFilePath = Path.Combine(__SOURCE_DIRECTORY__, "..", "artifacts", "TestResults", "Release", "FSharp.Compiler.Service.Test.xml") diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj index 5aaf71caa3..e22e96fab5 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj @@ -89,11 +89,16 @@ - + + + + + + From 829797b85ee3dfbb24abc9268f343c300f2eba98 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Wed, 15 May 2019 20:21:51 -0700 Subject: [PATCH 079/286] Update VisualFSharp for VS2019.3 (#6735) * Update VisualFSharp for VS2019.3 * fix app config files * Remove extra file --- eng/Versions.props | 8 ++++---- src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.props | 2 +- src/fsharp/fsc/app.config | 2 +- src/fsharp/fsi/app.config | 2 +- src/fsharp/fsiAnyCpu/app.config | 2 +- src/utils/CompilerLocationUtils.fs | 2 +- tests/service/Common.fs | 2 +- vsintegration/tests/UnitTests/App.config | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 44c7900aec..ae6e98694e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -12,20 +12,20 @@ beta - 4.6 - $(FSCoreMajorVersion).3 + 4.7 + $(FSCoreMajorVersion).0 $(FSCoreMajorVersion).0 $(FSCoreVersionPrefix).0 - 10.5 + 10.6 $(FSPackageMajorVersion).0 $(FSPackageVersion) $(FSPackageVersion).0 16 - 2 + 3 $(VSMajorVersion).0 $(VSMajorVersion).$(VSMinorVersion).0 $(VSAssemblyVersionPrefix).0 diff --git a/src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.props b/src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.props index 2d07d58ce6..1a3b33ee3d 100644 --- a/src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.props +++ b/src/fsharp/FSharp.Build/Microsoft.FSharp.NetSdk.props @@ -74,7 +74,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and 4.4.0 - 4.6.2 + 4.7.0 $(DefaultValueTuplePackageVersion) $(DefaultFSharpCorePackageVersion) diff --git a/src/fsharp/fsc/app.config b/src/fsharp/fsc/app.config index 68fff88101..786b37b616 100644 --- a/src/fsharp/fsc/app.config +++ b/src/fsharp/fsc/app.config @@ -6,7 +6,7 @@ - + diff --git a/src/fsharp/fsi/app.config b/src/fsharp/fsi/app.config index 818ebc93b4..f8c553390d 100644 --- a/src/fsharp/fsi/app.config +++ b/src/fsharp/fsi/app.config @@ -5,7 +5,7 @@ - + diff --git a/src/fsharp/fsiAnyCpu/app.config b/src/fsharp/fsiAnyCpu/app.config index 6e8f1eb908..4b3e84f015 100644 --- a/src/fsharp/fsiAnyCpu/app.config +++ b/src/fsharp/fsiAnyCpu/app.config @@ -6,7 +6,7 @@ - + diff --git a/src/utils/CompilerLocationUtils.fs b/src/utils/CompilerLocationUtils.fs index 84a0dfbfd4..005595611c 100644 --- a/src/utils/CompilerLocationUtils.fs +++ b/src/utils/CompilerLocationUtils.fs @@ -12,7 +12,7 @@ open System.Runtime.InteropServices module internal FSharpEnvironment = /// The F# version reported in the banner - let FSharpBannerVersion = "10.4.0 for F# 4.6" + let FSharpBannerVersion = "10.6.0 for F# 4.7" let versionOf<'t> = #if FX_RESHAPED_REFLECTION diff --git a/tests/service/Common.fs b/tests/service/Common.fs index 0ec9aa2ab3..847447db77 100644 --- a/tests/service/Common.fs +++ b/tests/service/Common.fs @@ -71,7 +71,7 @@ let sysLib nm = #if !NETCOREAPP2_0 if System.Environment.OSVersion.Platform = System.PlatformID.Win32NT then // file references only valid on Windows let programFilesx86Folder = System.Environment.GetEnvironmentVariable("PROGRAMFILES(X86)") - programFilesx86Folder + @"\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\" + nm + ".dll" + programFilesx86Folder + @"\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\" + nm + ".dll" else #endif #if FX_NO_RUNTIMEENVIRONMENT diff --git a/vsintegration/tests/UnitTests/App.config b/vsintegration/tests/UnitTests/App.config index 768fbe1d13..8b67a95823 100644 --- a/vsintegration/tests/UnitTests/App.config +++ b/vsintegration/tests/UnitTests/App.config @@ -40,7 +40,7 @@ - + From 9d5ad121a58de7dbfb1e5faacc6a1109632518fd Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Sat, 25 May 2019 12:40:29 -0700 Subject: [PATCH 080/286] Netstandard2 (#6814) * Update FSharp.Core to netstandard2.0 * Remove netstandard1.6 feature flags * default.w32manifest * default.w32manifest --- FSharp.Profiles.props | 21 - Makefile | 2 +- .../FSharp.Compiler.Service.Tests.fsproj | 4 - .../FSharp.Compiler.Service.fsproj | 7 +- src/absil/illib.fs | 15 - src/absil/ilreflect.fs | 17 - src/absil/ilwrite.fs | 3 - src/fsharp/CompileOps.fs | 3 - src/fsharp/CompileOptions.fs | 6 - src/fsharp/ErrorLogger.fs | 8 - src/fsharp/ExtensionTyping.fs | 2 - src/fsharp/FSharp.Build/FSharp.Build.fsproj | 1 - ...Sharp.Compiler.Interactive.Settings.fsproj | 1 - .../FSharp.Compiler.Private.fsproj | 9 +- .../FSharp.Compiler.Private.netcore.nuspec | 4 +- .../Microsoft.FSharp.Compiler.nuspec | 6 +- .../FSharp.Core.nuget.csproj | 2 +- .../FSharp.Core.nuget/FSharp.Core.nuspec | 49 +-- src/fsharp/FSharp.Core/FSharp.Core.fsproj | 12 +- src/fsharp/FSharp.Core/Linq.fs | 9 - src/fsharp/FSharp.Core/Query.fs | 5 - src/fsharp/FSharp.Core/QueryExtensions.fs | 9 - src/fsharp/FSharp.Core/array.fs | 11 - src/fsharp/FSharp.Core/async.fs | 53 --- src/fsharp/FSharp.Core/async.fsi | 4 +- src/fsharp/FSharp.Core/event.fs | 4 - .../FSharp.Core/fslib-extra-pervasives.fs | 8 - src/fsharp/FSharp.Core/list.fs | 11 - src/fsharp/FSharp.Core/map.fs | 20 +- src/fsharp/FSharp.Core/prim-types.fs | 226 +--------- src/fsharp/FSharp.Core/prim-types.fsi | 19 - src/fsharp/FSharp.Core/printf.fs | 9 - src/fsharp/FSharp.Core/quotations.fs | 57 +-- src/fsharp/FSharp.Core/reflect.fs | 70 +-- src/fsharp/FSharp.Core/seq.fs | 8 - src/fsharp/FSharp.Core/set.fs | 21 +- src/fsharp/IlxGen.fs | 7 +- src/fsharp/XmlAdapters.fs | 23 + src/fsharp/fsc.fs | 15 +- src/fsharp/fsi/console.fs | 3 - src/fsharp/fsi/fsi.fs | 43 +- src/fsharp/lex.fsl | 4 - src/fsharp/lib.fs | 2 - src/fsharp/service/Reactor.fs | 4 - src/utils/CompilerLocationUtils.fs | 15 +- src/utils/prim-lexing.fs | 7 +- src/utils/reshapedmsbuild.fs | 78 ++-- src/utils/reshapedreflection.fs | 401 ------------------ src/utils/sformat.fs | 72 +--- src/utils/sformat.fsi | 8 - .../FSharp.Core.UnitTests.fsproj | 6 +- .../FSharp.Core/DiscrimantedUnionType.fs | 11 - .../FSharpReflection.fs | 36 +- .../FSharp.Core/RecordTypes.fs | 10 - tests/FSharp.Core.UnitTests/LibraryTestFx.fs | 39 +- .../SurfaceArea.coreclr.fs | 95 +++-- .../SurfaceArea.net40.fs | 3 +- tests/fsharp/Compiler/CompilerAssert.fs | 10 +- tests/fsharp/core/quotes/test.fsx | 20 +- tests/fsharp/core/samename/tempet.fsproj | 2 +- tests/fsharp/core/subtype/test.fsx | 4 - tests/fsharp/single-test.fs | 3 +- tests/fsharp/test-framework.fs | 2 +- tests/fsharp/tests.fs | 2 - tests/fsharpqa/Source/Misc/AsyncOperations.fs | 4 +- ...reSDK_FSharp_Library_netstandard1.6.fsproj | 2 +- tests/service/Common.fs | 8 - tests/service/FscTests.fs | 4 - tests/service/ReshapedReflection.fs | 9 - tests/service/data/samename/tempet.fsproj | 2 +- .../Utils/LanguageServiceProfiling/Options.fs | 3 +- 71 files changed, 229 insertions(+), 1444 deletions(-) create mode 100644 src/fsharp/XmlAdapters.fs delete mode 100644 src/utils/reshapedreflection.fs delete mode 100644 tests/service/ReshapedReflection.fs diff --git a/FSharp.Profiles.props b/FSharp.Profiles.props index 534ba96c04..6b473ce7ee 100644 --- a/FSharp.Profiles.props +++ b/FSharp.Profiles.props @@ -5,43 +5,22 @@ $(DefineConstants);CROSS_PLATFORM_COMPILER $(DefineConstants);ENABLE_MONO_SUPPORT - $(DefineConstants);BE_SECURITY_TRANSPARENT $(DefineConstants);FX_LCIDFROMCODEPAGE $(DefineConstants);NETSTANDARD $(DefineConstants);FX_NO_APP_DOMAINS - $(DefineConstants);FX_NO_ARRAY_LONG_LENGTH - $(DefineConstants);FX_NO_BEGINEND_READWRITE - $(DefineConstants);FX_NO_BINARY_SERIALIZATION - $(DefineConstants);FX_NO_CONVERTER - $(DefineConstants);FX_NO_DEFAULT_DEPENDENCY_TYPE $(DefineConstants);FX_NO_CORHOST_SIGNER - $(DefineConstants);FX_NO_EVENTWAITHANDLE_IDISPOSABLE - $(DefineConstants);FX_NO_EXIT_CONTEXT_FLAGS $(DefineConstants);FX_NO_LINKEDRESOURCES - $(DefineConstants);FX_NO_PARAMETERIZED_THREAD_START $(DefineConstants);FX_NO_PDB_READER $(DefineConstants);FX_NO_PDB_WRITER - $(DefineConstants);FX_NO_REFLECTION_MODULE_HANDLES - $(DefineConstants);FX_NO_REFLECTION_ONLY - $(DefineConstants);FX_NO_RUNTIMEENVIRONMENT - $(DefineConstants);FX_NO_SECURITY_PERMISSIONS - $(DefineConstants);FX_NO_SERVERCODEPAGES $(DefineConstants);FX_NO_SYMBOLSTORE $(DefineConstants);FX_NO_SYSTEM_CONFIGURATION - $(DefineConstants);FX_NO_THREAD - $(DefineConstants);FX_NO_THREADABORT - $(DefineConstants);FX_NO_WAITONE_MILLISECONDS - $(DefineConstants);FX_NO_WEB_CLIENT $(DefineConstants);FX_NO_WIN_REGISTRY $(DefineConstants);FX_NO_WINFORMS $(DefineConstants);FX_NO_INDENTED_TEXT_WRITER - $(DefineConstants);FX_REDUCED_EXCEPTIONS $(DefineConstants);FX_RESHAPED_REFEMIT - $(DefineConstants);FX_RESHAPED_GLOBALIZATION - $(DefineConstants);FX_RESHAPED_REFLECTION $(DefineConstants);FX_RESHAPED_MSBUILD $(OtherFlags) --simpleresolution diff --git a/Makefile b/Makefile index 10de364b67..a002620f23 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ restore: build: proto restore $(DotNetExe) build-server shutdown - $(DotNetExe) build -c $(Configuration) -f netstandard1.6 src/fsharp/FSharp.Core/FSharp.Core.fsproj + $(DotNetExe) build -c $(Configuration) -f netstandard2.0 src/fsharp/FSharp.Core/FSharp.Core.fsproj $(DotNetExe) build -c $(Configuration) -f netstandard2.0 src/fsharp/FSharp.Build/FSharp.Build.fsproj $(DotNetExe) build -c $(Configuration) -f netstandard2.0 src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj $(DotNetExe) build -c $(Configuration) -f netcoreapp2.1 src/fsharp/fsc/fsc.fsproj diff --git a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj index 9f16ede65d..747cbba31c 100644 --- a/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj +++ b/fcs/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj @@ -12,13 +12,9 @@ true - $(DefineConstants);FX_NO_RUNTIMEENVIRONMENT $(DefineConstants);NO_PROJECTCRACKER - - ReshapedReflection.fs - FsUnit.fs diff --git a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index 134a3ca745..68c60384f6 100644 --- a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -34,7 +34,6 @@ $(DefineConstants);FX_NO_SYMBOLSTORE $(DefineConstants);FX_NO_LINKEDRESOURCES $(DefineConstants);FX_NO_APP_DOMAINS - $(DefineConstants);FX_NO_RUNTIMEENVIRONMENT $(DefineConstants);FX_NO_WIN_REGISTRY $(DefineConstants);FX_NO_SYSTEM_CONFIGURATION $(DefineConstants);FX_RESHAPED_REFEMIT @@ -67,9 +66,6 @@ Logger.fs - - Reshaped/reshapedreflection.fs - ErrorText/sformat.fsi @@ -157,6 +153,9 @@ Utilities/bytes.fs + + Utilities\XmlAdapters.fs + Utilities/lib.fs diff --git a/src/absil/illib.fs b/src/absil/illib.fs index fea0fd92a9..68b7c8d40a 100644 --- a/src/absil/illib.fs +++ b/src/absil/illib.fs @@ -12,10 +12,6 @@ open System.Reflection open System.Threading open System.Runtime.CompilerServices -#if FX_RESHAPED_REFLECTION -open Microsoft.FSharp.Core.ReflectionAdapters -#endif - // Logical shift right treating int32 as unsigned integer. // Code that uses this should probably be adjusted to use unsigned integer types. let (>>>&) (x: int32) (n: int32) = int32 (uint32 x >>> n) @@ -258,12 +254,6 @@ module Option = module List = - //let item n xs = List.nth xs n -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters - open Microsoft.FSharp.Core.ReflectionAdapters -#endif - let sortWithOrder (c: IComparer<'T>) elements = List.sortWith (Order.toFunction c) elements let splitAfter n l = @@ -1272,11 +1262,6 @@ type LayeredMultiMap<'Key, 'Value when 'Key : equality and 'Key : comparison>(co [] module Shim = -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters - open Microsoft.FSharp.Core.ReflectionAdapters -#endif - type IFileSystem = /// A shim over File.ReadAllBytes diff --git a/src/absil/ilreflect.fs b/src/absil/ilreflect.fs index 404ebf81b0..9550c27cb9 100644 --- a/src/absil/ilreflect.fs +++ b/src/absil/ilreflect.fs @@ -24,10 +24,6 @@ open FSharp.Compiler.ErrorLogger open FSharp.Compiler.Range open FSharp.Core.Printf -#if FX_RESHAPED_REFLECTION -open Microsoft.FSharp.Core.ReflectionAdapters -#endif - let codeLabelOrder = ComparisonIdentity.Structural // Convert the output of convCustomAttr @@ -314,10 +310,8 @@ let convAssemblyRef (aref: ILAssemblyRef) = asmName.Version <- System.Version (int32 version.Major, int32 version.Minor, int32 version.Build, int32 version.Revision) Option.iter setVersion aref.Version // asmName.ProcessorArchitecture <- System.Reflection.ProcessorArchitecture.MSIL -#if !FX_RESHAPED_GLOBALIZATION //Option.iter (fun name -> asmName.CultureInfo <- System.Globalization.CultureInfo.CreateSpecificCulture name) aref.Locale asmName.CultureInfo <- System.Globalization.CultureInfo.InvariantCulture -#endif asmName /// The global environment. @@ -663,9 +657,6 @@ let TypeBuilderInstantiationT = ty let typeIsNotQueryable (ty: Type) = -#if FX_RESHAPED_REFLECTION - let ty = ty.GetTypeInfo() -#endif (ty :? TypeBuilder) || ((ty.GetType()).Equals(TypeBuilderInstantiationT)) //---------------------------------------------------------------------------- // convFieldSpec @@ -794,11 +785,7 @@ let queryableTypeGetMethod cenv emEnv parentT (mref: ILMethodRef) = parentT.GetMethod(mref.Name, cconv ||| BindingFlags.Public ||| BindingFlags.NonPublic, null, argTs, -#if FX_RESHAPED_REFLECTION - (null: obj[])) -#else (null: ParameterModifier[])) -#endif // This can fail if there is an ambiguity w.r.t. return type with _ -> null if (isNonNull methInfo && equalTypes resT methInfo.ReturnType) then @@ -1434,11 +1421,7 @@ let buildGenParamsPass1 _emEnv defineGenericParameters (gps: ILGenericParameterD let buildGenParamsPass1b cenv emEnv (genArgs: Type array) (gps: ILGenericParameterDefs) = -#if FX_RESHAPED_REFLECTION - let genpBs = genArgs |> Array.map (fun x -> (x.GetTypeInfo() :?> GenericTypeParameterBuilder)) -#else let genpBs = genArgs |> Array.map (fun x -> (x :?> GenericTypeParameterBuilder)) -#endif gps |> List.iteri (fun i (gp: ILGenericParameterDef) -> let gpB = genpBs.[i] // the Constraints are either the parent (base) type or interfaces. diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index 5d6bfd3ee0..38f9fcfe39 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -3035,9 +3035,6 @@ module FileSystemUtilites = open System open System.Reflection open System.Globalization -#if FX_RESHAPED_REFLECTION - open Microsoft.FSharp.Core.ReflectionAdapters -#endif let progress = try System.Environment.GetEnvironmentVariable("FSharp_DebugSetFilePermissions") <> null with _ -> false let setExecutablePermission (filename: string) = diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 34a5dd5087..80334741ec 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -5247,11 +5247,8 @@ let CheckSimulateException(tcConfig: TcConfig) = | Some("tc-oom") -> raise(System.OutOfMemoryException()) | Some("tc-an") -> raise(System.ArgumentNullException("simulated")) | Some("tc-invop") -> raise(System.InvalidOperationException()) -#if FX_REDUCED_EXCEPTIONS -#else | Some("tc-av") -> raise(System.AccessViolationException()) | Some("tc-nfn") -> raise(System.NotFiniteNumberException()) -#endif | Some("tc-aor") -> raise(System.ArgumentOutOfRangeException()) | Some("tc-dv0") -> raise(System.DivideByZeroException()) | Some("tc-oe") -> raise(System.OverflowException()) diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index 0c385cc367..716263369a 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -1604,16 +1604,10 @@ let ReportTime (tcConfig:TcConfig) descr = | Some("fsc-oom") -> raise(System.OutOfMemoryException()) | Some("fsc-an") -> raise(System.ArgumentNullException("simulated")) | Some("fsc-invop") -> raise(System.InvalidOperationException()) -#if FX_REDUCED_EXCEPTIONS -#else | Some("fsc-av") -> raise(System.AccessViolationException()) -#endif | Some("fsc-aor") -> raise(System.ArgumentOutOfRangeException()) | Some("fsc-dv0") -> raise(System.DivideByZeroException()) -#if FX_REDUCED_EXCEPTIONS -#else | Some("fsc-nfn") -> raise(System.NotFiniteNumberException()) -#endif | Some("fsc-oe") -> raise(System.OverflowException()) | Some("fsc-atmm") -> raise(System.ArrayTypeMismatchException()) | Some("fsc-bif") -> raise(System.BadImageFormatException()) diff --git a/src/fsharp/ErrorLogger.fs b/src/fsharp/ErrorLogger.fs index e84b5c69e4..f33f6ae117 100755 --- a/src/fsharp/ErrorLogger.fs +++ b/src/fsharp/ErrorLogger.fs @@ -351,10 +351,6 @@ module ErrorLoggerExtensions = /// Reraise an exception if it is one we want to report to Watson. let ReraiseIfWatsonable(exn:exn) = -#if FX_REDUCED_EXCEPTIONS - ignore exn - () -#else match exn with // These few SystemExceptions which we don't report to Watson are because we handle these in some way in Build.fs | :? System.Reflection.TargetInvocationException -> () @@ -366,7 +362,6 @@ module ErrorLoggerExtensions = PreserveStackTrace exn raise exn | _ -> () -#endif type ErrorLogger with @@ -404,10 +399,7 @@ module ErrorLoggerExtensions = // Throws StopProcessing and exceptions raised by the DiagnosticSink(exn) handler. match exn with (* Don't send ThreadAbortException down the error channel *) -#if FX_REDUCED_EXCEPTIONS -#else | :? System.Threading.ThreadAbortException | WrappedError((:? System.Threading.ThreadAbortException), _) -> () -#endif | ReportedError _ | WrappedError(ReportedError _, _) -> () | StopProcessing | WrappedError(StopProcessing, _) -> PreserveStackTrace exn diff --git a/src/fsharp/ExtensionTyping.fs b/src/fsharp/ExtensionTyping.fs index 0513bcf2ee..0c880dd9da 100755 --- a/src/fsharp/ExtensionTyping.fs +++ b/src/fsharp/ExtensionTyping.fs @@ -140,9 +140,7 @@ module internal ExtensionTyping = let StripException (e: exn) = match e with -#if !FX_REDUCED_EXCEPTIONS | :? System.Reflection.TargetInvocationException as e -> e.InnerException -#endif | :? TypeInitializationException as e -> e.InnerException | _ -> e diff --git a/src/fsharp/FSharp.Build/FSharp.Build.fsproj b/src/fsharp/FSharp.Build/FSharp.Build.fsproj index ef4d013dc1..72febbd64d 100644 --- a/src/fsharp/FSharp.Build/FSharp.Build.fsproj +++ b/src/fsharp/FSharp.Build/FSharp.Build.fsproj @@ -18,7 +18,6 @@ - diff --git a/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj b/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj index 70c01bec4f..75af428f4f 100644 --- a/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj +++ b/src/fsharp/FSharp.Compiler.Interactive.Settings/FSharp.Compiler.Interactive.Settings.fsproj @@ -21,7 +21,6 @@ - diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index ebef5fb040..cf5da21fbf 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -73,12 +73,6 @@ Logger.fs - - Reflection\reshapedreflection.fs - - - Reflection\reshapedmsbuild.fs - ErrorText\sformat.fsi @@ -157,6 +151,9 @@ Utilities\bytes.fs + + Utilities\XmlAdapters.fs + Utilities\InternalCollections.fsi diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.netcore.nuspec b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.netcore.nuspec index 2133f3bcf1..e8af5ff0e4 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.netcore.nuspec +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.netcore.nuspec @@ -4,7 +4,7 @@ FSharp.Compiler.Private.netcore .NET Core compatible version of the fsharp compiler service dll - Supported Platforms: - .NET Core (netstandard1.6) + Supported Platforms: - .NET Core (netstandard2.0) en-US true @@ -15,7 +15,7 @@ $tags$ - + diff --git a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec index d3756ebc39..4a07b917ab 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec +++ b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec @@ -45,7 +45,7 @@ - + - + - + true - net45;netstandard1.6 + net45;netstandard2.0 FSharp.Core FSharp.Core.nuspec true diff --git a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec index b11df35fca..9a69f48ec7 100644 --- a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec +++ b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec @@ -5,50 +5,23 @@ http://fsharp.org/img/logo.png en-US - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + - - - - + + + + - + diff --git a/src/fsharp/FSharp.Core/FSharp.Core.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.fsproj index 588f72eaed..829a118bc8 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj +++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj @@ -4,8 +4,8 @@ Library - net45;netstandard1.6 - netstandard1.6 + net45;netstandard2.0 + netstandard2.0 $(NoWarn);45;55;62;75;1204 true $(DefineConstants);FSHARP_CORE @@ -113,9 +113,6 @@ Collections/set.fs - - Reflection/reshapedreflection.fs - Reflection/reflect.fsi @@ -223,11 +220,6 @@ - - - - - diff --git a/src/fsharp/FSharp.Core/Linq.fs b/src/fsharp/FSharp.Core/Linq.fs index 4663e6f79a..cd942cf672 100644 --- a/src/fsharp/FSharp.Core/Linq.fs +++ b/src/fsharp/FSharp.Core/Linq.fs @@ -162,11 +162,6 @@ open Microsoft.FSharp.Quotations open Microsoft.FSharp.Quotations.Patterns open Microsoft.FSharp.Quotations.DerivedPatterns -#if FX_RESHAPED_REFLECTION -open PrimReflectionAdapters -open ReflectionAdapters -#endif - module LeafExpressionConverter = // The following is recognized as a LINQ 'member initialization pattern' in a quotation. @@ -219,11 +214,7 @@ module LeafExpressionConverter = SubstHelperRaw(q, x, y) |> Expr.Cast let showAll = -#if FX_RESHAPED_REFLECTION - true -#else BindingFlags.Public ||| BindingFlags.NonPublic -#endif let NullableConstructor = typedefof>.GetConstructors().[0] diff --git a/src/fsharp/FSharp.Core/Query.fs b/src/fsharp/FSharp.Core/Query.fs index 742f04b32d..31e78f11de 100644 --- a/src/fsharp/FSharp.Core/Query.fs +++ b/src/fsharp/FSharp.Core/Query.fs @@ -302,11 +302,6 @@ open Microsoft.FSharp.Quotations.DerivedPatterns open Microsoft.FSharp.Linq.QueryRunExtensions -#if FX_RESHAPED_REFLECTION -open PrimReflectionAdapters -open ReflectionAdapters -#endif - [] module Query = diff --git a/src/fsharp/FSharp.Core/QueryExtensions.fs b/src/fsharp/FSharp.Core/QueryExtensions.fs index 4885899fe8..bfddf7e57e 100644 --- a/src/fsharp/FSharp.Core/QueryExtensions.fs +++ b/src/fsharp/FSharp.Core/QueryExtensions.fs @@ -15,11 +15,6 @@ open System.Collections.Generic open System.Linq open System.Linq.Expressions -#if FX_RESHAPED_REFLECTION -open PrimReflectionAdapters -open ReflectionAdapters -#endif - // ---------------------------------------------------------------------------- /// A type used to reconstruct a grouping after applying a mutable->immutable mapping transformation @@ -171,11 +166,7 @@ module internal Adapters = let (|RecordFieldGetSimplification|_|) (expr:Expr) = match expr with | Patterns.PropertyGet(Some (Patterns.NewRecord(typ,els)),propInfo,[]) -> -#if FX_RESHAPED_REFLECTION - let fields = Microsoft.FSharp.Reflection.FSharpType.GetRecordFields(typ, true) -#else let fields = Microsoft.FSharp.Reflection.FSharpType.GetRecordFields(typ,System.Reflection.BindingFlags.Public|||System.Reflection.BindingFlags.NonPublic) -#endif match fields |> Array.tryFindIndex (fun p -> p = propInfo) with | None -> None | Some i -> if i < els.Length then Some els.[i] else None diff --git a/src/fsharp/FSharp.Core/array.fs b/src/fsharp/FSharp.Core/array.fs index 8d7ce38869..0ac47bd39a 100644 --- a/src/fsharp/FSharp.Core/array.fs +++ b/src/fsharp/FSharp.Core/array.fs @@ -10,9 +10,6 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Core.Operators open Microsoft.FSharp.Core.CompilerServices open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators -#if FX_RESHAPED_REFLECTION - open System.Reflection -#endif /// Basic operations on arrays [] @@ -191,11 +188,7 @@ namespace Microsoft.FSharp.Collections [] let countBy (projection: 'T->'Key) (array: 'T[]) = checkNonNull "array" array -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then countByValueType projection array else countByRefType projection array @@ -445,11 +438,7 @@ namespace Microsoft.FSharp.Collections [] let groupBy (projection: 'T->'Key) (array: 'T[]) = checkNonNull "array" array -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then groupByValueType projection array else groupByRefType projection array diff --git a/src/fsharp/FSharp.Core/async.fs b/src/fsharp/FSharp.Core/async.fs index 1f20f7c811..86a1b262a4 100644 --- a/src/fsharp/FSharp.Core/async.fs +++ b/src/fsharp/FSharp.Core/async.fs @@ -17,10 +17,6 @@ namespace Microsoft.FSharp.Control open Microsoft.FSharp.Control open Microsoft.FSharp.Collections -#if FX_RESHAPED_REFLECTION - open ReflectionAdapters -#endif - type LinkedSubSource(cancellationToken: CancellationToken) = let failureCTS = new CancellationTokenSource() @@ -168,13 +164,11 @@ namespace Microsoft.FSharp.Control let f = unbox<(unit -> AsyncReturn)> o this.ExecuteWithTrampoline f |> unfake) -#if !FX_NO_PARAMETERIZED_THREAD_START // Preallocate this delegate and keep it in the trampoline holder. let threadStartCallbackForStartThreadWithTrampoline = ParameterizedThreadStart (fun o -> let f = unbox<(unit -> AsyncReturn)> o this.ExecuteWithTrampoline f |> unfake) -#endif /// Execute an async computation after installing a trampoline on its synchronous stack. [] @@ -196,22 +190,10 @@ namespace Microsoft.FSharp.Control | null -> this.QueueWorkItemWithTrampoline f | _ -> this.PostWithTrampoline syncCtxt f -#if FX_NO_PARAMETERIZED_THREAD_START - // This should be the only call to Thread.Start in this library. We must always install a trampoline. - member this.StartThreadWithTrampoline (f: unit -> AsyncReturn) = -#if FX_NO_THREAD - this.QueueWorkItemWithTrampoline f -#else - (new Thread((fun _ -> this.Execute f |> unfake), IsBackground=true)).Start() - fake() -#endif - -#else // This should be the only call to Thread.Start in this library. We must always install a trampoline. member __.StartThreadWithTrampoline (f: unit -> AsyncReturn) = (new Thread(threadStartCallbackForStartThreadWithTrampoline, IsBackground=true)).Start(f|>box) fake() -#endif /// Save the exception continuation during propagation of an exception, or prior to raising an exception member inline __.OnExceptionRaised econt = @@ -731,12 +713,7 @@ namespace Microsoft.FSharp.Control match resEvent with | null -> () | ev -> -#if FX_NO_EVENTWAITHANDLE_IDISPOSABLE - ev.Dispose() - System.GC.SuppressFinalize ev -#else ev.Close() -#endif resEvent <- null) interface IDisposable with @@ -824,15 +801,7 @@ namespace Microsoft.FSharp.Control | None -> // OK, let's really wait for the Set signal. This may block. let timeout = defaultArg timeout Threading.Timeout.Infinite -#if FX_NO_EXIT_CONTEXT_FLAGS -#if FX_NO_WAITONE_MILLISECONDS - let ok = resHandle.WaitOne(TimeSpan(int64 timeout*10000L)) -#else - let ok = resHandle.WaitOne(millisecondsTimeout= timeout) -#endif -#else let ok = resHandle.WaitOne(millisecondsTimeout= timeout, exitContext=true) -#endif if ok then // Now the result really must be available result @@ -1385,15 +1354,7 @@ namespace Microsoft.FSharp.Control let millisecondsTimeout = defaultArg millisecondsTimeout Threading.Timeout.Infinite if millisecondsTimeout = 0 then async.Delay(fun () -> -#if FX_NO_EXIT_CONTEXT_FLAGS -#if FX_NO_WAITONE_MILLISECONDS - let ok = waitHandle.WaitOne(TimeSpan 0L) -#else - let ok = waitHandle.WaitOne 0 -#endif -#else let ok = waitHandle.WaitOne(0, exitContext=false) -#endif async.Return ok) else CreateDelimitedUserCodeAsync(fun ctxt -> @@ -1683,12 +1644,7 @@ namespace Microsoft.FSharp.Control member stream.AsyncRead(buffer: byte[], ?offset, ?count) = let offset = defaultArg offset 0 let count = defaultArg count buffer.Length -#if FX_NO_BEGINEND_READWRITE - // use combo CreateDelimitedUserCodeAsync + taskContinueWith instead of AwaitTask so we can pass cancellation token to the ReadAsync task - CreateDelimitedUserCodeAsync (fun ctxt -> taskContinueWith (stream.ReadAsync(buffer, offset, count, ctxt.aux.token)) ctxt false) -#else Async.FromBeginEnd (buffer, offset, count, stream.BeginRead, stream.EndRead) -#endif [] // give the extension member a 'nice', unmangled compiled name, unique within this module member stream.AsyncRead count = @@ -1705,12 +1661,7 @@ namespace Microsoft.FSharp.Control member stream.AsyncWrite(buffer:byte[], ?offset:int, ?count:int) = let offset = defaultArg offset 0 let count = defaultArg count buffer.Length -#if FX_NO_BEGINEND_READWRITE - // use combo CreateDelimitedUserCodeAsync + taskContinueWithUnit instead of AwaitTask so we can pass cancellation token to the WriteAsync task - CreateDelimitedUserCodeAsync (fun ctxt -> taskContinueWithUnit (stream.WriteAsync(buffer, offset, count, ctxt.aux.token)) ctxt false) -#else Async.FromBeginEnd (buffer, offset, count, stream.BeginWrite, stream.EndWrite) -#endif type IObservable<'Args> with @@ -1746,8 +1697,6 @@ namespace Microsoft.FSharp.Control | _ -> None) -#if !FX_NO_WEB_CLIENT - type System.Net.WebClient with member inline private this.Download(event: IEvent<'T, _>, handler: _ -> 'T, start, result) = let downloadAsync = @@ -1799,5 +1748,3 @@ namespace Microsoft.FSharp.Control start = (fun userToken -> this.DownloadFileAsync(address, fileName, userToken)), result = (fun _ -> ()) ) -#endif - diff --git a/src/fsharp/FSharp.Core/async.fsi b/src/fsharp/FSharp.Core/async.fsi index b3312c6990..8e054b39b6 100644 --- a/src/fsharp/FSharp.Core/async.fsi +++ b/src/fsharp/FSharp.Core/async.fsi @@ -739,8 +739,7 @@ namespace Microsoft.FSharp.Control /// An asynchronous computation that waits for response to the WebRequest. [] // give the extension member a nice, unmangled compiled name, unique within this module member AsyncGetResponse : unit -> Async - -#if !FX_NO_WEB_CLIENT + type System.Net.WebClient with /// Returns an asynchronous computation that, when run, will wait for the download of the given URI. @@ -761,7 +760,6 @@ namespace Microsoft.FSharp.Control /// An asynchronous computation that will wait for the download of the URI to specified file. [] // give the extension member a nice, unmangled compiled name, unique within this module member AsyncDownloadFile : address:System.Uri * fileName: string -> Async -#endif // Internals used by MailboxProcessor module internal AsyncBuilderImpl = diff --git a/src/fsharp/FSharp.Core/event.fs b/src/fsharp/FSharp.Core/event.fs index 4489c325d5..8643b669c3 100644 --- a/src/fsharp/FSharp.Core/event.fs +++ b/src/fsharp/FSharp.Core/event.fs @@ -11,10 +11,6 @@ namespace Microsoft.FSharp.Control open System.Reflection open System.Diagnostics -#if FX_RESHAPED_REFLECTION - open ReflectionAdapters -#endif - [] type DelegateEvent<'Delegate when 'Delegate :> System.Delegate>() = let mutable multicast : System.Delegate = null diff --git a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs index dd8d087345..0917f84a50 100644 --- a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs +++ b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs @@ -166,21 +166,13 @@ module ExtraTopLevelOperators = [] let dict (keyValuePairs:seq<'Key*'T>) : IDictionary<'Key,'T> = -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then dictValueType keyValuePairs :> _ else dictRefType keyValuePairs :> _ [] let readOnlyDict (keyValuePairs:seq<'Key*'T>) : IReadOnlyDictionary<'Key,'T> = -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then dictValueType keyValuePairs :> _ else dictRefType keyValuePairs :> _ diff --git a/src/fsharp/FSharp.Core/list.fs b/src/fsharp/FSharp.Core/list.fs index 653c557a45..e7fd17ee52 100644 --- a/src/fsharp/FSharp.Core/list.fs +++ b/src/fsharp/FSharp.Core/list.fs @@ -9,9 +9,6 @@ namespace Microsoft.FSharp.Collections open Microsoft.FSharp.Collections open Microsoft.FSharp.Core.CompilerServices open System.Collections.Generic -#if FX_RESHAPED_REFLECTION - open System.Reflection -#endif [] [] @@ -71,11 +68,7 @@ namespace Microsoft.FSharp.Collections [] let countBy (projection:'T->'Key) (list:'T list) = -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then countByValueType projection list else countByRefType projection list @@ -446,11 +439,7 @@ namespace Microsoft.FSharp.Collections [] let groupBy (projection:'T->'Key) (list:'T list) = -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then groupByValueType projection list else groupByRefType projection list diff --git a/src/fsharp/FSharp.Core/map.fs b/src/fsharp/FSharp.Core/map.fs index d701fb87cf..d0fccda1fd 100644 --- a/src/fsharp/FSharp.Core/map.fs +++ b/src/fsharp/FSharp.Core/map.fs @@ -446,21 +446,19 @@ module MapTree = [] type Map<[]'Key, []'Value when 'Key : comparison >(comparer: IComparer<'Key>, tree: MapTree<'Key, 'Value>) = -#if !FX_NO_BINARY_SERIALIZATION [] - // This type is logically immutable. This field is only mutated during deserialization. - let mutable comparer = comparer + // This type is logically immutable. This field is only mutated during deserialization. + let mutable comparer = comparer [] - // This type is logically immutable. This field is only mutated during deserialization. - let mutable tree = tree + // This type is logically immutable. This field is only mutated during deserialization. + let mutable tree = tree - // This type is logically immutable. This field is only mutated during serialization and deserialization. + // This type is logically immutable. This field is only mutated during serialization and deserialization. // - // WARNING: The compiled name of this field may never be changed because it is part of the logical + // WARNING: The compiled name of this field may never be changed because it is part of the logical // WARNING: permanent serialization format for this type. - let mutable serializedData = null -#endif + let mutable serializedData = null // We use .NET generics per-instantiation static fields to avoid allocating a new object for each empty // set (it is just a lookup into a .NET table of type-instantiation-indexed static fields). @@ -468,7 +466,6 @@ type Map<[]'Key, [ new Map<'Key, 'Value>(comparer, MapTree<_, _>.MapEmpty) -#if !FX_NO_BINARY_SERIALIZATION [] member __.OnSerializing(context: System.Runtime.Serialization.StreamingContext) = ignore context @@ -483,9 +480,8 @@ type Map<[]'Key, [ - tree <- serializedData |> Array.map (fun (KeyValue(k, v)) -> (k, v)) |> MapTree.ofArray comparer + tree <- serializedData |> Array.map (fun (KeyValue(k, v)) -> (k, v)) |> MapTree.ofArray comparer serializedData <- null -#endif static member Empty : Map<'Key, 'Value> = empty diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 2e91dec124..1fe3d7e841 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -374,29 +374,6 @@ namespace Microsoft.FSharp.Core /// Represents a out-argument managed pointer in F# code. This type should only be used with F# 4.5+. type outref<'T> = byref<'T, ByRefKinds.Out> -#if FX_RESHAPED_REFLECTION - module PrimReflectionAdapters = - - open System.Reflection - open System.Linq - // copied from BasicInlinedOperations - let inline box (x:'T) = (# "box !0" type ('T) x : obj #) - let inline unboxPrim<'T>(x:obj) = (# "unbox.any !0" type ('T) x : 'T #) - type System.Type with - member inline this.IsGenericType = this.GetTypeInfo().IsGenericType - member inline this.IsValueType = this.GetTypeInfo().IsValueType - member inline this.IsSealed = this.GetTypeInfo().IsSealed - member inline this.IsAssignableFrom(otherType: Type) = this.GetTypeInfo().IsAssignableFrom(otherType.GetTypeInfo()) - member inline this.GetGenericArguments() = this.GetTypeInfo().GenericTypeArguments - member inline this.GetProperty(name) = this.GetRuntimeProperty(name) - member inline this.GetMethod(name, parameterTypes) = this.GetRuntimeMethod(name, parameterTypes) - member inline this.GetCustomAttributes(attributeType: Type, inherits: bool) : obj[] = - unboxPrim<_> (box (CustomAttributeExtensions.GetCustomAttributes(this.GetTypeInfo(), attributeType, inherits).ToArray())) - - open PrimReflectionAdapters - -#endif - module internal BasicInlinedOperations = let inline unboxPrim<'T>(x:obj) = (# "unbox.any !0" type ('T) x : 'T #) let inline box (x:'T) = (# "box !0" type ('T) x : obj #) @@ -548,12 +525,8 @@ namespace Microsoft.FSharp.Core ignore obj // pretend the variable is used let e = new System.ArgumentException(ErrorStrings.AddressOpNotFirstClassString) (# "throw" (e :> System.Exception) : nativeptr<'T> #) - - + open IntrinsicOperators -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters -#endif [] // nested module OK module IntrinsicFunctions = @@ -881,78 +854,6 @@ namespace Microsoft.FSharp.Core /// specialcase: Core implementation of structural comparison on arbitrary arrays. and GenericComparisonArbArrayWithComparer (comp:GenericComparer) (x:System.Array) (y:System.Array) : int = -#if FX_NO_ARRAY_LONG_LENGTH - if x.Rank = 1 && y.Rank = 1 then - let lenx = x.Length - let leny = y.Length - let c = intOrder lenx leny - if c <> 0 then c else - let basex = (x.GetLowerBound(0)) - let basey = (y.GetLowerBound(0)) - let c = intOrder basex basey - if c <> 0 then c else - let rec check i = - if i >= lenx then 0 else - let c = GenericCompare comp ((x.GetValue(i + basex)),(y.GetValue(i + basey))) - if c <> 0 then c else check (i + 1) - check 0 - elif x.Rank = 2 && y.Rank = 2 then - let lenx0 = x.GetLength(0) - let leny0 = y.GetLength(0) - let c = intOrder lenx0 leny0 - if c <> 0 then c else - let lenx1 = x.GetLength(1) - let leny1 = y.GetLength(1) - let c = intOrder lenx1 leny1 - if c <> 0 then c else - let basex0 = (x.GetLowerBound(0)) - let basex1 = (x.GetLowerBound(1)) - let basey0 = (y.GetLowerBound(0)) - let basey1 = (y.GetLowerBound(1)) - let c = intOrder basex0 basey0 - if c <> 0 then c else - let c = intOrder basex1 basey1 - if c <> 0 then c else - let rec check0 i = - let rec check1 j = - if j >= lenx1 then 0 else - let c = GenericCompare comp ((x.GetValue(i + basex0,j + basex1)), (y.GetValue(i + basey0,j + basey1))) - if c <> 0 then c else check1 (j + 1) - if i >= lenx0 then 0 else - let c = check1 0 - if c <> 0 then c else - check0 (i + 1) - check0 0 - else - let c = intOrder x.Rank y.Rank - if c <> 0 then c else - let ndims = x.Rank - // check lengths - let rec precheck k = - if k >= ndims then 0 else - let c = intOrder (x.GetLength(k)) (y.GetLength(k)) - if c <> 0 then c else - let c = intOrder (x.GetLowerBound(k)) (y.GetLowerBound(k)) - if c <> 0 then c else - precheck (k+1) - let c = precheck 0 - if c <> 0 then c else - let idxs : int[] = zeroCreate ndims - let rec checkN k baseIdx i lim = - if i >= lim then 0 else - set idxs k (baseIdx + i) - let c = - if k = ndims - 1 - then GenericCompare comp ((x.GetValue(idxs)), (y.GetValue(idxs))) - else check (k+1) - if c <> 0 then c else - checkN k baseIdx (i + 1) lim - and check k = - if k >= ndims then 0 else - let baseIdx = x.GetLowerBound(k) - checkN k baseIdx 0 (x.GetLength(k)) - check 0 -#else if x.Rank = 1 && y.Rank = 1 then let lenx = x.LongLength let leny = y.LongLength @@ -985,11 +886,11 @@ namespace Microsoft.FSharp.Core let c = int64Order basex1 basey1 if c <> 0 then c else let rec check0 i = - let rec check1 j = + let rec check1 j = if j >=. lenx1 then 0 else let c = GenericCompare comp ((x.GetValue(i +. basex0,j +. basex1)), (y.GetValue(i +. basey0,j +. basey1))) if c <> 0 then c else check1 (j +. 1L) - if i >=. lenx0 then 0 else + if i >=. lenx0 then 0 else let c = check1 0L if c <> 0 then c else check0 (i +. 1L) @@ -998,8 +899,8 @@ namespace Microsoft.FSharp.Core let c = intOrder x.Rank y.Rank if c <> 0 then c else let ndims = x.Rank - // check lengths - let rec precheck k = + // check lengths + let rec precheck k = if k >= ndims then 0 else let c = int64Order (x.GetLongLength(k)) (y.GetLongLength(k)) if c <> 0 then c else @@ -1023,10 +924,9 @@ namespace Microsoft.FSharp.Core let baseIdx = x.GetLowerBound(k) checkN k (int64 baseIdx) 0L (x.GetLongLength(k)) check 0 -#endif - + /// optimized case: Core implementation of structural comparison on object arrays. - and GenericComparisonObjArrayWithComparer (comp:GenericComparer) (x:obj[]) (y:obj[]) : int = + and GenericComparisonObjArrayWithComparer (comp:GenericComparer) (x:obj[]) (y:obj[]) : int = let lenx = x.Length let leny = y.Length let c = intOrder lenx leny @@ -1035,8 +935,8 @@ namespace Microsoft.FSharp.Core let mutable i = 0 let mutable res = 0 while i < lenx do - let c = GenericCompare comp ((get x i), (get y i)) - if c <> 0 then (res <- c; i <- lenx) + let c = GenericCompare comp ((get x i), (get y i)) + if c <> 0 then (res <- c; i <- lenx) else i <- i + 1 res @@ -1058,7 +958,7 @@ namespace Microsoft.FSharp.Core type GenericComparer with interface System.Collections.IComparer with override c.Compare(x:obj,y:obj) = GenericCompare c (x,y) - + /// The unique object for comparing values in PER mode (where local exceptions are thrown when NaNs are compared) let fsComparerPER = GenericComparer(true) @@ -1403,63 +1303,6 @@ namespace Microsoft.FSharp.Core /// specialcase: Core implementation of structural equality on arbitrary arrays. and GenericEqualityArbArray er (iec:System.Collections.IEqualityComparer) (x:System.Array) (y:System.Array) : bool = -#if FX_NO_ARRAY_LONG_LENGTH - if x.Rank = 1 && y.Rank = 1 then - // check lengths - let lenx = x.Length - let leny = y.Length - (int32Eq lenx leny) && - // check contents - let basex = x.GetLowerBound(0) - let basey = y.GetLowerBound(0) - (int32Eq basex basey) && - let rec check i = (i >= lenx) || (GenericEqualityObj er iec ((x.GetValue(basex + i)),(y.GetValue(basey + i))) && check (i + 1)) - check 0 - elif x.Rank = 2 && y.Rank = 2 then - // check lengths - let lenx0 = x.GetLength(0) - let leny0 = y.GetLength(0) - (int32Eq lenx0 leny0) && - let lenx1 = x.GetLength(1) - let leny1 = y.GetLength(1) - (int32Eq lenx1 leny1) && - let basex0 = x.GetLowerBound(0) - let basex1 = x.GetLowerBound(1) - let basey0 = y.GetLowerBound(0) - let basey1 = y.GetLowerBound(1) - (int32Eq basex0 basey0) && - (int32Eq basex1 basey1) && - // check contents - let rec check0 i = - let rec check1 j = (j >= lenx1) || (GenericEqualityObj er iec ((x.GetValue(basex0 + i,basex1 + j)), (y.GetValue(basey0 + i,basey1 + j))) && check1 (j + 1)) - (i >= lenx0) || (check1 0 && check0 (i + 1)) - check0 0 - else - (x.Rank = y.Rank) && - let ndims = x.Rank - // check lengths - let rec precheck k = - (k >= ndims) || - (int32Eq (x.GetLength(k)) (y.GetLength(k)) && - int32Eq (x.GetLowerBound(k)) (y.GetLowerBound(k)) && - precheck (k+1)) - precheck 0 && - let idxs : int32[] = zeroCreate ndims - // check contents - let rec checkN k baseIdx i lim = - (i >= lim) || - (set idxs k (baseIdx + i); - (if k = ndims - 1 - then GenericEqualityObj er iec ((x.GetValue(idxs)),(y.GetValue(idxs))) - else check (k+1)) && - checkN k baseIdx (i + 1) lim) - and check k = - (k >= ndims) || - (let baseIdx = x.GetLowerBound(k) - checkN k baseIdx 0 (x.GetLength(k))) - - check 0 -#else if x.Rank = 1 && y.Rank = 1 then // check lengths let lenx = x.LongLength @@ -1468,9 +1311,9 @@ namespace Microsoft.FSharp.Core // check contents let basex = int64 (x.GetLowerBound(0)) let basey = int64 (y.GetLowerBound(0)) - (int64Eq basex basey) && + (int64Eq basex basey) && let rec check i = (i >=. lenx) || (GenericEqualityObj er iec ((x.GetValue(basex +. i)),(y.GetValue(basey +. i))) && check (i +. 1L)) - check 0L + check 0L elif x.Rank = 2 && y.Rank = 2 then // check lengths let lenx0 = x.GetLongLength(0) @@ -1491,16 +1334,16 @@ namespace Microsoft.FSharp.Core (i >=. lenx0) || (check1 0L && check0 (i +. 1L)) check0 0L else - (x.Rank = y.Rank) && + (x.Rank = y.Rank) && let ndims = x.Rank - // check lengths - let rec precheck k = - (k >= ndims) || - (int64Eq (x.GetLongLength(k)) (y.GetLongLength(k)) && - int32Eq (x.GetLowerBound(k)) (y.GetLowerBound(k)) && + // check lengths + let rec precheck k = + (k >= ndims) || + (int64Eq (x.GetLongLength(k)) (y.GetLongLength(k)) && + int32Eq (x.GetLowerBound(k)) (y.GetLowerBound(k)) && precheck (k+1)) precheck 0 && - let idxs : int64[] = zeroCreate ndims + let idxs : int64[] = zeroCreate ndims // check contents let rec checkN k baseIdx i lim = (i >=. lim) || @@ -1513,10 +1356,8 @@ namespace Microsoft.FSharp.Core (k >= ndims) || (let baseIdx = x.GetLowerBound(k) checkN k (int64 baseIdx) 0L (x.GetLongLength(k))) - check 0 -#endif - + /// optimized case: Core implementation of structural equality on object arrays. and GenericEqualityObjArray er iec (x:obj[]) (y:obj[]) : bool = let lenx = x.Length @@ -2960,7 +2801,6 @@ namespace Microsoft.FSharp.Core [] static member op_Implicit(func : ('T -> 'Res) ) = new System.Func<'T,'Res>(func) -#if !FX_NO_CONVERTER [] static member op_Implicit(f : System.Converter<_,_>) : ('T -> 'Res) = (fun t -> f.Invoke(t)) @@ -2970,7 +2810,6 @@ namespace Microsoft.FSharp.Core static member FromConverter (converter: System.Converter<_,_>) : ('T -> 'Res) = (fun t -> converter.Invoke(t)) static member ToConverter (func: ('T -> 'Res) ) = new System.Converter<'T,'Res>(func) -#endif static member InvokeFast (func:FSharpFunc<_,_>, arg1: 'T, arg2: 'Res) = OptimizedClosures.invokeFast2(func, arg1, arg2) @@ -2986,9 +2825,7 @@ namespace Microsoft.FSharp.Core static member inline ToFSharpFunc (action: Action<_>) = (fun t -> action.Invoke(t)) -#if !FX_NO_CONVERTER static member inline ToFSharpFunc (converter : Converter<_,_>) = (fun t -> converter.Invoke(t)) -#endif // Note: this is not made public in the signature, because of conflicts with the Converter overload. // The method remains in case someone is calling it via reflection. @@ -4268,26 +4105,12 @@ namespace Microsoft.FSharp.Core module Attributes = open System.Runtime.CompilerServices -#if !FX_NO_DEFAULT_DEPENDENCY_TYPE - [] -#endif - -#if !FX_NO_COMVISIBLE [] -#endif [] - -#if BE_SECURITY_TRANSPARENT [] // assembly is fully transparent #if CROSS_PLATFORM_COMPILER #else [] // v4 transparency; soon to be the default, but not yet -#endif -#else -#if !FX_NO_SECURITY_PERMISSIONS - // REVIEW: Need to choose a specific permission for the action to be applied to - [] -#endif #endif do () @@ -4654,13 +4477,10 @@ namespace Microsoft.FSharp.Core when ^T : unativeint = (# "conv.ovf.i.un" value : nativeint #) when ^T : byte = (# "conv.ovf.i.un" value : nativeint #) - module OperatorIntrinsics = - + module OperatorIntrinsics = + open System.Collections -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters -#endif - + let notStarted() = raise (new System.InvalidOperationException(SR.GetString(SR.enumerationNotStarted))) let alreadyFinished() = raise (new System.InvalidOperationException(SR.GetString(SR.enumerationAlreadyFinished))) diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index c977af4541..264cf7ff87 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -1342,20 +1342,6 @@ namespace Microsoft.FSharp.Core [] val inline FastCompareTuple5 : comparer:System.Collections.IComparer -> tuple1:('T1 * 'T2 * 'T3 * 'T4 * 'T5) -> tuple2:('T1 * 'T2 * 'T3 * 'T4 * 'T5) -> int -#if FX_RESHAPED_REFLECTION - module internal PrimReflectionAdapters = - - open System.Reflection - - type System.Type with - member inline IsGenericType : bool - member inline IsValueType : bool - member inline GetMethod : string * parameterTypes : Type[] -> MethodInfo - member inline GetProperty : string -> PropertyInfo - member inline IsAssignableFrom : otherType : Type -> bool - member inline GetCustomAttributes : attributeType : Type * inherits: bool -> obj[] -#endif - //------------------------------------------------------------------------- // F# Choice Types @@ -1503,8 +1489,6 @@ namespace Microsoft.FSharp.Core /// 'U abstract member Invoke : func:'T -> 'U -#if !FX_NO_CONVERTER - /// Convert an F# first class function value to a value of type System.Converter /// The input function. /// A System.Converter of the function type. @@ -1524,7 +1508,6 @@ namespace Microsoft.FSharp.Core /// The input System.Converter. /// An F# function of the same type. static member FromConverter : converter:System.Converter<'T,'U> -> ('T -> 'U) -#endif /// Invoke an F# first class function value with five curried arguments. In some cases this /// will result in a more efficient application than applying the arguments successively. @@ -1575,12 +1558,10 @@ namespace Microsoft.FSharp.Core /// The F# function. static member inline ToFSharpFunc : action:Action<'T> -> ('T -> unit) -#if !FX_NO_CONVERTER /// Convert the given Converter delegate object to an F# function value /// The input Converter delegate. /// The F# function. static member inline ToFSharpFunc : converter:Converter<'T,'U> -> ('T -> 'U) -#endif /// Convert the given Action delegate object to an F# function value /// The input Action delegate. diff --git a/src/fsharp/FSharp.Core/printf.fs b/src/fsharp/FSharp.Core/printf.fs index 141c9752da..59a3687698 100644 --- a/src/fsharp/FSharp.Core/printf.fs +++ b/src/fsharp/FSharp.Core/printf.fs @@ -47,11 +47,6 @@ module internal PrintfImpl = open Microsoft.FSharp.Collections open LanguagePrimitives.IntrinsicOperators -#if FX_RESHAPED_REFLECTION - open Microsoft.FSharp.Core.PrimReflectionAdapters - open Microsoft.FSharp.Core.ReflectionAdapters -#endif - open System.IO [] @@ -1070,12 +1065,8 @@ module internal PrintfImpl = static member GenericToString<'T>(spec: FormatSpecifier) = let bindingFlags = -#if FX_RESHAPED_REFLECTION - isPlusForPositives spec.Flags // true - show non-public -#else if isPlusForPositives spec.Flags then BindingFlags.Public ||| BindingFlags.NonPublic else BindingFlags.Public -#endif let useZeroWidth = isPadWithZeros spec.Flags let opts = diff --git a/src/fsharp/FSharp.Core/quotations.fs b/src/fsharp/FSharp.Core/quotations.fs index efd9763e1c..974e32c767 100644 --- a/src/fsharp/FSharp.Core/quotations.fs +++ b/src/fsharp/FSharp.Core/quotations.fs @@ -20,11 +20,6 @@ open Microsoft.FSharp.Text.StructuredPrintfImpl.TaggedTextOps #nowarn "52" // The value has been copied to ensure the original is not mutated by this operation -#if FX_RESHAPED_REFLECTION -open PrimReflectionAdapters -open ReflectionAdapters -#endif - //-------------------------------------------------------------------------- // RAW quotations - basic data types //-------------------------------------------------------------------------- @@ -56,11 +51,7 @@ module Helpers = let staticBindingFlags = BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly let staticOrInstanceBindingFlags = BindingFlags.Instance ||| BindingFlags.Static ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly let instanceBindingFlags = BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.DeclaredOnly -#if FX_RESHAPED_REFLECTION - let publicOrPrivateBindingFlags = true -#else let publicOrPrivateBindingFlags = BindingFlags.Public ||| BindingFlags.NonPublic -#endif let isDelegateType (typ:Type) = if typ.IsSubclassOf(typeof) then @@ -989,11 +980,7 @@ module Patterns = let resT = instFormal tyargTs rty let methInfo = try -#if FX_RESHAPED_REFLECTION - match parentT.GetMethod(nm, argTs) with -#else match parentT.GetMethod(nm, staticOrInstanceBindingFlags, null, argTs, null) with -#endif | null -> None | res -> Some res with :? AmbiguousMatchException -> None @@ -1021,11 +1008,7 @@ module Patterns = let tyArgs = List.toArray tyArgs let methInfo = try -#if FX_RESHAPED_REFLECTION - match ty.GetMethod(nm, argTypes) with -#else match ty.GetMethod(nm, staticOrInstanceBindingFlags, null, argTypes, null) with -#endif | null -> None | res -> Some res with :? AmbiguousMatchException -> None @@ -1138,21 +1121,13 @@ module Patterns = | _ -> null | ctor -> ctor - let bindProp (tc, propName, retType, argTypes, tyargs) = // We search in the instantiated type, rather than searching the generic type. let typ = mkNamedType (tc, tyargs) let argtyps : Type list = argTypes |> inst tyargs let retType : Type = retType |> inst tyargs |> removeVoid -#if FX_RESHAPED_REFLECTION - try - typ.GetProperty(propName, staticOrInstanceBindingFlags) - with :? AmbiguousMatchException -> null // more than one property found with the specified name and matching binding constraints - return null to initiate manual search - |> bindPropBySearchIfCandidateIsNull typ propName retType (Array.ofList argtyps) - |> checkNonNullResult ("propName", String.Format(SR.GetString(SR.QfailedToBindProperty), propName)) // fxcop may not see "propName" as an arg -#else typ.GetProperty(propName, staticOrInstanceBindingFlags, null, retType, Array.ofList argtyps, null) |> checkNonNullResult ("propName", String.Format(SR.GetString(SR.QfailedToBindProperty), propName)) // fxcop may not see "propName" as an arg -#endif + let bindField (tc, fldName, tyargs) = let typ = mkNamedType (tc, tyargs) typ.GetField(fldName, staticOrInstanceBindingFlags) |> checkNonNullResult ("fldName", String.Format(SR.GetString(SR.QfailedToBindField), fldName)) // fxcop may not see "fldName" as an arg @@ -1163,26 +1138,12 @@ module Patterns = let bindGenericCtor (tc:Type, argTypes:Instantiable) = let argtyps = instFormal (getGenericArguments tc) argTypes -#if FX_RESHAPED_REFLECTION - let argTypes = Array.ofList argtyps - tc.GetConstructor argTypes - |> bindCtorBySearchIfCandidateIsNull tc argTypes - |> checkNonNullResult ("tc", SR.GetString(SR.QfailedToBindConstructor)) -#else tc.GetConstructor(instanceBindingFlags, null, Array.ofList argtyps, null) |> checkNonNullResult ("tc", SR.GetString(SR.QfailedToBindConstructor)) -#endif let bindCtor (tc, argTypes:Instantiable, tyargs) = let typ = mkNamedType (tc, tyargs) let argtyps = argTypes |> inst tyargs -#if FX_RESHAPED_REFLECTION - let argTypes = Array.ofList argtyps - typ.GetConstructor argTypes - |> bindCtorBySearchIfCandidateIsNull typ argTypes - |> checkNonNullResult ("tc", SR.GetString(SR.QfailedToBindConstructor)) -#else typ.GetConstructor(instanceBindingFlags, null, Array.ofList argtyps, null) |> checkNonNullResult ("tc", SR.GetString(SR.QfailedToBindConstructor)) -#endif let chop n xs = if n < 0 then invalidArg "n" (SR.GetString(SR.inputMustBeNonNegative)) @@ -1358,11 +1319,7 @@ module Patterns = if a = "" then mscorlib elif a = "." then st.localAssembly else -#if FX_RESHAPED_REFLECTION - match System.Reflection.Assembly.Load(AssemblyName a) with -#else match System.Reflection.Assembly.Load a with -#endif | null -> raise <| System.InvalidOperationException(String.Format(SR.GetString(SR.QfailedToBindAssembly), a.ToString())) | assembly -> assembly @@ -1684,14 +1641,6 @@ module Patterns = let decodedTopResources = new Dictionary(10, HashIdentity.Structural) -#if FX_NO_REFLECTION_MODULE_HANDLES // not available on Silverlight - [] - type ModuleHandle = ModuleHandle of string * string - type System.Reflection.Module with - member x.ModuleHandle = ModuleHandle(x.Assembly.FullName, x.Name) -#else - type ModuleHandle = System.ModuleHandle -#endif [] type ReflectedDefinitionTableKey = @@ -1735,11 +1684,7 @@ module Patterns = not (decodedTopResources.ContainsKey((assem, resourceName))) then let cmaAttribForResource = -#if FX_RESHAPED_REFLECTION - CustomAttributeExtensions.GetCustomAttributes(assem, typeof) |> Seq.toArray -#else assem.GetCustomAttributes(typeof, false) -#endif |> (function null -> [| |] | x -> x) |> Array.tryPick (fun ca -> match ca with diff --git a/src/fsharp/FSharp.Core/reflect.fs b/src/fsharp/FSharp.Core/reflect.fs index 2024be205b..f9e0a9daa8 100644 --- a/src/fsharp/FSharp.Core/reflect.fs +++ b/src/fsharp/FSharp.Core/reflect.fs @@ -27,11 +27,6 @@ module internal ReflectionUtils = [] module internal Impl = -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters - open ReflectionAdapters -#endif - let getBindingFlags allowAccess = ReflectionUtils.toBindingFlags (defaultArg allowAccess false) let inline checkNonNull argName (v: 'T) = @@ -56,31 +51,18 @@ module internal Impl = //----------------------------------------------------------------- // GENERAL UTILITIES -#if FX_RESHAPED_REFLECTION - let instanceFieldFlags = BindingFlags.Instance - let instancePropertyFlags = BindingFlags.Instance - let staticPropertyFlags = BindingFlags.Static - let staticFieldFlags = BindingFlags.Static - let staticMethodFlags = BindingFlags.Static -#else let instanceFieldFlags = BindingFlags.GetField ||| BindingFlags.Instance let instancePropertyFlags = BindingFlags.GetProperty ||| BindingFlags.Instance let staticPropertyFlags = BindingFlags.GetProperty ||| BindingFlags.Static let staticFieldFlags = BindingFlags.GetField ||| BindingFlags.Static let staticMethodFlags = BindingFlags.Static -#endif - let getInstancePropertyInfo (typ: Type, propName, bindingFlags) = typ.GetProperty(propName, instancePropertyFlags ||| bindingFlags) let getInstancePropertyInfos (typ, names, bindingFlags) = names |> Array.map (fun nm -> getInstancePropertyInfo (typ, nm, bindingFlags)) - let getInstancePropertyReader (typ: Type, propName, bindingFlags) = match getInstancePropertyInfo(typ, propName, bindingFlags) with | null -> None -#if FX_RESHAPED_REFLECTION - | prop -> Some(fun (obj: obj) -> prop.GetValue (obj, null)) -#else | prop -> Some(fun (obj: obj) -> prop.GetValue (obj, instancePropertyFlags ||| bindingFlags, null, null, null)) -#endif + //----------------------------------------------------------------- // ATTRIBUTE DECOMPILATION @@ -95,7 +77,6 @@ module internal Impl = | None -> failwith "no compilation mapping attribute" | Some a -> a -#if !FX_NO_REFLECTION_ONLY let cmaName = typeof.FullName let assemblyName = typeof.Assembly.GetName().Name let _ = assert (assemblyName = "FSharp.Core") @@ -121,33 +102,26 @@ module internal Impl = match tryFindCompilationMappingAttributeFromData attrs with | None -> failwith "no compilation mapping attribute" | Some a -> a -#endif let tryFindCompilationMappingAttributeFromType (typ: Type) = -#if !FX_NO_REFLECTION_ONLY let assem = typ.Assembly if (not (isNull assem)) && assem.ReflectionOnly then tryFindCompilationMappingAttributeFromData ( typ.GetCustomAttributesData()) else -#endif tryFindCompilationMappingAttribute ( typ.GetCustomAttributes (typeof, false)) let tryFindCompilationMappingAttributeFromMemberInfo (info: MemberInfo) = -#if !FX_NO_REFLECTION_ONLY let assem = info.DeclaringType.Assembly if (not (isNull assem)) && assem.ReflectionOnly then tryFindCompilationMappingAttributeFromData (info.GetCustomAttributesData()) else -#endif tryFindCompilationMappingAttribute (info.GetCustomAttributes (typeof, false)) let findCompilationMappingAttributeFromMemberInfo (info: MemberInfo) = -#if !FX_NO_REFLECTION_ONLY let assem = info.DeclaringType.Assembly if (not (isNull assem)) && assem.ReflectionOnly then findCompilationMappingAttributeFromData (info.GetCustomAttributesData()) else -#endif findCompilationMappingAttribute (info.GetCustomAttributes (typeof, false)) let sequenceNumberOfMember (x: MemberInfo) = let (_, n, _) = findCompilationMappingAttributeFromMemberInfo x in n @@ -285,11 +259,8 @@ module internal Impl = let getUnionCaseRecordReader (typ: Type, tag: int, bindingFlags) = let props = fieldsPropsOfUnionCase (typ, tag, bindingFlags) -#if FX_RESHAPED_REFLECTION - (fun (obj: obj) -> props |> Array.map (fun prop -> prop.GetValue (obj, null))) -#else (fun (obj: obj) -> props |> Array.map (fun prop -> prop.GetValue (obj, bindingFlags, null, null, null))) -#endif + let getUnionTagReader (typ: Type, bindingFlags) : (obj -> int) = if isOptionType typ then (fun (obj: obj) -> match obj with null -> 0 | _ -> 1) @@ -302,20 +273,12 @@ module internal Impl = | Some reader -> (fun (obj: obj) -> reader obj :?> int) | None -> (fun (obj: obj) -> -#if FX_RESHAPED_REFLECTION - let m2b = typ.GetMethod("GetTag", [| typ |]) -#else let m2b = typ.GetMethod("GetTag", BindingFlags.Static ||| bindingFlags, null, [| typ |], null) -#endif m2b.Invoke(null, [|obj|]) :?> int) let getUnionTagMemberInfo (typ: Type, bindingFlags) = match getInstancePropertyInfo (typ, "Tag", bindingFlags) with -#if FX_RESHAPED_REFLECTION - | null -> (typ.GetMethod("GetTag") :> MemberInfo) -#else | null -> (typ.GetMethod("GetTag", BindingFlags.Static ||| bindingFlags) :> MemberInfo) -#endif | info -> (info :> MemberInfo) let isUnionCaseNullary (typ: Type, tag: int, bindingFlags) = @@ -335,11 +298,8 @@ module internal Impl = let getUnionCaseConstructor (typ: Type, tag: int, bindingFlags) = let meth = getUnionCaseConstructorMethod (typ, tag, bindingFlags) (fun args -> -#if FX_RESHAPED_REFLECTION - meth.Invoke(null, args)) -#else meth.Invoke(null, BindingFlags.Static ||| BindingFlags.InvokeMethod ||| bindingFlags, null, args, null)) -#endif + let checkUnionType (unionType, bindingFlags) = checkNonNull "unionType" unionType if not (isUnionType (unionType, bindingFlags)) then @@ -513,18 +473,10 @@ module internal Impl = let ctor = if typ.IsValueType then let fields = typ.GetFields (instanceFieldFlags ||| BindingFlags.Public) |> orderTupleFields -#if FX_RESHAPED_REFLECTION - typ.GetConstructor(fields |> Array.map (fun fi -> fi.FieldType)) -#else typ.GetConstructor(BindingFlags.Public ||| BindingFlags.Instance, null, fields |> Array.map (fun fi -> fi.FieldType), null) -#endif else let props = typ.GetProperties() |> orderTupleProperties -#if FX_RESHAPED_REFLECTION - typ.GetConstructor(props |> Array.map (fun p -> p.PropertyType)) -#else typ.GetConstructor(BindingFlags.Public ||| BindingFlags.Instance, null, props |> Array.map (fun p -> p.PropertyType), null) -#endif match ctor with | null -> raise (ArgumentException (String.Format (SR.GetString (SR.invalidTupleTypeConstructorNotDefined), typ.FullName))) | _ -> () @@ -533,11 +485,7 @@ module internal Impl = let getTupleCtor(typ: Type) = let ctor = getTupleConstructorMethod typ (fun (args: obj[]) -> -#if FX_RESHAPED_REFLECTION - ctor.Invoke args) -#else ctor.Invoke(BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| BindingFlags.Public, null, args, null)) -#endif let rec getTupleReader (typ: Type) = let etys = typ.GetGenericArguments() @@ -639,11 +587,7 @@ module internal Impl = let getRecordConstructorMethod(typ: Type, bindingFlags) = let props = fieldPropsOfRecordType(typ, bindingFlags) -#if FX_RESHAPED_REFLECTION - let ctor = typ.GetConstructor(props |> Array.map (fun p -> p.PropertyType)) -#else let ctor = typ.GetConstructor(BindingFlags.Instance ||| bindingFlags, null, props |> Array.map (fun p -> p.PropertyType), null) -#endif match ctor with | null -> raise <| ArgumentException (String.Format (SR.GetString (SR.invalidRecordTypeConstructorNotDefined), typ.FullName)) | _ -> () @@ -652,11 +596,7 @@ module internal Impl = let getRecordConstructor(typ: Type, bindingFlags) = let ctor = getRecordConstructorMethod(typ, bindingFlags) (fun (args: obj[]) -> -#if FX_RESHAPED_REFLECTION - ctor.Invoke args) -#else ctor.Invoke(BindingFlags.InvokeMethod ||| BindingFlags.Instance ||| bindingFlags, null, args, null)) -#endif /// EXCEPTION DECOMPILATION // Check the base type - if it is also an F# type then @@ -703,10 +643,6 @@ module internal Impl = if not (isTupleType tupleType) then invalidArg argName (String.Format (SR.GetString (SR.notATupleType), tupleType.FullName)) -#if FX_RESHAPED_REFLECTION -open ReflectionAdapters -#endif - [] type UnionCaseInfo(typ: System.Type, tag: int) = diff --git a/src/fsharp/FSharp.Core/seq.fs b/src/fsharp/FSharp.Core/seq.fs index ab48146b63..97326e7315 100644 --- a/src/fsharp/FSharp.Core/seq.fs +++ b/src/fsharp/FSharp.Core/seq.fs @@ -1071,11 +1071,7 @@ namespace Microsoft.FSharp.Collections [] let groupBy (projection:'T->'Key) (source:seq<'T>) = -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then mkDelayedSeq (fun () -> groupByValueType projection source) else mkDelayedSeq (fun () -> groupByRefType projection source) @@ -1164,11 +1160,7 @@ namespace Microsoft.FSharp.Collections let countBy (projection:'T->'Key) (source:seq<'T>) = checkNonNull "source" source -#if FX_RESHAPED_REFLECTION - if (typeof<'Key>).GetTypeInfo().IsValueType -#else if typeof<'Key>.IsValueType -#endif then mkDelayedSeq (fun () -> countByValueType projection source) else mkDelayedSeq (fun () -> countByRefType projection source) diff --git a/src/fsharp/FSharp.Core/set.fs b/src/fsharp/FSharp.Core/set.fs index f0c88dcf58..5da5152f29 100644 --- a/src/fsharp/FSharp.Core/set.fs +++ b/src/fsharp/FSharp.Core/set.fs @@ -512,23 +512,20 @@ module internal SetTree = [>)>] [] [] -type Set<[]'T when 'T: comparison >(comparer:IComparer<'T>, tree: SetTree<'T>) = +type Set<[]'T when 'T: comparison >(comparer:IComparer<'T>, tree: SetTree<'T>) = -#if !FX_NO_BINARY_SERIALIZATION [] - // NOTE: This type is logically immutable. This field is only mutated during deserialization. - let mutable comparer = comparer + // NOTE: This type is logically immutable. This field is only mutated during deserialization. + let mutable comparer = comparer [] - // NOTE: This type is logically immutable. This field is only mutated during deserialization. - let mutable tree = tree + // NOTE: This type is logically immutable. This field is only mutated during deserialization. + let mutable tree = tree - // NOTE: This type is logically immutable. This field is only mutated during serialization and deserialization. - // - // WARNING: The compiled name of this field may never be changed because it is part of the logical + // NOTE: This type is logically immutable. This field is only mutated during serialization and deserialization. + // WARNING: The compiled name of this field may never be changed because it is part of the logical // WARNING: permanent serialization format for this type. - let mutable serializedData = null -#endif + let mutable serializedData = null // We use .NET generics per-instantiation static fields to avoid allocating a new object for each empty // set (it is just a lookup into a .NET table of type-instantiation-indexed static fields). @@ -537,7 +534,6 @@ type Set<[]'T when 'T: comparison >(comparer:IComparer<'T let comparer = LanguagePrimitives.FastGenericComparer<'T> Set<'T>(comparer, SetEmpty) -#if !FX_NO_BINARY_SERIALIZATION [] member __.OnSerializing(context: System.Runtime.Serialization.StreamingContext) = ignore context @@ -554,7 +550,6 @@ type Set<[]'T when 'T: comparison >(comparer:IComparer<'T comparer <- LanguagePrimitives.FastGenericComparer<'T> tree <- SetTree.ofArray comparer serializedData serializedData <- null -#endif [] member internal set.Comparer = comparer diff --git a/src/fsharp/IlxGen.fs b/src/fsharp/IlxGen.fs index c188b54807..cdd9c84f71 100644 --- a/src/fsharp/IlxGen.fs +++ b/src/fsharp/IlxGen.fs @@ -7370,13 +7370,10 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) = mkLdarg 2us mkNormalCall (mkILCtorMethSpecForTy (g.iltyp_Exception, [serializationInfoType; streamingContextType])) ], None)) - -//#if BE_SECURITY_TRANSPARENT + [ilCtorDefForSerialziation] -//#else (* let getObjectDataMethodForSerialization = - let ilMethodDef = mkILNonGenericVirtualMethod ("GetObjectData", ILMemberAccess.Public, @@ -7404,7 +7401,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) = | _ -> [] let ilTypeName = tref.Name - + let interfaces = exnc.ImmediateInterfaceTypesOfFSharpTycon |> List.map (GenType cenv.amap m eenv.tyenv) let tdef = mkILGenericClass diff --git a/src/fsharp/XmlAdapters.fs b/src/fsharp/XmlAdapters.fs new file mode 100644 index 0000000000..4f48955945 --- /dev/null +++ b/src/fsharp/XmlAdapters.fs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace Microsoft.FSharp.Core +open System.Reflection + +//Replacement for: System.Security.SecurityElement.Escape(line) All platforms +module internal XmlAdapters = + open System.Text + open Microsoft.FSharp.Collections + + let s_escapeChars = [| '<'; '>'; '\"'; '\''; '&' |] + + let getEscapeSequence c = + match c with + | '<' -> "<" + | '>' -> ">" + | '\"' -> """ + | '\'' -> "'" + | '&' -> "&" + | _ as ch -> ch.ToString() + + let escape str = String.collect getEscapeSequence str + diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 2715098473..0713a1bd6f 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1066,13 +1066,10 @@ module MainModuleBuilder = elif not(tcConfig.target.IsExe) || not(tcConfig.includewin32manifest) || not(tcConfig.win32res = "") || runningOnMono then "" // otherwise, include the default manifest else -#if FX_NO_RUNTIMEENVIRONMENT - // On coreclr default manifest is alongside the compiler - Path.Combine(System.AppContext.BaseDirectory, @"default.win32manifest") -#else - // On the desktop default manifest is alongside the clr - Path.Combine(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), @"default.win32manifest") -#endif + let path = Path.Combine(System.AppContext.BaseDirectory, @"default.win32manifest") + if File.Exists(path) then path + else Path.Combine(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), @"default.win32manifest") + let nativeResources = [ for av in assemblyVersionResources findAttribute assemblyVersion do yield ILNativeResource.Out av @@ -1720,11 +1717,7 @@ let main0(ctok, argv, legacyReferenceResolver, bannerAlreadyPrinted, let directoryBuildingFrom = Directory.GetCurrentDirectory() let setProcessThreadLocals tcConfigB = match tcConfigB.preferredUiLang with -#if FX_RESHAPED_GLOBALIZATION - | Some s -> CultureInfo.CurrentUICulture <- new CultureInfo(s) -#else | Some s -> Thread.CurrentThread.CurrentUICulture <- new CultureInfo(s) -#endif | None -> () if tcConfigB.utf8output then Console.OutputEncoding <- Encoding.UTF8 diff --git a/src/fsharp/fsi/console.fs b/src/fsharp/fsi/console.fs index aa57916df5..39b2c81e93 100644 --- a/src/fsharp/fsi/console.fs +++ b/src/fsharp/fsi/console.fs @@ -14,8 +14,6 @@ open Internal.Utilities module internal ConsoleOptions = let readKeyFixup (c:char) = -#if FX_NO_SERVERCODEPAGES -#else // Assumes the c:char is actually a byte in the System.Console.InputEncoding. // Convert it to a Unicode char through the encoding. if 0 <= int c && int c <= 255 then @@ -27,7 +25,6 @@ module internal ConsoleOptions = c // no fix up else assert("readKeyFixHook: given char is outside the 0..255 byte range" = "") -#endif c type internal Style = Prompt | Out | Error diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index a0997a46d2..7032d3a1ac 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -389,9 +389,7 @@ type internal FsiValuePrinter(fsi: FsiEvaluationSessionHostConfig, g: TcGlobals, | PrintExpr -> anyToLayoutCall.AnyToLayout(opts, x, ty) with -#if !FX_REDUCED_EXCEPTIONS | :? ThreadAbortException -> Layout.wordL (TaggedTextOps.tagText "") -#endif | e -> #if DEBUG printf "\n\nPrintValue: x = %+A and ty=%s\n" x (ty.FullName) @@ -805,7 +803,6 @@ let internal InstallErrorLoggingOnThisThread errorLogger = SetThreadErrorLoggerNoUnwind(errorLogger) SetThreadBuildPhaseNoUnwind(BuildPhase.Interactive) -#if !FX_NO_SERVERCODEPAGES /// Set the input/output encoding. The use of a thread is due to a known bug on /// on Vista where calls to Console.InputEncoding can block the process. let internal SetServerCodePages(fsiOptions: FsiCommandLineOptions) = @@ -835,7 +832,6 @@ let internal SetServerCodePages(fsiOptions: FsiCommandLineOptions) = if not !successful then System.Windows.Forms.MessageBox.Show(FSIstrings.SR.fsiConsoleProblem()) |> ignore #endif -#endif //---------------------------------------------------------------------------- // Prompt printing @@ -1340,7 +1336,6 @@ type internal FsiDynamicCompiler //---------------------------------------------------------------------------- // ctrl-c handling //---------------------------------------------------------------------------- - module internal NativeMethods = type ControlEventHandler = delegate of int -> bool @@ -1402,14 +1397,6 @@ type internal FsiInterruptController(fsiOptions : FsiCommandLineOptions, Microsoft.FSharp.Silverlight.InterruptThread(threadToKill.ManagedThreadId) ctrlEventActions <- action :: ctrlEventActions; -#else -#if FX_NO_THREADABORT - ignore threadToKill - ignore pauseMilliseconds - ignore fsiConsoleOutput - ignore CTRL_C - ignore fsiOptions - exitViaKillThread <- false #else if !progress then fprintfn fsiConsoleOutput.Out "installing CtrlC handler" // WINDOWS TECHNIQUE: .NET has more safe points, and you can do more when a safe point. @@ -1437,18 +1424,18 @@ type internal FsiInterruptController(fsiOptions : FsiCommandLineOptions, if !progress then fsiConsoleOutput.uprintnfn "%s" (FSIstrings.SR.fsiAbortingMainThread()) killThreadRequest <- NoRequest threadToKill.Abort() - ()),Name="ControlCAbortThread") + ()),Name="ControlCAbortThread") killerThread.IsBackground <- true - killerThread.Start() - + killerThread.Start() + let ctrlEventHandler = new NativeMethods.ControlEventHandler(fun i -> if i = CTRL_C then (raiseCtrlC(); true) else false ) ctrlEventHandlers <- ctrlEventHandler :: ctrlEventHandlers ctrlEventActions <- raiseCtrlC :: ctrlEventActions let _resultOK = NativeMethods.SetConsoleCtrlHandler(ctrlEventHandler,true) exitViaKillThread <- false // don't exit via kill thread - with e -> + with e -> if !progress then fprintfn fsiConsoleOutput.Error "Failed to install ctrl-c handler using Windows technique - trying to install one using Unix signal handling..."; - // UNIX TECHNIQUE: We start up a killer thread, and it watches the mutable reference location. + // UNIX TECHNIQUE: We start up a killer thread, and it watches the mutable reference location. // We can't have a dependency on Mono DLLs (indeed we don't even have them!) // So SOFT BIND the following code: // Mono.Unix.Native.Stdlib.signal(Mono.Unix.Native.Signum.SIGINT,new Mono.Unix.Native.SignalHandler(fun n -> PosixSignalProcessor.PosixInvoke(n))) |> ignore; @@ -1507,8 +1494,6 @@ type internal FsiInterruptController(fsiOptions : FsiCommandLineOptions, | Choice2Of2 e -> fprintf fsiConsoleOutput.Error "%s" (FSIstrings.SR.fsiCouldNotInstallCtrlCHandler(e.Message)) exitViaKillThread <- false -#endif - member x.PosixInvoke(n:int) = // we run this code once with n = -1 to make sure it is JITted before execution begins @@ -2034,13 +2019,11 @@ type internal FsiInteractionProcessor fsiInterruptController.InterruptAllowed <- InterruptIgnored; res with -#if !FX_REDUCED_EXCEPTIONS | :? ThreadAbortException -> fsiInterruptController.ClearInterruptRequest() fsiInterruptController.InterruptAllowed <- InterruptIgnored; (try Thread.ResetAbort() with _ -> ()); (istate,CtrlC) -#endif | e -> fsiInterruptController.ClearInterruptRequest() fsiInterruptController.InterruptAllowed <- InterruptIgnored; @@ -2361,7 +2344,6 @@ let internal DriveFsiEventLoop (fsi: FsiEvaluationSessionHostConfig, fsiConsoleO if !progress then fprintfn fsiConsoleOutput.Out "MAIN: entering event loop..."; fsi.EventLoopRun() with -#if !FX_REDUCED_EXCEPTIONS | :? ThreadAbortException -> // If this TAE handler kicks it's almost certainly too late to save the // state of the process - the state of the message loop may have been corrupted @@ -2369,7 +2351,6 @@ let internal DriveFsiEventLoop (fsi: FsiEvaluationSessionHostConfig, fsiConsoleO (try Thread.ResetAbort() with _ -> ()); true // Try again, just case we can restart -#endif | e -> stopProcessingRecovery e range0; true @@ -2466,20 +2447,14 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i do match tcConfigB.preferredUiLang with -#if FX_RESHAPED_GLOBALIZATION - | Some s -> System.Globalization.CultureInfo.CurrentUICulture <- new System.Globalization.CultureInfo(s) -#else | Some s -> Thread.CurrentThread.CurrentUICulture <- new System.Globalization.CultureInfo(s) -#endif | None -> () -#if !FX_NO_SERVERCODEPAGES - do - try - SetServerCodePages fsiOptions - with e -> + do + try + SetServerCodePages fsiOptions + with e -> warning(e) -#endif do updateBannerText() // resetting banner text after parsing options diff --git a/src/fsharp/lex.fsl b/src/fsharp/lex.fsl index 0af96d71c9..b72b15e8e9 100644 --- a/src/fsharp/lex.fsl +++ b/src/fsharp/lex.fsl @@ -85,11 +85,7 @@ let parseInt32 (s:string) = let mutable p = 0 let sign = getSign32 s &p l let specifier = get0OXB s &p l -#if FX_RESHAPED_GLOBALIZATION - match CultureInfo.InvariantCulture.TextInfo.ToLower(specifier) with -#else match Char.ToLower(specifier,CultureInfo.InvariantCulture) with -#endif | 'x' -> sign * (int32 (Convert.ToUInt32(UInt64.Parse(s.Substring(p), NumberStyles.AllowHexSpecifier,CultureInfo.InvariantCulture)))) | 'b' -> sign * (int32 (Convert.ToUInt32(parseBinaryUInt64 s p l))) | 'o' -> sign * (int32 (Convert.ToUInt32(parseOctalUInt64 s p l))) diff --git a/src/fsharp/lib.fs b/src/fsharp/lib.fs index f121639005..9a2a80f2b1 100755 --- a/src/fsharp/lib.fs +++ b/src/fsharp/lib.fs @@ -522,9 +522,7 @@ module UnmanagedProcessExecutionOptions = extern UInt32 private GetLastError() // Translation of C# from http://swikb/v1/DisplayOnlineDoc.aspx?entryID=826 and copy in bug://5018 -#if !FX_NO_SECURITY_PERMISSIONS [] -#endif let EnableHeapTerminationOnCorruption() = if (System.Environment.OSVersion.Version.Major >= 6 && // If OS is Vista or higher System.Environment.Version.Major < 3) then // and CLR not 3.0 or higher diff --git a/src/fsharp/service/Reactor.fs b/src/fsharp/service/Reactor.fs index bae570d0c5..dd307ca13e 100755 --- a/src/fsharp/service/Reactor.fs +++ b/src/fsharp/service/Reactor.fs @@ -64,11 +64,7 @@ type Reactor() = Trace.TraceInformation("Reactor: {0:n3} pausing {1} milliseconds", DateTime.Now.TimeOfDay.TotalSeconds, pauseBeforeBackgroundWork) pauseBeforeBackgroundWork return! inbox.TryReceive(timeout) } -#if FX_RESHAPED_GLOBALIZATION - CultureInfo.CurrentUICulture <- culture -#else Thread.CurrentThread.CurrentUICulture <- culture -#endif match msg with | Some (SetBackgroundOp bgOpOpt) -> //Trace.TraceInformation("Reactor: --> set background op, remaining {0}", inbox.CurrentQueueLength) diff --git a/src/utils/CompilerLocationUtils.fs b/src/utils/CompilerLocationUtils.fs index 41de8bb911..da626b54c5 100644 --- a/src/utils/CompilerLocationUtils.fs +++ b/src/utils/CompilerLocationUtils.fs @@ -23,20 +23,7 @@ module internal FSharpEnvironment = #endif let versionOf<'t> = -#if FX_RESHAPED_REFLECTION - let aq = (typeof<'t>).AssemblyQualifiedName - let version = - if aq <> null then - let x = aq.Split(',', ' ') |> Seq.filter(fun x -> x.StartsWith("Version=", StringComparison.OrdinalIgnoreCase)) |> Seq.tryHead - match x with - | Some(x) -> x.Substring(8) - | _ -> null - else - null - version -#else typeof<'t>.Assembly.GetName().Version.ToString() -#endif let FSharpCoreLibRunningVersion = try match versionOf with @@ -200,7 +187,7 @@ module internal FSharpEnvironment = #else // Check for an app.config setting to redirect the default compiler location // Like fsharp-compiler-location - try + try // FSharp.Compiler support setting an appkey for compiler location. I've never seen this used. let result = tryAppConfig "fsharp-compiler-location" match result with diff --git a/src/utils/prim-lexing.fs b/src/utils/prim-lexing.fs index c397257b46..fe71c12197 100644 --- a/src/utils/prim-lexing.fs +++ b/src/utils/prim-lexing.fs @@ -334,11 +334,7 @@ namespace Internal.Utilities.Text.Lexing // ways let baseForUnicodeCategories = numLowUnicodeChars+numSpecificUnicodeChars*2 let unicodeCategory = -#if FX_RESHAPED_GLOBALIZATION - System.Globalization.CharUnicodeInfo.GetUnicodeCategory(inp) -#else System.Char.GetUnicodeCategory(inp) -#endif //System.Console.WriteLine("inp = {0}, unicodeCategory = {1}", [| box inp; box unicodeCategory |]); int trans.[state].[baseForUnicodeCategories + int32 unicodeCategory] else @@ -349,10 +345,9 @@ namespace Internal.Utilities.Text.Lexing if c = inp then int trans.[state].[baseForSpecificUnicodeChars+i*2+1] else loop(i+1) - loop 0 let eofPos = numLowUnicodeChars + 2*numSpecificUnicodeChars + numUnicodeCategories - + let rec scanUntilSentinel lexBuffer state = // Return an endOfScan after consuming the input let a = int accept.[state] diff --git a/src/utils/reshapedmsbuild.fs b/src/utils/reshapedmsbuild.fs index 75859f4476..20b5cd6f96 100644 --- a/src/utils/reshapedmsbuild.fs +++ b/src/utils/reshapedmsbuild.fs @@ -21,41 +21,45 @@ type ITaskItem = abstract member CopyMetadataTo : ITaskItem -> unit abstract member CloneCustomMetadata : IDictionary -namespace Microsoft.Build.Utilities -open Microsoft.Build.Framework -open Microsoft.FSharp.Core.ReflectionAdapters -open System -open System.Collections -open System.Reflection - -type TaskItem (itemSpec:string) = - let assembly = Assembly.Load(new AssemblyName("Microsoft.Build.Utilities.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")) - let buildUtilitiesTaskType = assembly.GetType("Microsoft.Build.Utilities.Task") - let instance = Activator.CreateInstance(buildUtilitiesTaskType, [|itemSpec|]) - - interface ITaskItem with - member this.ItemSpec - with get () :string = (instance.GetPropertyValue("ItemSpec") :?> string) - and set (value:string) = (instance.SetPropertyValue("ItemSpec", value)); () - member this.MetadataNames - with get () :ICollection = (instance.GetPropertyValue("MetadataNames") :?> ICollection) - member this.MetadataCount - with get () :int = (instance.GetPropertyValue("MetadataCount") :?> int) - member this.CopyMetadataTo(iTaskItem) = - let m = buildUtilitiesTaskType.GetMethod("CopyMetadataTo", [| typeof |]) - m.Invoke(instance, [|iTaskItem :>obj|]) |> ignore - member this.CloneCustomMetadata = - let m = buildUtilitiesTaskType.GetMethod("CloneCustomMetadata", [||]) - (m.Invoke(instance,[||])) :?>IDictionary - member this.GetMetadata(metadataName) = - let m = buildUtilitiesTaskType.GetMethod("GetMetadata", [|typeof|]) - (m.Invoke(instance,[|metadataName|])) :?>string - member this.RemoveMetadata(metadataName) = - let m = buildUtilitiesTaskType.GetMethod("RemoveMetadata", [|typeof|]) - (m.Invoke(instance,[|metadataName|])) :?>string |>ignore - member this.SetMetadata(metadataName, metadataValue) = - let m = buildUtilitiesTaskType.GetMethod("SetMetadata", [|typeof;typeof|]) - (m.Invoke(instance,[|metadataName; metadataValue|])) |>ignore +module Utilities = + open Microsoft.Build.Framework + open System + open System.Collections + open System.Reflection + + type System.Object with + member this.GetPropertyValue(propName) = this.GetType().GetProperty(propName, BindingFlags.Public).GetValue(this, null) + member this.SetPropertyValue(propName, propValue) = this.GetType().GetProperty(propName, BindingFlags.Public).SetValue(this, propValue, null) + member this.GetMethod(methodName, argTypes) = this.GetType().GetMethod(methodName, argTypes, [||]) + + type TaskItem (itemSpec:string) = + let assembly = Assembly.Load(new AssemblyName("Microsoft.Build.Utilities.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")) + let buildUtilitiesTaskType = assembly.GetType("Microsoft.Build.Utilities.Task") + let instance = Activator.CreateInstance(buildUtilitiesTaskType, [|itemSpec|]) + + interface ITaskItem with + member this.ItemSpec + with get () :string = (instance.GetPropertyValue("ItemSpec") :?> string) + and set (value:string) = (instance.SetPropertyValue("ItemSpec", value)); () + member this.MetadataNames + with get () :ICollection = (instance.GetPropertyValue("MetadataNames") :?> ICollection) + member this.MetadataCount + with get () :int = (instance.GetPropertyValue("MetadataCount") :?> int) + member this.CopyMetadataTo(iTaskItem) = + let m = buildUtilitiesTaskType.GetMethod("CopyMetadataTo", [| typeof |]) + m.Invoke(instance, [|iTaskItem :>obj|]) |> ignore + member this.CloneCustomMetadata = + let m = buildUtilitiesTaskType.GetMethod("CloneCustomMetadata", [||]) + (m.Invoke(instance,[||])) :?>IDictionary + member this.GetMetadata(metadataName) = + let m = buildUtilitiesTaskType.GetMethod("GetMetadata", [|typeof|]) + (m.Invoke(instance,[|metadataName|])) :?>string + member this.RemoveMetadata(metadataName) = + let m = buildUtilitiesTaskType.GetMethod("RemoveMetadata", [|typeof|]) + (m.Invoke(instance,[|metadataName|])) :?>string |>ignore + member this.SetMetadata(metadataName, metadataValue) = + let m = buildUtilitiesTaskType.GetMethod("SetMetadata", [|typeof;typeof|]) + (m.Invoke(instance,[|metadataName; metadataValue|])) |>ignore namespace FSharp.Compiler open System @@ -66,11 +70,10 @@ open System.Linq open System.Runtime.Versioning open FSComp open Microsoft.Win32 +open Microsoft.Build.Framework.Utilities module internal MsBuildAdapters = - open Microsoft.FSharp.Core.ReflectionAdapters - /// /// Used to specify the targeted version of the .NET Framework for some methods of ToolLocationHelper. This is meant to mimic /// the official version here: https://source.dot.net/#q=TargetDotNetFrameworkVersion. @@ -102,7 +105,6 @@ module internal MsBuildAdapters = module internal ToolLocationHelper = open Microsoft.Build.Framework - open Microsoft.FSharp.Core.ReflectionAdapters open System.Linq open System.Reflection open MsBuildAdapters diff --git a/src/utils/reshapedreflection.fs b/src/utils/reshapedreflection.fs deleted file mode 100644 index 0b143951dd..0000000000 --- a/src/utils/reshapedreflection.fs +++ /dev/null @@ -1,401 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Microsoft.FSharp.Core -open System.Reflection - -//Replacement for: System.Security.SecurityElement.Escape(line) All platforms -module internal XmlAdapters = - open System.Text - open Microsoft.FSharp.Collections - - let s_escapeChars = [| '<'; '>'; '\"'; '\''; '&' |] - - let getEscapeSequence c = - match c with - | '<' -> "<" - | '>' -> ">" - | '\"' -> """ - | '\'' -> "'" - | '&' -> "&" - | _ as ch -> ch.ToString() - - let escape str = String.collect getEscapeSequence str - -#if FX_RESHAPED_REFLECTION -module internal ReflectionAdapters = - open System - open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators - open Microsoft.FSharp.Collections - open PrimReflectionAdapters - - let inline hasFlag (flag : BindingFlags) f = (f &&& flag) = flag - let isDeclaredFlag f = hasFlag BindingFlags.DeclaredOnly f - let isPublicFlag f = hasFlag BindingFlags.Public f - let isStaticFlag f = hasFlag BindingFlags.Static f - let isInstanceFlag f = hasFlag BindingFlags.Instance f - let isNonPublicFlag f = hasFlag BindingFlags.NonPublic f - - let isAcceptable bindingFlags isStatic isPublic = - // 1. check if member kind (static\instance) was specified in flags - ((isStaticFlag bindingFlags && isStatic) || (isInstanceFlag bindingFlags && not isStatic)) && - // 2. check if member accessibility was specified in flags - ((isPublicFlag bindingFlags && isPublic) || (isNonPublicFlag bindingFlags && not isPublic)) - - let publicFlags = BindingFlags.Public ||| BindingFlags.Instance ||| BindingFlags.Static - - let commit (results : _[]) = - match results with - | [||] -> null - | [| m |] -> m - | _ -> raise (AmbiguousMatchException()) - - let canUseAccessor (accessor : MethodInfo) nonPublic = - (not (isNull (box accessor))) && (accessor.IsPublic || nonPublic) - - type System.Type with - member this.GetTypeInfo() = IntrospectionExtensions.GetTypeInfo(this) - member this.GetRuntimeProperties() = RuntimeReflectionExtensions.GetRuntimeProperties(this) - member this.GetRuntimeEvents() = RuntimeReflectionExtensions.GetRuntimeEvents(this) - member this.Attributes = this.GetTypeInfo().Attributes - member this.GetCustomAttributes(attrTy, inherits) : obj[] = downcast box(CustomAttributeExtensions.GetCustomAttributes(this.GetTypeInfo(), attrTy, inherits) |> Seq.toArray) - member this.GetNestedType (name, bindingFlags) = - // MSDN: http://msdn.microsoft.com/en-us/library/0dcb3ad5.aspx - // The following BindingFlags filter flags can be used to define which nested types to include in the search: - // You must specify either BindingFlags.Public or BindingFlags.NonPublic to get a return. - // Specify BindingFlags.Public to include public nested types in the search. - // Specify BindingFlags.NonPublic to include non-public nested types (that is, private, internal, and protected nested types) in the search. - // This method returns only the nested types of the current type. It does not search the base classes of the current type. - // To find types that are nested in base classes, you must walk the inheritance hierarchy, calling GetNestedType at each level. - let nestedTyOpt = - this.GetTypeInfo().DeclaredNestedTypes - |> Seq.tryFind (fun nestedTy -> - nestedTy.Name = name && ( - (isPublicFlag bindingFlags && nestedTy.IsNestedPublic) || - (isNonPublicFlag bindingFlags && (nestedTy.IsNestedPrivate || nestedTy.IsNestedFamily || nestedTy.IsNestedAssembly || nestedTy.IsNestedFamORAssem || nestedTy.IsNestedFamANDAssem)) - ) - ) - |> Option.map (fun ti -> ti.AsType()) - defaultArg nestedTyOpt null - // use different sources based on Declared flag - member this.GetMethods(bindingFlags) = - (if isDeclaredFlag bindingFlags then this.GetTypeInfo().DeclaredMethods else this.GetRuntimeMethods()) - |> Seq.filter (fun m -> isAcceptable bindingFlags m.IsStatic m.IsPublic) - |> Seq.toArray - - // use different sources based on Declared flag - member this.GetFields(bindingFlags) = - (if isDeclaredFlag bindingFlags then this.GetTypeInfo().DeclaredFields else this.GetRuntimeFields()) - |> Seq.filter (fun f -> isAcceptable bindingFlags f.IsStatic f.IsPublic) - |> Seq.toArray - - // use different sources based on Declared flag - member this.GetProperties(?bindingFlags) = - let bindingFlags = defaultArg bindingFlags publicFlags - (if isDeclaredFlag bindingFlags then this.GetTypeInfo().DeclaredProperties else this.GetRuntimeProperties()) - |> Seq.filter (fun pi-> - let mi = match pi.GetMethod with | null -> pi.SetMethod | _ -> pi.GetMethod - if mi = null then false - else isAcceptable bindingFlags mi.IsStatic mi.IsPublic - ) - |> Seq.toArray - - member this.GetEvents(?bindingFlags) = - let bindingFlags = defaultArg bindingFlags publicFlags - (if isDeclaredFlag bindingFlags then this.GetTypeInfo().DeclaredEvents else this.GetRuntimeEvents()) - |> Seq.filter (fun ei-> - let m = ei.GetAddMethod(true) - if m = null then false - else isAcceptable bindingFlags m.IsStatic m.IsPublic - ) - |> Seq.toArray - - member this.GetEvent(name, ?bindingFlags) = - let bindingFlags = defaultArg bindingFlags publicFlags - this.GetEvents(bindingFlags) - |> Array.filter (fun ei -> ei.Name = name) - |> commit - - member this.GetConstructor(bindingFlags, _binder, argsT:Type[], _parameterModifiers) = - this.GetConstructor(bindingFlags,argsT) - - member this.GetMethod(name, ?bindingFlags) = - let bindingFlags = defaultArg bindingFlags publicFlags - this.GetMethods(bindingFlags) - |> Array.filter(fun m -> m.Name = name) - |> commit - - member this.GetMethod(name, _bindingFlags, _binder, argsT:Type[], _parameterModifiers) = - this.GetMethod(name, argsT) - - // use different sources based on Declared flag - member this.GetProperty(name, bindingFlags) = - this.GetProperties(bindingFlags) - |> Array.filter (fun pi -> pi.Name = name) - |> commit - - member this.GetMethod(methodName, args:Type[], ?bindingFlags) = - let bindingFlags = defaultArg bindingFlags publicFlags - let compareSequences parms args = - Seq.compareWith (fun parm arg -> if parm <> arg then 1 else 0) parms args - this.GetMethods(bindingFlags) - |> Array.filter(fun m -> m.Name = methodName && (compareSequences (m.GetParameters() |> Seq.map(fun x -> x.ParameterType)) args) = 0) - |> commit - - member this.GetNestedTypes(?bindingFlags) = - let bindingFlags = defaultArg bindingFlags publicFlags - this.GetTypeInfo().DeclaredNestedTypes - |> Seq.filter (fun nestedTy-> - (isPublicFlag bindingFlags && nestedTy.IsNestedPublic) || - (isNonPublicFlag bindingFlags && (nestedTy.IsNestedPrivate || nestedTy.IsNestedFamily || nestedTy.IsNestedAssembly || nestedTy.IsNestedFamORAssem || nestedTy.IsNestedFamANDAssem))) - |> Seq.map (fun ti -> ti.AsType()) - |> Seq.toArray - - member this.GetEnumUnderlyingType() = - Enum.GetUnderlyingType(this) - - member this.InvokeMember(memberName, bindingFlags, _binder, target:obj, arguments:obj[], _cultureInfo) = - let m = this.GetMethod(memberName, (arguments |> Seq.map(fun x -> x.GetType()) |> Seq.toArray), bindingFlags) - match m with - | null -> raise <| System.MissingMethodException(String.Format("Method '{0}.{1}' not found.", this.FullName, memberName)) - | _ -> m.Invoke(target, arguments) - - member this.IsGenericType = this.GetTypeInfo().IsGenericType - - member this.IsGenericTypeDefinition = this.GetTypeInfo().IsGenericTypeDefinition - - member this.GetGenericArguments() = - if this.IsGenericTypeDefinition then this.GetTypeInfo().GenericTypeParameters - elif this.IsGenericType then this.GenericTypeArguments - else [||] - - member this.IsInterface = this.GetTypeInfo().IsInterface - - member this.IsPublic = this.GetTypeInfo().IsPublic - - member this.IsNestedPublic = this.GetTypeInfo().IsNestedPublic - - member this.IsClass = this.GetTypeInfo().IsClass - - member this.IsValueType = this.GetTypeInfo().IsValueType - - member this.IsSealed = this.GetTypeInfo().IsSealed - - member this.BaseType = this.GetTypeInfo().BaseType - - member this.GetConstructor(bindingFlags, parameterTypes : Type[]) = - this.GetTypeInfo().DeclaredConstructors - |> Seq.filter (fun ci -> isAcceptable bindingFlags ci.IsStatic ci.IsPublic) - |> Seq.filter (fun ci -> - ( - let parameters = ci.GetParameters() - (parameters.Length = parameterTypes.Length) && - (parameterTypes, parameters) ||> Array.forall2 (fun ty pi -> pi.ParameterType.Equals ty) - ) - ) - |> Seq.toArray - |> commit - - member this.GetConstructor(parameterTypes : Type[]) = - this.GetConstructor(BindingFlags.Public ||| BindingFlags.NonPublic ||| BindingFlags.Instance, parameterTypes) - - member this.GetConstructors(?bindingFlags) = - let bindingFlags = defaultArg bindingFlags (BindingFlags.Public ||| BindingFlags.Instance) - // type initializer will also be included in resultset - this.GetTypeInfo().DeclaredConstructors - |> Seq.filter (fun ci -> isAcceptable bindingFlags ci.IsStatic ci.IsPublic) - |> Seq.toArray - - // MSDN: returns an array of Type objects representing all the interfaces implemented or inherited by the current Type. - member this.GetInterfaces() = this.GetTypeInfo().ImplementedInterfaces |> Seq.toArray - - member this.GetMethods() = this.GetMethods(publicFlags) - - member this.Assembly = this.GetTypeInfo().Assembly - - member this.IsSubclassOf(otherTy : Type) = this.GetTypeInfo().IsSubclassOf(otherTy) - - member this.IsEnum = this.GetTypeInfo().IsEnum; - - member this.GetField(name, bindingFlags) = - this.GetFields(bindingFlags) - |> Array.filter (fun fi -> fi.Name = name) - |> commit - - member this.GetField(name) = RuntimeReflectionExtensions.GetRuntimeField(this, name) - - member this.GetProperty(name, propertyType, parameterTypes : Type[]) = - this.GetProperties() - |> Array.filter (fun pi -> - pi.Name = name && - pi.PropertyType = propertyType && - ( - let parameters = pi.GetIndexParameters() - (parameters.Length = parameterTypes.Length) && - (parameterTypes, parameters) ||> Array.forall2 (fun ty pi -> pi.ParameterType.Equals ty) - ) - ) - |> commit - - static member GetTypeCode(ty : Type) = - if typeof.Equals ty then TypeCode.Int32 - elif typeof.Equals ty then TypeCode.Int64 - elif typeof.Equals ty then TypeCode.Byte - elif ty = typeof then TypeCode.SByte - elif ty = typeof then TypeCode.Int16 - elif ty = typeof then TypeCode.UInt16 - elif ty = typeof then TypeCode.UInt32 - elif ty = typeof then TypeCode.UInt64 - elif ty = typeof then TypeCode.Single - elif ty = typeof then TypeCode.Double - elif ty = typeof then TypeCode.Decimal - else TypeCode.Object - - member this.Module = - this.GetTypeInfo().Module - - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - let s = String.Format("{0}", this.ToString()) - s.GetHashCode() - - type System.Reflection.EventInfo with - - member this.GetAddMethod() = - this.AddMethod - - member this.GetRemoveMethod() = - this.RemoveMethod - - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - let s = String.Format("{0},{0}", this.DeclaringType.ToString(), this.ToString()) - s.GetHashCode() - - type System.Reflection.FieldInfo with - member this.GetRawConstantValue() = - this.GetValue(null) - - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - let s = String.Format("{0},{0}", this.DeclaringType.ToString(), this.ToString()) - s.GetHashCode() - - type System.Reflection.MemberInfo with - member this.GetCustomAttributes(attrTy, inherits) : obj[] = downcast box(CustomAttributeExtensions.GetCustomAttributes(this, attrTy, inherits) |> Seq.toArray) - - // TODO: is this an adequate replacement for MetadataToken - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - let s = String.Format("{0},{0}", this.DeclaringType.ToString(), this.ToString()) - s.GetHashCode() - - type System.Reflection.MethodInfo with - - member this.GetCustomAttributes(inherits : bool) : obj[] = downcast box(CustomAttributeExtensions.GetCustomAttributes(this, inherits) |> Seq.toArray) - - member this.Invoke(obj, _bindingFlags, _binder, args, _ci) = - this.Invoke(obj, args) - - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - let s = String.Format("{0},{0}", this.DeclaringType.ToString(), this.ToString()) - s.GetHashCode() - - type System.Reflection.ParameterInfo with - - member this.RawDefaultValue = this.DefaultValue - - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - // I really do not understand why: sprintf "%s,%s" (this.ReflectedType.ToString()) (this.ToString()) did not work - let s = String.Format("{0},{0},{0}", this.Member.DeclaringType.ToString(),this.Member.ToString(), this.ToString()) - s.GetHashCode() - - type System.Reflection.PropertyInfo with - - member this.GetGetMethod(nonPublic) = - let mi = this.GetMethod - if canUseAccessor mi nonPublic then mi - else null - - member this.GetSetMethod(nonPublic) = - let mi = this.SetMethod - if canUseAccessor mi nonPublic then mi - else null - - member this.GetGetMethod() = this.GetMethod - - member this.GetSetMethod() = this.SetMethod - - type System.Reflection.Assembly with - - member this.GetTypes() = - this.DefinedTypes - |> Seq.map (fun ti -> ti.AsType()) - |> Seq.toArray - - member this.GetExportedTypes() = - this.DefinedTypes - |> Seq.filter(fun ti -> ti.IsPublic) - |> Seq.map (fun ti -> ti.AsType()) - |> Seq.toArray - - member this.Location = - this.ManifestModule.FullyQualifiedName - - type System.Delegate with - - static member CreateDelegate(delegateType, methodInfo : MethodInfo) = methodInfo.CreateDelegate(delegateType) - - static member CreateDelegate(delegateType, obj : obj, methodInfo : MethodInfo) = methodInfo.CreateDelegate(delegateType, obj) - - type System.Object with - member this.GetPropertyValue(propName) = - this.GetType().GetProperty(propName, BindingFlags.Public).GetValue(this, null) - - member this.SetPropertyValue(propName, propValue) = - this.GetType().GetProperty(propName, BindingFlags.Public).SetValue(this, propValue, null) - - member this.GetMethod(methodName, argTypes) = - this.GetType().GetMethod(methodName, argTypes, BindingFlags.Public) - - type System.Char with - static member GetUnicodeCategory(c: char) = System.Globalization.CharUnicodeInfo.GetUnicodeCategory(c) - - type System.Reflection.Module with - member this.MetadataToken = - // TODO: is this an adequate replacement for MetadataToken - let s = this.FullyQualifiedName - s.GetHashCode() - -#if COMPILER // This part includes global state in globalLoadContext. Only include this support "once", i.e. when compiling FSharp.Compiler.Private.dll, FSharp.Compiler.Service.dll, fsc-proto.exe - - type CustomAssemblyResolver() = - inherit System.Runtime.Loader.AssemblyLoadContext() - override this.Load (assemblyName:AssemblyName):Assembly = - this.LoadFromAssemblyName(assemblyName) - - let globalLoadContext = - // This is an unfortunate temporary fix!!!! - // ======================================== - // We need to run fsi tests on a very old version of the corclr because of an unfortunate test framework - // This hack detects that, and uses the old code. - // On slightly newer code AssemblyLoadContext.Default is the way to go. - match Seq.tryHead (typeof.GetTypeInfo().Assembly.GetCustomAttributes()) with - | Some a when a.Version = "4.6.24410.01" -> new CustomAssemblyResolver() :> System.Runtime.Loader.AssemblyLoadContext - | _ -> System.Runtime.Loader.AssemblyLoadContext.Default - - type System.Reflection.Assembly with - static member LoadFrom(filename:string) = - globalLoadContext.LoadFromAssemblyPath(filename) - - static member UnsafeLoadFrom(filename:string) = - globalLoadContext.LoadFromAssemblyPath(filename) - - type System.Reflection.AssemblyName with - static member GetAssemblyName(path) = - System.Runtime.Loader.AssemblyLoadContext.GetAssemblyName(path) - -#endif - -#endif diff --git a/src/utils/sformat.fs b/src/utils/sformat.fs index b490283f67..0c8cc5fc2f 100644 --- a/src/utils/sformat.fs +++ b/src/utils/sformat.fs @@ -38,11 +38,6 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl open Microsoft.FSharp.Collections open Microsoft.FSharp.Primitives.Basics -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters - open ReflectionAdapters -#endif - [] type LayoutTag = | ActivePatternCase @@ -321,11 +316,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl StringLimit : int; #endif FormatProvider: System.IFormatProvider; -#if FX_RESHAPED_REFLECTION - ShowNonPublic : bool -#else BindingFlags: System.Reflection.BindingFlags -#endif PrintWidth : int; PrintDepth : int; PrintLength : int; @@ -339,11 +330,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl StringLimit = System.Int32.MaxValue; #endif AttributeProcessor= (fun _ _ _ -> ()); -#if FX_RESHAPED_REFLECTION - ShowNonPublic = false -#else BindingFlags = System.Reflection.BindingFlags.Public; -#endif FloatingPointFormat = "g10"; PrintWidth = 80 ; PrintDepth = 100 ; @@ -358,11 +345,6 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl open System open System.Reflection -#if FX_RESHAPED_REFLECTION - open PrimReflectionAdapters - open Microsoft.FSharp.Core.ReflectionAdapters -#endif - [] type TypeInfo = | TupleType of Type list @@ -404,10 +386,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // Analyze an object to see if it the representation // of an F# value. - let GetValueInfoOfObject (bindingFlags:BindingFlags) (obj : obj) = -#if FX_RESHAPED_REFLECTION - let showNonPublic = isNonPublicFlag bindingFlags -#endif + let GetValueInfoOfObject (bindingFlags:BindingFlags) (obj : obj) = match obj with | null -> ObjectValue(obj) | _ -> @@ -429,34 +408,18 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // the type are the actual fields of the type. Again, // we should be reading attributes here that indicate the // true structure of the type, e.g. the order of the fields. -#if FX_RESHAPED_REFLECTION - elif FSharpType.IsUnion(reprty, showNonPublic) then - let tag,vals = FSharpValue.GetUnionFields (obj,reprty, showNonPublic) -#else elif FSharpType.IsUnion(reprty,bindingFlags) then let tag,vals = FSharpValue.GetUnionFields (obj,reprty,bindingFlags) -#endif let props = tag.GetFields() let pvals = (props,vals) ||> Array.map2 (fun prop v -> prop.Name,(v, prop.PropertyType)) ConstructorValue(tag.Name, Array.toList pvals) -#if FX_RESHAPED_REFLECTION - elif FSharpType.IsExceptionRepresentation(reprty, showNonPublic) then - let props = FSharpType.GetExceptionFields(reprty, showNonPublic) - let vals = FSharpValue.GetExceptionFields(obj, showNonPublic) -#else elif FSharpType.IsExceptionRepresentation(reprty,bindingFlags) then let props = FSharpType.GetExceptionFields(reprty,bindingFlags) let vals = FSharpValue.GetExceptionFields(obj,bindingFlags) -#endif let pvals = (props,vals) ||> Array.map2 (fun prop v -> prop.Name,(v, prop.PropertyType)) ExceptionValue(reprty, pvals |> Array.toList) -#if FX_RESHAPED_REFLECTION - elif FSharpType.IsRecord(reprty, showNonPublic) then - let props = FSharpType.GetRecordFields(reprty, showNonPublic) -#else elif FSharpType.IsRecord(reprty,bindingFlags) then let props = FSharpType.GetRecordFields(reprty,bindingFlags) -#endif RecordValue(props |> Array.map (fun prop -> prop.Name, prop.GetValue(obj,null), prop.PropertyType) |> Array.toList) else ObjectValue(obj) @@ -491,12 +454,8 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl let string_of_int (i:int) = i.ToString() let typeUsesSystemObjectToString (ty:System.Type) = - try -#if FX_RESHAPED_REFLECTION - let methInfo = ty.GetRuntimeMethod("ToString",[| |]) -#else + try let methInfo = ty.GetMethod("ToString",BindingFlags.Public ||| BindingFlags.Instance,null,[| |],null) -#endif methInfo.DeclaringType = typeof with e -> false /// If "str" ends with "ending" then remove it from "str", otherwise no change. @@ -800,16 +759,8 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // -------------------------------------------------------------------- let getProperty (ty: Type) (obj: obj) name = -#if FX_RESHAPED_REFLECTION - let prop = ty.GetProperty(name, (BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic)) - if not (isNull prop) then prop.GetValue(obj,[||]) - // Others raise MissingMethodException - else - let msg = System.String.Concat([| "Method '"; ty.FullName; "."; name; "' not found." |]) - raise (System.MissingMethodException(msg)) -#else ty.InvokeMember(name, (BindingFlags.GetProperty ||| BindingFlags.Instance ||| BindingFlags.Public ||| BindingFlags.NonPublic), null, obj, [| |],CultureInfo.InvariantCulture) -#endif + let getField obj (fieldInfo: FieldInfo) = fieldInfo.GetValue(obj) @@ -1177,11 +1128,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // If the leafFormatter was directly here, then layout leaves could store strings. match obj with | _ when opts.ShowProperties -> -#if FX_RESHAPED_REFLECTION - let props = ty.GetProperties(BindingFlags.Instance ||| BindingFlags.Public) -#else let props = ty.GetProperties(BindingFlags.GetField ||| BindingFlags.Instance ||| BindingFlags.Public) -#endif let fields = ty.GetFields(BindingFlags.Instance ||| BindingFlags.Public) |> Array.map (fun i -> i :> MemberInfo) let propsAndFields = props |> Array.map (fun i -> i :> MemberInfo) @@ -1197,10 +1144,10 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // massively reign in deep printing of properties let nDepth = depthLim/10 #if NETSTANDARD - Array.Sort((propsAndFields),{ new IComparer with member this.Compare(p1,p2) = compare (p1.Name) (p2.Name) } ); -#else - Array.Sort((propsAndFields :> Array),{ new System.Collections.IComparer with member this.Compare(p1,p2) = compare ((p1 :?> MemberInfo).Name) ((p2 :?> MemberInfo).Name) } ); -#endif + Array.Sort((propsAndFields),{ new IComparer with member this.Compare(p1,p2) = compare (p1.Name) (p2.Name) } ) +#else + Array.Sort((propsAndFields :> Array),{ new System.Collections.IComparer with member this.Compare(p1,p2) = compare ((p1 :?> MemberInfo).Name) ((p2 :?> MemberInfo).Name) } ) +#endif if propsAndFields.Length = 0 || (nDepth <= 0) then basicL else basicL --- @@ -1311,12 +1258,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl let fsi_any_to_layout opts x = anyL ShowTopLevelBinding BindingFlags.Public opts x #else // FSharp.Core -#if FX_RESHAPED_REFLECTION - let internal anyToStringForPrintf options (showNonPublicMembers : bool) x = - let bindingFlags = ReflectionUtils.toBindingFlags showNonPublicMembers -#else let internal anyToStringForPrintf options (bindingFlags:BindingFlags) x = -#endif x |> anyL ShowAll bindingFlags options |> layout_to_string options #endif diff --git a/src/utils/sformat.fsi b/src/utils/sformat.fsi index f7c053e51f..e6ff9762bb 100644 --- a/src/utils/sformat.fsi +++ b/src/utils/sformat.fsi @@ -302,11 +302,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl StringLimit: int; #endif FormatProvider: System.IFormatProvider -#if FX_RESHAPED_REFLECTION - ShowNonPublic : bool -#else BindingFlags: System.Reflection.BindingFlags -#endif PrintWidth : int PrintDepth : int PrintLength : int @@ -341,11 +337,7 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl #if FSHARP_CORE // FSharp.Core.dll: Most functions aren't needed in FSharp.Core.dll, but we add one entry for printf -#if FX_RESHAPED_REFLECTION - val anyToStringForPrintf: options:FormatOptions -> showNonPublicMembers : bool -> value:'T * Type -> string -#else val anyToStringForPrintf: options:FormatOptions -> bindingFlags:System.Reflection.BindingFlags -> value:'T * Type -> string -#endif #else val asTaggedTextWriter: writer: TextWriter -> TaggedTextWriter val any_to_layout : options:FormatOptions -> value:'T * Type -> Layout diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj index 24a2132e9c..cf028bc3d2 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj @@ -32,6 +32,7 @@ + @@ -80,8 +81,9 @@ - - + + + diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/DiscrimantedUnionType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/DiscrimantedUnionType.fs index 90d30f40a6..e5a48ad300 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/DiscrimantedUnionType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/DiscrimantedUnionType.fs @@ -10,17 +10,6 @@ open NUnit.Framework open FsCheck open FsCheck.PropOperators -#if FX_RESHAPED_REFLECTION -open FSharp.Reflection.FSharpReflectionExtensions - -[] -module PrimReflectionAdapters = - - type System.Type with - member this.IsValueType = this.GetTypeInfo().IsValueType -#endif - - type EnumUnion = | A | B diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs index 7e1dec5a2f..21df908745 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Reflection/FSharpReflection.fs @@ -26,30 +26,6 @@ Make sure each method works on: * Struct versions of the above *) -#if FX_RESHAPED_REFLECTION -module PrimReflectionAdapters = - open System.Linq - - type System.Type with - member this.Assembly = this.GetTypeInfo().Assembly - member this.IsGenericType = this.GetTypeInfo().IsGenericType - member this.IsValueType = this.GetTypeInfo().IsValueType - member this.IsAssignableFrom(otherTy : Type) = this.GetTypeInfo().IsAssignableFrom(otherTy.GetTypeInfo()) - member this.GetProperty(name) = this.GetRuntimeProperty(name) - member this.GetProperties() = this.GetRuntimeProperties() |> Array.ofSeq - member this.GetMethod(name, parameterTypes) = this.GetRuntimeMethod(name, parameterTypes) - member this.GetCustomAttributes(attrTy : Type, inherits : bool) : obj[] = - unbox (box (CustomAttributeExtensions.GetCustomAttributes(this.GetTypeInfo(), attrTy, inherits).ToArray())) - - type System.Reflection.MemberInfo with - member this.ReflectedType = this.DeclaringType - - type System.Reflection.Assembly with - member this.GetTypes() = this.DefinedTypes |> Seq.map (fun ti -> ti.AsType()) |> Array.ofSeq - -open PrimReflectionAdapters -#endif - module IsModule = type IsModuleType () = member __.M = 1 @@ -1056,22 +1032,14 @@ type FSharpTypeTests() = // Regression for 5588, Reflection: unit is still treated as a record type, but only if you pass BindingFlags.NonPublic [] - member __.``IsRecord.Regression5588``() = - + member __.``IsRecord.Regression5588``() = // negative Assert.IsFalse(FSharpType.IsRecord(typeof)) - -#if FX_RESHAPED_REFLECTION - Assert.IsFalse( FSharpType.IsRecord(typeof, true) ) -#else Assert.IsFalse( FSharpType.IsRecord(typeof, System.Reflection.BindingFlags.NonPublic) ) -#endif () - [] - member __.IsTuple() = - + member __.IsTuple() = // positive Assert.IsTrue(FSharpType.IsTuple(typeof>)) Assert.IsTrue(FSharpType.IsTuple(typeof>)) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs index 112c3509b1..e131a9274d 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/RecordTypes.fs @@ -11,16 +11,6 @@ open NUnit.Framework open FsCheck open FsCheck.PropOperators -#if FX_RESHAPED_REFLECTION -open FSharp.Reflection.FSharpReflectionExtensions - -[] -module PrimReflectionAdapters = - - type System.Type with - member this.IsValueType = this.GetTypeInfo().IsValueType -#endif - type Record = { A: int B: int diff --git a/tests/FSharp.Core.UnitTests/LibraryTestFx.fs b/tests/FSharp.Core.UnitTests/LibraryTestFx.fs index 03adf3fff5..77a9b2a3e6 100644 --- a/tests/FSharp.Core.UnitTests/LibraryTestFx.fs +++ b/tests/FSharp.Core.UnitTests/LibraryTestFx.fs @@ -54,60 +54,29 @@ let CheckThrowsFormatException f = CheckThrowsExn let VerifySeqsEqual (seq1 : seq<'T>) (seq2 : seq<'T>) = CollectionAssert.AreEqual(seq1, seq2) -let sleep(n : int32) = -#if FX_NO_THREAD - async { do! Async.Sleep(n) } |> Async.RunSynchronously -#else +let sleep(n : int32) = System.Threading.Thread.Sleep(n) -#endif -#if VERIFY_SURFACEAREA module SurfaceArea = open System.Reflection open System open System.Text.RegularExpressions - + // gets string form of public surface area for the currently-loaded FSharp.Core let private getActual () = - // get current FSharp.Core let asm = -#if FX_RESHAPED_REFLECTION - typeof.GetTypeInfo().Assembly -#else typeof.Assembly -#endif - + // public types only let types = -#if FX_RESHAPED_REFLECTION - asm.ExportedTypes |> Seq.filter (fun ty -> let ti = ty.GetTypeInfo() in ti.IsPublic || ti.IsNestedPublic) |> Array.ofSeq -#else asm.GetExportedTypes() -#endif // extract canonical string form for every public member of every type let getTypeMemberStrings (t : Type) = // for System.Runtime-based profiles, need to do lots of manual work -#if FX_RESHAPED_REFLECTION - let getMembers (t : Type) = - let ti = t.GetTypeInfo() - let cast (info : #MemberInfo) = (t, info :> MemberInfo) - seq { - yield! t.GetRuntimeEvents() |> Seq.filter (fun m -> m.AddMethod.IsPublic) |> Seq.map cast - yield! t.GetRuntimeProperties() |> Seq.filter (fun m -> m.GetMethod.IsPublic) |> Seq.map cast - yield! t.GetRuntimeMethods() |> Seq.filter (fun m -> m.IsPublic) |> Seq.map cast - yield! t.GetRuntimeFields() |> Seq.filter (fun m -> m.IsPublic) |> Seq.map cast - yield! ti.DeclaredConstructors |> Seq.filter (fun m -> m.IsPublic) |> Seq.map cast - yield! ti.DeclaredNestedTypes |> Seq.filter (fun ty -> ty.IsNestedPublic) |> Seq.map cast - } |> Array.ofSeq - - getMembers t - |> Array.map (fun (ty, m) -> sprintf "%s: %s" (ty.ToString()) (m.ToString())) -#else t.GetMembers() |> Array.map (fun v -> sprintf "%s: %s" (v.ReflectedType.ToString()) (v.ToString())) -#endif let actual = types |> Array.collect getTypeMemberStrings @@ -173,4 +142,4 @@ module SurfaceArea = sb.ToString () Assert.Fail msg -#endif \ No newline at end of file + () diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs index 9de6db290b..bc647b34ae 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs @@ -5,7 +5,6 @@ namespace FSharp.Core.UnitTests.Portable.SurfaceArea open NUnit.Framework open FSharp.Core.UnitTests.LibraryTestFx -[] type SurfaceAreaTest() = [] member this.VerifyArea() = @@ -91,6 +90,7 @@ Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Collections.FSharpLis Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], T[]) +Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](T[]) @@ -114,7 +114,6 @@ Microsoft.FSharp.Collections.ArrayModule: System.Tuple`3[T1[],T2[],T3[]] Unzip3[ Microsoft.FSharp.Collections.ArrayModule: System.Type GetType() Microsoft.FSharp.Collections.ArrayModule: T Average[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T ExactlyOne[T](T[]) -Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: T Get[T](T[], Int32) @@ -345,6 +344,7 @@ Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](Microsoft.FSharp.Collections.FSharpList`1[T]) @@ -361,7 +361,6 @@ Microsoft.FSharp.Collections.ListModule: System.Tuple`3[Microsoft.FSharp.Collect Microsoft.FSharp.Collections.ListModule: System.Type GetType() Microsoft.FSharp.Collections.ListModule: T Average[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T ExactlyOne[T](Microsoft.FSharp.Collections.FSharpList`1[T]) -Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Get[T](Microsoft.FSharp.Collections.FSharpList`1[T], Int32) @@ -433,6 +432,7 @@ Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Collections.FSharpList` Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](System.Collections.Generic.IEnumerable`1[T]) @@ -496,7 +496,6 @@ Microsoft.FSharp.Collections.SeqModule: System.Tuple`2[System.Collections.Generi Microsoft.FSharp.Collections.SeqModule: System.Type GetType() Microsoft.FSharp.Collections.SeqModule: T Average[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T ExactlyOne[T](System.Collections.Generic.IEnumerable`1[T]) -Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Get[T](Int32, System.Collections.Generic.IEnumerable`1[T]) @@ -755,6 +754,9 @@ Microsoft.FSharp.Control.ObservableModule: Void Add[T](Microsoft.FSharp.Core.FSh Microsoft.FSharp.Control.WebExtensions: Boolean Equals(System.Object) Microsoft.FSharp.Control.WebExtensions: Int32 GetHashCode() Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[System.Net.WebResponse] AsyncGetResponse(System.Net.WebRequest) +Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[Microsoft.FSharp.Core.Unit] AsyncDownloadFile(System.Net.WebClient, System.Uri, System.String) +Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[System.Byte[]] AsyncDownloadData(System.Net.WebClient, System.Uri) +Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[System.String] AsyncDownloadString(System.Net.WebClient, System.Uri) Microsoft.FSharp.Control.WebExtensions: System.String ToString() Microsoft.FSharp.Control.WebExtensions: System.Type GetType() Microsoft.FSharp.Core.AbstractClassAttribute: Boolean Equals(System.Object) @@ -2136,6 +2138,10 @@ Microsoft.FSharp.Core.FSharpChoice`7[T1,T2,T3,T4,T5,T6,T7]: System.String ToStri Microsoft.FSharp.Core.FSharpChoice`7[T1,T2,T3,T4,T5,T6,T7]: System.Type GetType() Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: Boolean Equals(System.Object) Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: Int32 GetHashCode() +Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] FromConverter(System.Converter`2[T,TResult]) +Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] op_Implicit(System.Converter`2[T,TResult]) +Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: System.Converter`2[T,TResult] ToConverter(Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]) +Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: System.Converter`2[T,TResult] op_Implicit(Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]) Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: System.String ToString() Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: System.Type GetType() Microsoft.FSharp.Core.FSharpFunc`2[T,TResult]: TResult Invoke(T) @@ -2250,8 +2256,12 @@ Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T]: System.Type GetType() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean Equals(Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean Equals(System.Object) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsNone +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsSome Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsValueNone Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsValueSome +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsNone() +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsSome() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsValueNone() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsValueSome() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 CompareTo(Microsoft.FSharp.Core.FSharpValueOption`1[T]) @@ -2263,7 +2273,10 @@ Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 Tag Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 get_Tag() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T] Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] NewValueSome(T) +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] None +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] Some(T) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] ValueNone +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_None() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_ValueNone() Microsoft.FSharp.Core.FSharpValueOption`1[T]: System.String ToString() Microsoft.FSharp.Core.FSharpValueOption`1[T]: System.Type GetType() @@ -2271,19 +2284,6 @@ Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Item Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Value Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Item() Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Value() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsNone -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsSome -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsNone() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsSome() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] None -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] Some(T) -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_None() -Microsoft.FSharp.Core.FSharpTypeFunc: Boolean Equals(System.Object) -Microsoft.FSharp.Core.FSharpTypeFunc: Int32 GetHashCode() -Microsoft.FSharp.Core.FSharpTypeFunc: System.Object Specialize[T]() -Microsoft.FSharp.Core.FSharpTypeFunc: System.String ToString() -Microsoft.FSharp.Core.FSharpTypeFunc: System.Type GetType() -Microsoft.FSharp.Core.FSharpTypeFunc: Void .ctor() Microsoft.FSharp.Core.FuncConvert: Boolean Equals(System.Object) Microsoft.FSharp.Core.FuncConvert: Int32 GetHashCode() Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit] FromAction(System.Action) @@ -2291,6 +2291,7 @@ Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[Microsoft. Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit] FromAction[T](System.Action`1[T]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit] ToFSharpFunc[T](System.Action`1[T]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] FromFunc[T,TResult](System.Func`2[T,TResult]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] ToFSharpFunc[T,TResult](System.Converter`2[T,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,Microsoft.FSharp.Core.Unit]]]]] FromAction[T1,T2,T3,T4,T5](System.Action`5[T1,T2,T3,T4,T5]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,TResult]]]]] FromFunc[T1,T2,T3,T4,T5,TResult](System.Func`6[T1,T2,T3,T4,T5,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,TResult]]]]] FuncFromTupled[T1,T2,T3,T4,T5,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`5[T1,T2,T3,T4,T5],TResult]) @@ -2874,36 +2875,6 @@ Microsoft.FSharp.Core.OptionModule: TState FoldBack[T,TState](Microsoft.FSharp.C Microsoft.FSharp.Core.OptionModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: T[] ToArray[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean Contains[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean Equals(System.Object) -Microsoft.FSharp.Core.ValueOption: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Int32 GetHashCode() -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: System.String ToString() -Microsoft.FSharp.Core.ValueOption: System.Type GetType() -Microsoft.FSharp.Core.ValueOption: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T GetValue[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T ToObj[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Core.FSharpValueOption`1[T], TState) -Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Equals(System.Object) Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean IsDefaultAttribute() Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Match(System.Object) @@ -3101,6 +3072,36 @@ Microsoft.FSharp.Core.UnverifiableAttribute: System.Object get_TypeId() Microsoft.FSharp.Core.UnverifiableAttribute: System.String ToString() Microsoft.FSharp.Core.UnverifiableAttribute: System.Type GetType() Microsoft.FSharp.Core.UnverifiableAttribute: Void .ctor() +Microsoft.FSharp.Core.ValueOption: Boolean Contains[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean Equals(System.Object) +Microsoft.FSharp.Core.ValueOption: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Int32 GetHashCode() +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: System.String ToString() +Microsoft.FSharp.Core.ValueOption: System.Type GetType() +Microsoft.FSharp.Core.ValueOption: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T GetValue[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T ToObj[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Core.FSharpValueOption`1[T], TState) +Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.VolatileFieldAttribute: Boolean Equals(System.Object) Microsoft.FSharp.Core.VolatileFieldAttribute: Boolean IsDefaultAttribute() Microsoft.FSharp.Core.VolatileFieldAttribute: Boolean Match(System.Object) diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs index 16035e67c0..54fd479eb2 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs @@ -5,7 +5,6 @@ namespace FSharp.Core.UnitTests.SurfaceArea open NUnit.Framework open FSharp.Core.UnitTests.LibraryTestFx -[] type SurfaceAreaTest() = [] member this.VerifyArea() = @@ -3666,4 +3665,4 @@ Microsoft.FSharp.Reflection.UnionCaseInfo: System.Type get_DeclaringType() // disabled because of slight order and GetMember discrepencies #else SurfaceArea.verify expected "net40" (System.IO.Path.Combine(__SOURCE_DIRECTORY__,__SOURCE_FILE__)) -#endif +#endif \ No newline at end of file diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index 37946c4087..46f202db26 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -3,9 +3,10 @@ namespace FSharp.Compiler.UnitTests open System +open System.Diagnostics open System.IO open System.Text -open System.Diagnostics + open FSharp.Compiler.Text open FSharp.Compiler.SourceCodeServices open FSharp.Compiler.Interactive.Shell @@ -16,7 +17,6 @@ open NUnit.Framework module CompilerAssert = let checker = FSharpChecker.Create() - let private config = TestFramework.initializeSuite () let private defaultProjectOptions = @@ -34,9 +34,10 @@ module CompilerAssert = |> Path.GetDirectoryName |> Directory.EnumerateFiles |> Seq.toArray - |> Array.filter (fun x -> x.ToLowerInvariant().Contains("system.")) + |> Array.filter (fun x -> x.ToLowerInvariant().Contains("system.") || x.ToLowerInvariant().EndsWith("netstandard.dll")) |> Array.map (fun x -> sprintf "-r:%s" x) Array.append [|"--targetprofile:netcore"; "--noframework"|] assemblies + #endif ReferencedProjects = [||] IsIncompleteTypeCheckEnvironment = false @@ -47,7 +48,7 @@ module CompilerAssert = ExtraProjectInfo = None Stamp = None } - + let lockObj = obj () let Pass (source: string) = @@ -116,4 +117,3 @@ module CompilerAssert = ||> Seq.iter2 (fun expectedErrorMessage errorMessage -> Assert.AreEqual(expectedErrorMessage, errorMessage) ) - \ No newline at end of file diff --git a/tests/fsharp/core/quotes/test.fsx b/tests/fsharp/core/quotes/test.fsx index 289988569d..8be5e21097 100644 --- a/tests/fsharp/core/quotes/test.fsx +++ b/tests/fsharp/core/quotes/test.fsx @@ -2007,7 +2007,6 @@ module TestQuotationOfCOnstructors = | _ -> false) -#if !FX_RESHAPED_REFLECTION // Also test getting the reflected definition for private members implied by "let f() = ..." bindings let fMethod = (typeof.GetMethod("f", Reflection.BindingFlags.Instance ||| Reflection.BindingFlags.Public ||| Reflection.BindingFlags.NonPublic)) @@ -2020,9 +2019,7 @@ module TestQuotationOfCOnstructors = -> unitVar.Type = typeof | _ -> false) - Expr.TryGetReflectedDefinition fMethod |> printfn "%A" -#endif test "vkjnkvrw0" (match Expr.TryGetReflectedDefinition (typeof.GetConstructors().[0]) with @@ -2312,29 +2309,17 @@ module ReflectedDefinitionOnTypesWithImplicitCodeGen = // This type has an implicit IComparable implementation, it is not accessible as a reflected definition type U = A of int | B of string | C of System.DateTime -#if FX_RESHAPED_REFLECTION - for m in typeof.GetMethods() do -#else for m in typeof.GetMethods(System.Reflection.BindingFlags.DeclaredOnly) do -#endif check "celnwer33" (Quotations.Expr.TryGetReflectedDefinition(m).IsNone) true // This type has some implicit codegen exception X of string * int -#if FX_RESHAPED_REFLECTION - for m in typeof.GetMethods() do -#else for m in typeof.GetMethods(System.Reflection.BindingFlags.DeclaredOnly) do -#endif check "celnwer34" (Quotations.Expr.TryGetReflectedDefinition(m).IsNone) true // This type has an implicit IComparable implementation, it is not accessible as a reflected definition [] type SR = { x:int; y:string; z:System.DateTime } -#if FX_RESHAPED_REFLECTION - for m in typeof.GetMethods() do -#else for m in typeof.GetMethods(System.Reflection.BindingFlags.DeclaredOnly) do -#endif check "celnwer35" (Quotations.Expr.TryGetReflectedDefinition(m).IsNone) true #if !NETCOREAPP @@ -3175,13 +3160,10 @@ module TestMatchBang = | expr -> Error "Delay is incorrect") (Ok ()) - testSimpleMatchBang() - + testSimpleMatchBang() -#if !FX_RESHAPED_REFLECTION module TestAssemblyAttributes = let attributes = System.Reflection.Assembly.GetExecutingAssembly().GetCustomAttributes(false) -#endif #if TESTS_AS_APP let RUN() = !failures diff --git a/tests/fsharp/core/samename/tempet.fsproj b/tests/fsharp/core/samename/tempet.fsproj index d6ac10eab9..20f63eb9cc 100644 --- a/tests/fsharp/core/samename/tempet.fsproj +++ b/tests/fsharp/core/samename/tempet.fsproj @@ -1,7 +1,7 @@  - netstandard1.6 + netstandard2.0 diff --git a/tests/fsharp/core/subtype/test.fsx b/tests/fsharp/core/subtype/test.fsx index 381e5b9a65..9751d03e6e 100644 --- a/tests/fsharp/core/subtype/test.fsx +++ b/tests/fsharp/core/subtype/test.fsx @@ -1386,12 +1386,10 @@ module CoercivePipingTest = check "clwcweki" (f8 3) (box 3) check "clwcweki" (f9 3) (box 3) -#if !FX_RESHAPED_REFLECTION // this was the actual repro let f (info: System.Reflection.MethodInfo) = System.Attribute.GetCustomAttribute(info, typeof) :?> ReflectedDefinitionAttribute -#endif module Test_Dev10_Bug_917383 = @@ -1728,7 +1726,6 @@ module InliningOnSubTypes1 = do check "clkewlijwlkw" (f()) (13, 17) -#if !FX_RESHAPED_REFLECTION module StructUnionSingleCase = [] type S = S @@ -1756,7 +1753,6 @@ module StructUnionSingleCase = do check "wekew0ewek5" (typeof.IsValueType) true do check "wekew0ewek5b" (typeof.BaseType) typeof -#endif // See https://github.com/Microsoft/visualfsharp/issues/238 module GenericPropertyConstraintSolvedByRecord = diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index 26b257d944..d3dc0f0c83 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -106,7 +106,7 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo "FSharp.Core" let targetCore = if targetFramework.StartsWith("netstandard", StringComparison.InvariantCultureIgnoreCase) || targetFramework.StartsWith("netcoreapp", StringComparison.InvariantCultureIgnoreCase) then - "netstandard1.6" + "netstandard2.0" else "net45" (Path.GetFullPath(__SOURCE_DIRECTORY__) + "/../../artifacts/bin/" + compiler + "/" + configuration + "/" + targetCore + "/FSharp.Core.dll") @@ -150,7 +150,6 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo portable $(OPTIMIZE) false - FX_RESHAPED_REFLECTION NETCOREAPP false $(RestoreFromArtifactsPath) diff --git a/tests/fsharp/test-framework.fs b/tests/fsharp/test-framework.fs index 6804b829f1..1e3aa9b37a 100644 --- a/tests/fsharp/test-framework.fs +++ b/tests/fsharp/test-framework.fs @@ -166,7 +166,7 @@ let config configurationName envVars = #else let fscArchitecture = "netcoreapp2.1" let fsiArchitecture = "netcoreapp2.1" - let fsharpCoreArchitecture = "netstandard1.6" + let fsharpCoreArchitecture = "netstandard2.0" let fsharpBuildArchitecture = "netcoreapp2.1" let fsharpCompilerInteractiveSettingsArchitecture = "netstandard2.0" #endif diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 96c7be2836..e302a74377 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -2090,10 +2090,8 @@ module TypecheckTests = let cfg = testConfig "typecheck/full-rank-arrays" SingleTest.singleTestBuildAndRunWithCopyDlls cfg "full-rank-arrays.dll" FSC_BASIC -#if !FX_NO_CONVERTER [] let misc () = singleTestBuildAndRun "typecheck/misc" FSC_BASIC -#endif #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS diff --git a/tests/fsharpqa/Source/Misc/AsyncOperations.fs b/tests/fsharpqa/Source/Misc/AsyncOperations.fs index 4b53b0ccff..2bc7738de7 100644 --- a/tests/fsharpqa/Source/Misc/AsyncOperations.fs +++ b/tests/fsharpqa/Source/Misc/AsyncOperations.fs @@ -127,8 +127,7 @@ namespace Microsoft.FSharp.Control type System.Net.WebRequest with member req.AsyncGetResponse() = callFSharpCoreAsyncGetResponse req // this calls the FSharp.Core method member req.GetResponseAsync() = callFSharpCoreAsyncGetResponse req // this calls the FSharp.Core method - -#if !FX_NO_WEB_CLIENT + [] module WebClientExtensions = open System.Net @@ -138,5 +137,4 @@ namespace Microsoft.FSharp.Control type WebClient with member this.AsyncDownloadString address = callFSharpCoreAsyncDownloadString this address -#endif diff --git a/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj index abac283cf0..a237159916 100644 --- a/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj +++ b/tests/projects/Sample_NETCoreSDK_FSharp_Library_netstandard1.6/Sample_NETCoreSDK_FSharp_Library_netstandard1.6.fsproj @@ -1,6 +1,6 @@ - netstandard1.6 + netstandard2.0 diff --git a/tests/service/Common.fs b/tests/service/Common.fs index 847447db77..6920e682af 100644 --- a/tests/service/Common.fs +++ b/tests/service/Common.fs @@ -6,10 +6,6 @@ open System.Collections.Generic open FSharp.Compiler open FSharp.Compiler.SourceCodeServices -#if FX_RESHAPED_REFLECTION -open ReflectionAdapters -#endif - #if NETCOREAPP2_0 let readRefs (folder : string) (projectFile: string) = let runProcess (workingDir: string) (exePath: string) (args: string) = @@ -74,11 +70,7 @@ let sysLib nm = programFilesx86Folder + @"\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\" + nm + ".dll" else #endif -#if FX_NO_RUNTIMEENVIRONMENT let sysDir = System.AppContext.BaseDirectory -#else - let sysDir = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() -#endif let (++) a b = System.IO.Path.Combine(a,b) sysDir ++ nm + ".dll" diff --git a/tests/service/FscTests.fs b/tests/service/FscTests.fs index 9bedfd38b1..b7ff870675 100644 --- a/tests/service/FscTests.fs +++ b/tests/service/FscTests.fs @@ -20,10 +20,6 @@ open FSharp.Compiler.Service.Tests.Common open NUnit.Framework -#if FX_RESHAPED_REFLECTION -open ReflectionAdapters -#endif - exception VerificationException of (*assembly:*)string * (*errorCode:*)int * (*output:*)string with override e.Message = sprintf "Verification of '%s' failed with code %d, message <<<%s>>>" e.Data0 e.Data1 e.Data2 diff --git a/tests/service/ReshapedReflection.fs b/tests/service/ReshapedReflection.fs deleted file mode 100644 index 3b1ba07ce8..0000000000 --- a/tests/service/ReshapedReflection.fs +++ /dev/null @@ -1,9 +0,0 @@ -namespace FSharp.Compiler.Service.Tests - -#if FX_RESHAPED_REFLECTION -module internal ReflectionAdapters = - open System.Reflection - - type System.Type with - member this.Assembly = this.GetTypeInfo().Assembly -#endif diff --git a/tests/service/data/samename/tempet.fsproj b/tests/service/data/samename/tempet.fsproj index 682a3ec1a3..03da397c8d 100644 --- a/tests/service/data/samename/tempet.fsproj +++ b/tests/service/data/samename/tempet.fsproj @@ -1,6 +1,6 @@ - netstandard1.6 + netstandard2.0 diff --git a/vsintegration/Utils/LanguageServiceProfiling/Options.fs b/vsintegration/Utils/LanguageServiceProfiling/Options.fs index 07d3b5804e..1357e0da45 100644 --- a/vsintegration/Utils/LanguageServiceProfiling/Options.fs +++ b/vsintegration/Utils/LanguageServiceProfiling/Options.fs @@ -29,7 +29,6 @@ let FCS (repositoryDir: string) : Options = @"src\fsharp\FSharp.Compiler.Service\obj\Release\FSIstrings.fs" @"src\assemblyinfo\assemblyinfo.FSharp.Compiler.Private.dll.fs" @"src\assemblyinfo\assemblyinfo.shared.fs" - @"src\utils\reshapedreflection.fs" @"src\utils\sformat.fsi" @"src\utils\sformat.fs" @"src\fsharp\sr.fsi" @@ -205,7 +204,7 @@ let FCS (repositoryDir: string) : Options = [|@"-o:obj\Release\FSharp.Compiler.Private.dll"; "-g"; "--noframework"; @"--baseaddress:0x06800000"; "--define:DEBUG"; @"--define:CROSS_PLATFORM_COMPILER"; - @"--define:FX_ATLEAST_40"; "--define:BE_SECURITY_TRANSPARENT"; + @"--define:FX_ATLEAST_40"; @"--define:COMPILER"; @"--define:ENABLE_MONO_SUPPORT"; "--define:FX_MSBUILDRESOLVER_RUNTIMELIKE"; @"--define:FX_LCIDFROMCODEPAGE"; "--define:FX_RESX_RESOURCE_READER"; From 363383aa5c656a9f35fc527f1b7c61b38b1c581e Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Sun, 26 May 2019 21:15:32 -0700 Subject: [PATCH 081/286] Add --langversion:?|version|latest|preview (#6790) * Add langversion switch * re-enable tests * Feedback * Update build to recognize LangVersion * feedback * Use centralized comparer --- src/fsharp/CompileOps.fs | 95 +++++++++++++++++-- src/fsharp/CompileOps.fsi | 15 +++ src/fsharp/CompileOptions.fs | 22 ++--- src/fsharp/FSComp.txt | 3 + src/fsharp/FSharp.Build/Fsc.fs | 16 ++-- .../FSharp.Build/Microsoft.FSharp.Targets | 16 +++- src/fsharp/xlf/FSComp.txt.cs.xlf | 15 +++ src/fsharp/xlf/FSComp.txt.de.xlf | 15 +++ src/fsharp/xlf/FSComp.txt.es.xlf | 15 +++ src/fsharp/xlf/FSComp.txt.fr.xlf | 15 +++ src/fsharp/xlf/FSComp.txt.it.xlf | 15 +++ src/fsharp/xlf/FSComp.txt.ja.xlf | 15 +++ src/fsharp/xlf/FSComp.txt.ko.xlf | 15 +++ src/fsharp/xlf/FSComp.txt.pl.xlf | 15 +++ src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 15 +++ src/fsharp/xlf/FSComp.txt.ru.xlf | 15 +++ src/fsharp/xlf/FSComp.txt.tr.xlf | 15 +++ src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 15 +++ src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 15 +++ .../fsc/help/help40.437.1033.bsl | 4 + .../fsc/langversion/badlangversion.fsx | 5 + .../CompilerOptions/fsc/langversion/dummy.fsx | 3 + .../CompilerOptions/fsc/langversion/env.lst | 4 + .../langversion/langversionhelp.437.1033.bsl | 6 ++ .../fsi/exename/help40.437.1033.bsl | 4 + .../Source/CompilerOptions/fsi/help/env.lst | 2 - .../fsi/help/help40-nologo.437.1033.bsl | 4 + .../fsi/help/help40.437.1033.bsl | 4 + .../fsi/langversion/badlangversion.fsx | 5 + .../fsi/langversion/comparer.fsx | 32 +++++++ .../CompilerOptions/fsi/langversion/dummy.fsx | 3 + .../CompilerOptions/fsi/langversion/env.lst | 4 + .../langversion/langversionhelp.437.1033.bsl | 6 ++ tests/fsharpqa/Source/test.lst | 2 + tests/fsharpqa/comparer.fsx | 44 +++++++++ 35 files changed, 463 insertions(+), 31 deletions(-) create mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/langversion/badlangversion.fsx create mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/langversion/dummy.fsx create mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst create mode 100644 tests/fsharpqa/Source/CompilerOptions/fsc/langversion/langversionhelp.437.1033.bsl create mode 100644 tests/fsharpqa/Source/CompilerOptions/fsi/langversion/badlangversion.fsx create mode 100644 tests/fsharpqa/Source/CompilerOptions/fsi/langversion/comparer.fsx create mode 100644 tests/fsharpqa/Source/CompilerOptions/fsi/langversion/dummy.fsx create mode 100644 tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst create mode 100644 tests/fsharpqa/Source/CompilerOptions/fsi/langversion/langversionhelp.437.1033.bsl create mode 100644 tests/fsharpqa/comparer.fsx diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 80334741ec..9a09854b05 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -829,7 +829,6 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (suggestNames let filtered = ErrorResolutionHints.FilterPredictions suggestionsF id.idText if List.isEmpty filtered |> not then os.Append(ErrorResolutionHints.FormatPredictions DecompileOpName filtered) |> ignore - | InternalUndefinedItemRef(f, smr, ccuName, s) -> let _, errs = f(smr, ccuName, s) @@ -1786,7 +1785,7 @@ let OutputDiagnosticContext prefix fileLineFn os err = let (++) x s = x @ [s] -//---------------------------------------------------------------------------- +//-------------------------------------------------------------------------- // General file name resolver //-------------------------------------------------------------------------- @@ -1835,6 +1834,82 @@ let ComputeMakePathAbsolute implicitIncludeDir (path: string) = with :? System.ArgumentException -> path + +//------------------------------------------------------------------------------------------------------------------ +// Language version command line switch +//------------------------------------------------------------------------------------------------------------------ +// Add your features to this List - in code use languageVersion.SupportsFeature(LanguageFeatures.yourFeature) +// a return value of false means your feature is not supported by the user's language selection +// All new language features added from now on must be protected by this. +// Note: +// * The fslang design process will require a decision about feature name and whether it is required. +// * When a feature is assigned a release language, we will scrub the code of feature references and apply +// the Release Language version. + +/// LanguageFeature enumeration +[] +type LanguageFeature = + | LanguageVersion46 = 0 + | LanguageVersion47 = 1 + | Nullness = 1000 + | ScriptingPackageManagement = 1001 + +/// LanguageVersion management +type LanguageVersion (specifiedVersion) = + + // When we increment language versions here preview is higher than current RTM version + static let languageVersion46 = 4.6m + static let languageVersion47 = 4.7m + + static let previewVersion = languageVersion47 // Language version when preview specified + static let defaultVersion = languageVersion46 // Language version when default specified + static let latestVersion = defaultVersion // Language version when latest specified + static let latestMajorVersion = languageVersion46 // Language version when latestmajor specified + + static let validOptions = [| "preview"; "default"; "latest"; "latestmajor" |] + static let languageVersions = set [| latestVersion |] + + static let features = dict [| + // Add new LanguageVersions here ... + LanguageFeature.LanguageVersion47, 4.7m + LanguageFeature.LanguageVersion46, 4.6m + LanguageFeature.Nullness, previewVersion + LanguageFeature.ScriptingPackageManagement, previewVersion + // Add new LanguageFeatures here ... + |] + + static let dumpAllowedValues () = + printfn "%s" (FSComp.SR.optsSupportedLangVersions()) + for v in validOptions do printfn "%s" v + for v in languageVersions |> Seq.sort do + let label = if v = defaultVersion || v = latestVersion then "(Default)" else "" + printf "%M %s" v label + exit 0 + 0m + + let specified = + match specifiedVersion with + | "?" -> dumpAllowedValues() + | "preview" -> previewVersion + | "default" -> latestVersion + | "latest" -> latestVersion + | "latestmajor" -> latestMajorVersion + | _ -> + let raiseError () = error(Error(FSComp.SR.optsUnrecognizedLanguageVersion specifiedVersion, rangeCmdArgs)) + match Decimal.TryParse(specifiedVersion) with + | true, v -> + if languageVersions.Contains(v) then v + else raiseError (); 0m + | _ -> + raiseError () + 0m + + /// Check if this feature is supported by the selected langversion + member __.SupportsFeature featureId = + match features.TryGetValue featureId with + | true, v -> v <= specified + | false, _ -> false + //---------------------------------------------------------------------------- // Configuration //---------------------------------------------------------------------------- @@ -1963,7 +2038,7 @@ type UnresolvedAssemblyReference = UnresolvedAssemblyReference of string * Assem type ResolvedExtensionReference = ResolvedExtensionReference of string * AssemblyReference list * Tainted list #endif -type ImportedBinary = +type ImportedBinary = { FileName: string RawMetadata: IRawFSharpAssemblyData #if !NO_EXTENSIONTYPING @@ -1974,7 +2049,7 @@ type ImportedBinary = ILAssemblyRefs: ILAssemblyRef list ILScopeRef: ILScopeRef } -type ImportedAssembly = +type ImportedAssembly = { ILScopeRef: ILScopeRef FSharpViewOfMetadata: CcuThunk AssemblyAutoOpenAttributes: string list @@ -1989,7 +2064,7 @@ type AvailableImportedAssembly = | ResolvedImportedAssembly of ImportedAssembly | UnresolvedImportedAssembly of string -type CcuLoadFailureAction = +type CcuLoadFailureAction = | RaiseError | ReturnNone @@ -2150,8 +2225,10 @@ type TcConfigBuilder = mutable internalTestSpanStackReferring: bool mutable noConditionalErasure: bool - + mutable pathMap: PathMap + + mutable langVersion: LanguageVersion } static member Initial = @@ -2197,7 +2274,7 @@ type TcConfigBuilder = debuginfo = false testFlagEmitFeeFeeAs100001 = false dumpDebugInfo = false - debugSymbolFile = None + debugSymbolFile = None (* Backend configuration *) typeCheckOnly = false @@ -2288,6 +2365,7 @@ type TcConfigBuilder = internalTestSpanStackReferring = false noConditionalErasure = false pathMap = PathMap.empty + langVersion = LanguageVersion("default") } static member CreateNew(legacyReferenceResolver, defaultFSharpBinariesDir, reduceMemoryUsage, implicitIncludeDir, @@ -2737,6 +2815,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = member x.emitTailcalls = data.emitTailcalls member x.deterministic = data.deterministic member x.pathMap = data.pathMap + member x.langVersion = data.langVersion member x.preferredUiLang = data.preferredUiLang member x.lcid = data.lcid member x.optsOn = data.optsOn @@ -3113,7 +3192,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = member tcConfig.PrimaryAssemblyDllReference() = primaryAssemblyReference member tcConfig.CoreLibraryDllReference() = fslibReference - + let ReportWarning options err = warningOn err (options.WarnLevel) (options.WarnOn) && not (List.contains (GetDiagnosticNumber err) (options.WarnOff)) diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 3d08610670..94f59146a9 100644 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -209,6 +209,19 @@ type UnresolvedAssemblyReference = UnresolvedAssemblyReference of string * Assem type ResolvedExtensionReference = ResolvedExtensionReference of string * AssemblyReference list * Tainted list #endif +/// LanguageFeature enumeration +[] +type LanguageFeature = + | LanguageVersion46 = 0 + | LanguageVersion47 = 1 + | Nullness = 1000 + | ScriptingPackageManagement = 1001 + +/// LanguageVersion management +type LanguageVersion = + new: string -> LanguageVersion + member SupportsFeature: LanguageFeature-> bool + [] type CompilerTarget = | WinExe @@ -375,6 +388,8 @@ type TcConfigBuilder = mutable noConditionalErasure: bool mutable pathMap : PathMap + + mutable langVersion : LanguageVersion } static member Initial: TcConfigBuilder diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index 716263369a..a342275c47 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -525,6 +525,7 @@ let tagAddress = "
" let tagInt = "" let tagPathMap = "" let tagNone = "" +let tagLangVersionValues = "{?|version|latest|preview}" // PrintOptionInfo //---------------- @@ -821,19 +822,18 @@ let mlCompatibilityFlag (tcConfigB: TcConfigBuilder) = let languageFlags tcConfigB = [ - CompilerOption - ("checked", tagNone, - OptionSwitch (fun switch -> tcConfigB.checkOverflow <- (switch = OptionSwitch.On)), None, - Some (FSComp.SR.optsChecked())) - - CompilerOption - ("define", tagString, - OptionString (defineSymbol tcConfigB), None, - Some (FSComp.SR.optsDefine())) - + // -langversion:? Display the allowed values for language version + // -langversion: Specify language version such as + // 'default' (latest major version), or + // 'latest' (latest version, including minor versions), + // 'preview' (features for preview) + // or specific versions like '4.7' + CompilerOption("langversion", tagLangVersionValues, OptionString (fun switch -> tcConfigB.langVersion <- LanguageVersion(switch)), None, Some (FSComp.SR.optsLangVersion())) + + CompilerOption("checked", tagNone, OptionSwitch (fun switch -> tcConfigB.checkOverflow <- (switch = OptionSwitch.On)), None, Some (FSComp.SR.optsChecked())) + CompilerOption("define", tagString, OptionString (defineSymbol tcConfigB), None, Some (FSComp.SR.optsDefine())) mlCompatibilityFlag tcConfigB ] - // OptionBlock: Advanced user options //----------------------------------- diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index ee2b41f2e9..4e0f034aac 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -73,6 +73,7 @@ buildProductNameCommunity,"F# Compiler for F# %s" pickleErrorReadingWritingMetadata,"Error reading/writing metadata for the F# compiled DLL '%s'. Was the DLL compiled with an earlier version of the F# compiler? (error: '%s')." 245,tastTypeOrModuleNotConcrete,"The type/module '%s' is not a concrete module or type" tastTypeHasAssemblyCodeRepresentation,"The type '%s' has an inline assembly code representation" +246,optsUnrecognizedLanguageVersion,"Unrecognized value '%s' for --langversion use --langversion:? for complete list" 247,tastNamespaceAndModuleWithSameNameInAssembly,"A namespace and a module named '%s' both occur in two parts of this assembly" 248,tastTwoModulesWithSameNameInAssembly,"Two modules named '%s' occur in two parts of this assembly" 249,tastDuplicateTypeDefinitionInAssembly,"Two type definitions named '%s' occur in namespace '%s' in two parts of this assembly" @@ -1463,3 +1464,5 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl 3301,chkInvalidFunctionReturnType,"The function or method has an invalid return type '%s'. This is not permitted by the rules of Common IL." useSdkRefs,"Use reference assemblies for .NET framework references when available (Enabled by default)." fSharpBannerVersion,"%s for F# %s" +optsLangVersion,"Display the allowed values for language version, specify language version such as 'latest' or 'preview'" +optsSupportedLangVersions,"Supported language versions:" diff --git a/src/fsharp/FSharp.Build/Fsc.fs b/src/fsharp/FSharp.Build/Fsc.fs index 19d8cd171f..89e6a64db6 100644 --- a/src/fsharp/FSharp.Build/Fsc.fs +++ b/src/fsharp/FSharp.Build/Fsc.fs @@ -39,6 +39,7 @@ type public Fsc () as this = let mutable generateInterfaceFile : string = null let mutable highEntropyVA : bool = false let mutable keyFile : string = null + let mutable langVersion : string = null let mutable noFramework = false let mutable optimize : bool = true let mutable otherFlags : string = null @@ -102,15 +103,15 @@ type public Fsc () as this = | "EMBEDDED" -> "embedded" | "FULL" -> "full" | _ -> null) - if embedAllSources then - builder.AppendSwitch("--embed+") + if embedAllSources then builder.AppendSwitch("--embed+") if embeddedFiles <> null then for item in embeddedFiles do builder.AppendSwitchIfNotNull("--embed:", item.ItemSpec) builder.AppendSwitchIfNotNull("--sourcelink:", sourceLink) + builder.AppendSwitchIfNotNull("--langVersion:", langVersion) // NoFramework - if noFramework then - builder.AppendSwitch("--noframework") + if noFramework then + builder.AppendSwitch("--noframework") // BaseAddress builder.AppendSwitchIfNotNull("--baseaddress:", baseAddress) // DefineConstants @@ -119,7 +120,6 @@ type public Fsc () as this = builder.AppendSwitchIfNotNull("--define:", item.ItemSpec) // DocumentationFile builder.AppendSwitchIfNotNull("--doc:", documentationFile) - // GenerateInterfaceFile builder.AppendSwitchIfNotNull("--sig:", generateInterfaceFile) // KeyFile @@ -330,6 +330,10 @@ type public Fsc () as this = with get() = keyFile and set(s) = keyFile <- s + member fsc.LangVersion + with get() = langVersion + and set(s) = langVersion <- s + member fsc.LCID with get() = vslcid and set(p) = vslcid <- p @@ -363,7 +367,7 @@ type public Fsc () as this = member fsc.PathMap with get() = pathMap and set(s) = pathMap <- s - + // --pdb : // Name the debug output file member fsc.PdbFile diff --git a/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets b/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets index c36ce52c50..c10d3fb305 100644 --- a/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets +++ b/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets @@ -272,9 +272,16 @@ this file. $(OtherFlags) + + + preview + + - - + + Win32ResourceFile="$(Win32Resource)"> diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 3354ee57b5..9abdabd61b 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -7,6 +7,21 @@ {0} for F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + The namespace '{0}' is not defined. Není definovaný obor názvů {0}. diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 320acf4e03..e5f977192c 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -7,6 +7,21 @@ {0} for F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + The namespace '{0}' is not defined. Der Namespace "{0}" ist nicht definiert. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index b08960e486..e21d657eef 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -7,6 +7,21 @@ {0} for F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + The namespace '{0}' is not defined. El espacio de nombres "{0}" no está definido. diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index f23037f6a8..fd6cdbf549 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -7,6 +7,21 @@ {0} for F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + The namespace '{0}' is not defined. L'espace de noms '{0}' n'est pas défini. diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 32637f988d..f60b7905f5 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -7,6 +7,21 @@ {0} for F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + The namespace '{0}' is not defined. Lo spazio dei nomi '{0}' non è definito. diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 8157060c9d..0c19a13994 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -7,6 +7,21 @@ {0} for F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + The namespace '{0}' is not defined. 名前空間 '{0}' が定義されていません。 diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index f642d6b444..7185fb2935 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -7,6 +7,21 @@ {0} for F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + The namespace '{0}' is not defined. '{0}' 네임스페이스가 정의되지 않았습니다. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index b9749bedda..340810b041 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -7,6 +7,21 @@ {0} for F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + The namespace '{0}' is not defined. Nie zdefiniowano przestrzeni nazw „{0}”. diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 39537bc8cd..597b93b075 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -7,6 +7,21 @@ {0} for F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + The namespace '{0}' is not defined. O namespace '{0}' não está definido. diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index fcd4c723f7..7428d734b0 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -7,6 +7,21 @@ {0} for F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + The namespace '{0}' is not defined. Пространство имен "{0}" не определено. diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index 8092970883..1adde774d3 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -7,6 +7,21 @@ {0} for F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + The namespace '{0}' is not defined. '{0}' ad alanı tanımlı değil. diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index 1a7945d712..a1741df6fc 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -7,6 +7,21 @@ {0} for F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + The namespace '{0}' is not defined. 未定义命名空间“{0}”。 diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 0f67d46dbc..0cf2857c69 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -7,6 +7,21 @@ {0} for F# {1} + + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Display the allowed values for language version, specify language version such as 'latest' or 'preview' + + + + Supported language versions: + Supported language versions: + + + + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + The namespace '{0}' is not defined. 未定義命名空間 '{0}'。 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl index b0fd674681..d1321663d0 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl @@ -98,6 +98,10 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. - LANGUAGE - +--langversion:{?|version|latest|preview} Display the allowed values for + language version, specify language + version such as 'latest' or + 'preview' --checked[+|-] Generate overflow checks --define: Define conditional compilation symbols (Short form: -d) diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/badlangversion.fsx b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/badlangversion.fsx new file mode 100644 index 0000000000..b41237cd0b --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/badlangversion.fsx @@ -0,0 +1,5 @@ +// #NoMT #CompilerOptions #RequiresENU +// Unrecognized value '4.5' for --langversion use --langversion:? for complete list +// +#light +exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/dummy.fsx b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/dummy.fsx new file mode 100644 index 0000000000..c5ecbb3643 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/dummy.fsx @@ -0,0 +1,3 @@ +// #NoMT #CompilerOptions #RequiresENU +#light +exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst new file mode 100644 index 0000000000..3b89b6742d --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst @@ -0,0 +1,4 @@ +# ReqENU means that the test is non-localized + +ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >langversionhelp.txt --langversion:? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\..\\comparer.fsx langversionhelp.txt langversionhelp.437.1033.bsl" # --langversion:? +ReqENU SOURCE=badlangversion.fsx SCFLAGS=" --langversion:4.5" # --langversion:4.5 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/langversionhelp.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/langversionhelp.437.1033.bsl new file mode 100644 index 0000000000..c98bf79962 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/langversionhelp.437.1033.bsl @@ -0,0 +1,6 @@ +Supported language versions: +preview +default +latest +latestmajor +4.6 (Default) \ No newline at end of file diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl index d19a024e30..8a9d6d418a 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl @@ -49,6 +49,10 @@ Usage: fsharpi [script.fsx []] - LANGUAGE - +--langversion:{?|version|latest|preview} Display the allowed values for + language version, specify language + version such as 'latest' or + 'preview' --checked[+|-] Generate overflow checks --define: Define conditional compilation symbols (Short form: -d) diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/help/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsi/help/env.lst index 236e79c6d7..0676f8e9f7 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/help/env.lst +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/help/env.lst @@ -1,8 +1,6 @@ ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE >help.txt -? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx help.txt help40.437.1033.bsl" # -?-40 - ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE >help.txt --help 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx help.txt help40.437.1033.bsl" # --help-40 - ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE >help.txt /? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx help.txt help40.437.1033.bsl" # /?-40 # With --nologo diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl index 242cb274d2..041e86b828 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl @@ -49,6 +49,10 @@ Usage: fsi.exe [script.fsx []] - LANGUAGE - +--langversion:{?|version|latest|preview} Display the allowed values for + language version, specify language + version such as 'latest' or + 'preview' --checked[+|-] Generate overflow checks --define: Define conditional compilation symbols (Short form: -d) diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl index 34d28e5f70..24fbfc4de4 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl @@ -51,6 +51,10 @@ Usage: fsi.exe [script.fsx []] - LANGUAGE - +--langversion:{?|version|latest|preview} Display the allowed values for + language version, specify language + version such as 'latest' or + 'preview' --checked[+|-] Generate overflow checks --define: Define conditional compilation symbols (Short form: -d) diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/badlangversion.fsx b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/badlangversion.fsx new file mode 100644 index 0000000000..b41237cd0b --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/badlangversion.fsx @@ -0,0 +1,5 @@ +// #NoMT #CompilerOptions #RequiresENU +// Unrecognized value '4.5' for --langversion use --langversion:? for complete list +// +#light +exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/comparer.fsx b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/comparer.fsx new file mode 100644 index 0000000000..38adec6afd --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/comparer.fsx @@ -0,0 +1,32 @@ +// #NoMT #CompilerOptions #RequiresENU +#light + +let arg0 = System.Environment.GetCommandLineArgs().[0] +let path = System.Environment.GetEnvironmentVariable("PATH") +let fn1 = fsi.CommandLineArgs.[1] +let fn2 = fsi.CommandLineArgs.[2] + +// Read file into an array +let File2List (filename:string) = System.IO.File.ReadAllLines(filename) + +let f1 = File2List fn1 +let f2 = File2List fn2 + +let mutable i = 0 +let compare (f1:string[]) (f2:string[]) = + if f1.Length <> f2.Length then failwithf "Help text did not match. f1.Length = %d, f2.Length = %d. Check you have fsc on path, arg0 = %s, PATH=%s" f1.Length f2.Length arg0 path + (f1, f2) ||> Array.forall2 (fun (a:string) (b:string) -> + let aa = System.Text.RegularExpressions.Regex.Replace(a, @"F# Compiler version .+", "F# Compiler") + let bb = System.Text.RegularExpressions.Regex.Replace(b, @"F# Compiler version .+", "F# Compiler") + i <- i+1 + if (aa = bb) then + true + else + printfn "Files differ at line %d:" i + printfn "\t>> %s" a + printfn "\t<< %s" b + false + ) + +exit (if compare f1 f2 then 0 else 1) + diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/dummy.fsx b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/dummy.fsx new file mode 100644 index 0000000000..c5ecbb3643 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/dummy.fsx @@ -0,0 +1,3 @@ +// #NoMT #CompilerOptions #RequiresENU +#light +exit 0 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst new file mode 100644 index 0000000000..c776cbedee --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst @@ -0,0 +1,4 @@ +# ReqENU means that the test is non-localized + +ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE >c:\\temp\\langversionhelp.txt --langversion:? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx c:\\temp\\langversionhelp.txt langversionhelp.437.1033.bsl" # --langversion:? +ReqENU SOURCE=badlangversion.fsx SCFLAGS=" --langversion:4.5" # --langversion:4.5 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/langversionhelp.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/langversionhelp.437.1033.bsl new file mode 100644 index 0000000000..c98bf79962 --- /dev/null +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/langversionhelp.437.1033.bsl @@ -0,0 +1,6 @@ +Supported language versions: +preview +default +latest +latestmajor +4.6 (Default) \ No newline at end of file diff --git a/tests/fsharpqa/Source/test.lst b/tests/fsharpqa/Source/test.lst index 67199ab113..317445df66 100644 --- a/tests/fsharpqa/Source/test.lst +++ b/tests/fsharpqa/Source/test.lst @@ -42,6 +42,7 @@ CompilerOptions01,NoMT CompilerOptions\fsc\flaterrors CompilerOptions02,NoMT CompilerOptions\fsc\gccerrors CompilerOptions01,NoMT,help CompilerOptions\fsc\help CompilerOptions01,NoMT CompilerOptions\fsc\highentropyva +CompilerOptions01,NoMT CompilerOptions\fsc\langversion CompilerOptions01,NoMT CompilerOptions\fsc\lib CompilerOptions01,NoMT CompilerOptions\fsc\noframework CompilerOptions01,NoMT CompilerOptions\fsc\nologo @@ -63,6 +64,7 @@ CompilerOptions01,NoMT CompilerOptions\fsc\warnon CompilerOptions01,NoMT CompilerOptions\fsc\responsefile CompilerOptions01,NoMT,help CompilerOptions\fsi\help CompilerOptions01,NoMT CompilerOptions\fsi\highentropyva +CompilerOptions01,NoMT CompilerOptions\fsi\langversion CompilerOptions01,NoMT CompilerOptions\fsi\nologo CompilerOptions01,NoMT CompilerOptions\fsi\subsystemversion CompilerOptions01,NoMT CompilerOptions\fsi\times diff --git a/tests/fsharpqa/comparer.fsx b/tests/fsharpqa/comparer.fsx new file mode 100644 index 0000000000..26bff8cb78 --- /dev/null +++ b/tests/fsharpqa/comparer.fsx @@ -0,0 +1,44 @@ +// #NoMT #CompilerOptions #RequiresENU +#light +open System +open System.IO +open System.Text.RegularExpressions + +let arg0 = Environment.GetCommandLineArgs().[0] +let path = Environment.GetEnvironmentVariable("PATH") +let fn1 = fsi.CommandLineArgs.[1] +let fn2 = fsi.CommandLineArgs.[2] + +// Read file into an array +let File2List (filename:string) = File.ReadAllLines(filename) + +let f1 = File2List fn1 +let f2 = File2List fn2 + +let mutable i = 0 +let compare (f1:string[]) (f2:string[]) = + if f1.Length <> f2.Length then failwithf "Help text did not match. f1.Length = %d, f2.Length = %d, Check you have right fsi on path. fsi = %s, PATH=%s" f1.Length f2.Length arg0 path + (f1, f2) ||> Array.forall2 (fun (a:string) (b:string) -> + + let replace (sourcepattern:string) (replacement:string) (str:string) : string = + Regex.Replace(str, sourcepattern, replacement) + + let normalizeText (str:string) = + str |> replace @"F# Interactive version .+" "F# Interactive" + |> replace @"F# Compiler version .+" "F# Compiler" + |> replace "fsiAnyCpu.exe" "fsi.exe" + + let aa = normalizeText a + let bb = normalizeText b + + i <- i+1 + if (aa = bb) then + true + else + printfn "Files differ at line %d:" i + printfn "\t>> %s" a + printfn "\t<< %s" b + false + ) + +exit (if compare f1 f2 then 0 else 1) From 53c28283768e4eb9394e95d3f68ff3c6539718a1 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Mon, 27 May 2019 19:44:12 +0200 Subject: [PATCH 082/286] [RFC FS-1046] Wildcard self identifier. Allow single underscore in members. (#6829) * Add Underscore Dot rule * Update tests * Revert line where x is used * Code fix rename to single underscore --- src/fsharp/pars.fsy | 1 + tests/fsharp/core/members/basics/test.fs | 214 +++++++++--------- .../CodeFix/RenameUnusedValue.fs | 8 +- 3 files changed, 110 insertions(+), 113 deletions(-) diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 453e5c5634..9168e46c72 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -1912,6 +1912,7 @@ opt_typ: atomicPatternLongIdent: + | UNDERSCORE DOT pathOp { let (LongIdentWithDots(lid,dotms)) = $3 in (None,LongIdentWithDots(ident("_",rhs parseState 1)::lid, rhs parseState 2::dotms)) } | GLOBAL DOT pathOp { let (LongIdentWithDots(lid,dotms)) = $3 in (None,LongIdentWithDots(ident(MangledGlobalName,rhs parseState 1) :: lid, rhs parseState 2 :: dotms)) } | pathOp { (None,$1) } | access pathOp { (Some($1), $2) } diff --git a/tests/fsharp/core/members/basics/test.fs b/tests/fsharp/core/members/basics/test.fs index 27c9e6c3a4..ee04812f83 100644 --- a/tests/fsharp/core/members/basics/test.fs +++ b/tests/fsharp/core/members/basics/test.fs @@ -54,8 +54,8 @@ open System.Windows.Forms //----------------------------------------- // Some simple object-expression tests -let x0 = { new System.Object() with member __.GetHashCode() = 3 } -let x1 = { new System.Windows.Forms.Form() with member __.GetHashCode() = 3 } +let x0 = { new System.Object() with member _.GetHashCode() = 3 } +let x1 = { new System.Windows.Forms.Form() with member _.GetHashCode() = 3 } //----------------------------------------- // Test defining an F# class @@ -72,16 +72,16 @@ type ClassType1 = abstract VirtualMethod2: string * string -> int abstract VirtualMethod1PostHoc: string -> int abstract VirtualMethod2PostHoc: string * string -> int - default x.VirtualMethod1(s) = 3 - default x.VirtualMethod2(s1,s2) = 3 + default _.VirtualMethod1(s) = 3 + default _.VirtualMethod2(s1,s2) = 3 new(s: string) = { inherit System.Object(); someField = "abc" } end type ClassType1 with - default x.VirtualMethod1PostHoc(s) = 3 - default x.VirtualMethod2PostHoc(s1,s2) = 3 + default _.VirtualMethod1PostHoc(s) = 3 + default _.VirtualMethod2PostHoc(s1,s2) = 3 new(s1,s2) = { inherit System.Object(); someField = "constructor2" + s1 + s2 } end @@ -93,11 +93,11 @@ type ClassType1 end -let x2 = { new ClassType1("a") with member __.GetHashCode() = 3 } -let x3 = { new ClassType1("a") with member __.VirtualMethod1(s) = 4 } +let x2 = { new ClassType1("a") with member _.GetHashCode() = 3 } +let x3 = { new ClassType1("a") with member _.VirtualMethod1(s) = 4 } let x4 = { new ClassType1("a") with - member __.VirtualMethod1(s) = 5 - member __.VirtualMethod2(s1,s2) = s1.Length + s2.Length } + member _.VirtualMethod1(s) = 5 + member _.VirtualMethod2(s1,s2) = s1.Length + s2.Length } @@ -119,18 +119,18 @@ type ClassType2 = inherit ClassType1 val someField2 : string - override x.VirtualMethod1(s) = 2001 + override _.VirtualMethod1(s) = 2001 override x.VirtualMethod2(s1,s2) = s1.Length + s2.Length + String.length x.someField2 new(s) = { inherit ClassType1(s); someField2 = s } end -let x22 = { new ClassType2("a") with member __.GetHashCode() = 3 } -let x32 = { new ClassType2("abc") with member __.VirtualMethod1(s) = 4002 } +let x22 = { new ClassType2("a") with member _.GetHashCode() = 3 } +let x32 = { new ClassType2("abc") with member _.VirtualMethod1(s) = 4002 } let x42 = { new ClassType2("abcd") with - member __.VirtualMethod1(s) = 5004 - member __.VirtualMethod2(s1,s2) = 500 + s1.Length + s2.Length } + member _.VirtualMethod1(s) = 5004 + member _.VirtualMethod2(s1,s2) = 500 + s1.Length + s2.Length } do test "e09wckj2ddwdw" (ignore(((x22 :> obj) :?> ClassType1)); true) do test "e09wckj2ddwdw" (ignore((x22 :> ClassType1)); true) @@ -166,7 +166,7 @@ module AbstractClassTest = begin type ClassType1 with interface IEnumerable with - member x.GetEnumerator() = failwith "no implementation" + member _.GetEnumerator() = failwith "no implementation" end end @@ -175,8 +175,8 @@ module AbstractClassTest = begin //let shouldGiveError2 = { new ClassType1("a") with AbstractMethod1(s) = 4 } //let shouldGiveError3a = new ClassType1("a") let x4 = { new ClassType1("a") with - member __.AbstractMethod1(s) = 5 - member __.AbstractMethod2(s1,s2) = s1.Length + s2.Length } + member _.AbstractMethod1(s) = 5 + member _.AbstractMethod2(s1,s2) = s1.Length + s2.Length } do test "e09wckj2d" (try ignore((x2 :> IEnumerable).GetEnumerator()); false with Failure "no implementation" -> true) @@ -191,18 +191,18 @@ module AbstractClassTest = begin inherit ClassType1 val someField2 : string - override x.AbstractMethod1(s) = 2001 + override _.AbstractMethod1(s) = 2001 override x.AbstractMethod2(s1,s2) = s1.Length + s2.Length + String.length x.someField2 new(s) = { inherit ClassType1(s); someField2 = s } end - let x22 = { new ClassType2("a") with member __.GetHashCode() = 3 } - let x32 = { new ClassType2("abc") with member __.AbstractMethod1(s) = 4002 } + let x22 = { new ClassType2("a") with member _.GetHashCode() = 3 } + let x32 = { new ClassType2("abc") with member _.AbstractMethod1(s) = 4002 } let x42 = { new ClassType2("abcd") with - member __.AbstractMethod1(s) = 5004 - member __.AbstractMethod2(s1,s2) = 500 + s1.Length + s2.Length } + member _.AbstractMethod1(s) = 5004 + member _.AbstractMethod2(s1,s2) = 500 + s1.Length + s2.Length } do test "e09wckj2ddwdw" (ignore(((x22 :> obj) :?> ClassType1)); true) do test "e09wckj2ddwdw" (ignore((x22 :> ClassType1)); true) @@ -218,7 +218,7 @@ module AbstractClassTest = begin inherit ClassType2 val someField3 : string - override x.AbstractMethod1(s) = 2001 + override _.AbstractMethod1(s) = 2001 override x.AbstractMethod2(s1,s2) = s1.Length + s2.Length + String.length x.someField2 + x.someField3.Length new(s) = { inherit ClassType2(s); someField3 = s } @@ -306,8 +306,8 @@ module RecordTypeTest = begin with get(idx) = x.instanceArray.[idx] member x.InstanceIndexer2 with get(idx1,idx2) = x.instanceArray2.[idx1].[idx2] - member x.InstanceIndexer2Count1 = 2 - member x.InstanceIndexer2Count2 = 2 + member _.InstanceIndexer2Count1 = 2 + member _.InstanceIndexer2Count2 = 2 member x.MutableInstanceIndexerCount = Array.length x.mutableInstanceArray @@ -318,8 +318,8 @@ module RecordTypeTest = begin member x.MutableInstanceIndexer2 with get (idx1,idx2) = x.mutableInstanceArray2.[idx1].[idx2] and set (idx1,idx2) (v:string) = x.mutableInstanceArray2.[idx1].[idx2] <- v - member x.MutableInstanceIndexer2Count1 = 2 - member x.MutableInstanceIndexer2Count2 = 2 + member _.MutableInstanceIndexer2Count1 = 2 + member _.MutableInstanceIndexer2Count2 = 2 static member StaticProperty = staticField static member MutableStaticProperty @@ -353,8 +353,8 @@ module RecordTypeTest = begin with get(idx) = x.instanceArray.[idx] member x.PrivateInstanceIndexer2 with get(idx1,idx2) = x.instanceArray2.[idx1].[idx2] - member x.PrivateInstanceIndexer2Count1 = 2 - member x.PrivateInstanceIndexer2Count2 = 2 + member _.PrivateInstanceIndexer2Count1 = 2 + member _.PrivateInstanceIndexer2Count2 = 2 member x.PrivateMutableInstanceIndexerCount = Array.length x.mutableInstanceArray @@ -365,8 +365,8 @@ module RecordTypeTest = begin member x.PrivateMutableInstanceIndexer2 with get (idx1,idx2) = x.mutableInstanceArray2.[idx1].[idx2] and set (idx1,idx2) (v:string) = x.mutableInstanceArray2.[idx1].[idx2] <- v - member x.PrivateMutableInstanceIndexer2Count1 = 2 - member x.PrivateMutableInstanceIndexer2Count2 = 2 + member _.PrivateMutableInstanceIndexer2Count1 = 2 + member _.PrivateMutableInstanceIndexer2Count2 = 2 static member PrivateStaticProperty = staticField static member PrivateMutableStaticProperty @@ -602,35 +602,35 @@ module UnionTypeTest = begin static member MutableStaticIndexerCount = Array.length mutableStaticArray // methods - member x.InstanceMethod(s1:string) = Printf.sprintf "InstanceMethod(%s)" s1 + member _.InstanceMethod(s1:string) = Printf.sprintf "InstanceMethod(%s)" s1 static member StaticMethod((s1:string),(s2:string)) = Printf.sprintf "AbstractType.StaticMethod(%s,%s)" s1 s2 // private versions of the above - member x.PrivateInstanceProperty = "InstanceProperty" - member x.PrivateMutableInstanceProperty + member _.PrivateInstanceProperty = "InstanceProperty" + member _.PrivateMutableInstanceProperty with get() = "a" and set(v:string) = Printf.printf "called mutator\n" - member x.PrivateInstanceIndexerCount = 1 + member _.PrivateInstanceIndexerCount = 1 - member x.PrivateInstanceIndexer + member _.PrivateInstanceIndexer with get(idx) = "b" - member x.PrivateInstanceIndexer2 + member _.PrivateInstanceIndexer2 with get(idx1,idx2) = "c" - member x.PrivateInstanceIndexer2Count1 = 1 - member x.PrivateInstanceIndexer2Count2 = 1 + member _.PrivateInstanceIndexer2Count1 = 1 + member _.PrivateInstanceIndexer2Count2 = 1 - member x.PrivateMutableInstanceIndexerCount = 3 + member _.PrivateMutableInstanceIndexerCount = 3 - member x.PrivateMutableInstanceIndexer + member _.PrivateMutableInstanceIndexer with get (idx1) = "a" and set (idx1) (v:string) = Printf.printf "called mutator\n" - member x.PrivateMutableInstanceIndexer2 + member _.PrivateMutableInstanceIndexer2 with get (idx1,idx2) = "a" and set (idx1,idx2) (v:string) = Printf.printf "called mutator\n" - member x.PrivateMutableInstanceIndexer2Count1 = 2 - member x.PrivateMutableInstanceIndexer2Count2 = 2 + member _.PrivateMutableInstanceIndexer2Count1 = 2 + member _.PrivateMutableInstanceIndexer2Count2 = 2 static member PrivateStaticProperty = staticField static member PrivateMutableStaticProperty @@ -649,7 +649,7 @@ module UnionTypeTest = begin static member PrivateMutableStaticIndexerCount = Array.length mutableStaticArray // methods - member x.PrivateInstanceMethod(s1:string) = Printf.sprintf "InstanceMethod(%s)" s1 + member _.PrivateInstanceMethod(s1:string) = Printf.sprintf "InstanceMethod(%s)" s1 static member PrivateStaticMethod((s1:string),(s2:string)) = Printf.sprintf "AbstractType.StaticMethod(%s,%s)" s1 s2 end @@ -1286,7 +1286,7 @@ open System.Windows.Forms type MyCanvas2 = class inherit Form - override x.OnPaint(args) = Printf.printf "OnPaint\n"; base.OnPaint(args) + override _.OnPaint(args) = Printf.printf "OnPaint\n"; base.OnPaint(args) new() = { inherit Form(); } end @@ -1443,10 +1443,10 @@ module MultiInterfaceTest = begin type C1 = class interface PrivateInterfaceA1 with - member x.M1() = () + member _.M1() = () end interface PrivateInterfaceA2 with - member x.M2() = () + member _.M2() = () end end end @@ -1458,10 +1458,10 @@ module MultiInterfaceTestNameConflict = begin type C1 = class interface PrivateInterfaceA1 with - member x.M() = () + member _.M() = () end interface PrivateInterfaceA2 with - member x.M() = () + member _.M() = () end end end @@ -1474,10 +1474,10 @@ module GenericMultiInterfaceTestNameConflict = begin type C1 = class interface PrivateInterfaceA1 with - member x.M(y) = y + member _.M(y) = y end interface PrivateInterfaceA2 with - member x.M(y) = y + member _.M(y) = y end end end @@ -1491,28 +1491,28 @@ module DeepInterfaceInheritance = begin type C1 = class interface InterfaceA2 with - member x.M1(y) = y - member x.M2(y) = y + y + member _.M1(y) = y + member _.M2(y) = y + y end new() = { inherit Object(); } end type C2 = class interface InterfaceA3 with - member x.M1(y) = y - member x.M2(y) = y + y - member x.M3(y) = y + y + y + member _.M1(y) = y + member _.M2(y) = y + y + member _.M3(y) = y + y + y end new() = { inherit Object(); } end type C3 = class interface InterfaceA2 with - member x.M1(y) = y - member x.M2(y) = y + y + member _.M1(y) = y + member _.M2(y) = y + y end interface InterfaceA3 with - member x.M3(y) = y + y + y + member _.M3(y) = y + y + y end new() = { inherit Object(); } end @@ -1542,28 +1542,28 @@ module DeepGenericInterfaceInheritance = begin type C1 = class interface InterfaceA2 with - member obj.M1(y) = 1::y - member obj.M2(x,y) = x::y + member _.M1(y) = 1::y + member _.M2(x,y) = x::y end new() = { inherit Object(); } end type C2 = class interface InterfaceA3 with - member obj.M1(y) = "a" :: y - member obj.M2(x,y) = x :: y - member obj.M3(y) = "a" :: "b" :: "c" :: y + member _.M1(y) = "a" :: y + member _.M2(x,y) = x :: y + member _.M3(y) = "a" :: "b" :: "c" :: y end new() = { inherit Object(); } end type C3 = class interface InterfaceA2 with - member obj.M1(y) = "a" :: y - member obj.M2(x,y) = x :: y + member _.M1(y) = "a" :: y + member _.M2(x,y) = x :: y end interface InterfaceA3 with - member obj.M3(y) = "a" :: "b" :: "c" :: y + member _.M3(y) = "a" :: "b" :: "c" :: y end new() = { inherit Object(); } end @@ -1892,12 +1892,12 @@ module Ralf = begin val PrecisionMean : float val Precision : float new (precisionMean, precision) = { PrecisionMean = 0.0; Precision = 0.0 } - override x.NumberOfDimensions() = 1 - override x.Density point = 1.0 - override x.AbsoluteDifference distribution = 0.0 - override x.Clone() = new Gaussian1D (0.0,0.0) :> Distribution + override _.NumberOfDimensions() = 1 + override _.Density point = 1.0 + override _.AbsoluteDifference distribution = 0.0 + override _.Clone() = new Gaussian1D (0.0,0.0) :> Distribution override x.CloneConstant() = new Gaussian1D (x.PrecisionMean,x.Precision) :> Distribution - override x.Sample numberOfSamples random = failwith "" // new Matrix (numberOfSamples,x.NumberOfDimensions) + override _.Sample numberOfSamples random = failwith "" // new Matrix (numberOfSamples,x.NumberOfDimensions) end end @@ -2015,19 +2015,19 @@ module PropertyOverrideTests = begin type CTest = class inherit A - override x.S1 with set v = () - override x.S2 with set s v = () - override x.S3 with set (s1,s2) v = () - override x.G1 with get () = 1.0 - override x.G2 with get (s:string) = 2.0 - override x.G3 with get (s1,s2) = 3.0 + override _.S1 with set v = () + override _.S2 with set s v = () + override _.S3 with set (s1,s2) v = () + override _.G1 with get () = 1.0 + override _.G2 with get (s:string) = 2.0 + override _.G3 with get (s1,s2) = 3.0 interface IA with - override x.S1 with set v = () - override x.S2 with set s v = () - override x.S3 with set (s1,s2) v = () - override x.G1 with get () = 1.0 - override x.G2 with get (s:string) = 2.0 - override x.G3 with get (s1,s2) = 3.0 + override _.S1 with set v = () + override _.S2 with set s v = () + override _.S3 with set (s1,s2) v = () + override _.G1 with get () = 1.0 + override _.G2 with get (s:string) = 2.0 + override _.G3 with get (s1,s2) = 3.0 end end @@ -2439,7 +2439,7 @@ module BaseCallTest = begin type C1 = class new() = {} abstract Blah : unit -> unit - default this.Blah () = + default _.Blah () = ignore <| printf "From C1\n"; res := !res + 2 end @@ -2447,7 +2447,7 @@ module BaseCallTest = begin type C2 = class inherit C1 new() = {inherit C1()} - override this.Blah() = + override _.Blah() = ignore <| printf "From C2\n"; res := !res + 1; base.Blah() @@ -2465,7 +2465,7 @@ module BaseCallTest2 = begin type C1 = class new() = {} abstract Blah : unit -> unit - default this.Blah () = + default _.Blah () = ignore <| printf "From C1b\n"; ignore <| printf "From C1b\n"; ignore <| printf "From C1b\n"; @@ -2478,7 +2478,7 @@ module BaseCallTest2 = begin type C2 = class inherit C1 new() = {inherit C1()} - override this.Blah() = + override _.Blah() = ignore <| printf "From C2b\n"; ignore <| printf "From C2b\n"; ignore <| printf "From C2b\n"; @@ -2492,7 +2492,7 @@ module BaseCallTest2 = begin type C3 = class inherit C2 new() = {inherit C2()} - override this.Blah() = + override _.Blah() = ignore <| printf "From C3c\n"; ignore <| printf "From C3c\n"; ignore <| printf "From C3c\n"; @@ -2559,7 +2559,7 @@ module SettingPropertiesInConstruction = begin val mutable q : int member x.Q with set v = x.q <- v abstract Foo : int -> int - default o.Foo(x) = x + default _.Foo(x) = x new() = { p = 0; q = 1 } end @@ -2728,7 +2728,7 @@ module StephenTolksdorfBug1112 = begin type Test() = class interface ITest2 with - member x.Foo<'t>(v:'t) : 't = v + member _.Foo<'t>(v:'t) : 't = v end end @@ -2751,7 +2751,7 @@ module Bug1281Test = begin val mutable key: int new (keyIn) = {key=keyIn} - member n.Item with get(i:int) = if i=0 then 1 else + member _.Item with get(i:int) = if i=0 then 1 else failwith "node has 2 items only" end let nd = new node (10) @@ -2772,11 +2772,11 @@ module Bug960Test1 = begin type C = class inherit B - override x.A + override _.A with get() = 3 and set(v : int) = (invalidArg "arg" "C.A.set" : unit) - override x.M() = 3 + override _.M() = 3 end end @@ -2804,7 +2804,7 @@ module Bug960Test2 = begin new() = { inherit B(3,4) } - override x.A + override _.A with get() = 3 and set(v : int) = (invalidArg "arg" "C.A.set" : unit) end end @@ -2815,19 +2815,19 @@ module RandomAdditionalNameResolutionTests = begin module M = begin type Foo() = class - member x.Name = "a" + member _.Name = "a" end type Foo<'a>() = class - member x.Name = "a" + member _.Name = "a" end type Goo<'a>() = class - member x.Name = "a" + member _.Name = "a" end type Goo() = class - member x.Name = "a" + member _.Name = "a" end end @@ -3103,9 +3103,9 @@ module CondensationTest = begin class [] - member this.Prop = "Hello" + member _.Prop = "Hello" [] - member this.Meth() = "Boo" + member _.Meth() = "Boo" end let getAttribute<'t> (memb: MemberInfo) = let attrib = memb.GetCustomAttributes(typeof<'t>, false) in @@ -3138,7 +3138,7 @@ module OptionalArgumentWithSubTyping = begin type Test(?bse: Base) = class let value = match bse with Some b -> b | _ -> new Base() - member t.Value = value + member _.Value = value end let t1 = new Test(bse=Base()) // should not trigger exception @@ -3254,7 +3254,7 @@ module NewConstraintUtilizedInTypeEstablishment_FSharp_1_0_4850 = begin type D() = class let f = 0 interface I with - member x.foo = f + 1 + member _.foo = f + 1 end end @@ -3264,8 +3264,8 @@ module TestTupleOverloadRules_Bug5985 = begin type C() = class - member device.CheckCooperativeLevel() = true - member device.CheckCooperativeLevel([] x:byref) = true + member _.CheckCooperativeLevel() = true + member _.CheckCooperativeLevel([] x:byref) = true end let c = C() diff --git a/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs b/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs index 57d4eff5ef..6737932632 100644 --- a/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs +++ b/vsintegration/src/FSharp.Editor/CodeFix/RenameUnusedValue.fs @@ -69,12 +69,8 @@ type internal FSharpRenameUnusedValueCodeFixProvider match symbolUse.Symbol with | :? FSharpMemberOrFunctionOrValue as func -> createCodeFix(context, symbolName, SR.PrefixValueNameWithUnderscore(), TextChange(TextSpan(context.Span.Start, 0), "_")) - - if func.IsMemberThisValue then - createCodeFix(context, symbolName, SR.RenameValueToDoubleUnderscore(), TextChange(context.Span, "__")) - elif func.IsValue then - createCodeFix(context, symbolName, SR.RenameValueToUnderscore(), TextChange(context.Span, "_")) + if func.IsValue then createCodeFix(context, symbolName, SR.RenameValueToUnderscore(), TextChange(context.Span, "_")) | _ -> () } |> Async.Ignore - |> RoslynHelpers.StartAsyncUnitAsTask(context.CancellationToken) \ No newline at end of file + |> RoslynHelpers.StartAsyncUnitAsTask(context.CancellationToken) From 7784db679fca9d1d4a3d902ba1417d1dad6a29b5 Mon Sep 17 00:00:00 2001 From: Gustavo Leon <1261319+gusty@users.noreply.github.com> Date: Sun, 2 Jun 2019 20:29:33 +0200 Subject: [PATCH 083/286] Add missing case for underscore in 'for _ =' (#6867) * Add missing case for underscore in 'for _ =' * Add a forloop test with a wildcard --- src/fsharp/pars.fsy | 3 ++- tests/fsharp/core/forexpression/test.fsx | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 9168e46c72..03c8902b3e 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -130,7 +130,8 @@ let mkDefnBindings (mWhole,BindingSetPreAttrs(_,isRec,isUse,declsPreAttrs,_bindi attrDecls @ letDecls let idOfPat m p = - match p with + match p with + | SynPat.Wild r -> mkSynId r "_" | SynPat.Named (SynPat.Wild _,id,false,_,_) -> id | SynPat.LongIdent(LongIdentWithDots([id],_),_,None, SynConstructorArgs.Pats [], None,_) -> id | _ -> raiseParseErrorAt m (FSComp.SR.parsIntegerForLoopRequiresSimpleIdentifier()) diff --git a/tests/fsharp/core/forexpression/test.fsx b/tests/fsharp/core/forexpression/test.fsx index 6384d11369..437f62b971 100644 --- a/tests/fsharp/core/forexpression/test.fsx +++ b/tests/fsharp/core/forexpression/test.fsx @@ -19,6 +19,7 @@ let testData = let expectedArraySum = 167167000 // Find an expression for this sum from count let expectedRangeSum = ((count + 1) * count) / 2 let expectedStringSum = 30 +let expectedWildCard = count + 1 let getTestData (inner : int [] -> #seq) (outer : #seq [] -> #seq<'U>) = (testData |> Array.map inner) |> outer @@ -115,6 +116,13 @@ let sumOverString () = sum <- sum + ((int i) - (int '0')) #endif sum + +// usingWildcard counts using a wildcard in a for loop +let usingWildcard () = + let mutable sum = 0 + for _ = 0 to count do + sum <- sum + 1 + sum let arraySum = sumOverArray () let seqSum = sumOverSeq () @@ -124,6 +132,7 @@ let listSum = sumOverList () let ilistSum = sumOverIList () let rangeSum = sumOverRange () let stringSum = sumOverString () +let wildCard = usingWildcard () do test "arraySum" (expectedArraySum = arraySum ) do test "seqSum" (expectedArraySum = seqSum ) @@ -133,6 +142,7 @@ do test "listSum" (expectedArraySum = listSum ) do test "ilistSum" (expectedArraySum = ilistSum ) do test "rangeSum" (expectedRangeSum = rangeSum ) do test "stringSum" (expectedStringSum = stringSum ) +do test "wildCard" (expectedWildCard = wildCard ) #if TESTS_AS_APP let RUN() = !failures From dbd55ae2176c400b2145b0e9deeffb141ae5f19a Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 3 Jun 2019 01:00:43 +0100 Subject: [PATCH 084/286] [RFC FS-1070] relax indentations for static members and constructors (#6808) * relax indentations * fix baseline * add diagnostics * add diagnostics * diagnostics * diagnostics * diagnostics * add diagnostics and possible fix for tp smoke tests * fix build * fix build * more diagnostics * try to fix flaky test * Update neg77.fsx * fix build * try to fix dodgy test * Fix unused opens false positive for record fields (#6846) * Fix unused opens false positive for record fields * Add record check * add CI leg to verify assemblies aren't unnecessarily being rebuilt (#6816) * Removing option from Tuple active pattern (#6772) --- src/fsharp/LexFilter.fs | 9 ++++- tests/fsharp/typecheck/sigs/neg77.bsl | 12 ++++++ tests/fsharp/typecheck/sigs/neg77.fsx | 54 +++++++++++++++++++++++++ tests/fsharp/typecheck/sigs/neg77.vsbsl | 24 +++++++++++ 4 files changed, 98 insertions(+), 1 deletion(-) diff --git a/src/fsharp/LexFilter.fs b/src/fsharp/LexFilter.fs index 7cfdbcf494..a125a64d7b 100755 --- a/src/fsharp/LexFilter.fs +++ b/src/fsharp/LexFilter.fs @@ -764,7 +764,13 @@ type LexFilterImpl (lightSyntaxStatus: LightSyntaxStatus, compilingFsLib, lexer, // 'type C = class ... ' limited by 'type' // 'type C = interface ... ' limited by 'type' // 'type C = struct ... ' limited by 'type' - | _, (CtxtParen ((CLASS | STRUCT | INTERFACE), _) :: CtxtSeqBlock _ :: (CtxtTypeDefns _ as limitCtxt) :: _) + | _, (CtxtParen ((CLASS | STRUCT | INTERFACE), _) :: CtxtSeqBlock _ :: (CtxtTypeDefns _ as limitCtxt) :: _) + // 'type C(' limited by 'type' + | _, (CtxtSeqBlock _ :: CtxtParen(LPAREN, _) :: (CtxtTypeDefns _ as limitCtxt) :: _ ) + // 'static member C(' limited by 'static', likewise others + | _, (CtxtSeqBlock _ :: CtxtParen(LPAREN, _) :: (CtxtMemberHead _ as limitCtxt) :: _ ) + // 'static member P with get() = ' limited by 'static', likewise others + | _, (CtxtWithAsLet _ :: (CtxtMemberHead _ as limitCtxt) :: _ ) -> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol + 1) // REVIEW: document these @@ -780,6 +786,7 @@ type LexFilterImpl (lightSyntaxStatus: LightSyntaxStatus, compilingFsLib, lexer, // else expr | (CtxtIf _ | CtxtElse _ | CtxtThen _), (CtxtIf _ as limitCtxt) :: _rest -> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol) + // Permitted inner-construct precise block alignment: // while ... // do expr diff --git a/tests/fsharp/typecheck/sigs/neg77.bsl b/tests/fsharp/typecheck/sigs/neg77.bsl index 922e6b6695..3598ff0c93 100644 --- a/tests/fsharp/typecheck/sigs/neg77.bsl +++ b/tests/fsharp/typecheck/sigs/neg77.bsl @@ -4,3 +4,15 @@ neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: th neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions. neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression + +neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions. diff --git a/tests/fsharp/typecheck/sigs/neg77.fsx b/tests/fsharp/typecheck/sigs/neg77.fsx index c354321cde..2f38101f2d 100644 --- a/tests/fsharp/typecheck/sigs/neg77.fsx +++ b/tests/fsharp/typecheck/sigs/neg77.fsx @@ -243,6 +243,60 @@ do Application.Run(form) #endif +open System + +type OffsideCheck(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = 1 + +module M = + type OffsideCheck(a:int, + b:int, c:int, // warning + d:int, e:int, + f:int) = + class end + +module M2 = + type OffsideCheck() = + static member M(a:int, + b:int, c:int, // warning + d:int, e:int, + f:int) = 1 + +type C() = + static member P with get() = + 1 // no warning + +module M3 = + type C() = + static member P with get() = + 1 // warning + + +type OffsideCheck2(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = 1 + +type OffsideCheck3(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = 1 + + diff --git a/tests/fsharp/typecheck/sigs/neg77.vsbsl b/tests/fsharp/typecheck/sigs/neg77.vsbsl index 4483229805..32adc1f3b9 100644 --- a/tests/fsharp/typecheck/sigs/neg77.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg77.vsbsl @@ -5,10 +5,34 @@ neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: th neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression +neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions. + neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions. neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions. neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression +neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions. + +neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions. + neg77.fsx(153,75,153,79): typecheck error FS0001: The type 'Planet * 'a' is not compatible with the type 'Planet' From 896a6e3b3aca25713ca426907f6d879ffe991747 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Mon, 3 Jun 2019 17:01:03 +0100 Subject: [PATCH 085/286] code review --- src/fsharp/FSComp.txt | 2 +- src/fsharp/TastOps.fs | 2 +- src/fsharp/TypeChecker.fs | 2 +- src/fsharp/xlf/FSComp.txt.cs.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.de.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.es.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.fr.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.it.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.ja.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.ko.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.pl.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.ru.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.tr.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 4 ++-- src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 4 ++-- .../FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs | 10 +++------- .../DataExpressions/NameOf/E_NameOfWithPipe.fs | 2 +- 18 files changed, 33 insertions(+), 37 deletions(-) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index e6d6fa4b6f..5bc65b50c1 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1460,7 +1460,7 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl 3244,parsInvalidAnonRecdType,"Invalid anonymous record type" 3245,tcCopyAndUpdateNeedsRecordType,"The input to a copy-and-update expression that creates an anonymous record must be either an anonymous record or a record" 3250,expressionHasNoName,"Expression does not have a name." -3251,chkNoFirstClassNameOf,"First-class uses of the 'nameof' operator is not permitted." +3251,chkNoFirstClassNameOf,"Using the 'nameof' operator as a first-class function value is not permitted." 3300,chkInvalidFunctionParameterType,"The parameter '%s' has an invalid type '%s'. This is not permitted by the rules of Common IL." 3301,chkInvalidFunctionReturnType,"The function or method has an invalid return type '%s'. This is not permitted by the rules of Common IL." useSdkRefs,"Use reference assemblies for .NET framework references when available (Enabled by default)." diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 402d314ce8..55436c9184 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -3208,7 +3208,7 @@ let isSizeOfValRef g vref = let isNameOfValRef g vref = valRefEq g vref g.nameof_vref - // There is an internal version of typeof defined in prim-types.fs that needs to be detected + // There is an internal version of nameof defined in prim-types.fs that needs to be detected || (g.compilingFslib && vref.LogicalName = "nameof") let isTypeDefOfValRef g vref = diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 50eb6e732c..3e3258f7f3 100644 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -8805,7 +8805,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( //------------------------------------------------------------------------- and GetLongIdentTypeNameInfo delayed = - // Given 'MyOverloadedType.MySubType...' use arity of #given type arguments to help + // Given 'MyOverloadedType.MySubType...' use the number of given type arguments to help // resolve type name lookup of 'MyOverloadedType' // Also determine if type names should resolve to Item.Types or Item.CtorGroup match delayed with diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 2bfe3ef9c7..ad829ea660 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -7168,8 +7168,8 @@ - First-class uses of the 'nameof' operator is not permitted. - First-class uses of the 'nameof' operator is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index c7b95347b5..c9fb3d2d97 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -7168,8 +7168,8 @@ - First-class uses of the 'nameof' operator is not permitted. - First-class uses of the 'nameof' operator is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index 67530d8dbc..2b69e09ee9 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -7168,8 +7168,8 @@ - First-class uses of the 'nameof' operator is not permitted. - First-class uses of the 'nameof' operator is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index 52e151c896..22a2805509 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -7168,8 +7168,8 @@ - First-class uses of the 'nameof' operator is not permitted. - First-class uses of the 'nameof' operator is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index bda1c45e0b..1118b04fbb 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -7168,8 +7168,8 @@ - First-class uses of the 'nameof' operator is not permitted. - First-class uses of the 'nameof' operator is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index cb430d479a..39718690a4 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -7170,8 +7170,8 @@ - First-class uses of the 'nameof' operator is not permitted. - First-class uses of the 'nameof' operator is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index d8120ef1f2..9c03341891 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -7168,8 +7168,8 @@ - First-class uses of the 'nameof' operator is not permitted. - First-class uses of the 'nameof' operator is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index 05aced50fa..db1ab32f2b 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -7168,8 +7168,8 @@ - First-class uses of the 'nameof' operator is not permitted. - First-class uses of the 'nameof' operator is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 8b7d829074..099daff7c8 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -7168,8 +7168,8 @@ - First-class uses of the 'nameof' operator is not permitted. - First-class uses of the 'nameof' operator is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 993942ee06..97479232b4 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -7168,8 +7168,8 @@ - First-class uses of the 'nameof' operator is not permitted. - First-class uses of the 'nameof' operator is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index f8c8f6dd1a..8587d749f6 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -7168,8 +7168,8 @@ - First-class uses of the 'nameof' operator is not permitted. - First-class uses of the 'nameof' operator is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index af7649d2c9..32b33d4ada 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -7168,8 +7168,8 @@ - First-class uses of the 'nameof' operator is not permitted. - First-class uses of the 'nameof' operator is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 860f8f47f5..09d128221f 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -7168,8 +7168,8 @@ - First-class uses of the 'nameof' operator is not permitted. - First-class uses of the 'nameof' operator is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. + Using the 'nameof' operator as a first-class function value is not permitted. diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs index c9f9c51b2f..32decc4910 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs @@ -172,20 +172,18 @@ type FrameworkMethodTests() = let b = nameof(System.Tuple.Create) Assert.AreEqual("Create",b) - type CustomUnionType = -| OptionA -| OptionB of int * string + | OptionA + | OptionB of int * string type CustomRecordType = - { X: int; Y: int } + { X: int; Y: int } [] type Milliquacks [] type UnionAndRecordNameOfTests() = - [] member this.``measure 1`` () = let b = nameof(Milliquacks) @@ -295,5 +293,3 @@ type Person = | x when x = nameof __.Name -> { __ with Name = string value } | x when x = nameof __.Age -> { __ with Age = value :?> int } | _ -> __ - - diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs index 086a3c252b..26074a4cac 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfWithPipe.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof can't be used as a function. -//First-class uses of the 'nameof' operator is not permitted. +//Using the 'nameof' operator as a first-class function value is not permitted. let curriedFunction x y = x * y let b = curriedFunction |> nameof From 666fc5042c16e51db52f8bb7dfb7440514d97e2c Mon Sep 17 00:00:00 2001 From: Fraser Waters Date: Mon, 3 Jun 2019 20:14:26 +0100 Subject: [PATCH 086/286] Add maxDegreeOfParallelism to Async.Parallel (#6357) * Add maxDegreeOfParallelism to Async.Parallel * Add overload * Revert white space changes * Add argument validation and tests * Duplicate Parallel tests to also test with maxDegreeOfParallelism * Fix race condition * Start at -1 * Add Sequential --- src/fsharp/FSharp.Core/FSCore.resx | 3 + src/fsharp/FSharp.Core/async.fs | 66 ++++++++++++++++--- src/fsharp/FSharp.Core/async.fsi | 29 ++++++++ src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf | 5 ++ src/fsharp/FSharp.Core/xlf/FSCore.de.xlf | 5 ++ src/fsharp/FSharp.Core/xlf/FSCore.es.xlf | 5 ++ src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf | 5 ++ src/fsharp/FSharp.Core/xlf/FSCore.it.xlf | 5 ++ src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf | 5 ++ src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf | 5 ++ src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf | 5 ++ src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf | 5 ++ src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf | 5 ++ src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf | 5 ++ src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf | 5 ++ src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf | 5 ++ .../Microsoft.FSharp.Control/AsyncModule.fs | 61 +++++++++++++++++ 17 files changed, 215 insertions(+), 9 deletions(-) diff --git a/src/fsharp/FSharp.Core/FSCore.resx b/src/fsharp/FSharp.Core/FSCore.resx index 8b74b1d039..b90b5442f2 100644 --- a/src/fsharp/FSharp.Core/FSCore.resx +++ b/src/fsharp/FSharp.Core/FSCore.resx @@ -540,4 +540,7 @@ This is not a valid query expression. The construct '{0}' was used in a query but is not recognized by the F#-to-LINQ query translator. Check the specification of permitted queries and consider moving some of the operations out of the query expression. + + maxDegreeOfParallelism must be positive, was {0} + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/async.fs b/src/fsharp/FSharp.Core/async.fs index 86a1b262a4..1d4eb37ecc 100644 --- a/src/fsharp/FSharp.Core/async.fs +++ b/src/fsharp/FSharp.Core/async.fs @@ -1165,7 +1165,13 @@ namespace Microsoft.FSharp.Control async { let! cancellationToken = cancellationTokenAsync return AsyncPrimitives.StartAsTask cancellationToken computation taskCreationOptions } - static member Parallel (computations: seq>) = + static member Parallel (computations: seq>) = Async.Parallel(computations, ?maxDegreeOfParallelism=None) + + static member Parallel (computations: seq>, ?maxDegreeOfParallelism: int) = + match maxDegreeOfParallelism with + | Some x when x < 1 -> raise(System.ArgumentException(String.Format(SR.GetString(SR.maxDegreeOfParallelismNotPositive), x), "maxDegreeOfParallelism")) + | _ -> () + MakeAsync (fun ctxt -> let tasks, result = try @@ -1220,19 +1226,61 @@ namespace Microsoft.FSharp.Control | _ -> () finishTask(Interlocked.Decrement &count) - tasks |> Array.iteri (fun i p -> - QueueAsync + // If maxDegreeOfParallelism is set but is higher then the number of tasks we have we set it back to None to fall into the simple + // queue all items branch + let maxDegreeOfParallelism = + match maxDegreeOfParallelism with + | None -> None + | Some maxDegreeOfParallelism -> if maxDegreeOfParallelism >= tasks.Length then None else Some maxDegreeOfParallelism + + // Simple case (no maxDegreeOfParallelism) just queue all the work, if we have maxDegreeOfParallelism set we start that many workers + // which will make progress on the actual computations + match maxDegreeOfParallelism with + | None -> + tasks |> Array.iteri (fun i p -> + QueueAsync + innerCTS.Token + // on success, record the result + (fun res -> recordSuccess i res) + // on exception... + (fun edi -> recordFailure (Choice1Of2 edi)) + // on cancellation... + (fun cexn -> recordFailure (Choice2Of2 cexn)) + p + |> unfake) + | Some maxDegreeOfParallelism -> + let mutable i = -1 + let worker = MakeAsync (fun _ -> + while i < tasks.Length do + let j = Interlocked.Increment &i + if j < tasks.Length then + let trampolineHolder = new TrampolineHolder() + trampolineHolder.ExecuteWithTrampoline (fun () -> + let ctxt = + AsyncActivation.Create + innerCTS.Token + trampolineHolder + (fun res -> recordSuccess j res) + (fun edi -> recordFailure (Choice1Of2 edi)) + (fun cexn -> recordFailure (Choice2Of2 cexn)) + tasks.[j].Invoke ctxt + ) + |> unfake + fake() + ) + for x = 1 to maxDegreeOfParallelism do + QueueAsync innerCTS.Token - // on success, record the result - (fun res -> recordSuccess i res) - // on exception... + (fun _ -> fake()) (fun edi -> recordFailure (Choice1Of2 edi)) - // on cancellation... (fun cexn -> recordFailure (Choice2Of2 cexn)) - p - |> unfake) + worker + |> unfake + fake())) + static member Sequential (computations: seq>) = Async.Parallel(computations, maxDegreeOfParallelism=1) + static member Choice(computations: Async<'T option> seq) : Async<'T option> = MakeAsync (fun ctxt -> let result = diff --git a/src/fsharp/FSharp.Core/async.fsi b/src/fsharp/FSharp.Core/async.fsi index 8e054b39b6..a040722581 100644 --- a/src/fsharp/FSharp.Core/async.fsi +++ b/src/fsharp/FSharp.Core/async.fsi @@ -161,6 +161,35 @@ namespace Microsoft.FSharp.Control /// A computation that returns an array of values from the sequence of input computations. static member Parallel : computations:seq> -> Async<'T[]> + /// Creates an asynchronous computation that executes all the given asynchronous computations, + /// initially queueing each as work items and using a fork/join pattern. + /// + /// If all child computations succeed, an array of results is passed to the success continuation. + /// + /// If any child computation raises an exception, then the overall computation will trigger an + /// exception, and cancel the others. + /// + /// The overall computation will respond to cancellation while executing the child computations. + /// If cancelled, the computation will cancel any remaining child computations but will still wait + /// for the other child computations to complete. + /// A sequence of distinct computations to be parallelized. + /// A computation that returns an array of values from the sequence of input computations. + static member Parallel : computations:seq> * ?maxDegreeOfParallelism : int -> Async<'T[]> + + /// Creates an asynchronous computation that executes all the given asynchronous computations sequentially. + /// + /// If all child computations succeed, an array of results is passed to the success continuation. + /// + /// If any child computation raises an exception, then the overall computation will trigger an + /// exception, and cancel the others. + /// + /// The overall computation will respond to cancellation while executing the child computations. + /// If cancelled, the computation will cancel any remaining child computations but will still wait + /// for the other child computations to complete. + /// A sequence of distinct computations to be run in sequence. + /// A computation that returns an array of values from the sequence of input computations. + static member Sequential : computations:seq> -> Async<'T[]> + /// Creates an asynchronous computation that executes all given asynchronous computations in parallel, /// returning the result of the first succeeding computation (one whose result is 'Some x'). /// If all child computations complete with None, the parent computation also returns None. diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf index 7c8e97d650..e1e2a27ab6 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf @@ -707,6 +707,11 @@ Toto není platný výraz dotazu. V dotazu byla použita konstrukce {0}, která není rozpoznána překladačem dotazu z jazyka F# do jazyka LINQ. Prostudujte si specifikace povolených dotazů a zvažte přesunutí některých operací mimo výraz dotazu. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.de.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.de.xlf index cfcd71290f..be95b723e6 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.de.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.de.xlf @@ -707,6 +707,11 @@ Dies ist kein gültiger Abfrageausdruck. Das Konstrukt "{0}" wurde in einer Abfrage verwendet, wird jedoch vom F#-to-LINQ-Abfragekonvertierungsprogramm nicht erkannt. Überprüfen Sie die Spezifikation zulässiger Abfragen, und entfernen Sie unter Umständen einige Operationen aus dem Abfrageausdruck. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.es.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.es.xlf index 46a617777f..ad05289fb6 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.es.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.es.xlf @@ -707,6 +707,11 @@ Esta no es una expresión de consulta válida. La construcción '{0}' se usó en una consulta, pero el traductor de consultas F#-to-LINQ no la reconoce. Compruebe la especificación de consultas permitidas y considere mover algunas de las operaciones fuera de la expresión de consulta. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf index 09dfb48a62..46f595fa21 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf @@ -707,6 +707,11 @@ Cette expression de requête n'est pas valide. La construction '{0}' a été utilisée dans une requête, mais n'est pas reconnue par le traducteur de requête F#-to-LINQ. Vérifiez la spécification des requêtes autorisées et envisagez de retirer certaines opérations de l'expression de requête. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.it.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.it.xlf index 5598638a5f..ea57def3be 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.it.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.it.xlf @@ -707,6 +707,11 @@ Espressione di query non valida. Il costrutto '{0}' è stato utilizzato in una query ma non è stato riconosciuto dal traduttore di query da F# a LINQ. Verificare le specifiche delle query consentite e provare a spostare alcune operazioni all'esterno dell'espressione di query. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf index d33e013cb6..a62609fafb 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf @@ -707,6 +707,11 @@ これは有効なクエリ式ではありません。クエリで構造 '{0}' が使用されていますが、F# から LINQ へのクエリ トランスレーターに認識されません。許可されたクエリの仕様を確認し、一部の操作をクエリ式の外に移動することを検討してください。 + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf index ed24759baa..018fd4ac35 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf @@ -707,6 +707,11 @@ 올바른 쿼리 식이 아닙니다. '{0}' 구문이 쿼리에 사용되었지만 F#-to-LINQ 쿼리 변환기에서 인식할 수 없습니다. 허용되는 쿼리의 사양을 확인하고 일부 연산을 쿼리 식 외부로 이동하세요. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf index 3d869bc263..67c614650b 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf @@ -707,6 +707,11 @@ To nie jest prawidłowe wyrażenie zapytania. Konstrukcja „{0}” została użyta w zapytaniu, ale nie rozpoznaje jej translator zapytań z języka F# na język LINQ. Sprawdź specyfikacje dozwolonych zapytań i rozważ przeniesienie niektórych operacji poza wyrażenie zapytania. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf index 48c0450f62..01192de362 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf @@ -707,6 +707,11 @@ Expressão de consulta inválida. A construção '{0}' foi usada em uma consulta, mas não é reconhecida pelo conversor de consultas F#-to-LINQ. Verifique a especificação de consultas permitidas e considere remover algumas das operações da expressão de consulta. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf index cb488ded3e..81aa2e8561 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf @@ -707,6 +707,11 @@ Недопустимое выражение запроса. Конструкция "{0}" использовалась запросе, но не была распознана транслятором запросов из F# в LINQ. Проверьте спецификацию разрешенных запросов и попробуйте вынести часть операций за пределы выражения запроса. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf index 2baf7f4b07..ab262b8e56 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf @@ -707,6 +707,11 @@ Bu geçerli bir sorgu ifadesi değil. '{0}' yapısı sorguda kullanıldı, ancak F#-to-LINQ çevirmeni tarafından tanınmıyor. İzin verilen soruların belirtimini denetleyin ve işlemlerden bazılarını sorgu ifadesinin dışına taşımayı düşünün. + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf index 9bac5ce1a8..58fcba36d9 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf @@ -707,6 +707,11 @@ 这不是有效的查询表达式。查询中使用了构造“{0}”,但 F#-LINQ 查询转换器无法识别该构造。请查看有效查询的规范,考虑是否将部分运算移到查询表达式之外。 + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf index e75ede8758..7ebdf213bf 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf @@ -707,6 +707,11 @@ 這不是有效的查詢運算式。查詢中使用了建構 '{0}',但 F#-to-LINQ 查詢翻譯工具無法加以辨認。請檢查所允許之查詢的規格,並考慮將一些運算移出查詢運算式。 + + maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism must be positive, was {0} + + \ No newline at end of file diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs index 3e33f34bd5..9154bd875d 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs @@ -626,3 +626,64 @@ type AsyncModule() = } |> Async.RunSynchronously Console.WriteLine "Checking result...." Assert.AreEqual(1, !x) + + [] + member this.``Parallel with maxDegreeOfParallelism`` () = + let mutable i = 1 + let action j = async { + Assert.AreEqual(j, i) + i <- i + 1 + } + let computation = + [| for i in 1 .. 1000 -> action i |] + |> fun cs -> Async.Parallel(cs, 1) + Async.RunSynchronously(computation) |> ignore + + [] + member this.``maxDegreeOfParallelism can not be 0`` () = + try + [| for i in 1 .. 10 -> async { return i } |] + |> fun cs -> Async.Parallel(cs, 0) + |> ignore + Assert.Fail("Unexpected success") + with + | :? System.ArgumentException as exc -> + Assert.AreEqual("maxDegreeOfParallelism", exc.ParamName) + Assert.True(exc.Message.Contains("maxDegreeOfParallelism must be positive, was 0")) + + [] + member this.``maxDegreeOfParallelism can not be negative`` () = + try + [| for i in 1 .. 10 -> async { return i } |] + |> fun cs -> Async.Parallel(cs, -1) + |> ignore + Assert.Fail("Unexpected success") + with + | :? System.ArgumentException as exc -> + Assert.AreEqual("maxDegreeOfParallelism", exc.ParamName) + Assert.True(exc.Message.Contains("maxDegreeOfParallelism must be positive, was -1")) + + [] + member this.``RaceBetweenCancellationAndError.Parallel``() = + [| for i in 1 .. 1000 -> async { return i } |] + |> fun cs -> Async.Parallel(cs, 1) + |> testErrorAndCancelRace + + [] + member this.``error on one workflow should cancel all others with maxDegreeOfParallelism``() = + let counter = + async { + let counter = ref 0 + let job i = async { + if i = 55 then failwith "boom" + else + do! Async.Sleep 1000 + incr counter + } + + let! _ = Async.Parallel ([ for i in 1 .. 100 -> job i ], 2) |> Async.Catch + do! Async.Sleep 5000 + return !counter + } |> Async.RunSynchronously + + Assert.AreEqual(0, counter) \ No newline at end of file From 14646945a98288b221a109fbee49bae34ef57fc3 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Mon, 3 Jun 2019 12:13:18 -0700 Subject: [PATCH 087/286] Update surface area --- .../SurfaceArea.coreclr.fs | 2 + .../SurfaceArea.net40.fs | 137 +++++++++--------- 2 files changed, 71 insertions(+), 68 deletions(-) diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs index bc647b34ae..4d1c570e6f 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs @@ -620,6 +620,8 @@ Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[Sys Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[System.Threading.CancellationToken] get_CancellationToken() Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[System.Threading.Tasks.Task`1[T]] StartChildAsTask[T](Microsoft.FSharp.Control.FSharpAsync`1[T], Microsoft.FSharp.Core.FSharpOption`1[System.Threading.Tasks.TaskCreationOptions]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T[]] Parallel[T](System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Control.FSharpAsync`1[T]]) +Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T[]] Parallel[T](System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Control.FSharpAsync`1[T]], Microsoft.FSharp.Core.FSharpOption`1[System.Int32]) +Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T[]] Sequential[T](System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Control.FSharpAsync`1[T]]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T] AwaitEvent[TDel,T](Microsoft.FSharp.Control.IEvent`2[TDel,T], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit]]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T] AwaitTask[T](System.Threading.Tasks.Task`1[T]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T] FromBeginEnd[TArg1,TArg2,TArg3,T](TArg1, TArg2, TArg3, Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`5[TArg1,TArg2,TArg3,System.AsyncCallback,System.Object],System.IAsyncResult], Microsoft.FSharp.Core.FSharpFunc`2[System.IAsyncResult,T], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit]]) diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs index 54fd479eb2..945b341a37 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs @@ -90,6 +90,7 @@ Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Collections.FSharpLis Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], T[]) +Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](T[]) @@ -113,7 +114,6 @@ Microsoft.FSharp.Collections.ArrayModule: System.Tuple`3[T1[],T2[],T3[]] Unzip3[ Microsoft.FSharp.Collections.ArrayModule: System.Type GetType() Microsoft.FSharp.Collections.ArrayModule: T Average[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T ExactlyOne[T](T[]) -Microsoft.FSharp.Collections.ArrayModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](T[]) Microsoft.FSharp.Collections.ArrayModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], T[]) Microsoft.FSharp.Collections.ArrayModule: T Get[T](T[], Int32) @@ -238,6 +238,7 @@ Microsoft.FSharp.Collections.FSharpList`1[T]: Void .ctor(T, Microsoft.FSharp.Col Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Boolean ContainsKey(TKey) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Boolean Equals(System.Object) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Boolean IsEmpty +Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Boolean TryGetValue(TKey, TValue ByRef) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Boolean get_IsEmpty() Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Int32 Count Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Int32 GetHashCode() @@ -245,7 +246,6 @@ Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Int32 get_Count() Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue] Add(TKey, TValue) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue] Remove(TKey) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Microsoft.FSharp.Core.FSharpOption`1[TValue] TryFind(TKey) -Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: Boolean TryGetValue(TKey, TValue ByRef) Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: System.String ToString() Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: System.Type GetType() Microsoft.FSharp.Collections.FSharpMap`2[TKey,TValue]: TValue Item [TKey] @@ -344,6 +344,7 @@ Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Collections.FSharpList Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], Microsoft.FSharp.Collections.FSharpList`1[T]) +Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](Microsoft.FSharp.Collections.FSharpList`1[T]) @@ -360,7 +361,6 @@ Microsoft.FSharp.Collections.ListModule: System.Tuple`3[Microsoft.FSharp.Collect Microsoft.FSharp.Collections.ListModule: System.Type GetType() Microsoft.FSharp.Collections.ListModule: T Average[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T ExactlyOne[T](Microsoft.FSharp.Collections.FSharpList`1[T]) -Microsoft.FSharp.Collections.ListModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Collections.FSharpList`1[T]) Microsoft.FSharp.Collections.ListModule: T Get[T](Microsoft.FSharp.Collections.FSharpList`1[T], Int32) @@ -432,6 +432,7 @@ Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Collections.FSharpList` Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndexBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[System.Int32] TryFindIndex[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[TResult] TryPick[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpOption`1[TResult]], System.Collections.Generic.IEnumerable`1[T]) +Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryFind[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryHead[T](System.Collections.Generic.IEnumerable`1[T]) @@ -495,7 +496,6 @@ Microsoft.FSharp.Collections.SeqModule: System.Tuple`2[System.Collections.Generi Microsoft.FSharp.Collections.SeqModule: System.Type GetType() Microsoft.FSharp.Collections.SeqModule: T Average[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T ExactlyOne[T](System.Collections.Generic.IEnumerable`1[T]) -Microsoft.FSharp.Collections.SeqModule: Microsoft.FSharp.Core.FSharpOption`1[T] TryExactlyOne[T](System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T FindBack[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Find[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], System.Collections.Generic.IEnumerable`1[T]) Microsoft.FSharp.Collections.SeqModule: T Get[T](Int32, System.Collections.Generic.IEnumerable`1[T]) @@ -562,10 +562,10 @@ Microsoft.FSharp.Control.AsyncActivation`1[T]: Boolean IsCancellationRequested Microsoft.FSharp.Control.AsyncActivation`1[T]: Boolean get_IsCancellationRequested() Microsoft.FSharp.Control.AsyncActivation`1[T]: Int32 GetHashCode() Microsoft.FSharp.Control.AsyncActivation`1[T]: Microsoft.FSharp.Control.AsyncReturn OnCancellation() -Microsoft.FSharp.Control.AsyncActivation`1[T]: Void OnExceptionRaised() Microsoft.FSharp.Control.AsyncActivation`1[T]: Microsoft.FSharp.Control.AsyncReturn OnSuccess(T) Microsoft.FSharp.Control.AsyncActivation`1[T]: System.String ToString() Microsoft.FSharp.Control.AsyncActivation`1[T]: System.Type GetType() +Microsoft.FSharp.Control.AsyncActivation`1[T]: Void OnExceptionRaised() Microsoft.FSharp.Control.AsyncPrimitives: Boolean Equals(System.Object) Microsoft.FSharp.Control.AsyncPrimitives: Int32 GetHashCode() Microsoft.FSharp.Control.AsyncPrimitives: Microsoft.FSharp.Control.AsyncReturn Bind[T,TResult](Microsoft.FSharp.Control.AsyncActivation`1[T], Microsoft.FSharp.Control.FSharpAsync`1[TResult], Microsoft.FSharp.Core.FSharpFunc`2[TResult,Microsoft.FSharp.Control.FSharpAsync`1[T]]) @@ -620,6 +620,8 @@ Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[Sys Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[System.Threading.CancellationToken] get_CancellationToken() Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[System.Threading.Tasks.Task`1[T]] StartChildAsTask[T](Microsoft.FSharp.Control.FSharpAsync`1[T], Microsoft.FSharp.Core.FSharpOption`1[System.Threading.Tasks.TaskCreationOptions]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T[]] Parallel[T](System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Control.FSharpAsync`1[T]]) +Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T[]] Parallel[T](System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Control.FSharpAsync`1[T]], Microsoft.FSharp.Core.FSharpOption`1[System.Int32]) +Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T[]] Sequential[T](System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Control.FSharpAsync`1[T]]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T] AwaitEvent[TDel,T](Microsoft.FSharp.Control.IEvent`2[TDel,T], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit]]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T] AwaitTask[T](System.Threading.Tasks.Task`1[T]) Microsoft.FSharp.Control.FSharpAsync: Microsoft.FSharp.Control.FSharpAsync`1[T] FromBeginEnd[TArg1,TArg2,TArg3,T](TArg1, TArg2, TArg3, Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`5[TArg1,TArg2,TArg3,System.AsyncCallback,System.Object],System.IAsyncResult], Microsoft.FSharp.Core.FSharpFunc`2[System.IAsyncResult,T], Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit]]) @@ -2241,6 +2243,12 @@ Microsoft.FSharp.Core.FSharpResult`2[T,TError]: T ResultValue Microsoft.FSharp.Core.FSharpResult`2[T,TError]: T get_ResultValue() Microsoft.FSharp.Core.FSharpResult`2[T,TError]: TError ErrorValue Microsoft.FSharp.Core.FSharpResult`2[T,TError]: TError get_ErrorValue() +Microsoft.FSharp.Core.FSharpTypeFunc: Boolean Equals(System.Object) +Microsoft.FSharp.Core.FSharpTypeFunc: Int32 GetHashCode() +Microsoft.FSharp.Core.FSharpTypeFunc: System.Object Specialize[T]() +Microsoft.FSharp.Core.FSharpTypeFunc: System.String ToString() +Microsoft.FSharp.Core.FSharpTypeFunc: System.Type GetType() +Microsoft.FSharp.Core.FSharpTypeFunc: Void .ctor() Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T]: Boolean Equals(System.Object) Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T]: Int32 GetHashCode() Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T]: Int32 ValueNone @@ -2250,6 +2258,14 @@ Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T]: System.Type GetType() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean Equals(Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean Equals(System.Object) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean Equals(System.Object, System.Collections.IEqualityComparer) +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsNone +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsSome +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsValueNone +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsValueSome +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsNone() +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsSome() +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsValueNone() +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsValueSome() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 CompareTo(Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 CompareTo(System.Object) Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 CompareTo(System.Object, System.Collections.IComparer) @@ -2258,12 +2274,11 @@ Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 GetHashCode(System.Collectio Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 Tag Microsoft.FSharp.Core.FSharpValueOption`1[T]: Int32 get_Tag() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1+Tags[T] -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] ValueNone -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsValueNone -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsValueSome -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsValueNone() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsValueSome() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] NewValueSome(T) +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] None +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] Some(T) +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] ValueNone +Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_None() Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_ValueNone() Microsoft.FSharp.Core.FSharpValueOption`1[T]: System.String ToString() Microsoft.FSharp.Core.FSharpValueOption`1[T]: System.Type GetType() @@ -2271,38 +2286,25 @@ Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Item Microsoft.FSharp.Core.FSharpValueOption`1[T]: T Value Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Item() Microsoft.FSharp.Core.FSharpValueOption`1[T]: T get_Value() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsNone -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean IsSome -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsNone() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Boolean get_IsSome() -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] None -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] Some(T) -Microsoft.FSharp.Core.FSharpValueOption`1[T]: Microsoft.FSharp.Core.FSharpValueOption`1[T] get_None() -Microsoft.FSharp.Core.FSharpTypeFunc: Boolean Equals(System.Object) -Microsoft.FSharp.Core.FSharpTypeFunc: Int32 GetHashCode() -Microsoft.FSharp.Core.FSharpTypeFunc: System.Object Specialize[T]() -Microsoft.FSharp.Core.FSharpTypeFunc: System.String ToString() -Microsoft.FSharp.Core.FSharpTypeFunc: System.Type GetType() -Microsoft.FSharp.Core.FSharpTypeFunc: Void .ctor() Microsoft.FSharp.Core.FuncConvert: Boolean Equals(System.Object) +Microsoft.FSharp.Core.FuncConvert: Int32 GetHashCode() Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.Unit] FromAction(System.Action) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit] FromAction[T](System.Action`1[T]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.Unit]] FromAction[T1,T2](System.Action`2[T1,T2]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.Unit]]] FromAction[T1,T2,T3](System.Action`3[T1,T2,T3]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.Unit]]]] FromAction[T1,T2,T3,T4](System.Action`4[T1,T2,T3,T4]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,Microsoft.FSharp.Core.Unit]]]]] FromAction[T1,T2,T3,T4,T5](System.Action`5[T1,T2,T3,T4,T5]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T] FromFunc[T](System.Func`1[T]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] FromFunc[T,TResult](System.Func`2[T,TResult]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]] FromFunc[T1,T2,TResult](System.Func`3[T1,T2,TResult]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]] FromFunc[T1,T2,T3,TResult](System.Func`4[T1,T2,T3,TResult]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,TResult]]]] FromFunc[T1,T2,T3,T4,TResult](System.Func`5[T1,T2,T3,T4,TResult]) -Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,TResult]]]]] FromFunc[T1,T2,T3,T4,T5,TResult](System.Func`6[T1,T2,T3,T4,T5,TResult]) -Microsoft.FSharp.Core.FuncConvert: Int32 GetHashCode() +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit] FromAction[T](System.Action`1[T]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit] ToFSharpFunc[T](System.Action`1[T]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] FromFunc[T,TResult](System.Func`2[T,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T,TResult] ToFSharpFunc[T,TResult](System.Converter`2[T,TResult]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,Microsoft.FSharp.Core.Unit]]]]] FromAction[T1,T2,T3,T4,T5](System.Action`5[T1,T2,T3,T4,T5]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,TResult]]]]] FromFunc[T1,T2,T3,T4,T5,TResult](System.Func`6[T1,T2,T3,T4,T5,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.FSharpFunc`2[T5,TResult]]]]] FuncFromTupled[T1,T2,T3,T4,T5,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`5[T1,T2,T3,T4,T5],TResult]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,Microsoft.FSharp.Core.Unit]]]] FromAction[T1,T2,T3,T4](System.Action`4[T1,T2,T3,T4]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,TResult]]]] FromFunc[T1,T2,T3,T4,TResult](System.Func`5[T1,T2,T3,T4,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.FSharpFunc`2[T4,TResult]]]] FuncFromTupled[T1,T2,T3,T4,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`4[T1,T2,T3,T4],TResult]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,Microsoft.FSharp.Core.Unit]]] FromAction[T1,T2,T3](System.Action`3[T1,T2,T3]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]] FromFunc[T1,T2,T3,TResult](System.Func`4[T1,T2,T3,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]] FuncFromTupled[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`3[T1,T2,T3],TResult]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.Unit]] FromAction[T1,T2](System.Action`2[T1,T2]) +Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]] FromFunc[T1,T2,TResult](System.Func`3[T1,T2,TResult]) Microsoft.FSharp.Core.FuncConvert: Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]] FuncFromTupled[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[System.Tuple`2[T1,T2],TResult]) Microsoft.FSharp.Core.FuncConvert: System.String ToString() Microsoft.FSharp.Core.FuncConvert: System.Type GetType() @@ -2497,7 +2499,6 @@ Microsoft.FSharp.Core.MatchFailureException: System.String get_Message() Microsoft.FSharp.Core.MatchFailureException: System.String get_Source() Microsoft.FSharp.Core.MatchFailureException: System.String get_StackTrace() Microsoft.FSharp.Core.MatchFailureException: System.Type GetType() -Microsoft.FSharp.Core.MatchFailureException: System.Type GetType() Microsoft.FSharp.Core.MatchFailureException: Void .ctor() Microsoft.FSharp.Core.MatchFailureException: Void .ctor(System.String, Int32, Int32) Microsoft.FSharp.Core.MatchFailureException: Void GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) @@ -2722,8 +2723,8 @@ Microsoft.FSharp.Core.Operators: System.Collections.Generic.IEnumerable`1[T] op_ Microsoft.FSharp.Core.Operators: System.Collections.Generic.IEnumerable`1[T] op_Range[T](T, T) Microsoft.FSharp.Core.Operators: System.Decimal ToDecimal[T](T) Microsoft.FSharp.Core.Operators: System.Exception Failure(System.String) -Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleError[T]() Microsoft.FSharp.Core.Operators: System.IO.TextReader ConsoleIn[T]() +Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleError[T]() Microsoft.FSharp.Core.Operators: System.IO.TextWriter ConsoleOut[T]() Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + #if DEBUG @@ -2876,36 +2877,6 @@ Microsoft.FSharp.Core.OptionModule: TState FoldBack[T,TState](Microsoft.FSharp.C Microsoft.FSharp.Core.OptionModule: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: T[] ToArray[T](Microsoft.FSharp.Core.FSharpOption`1[T]) Microsoft.FSharp.Core.OptionModule: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean Contains[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean Equals(System.Object) -Microsoft.FSharp.Core.ValueOption: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Int32 GetHashCode() -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: System.String ToString() -Microsoft.FSharp.Core.ValueOption: System.Type GetType() -Microsoft.FSharp.Core.ValueOption: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T GetValue[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T ToObj[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Core.FSharpValueOption`1[T], TState) -Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) -Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Equals(System.Object) Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean IsDefaultAttribute() Microsoft.FSharp.Core.OptionalArgumentAttribute: Boolean Match(System.Object) @@ -3103,6 +3074,36 @@ Microsoft.FSharp.Core.UnverifiableAttribute: System.Object get_TypeId() Microsoft.FSharp.Core.UnverifiableAttribute: System.String ToString() Microsoft.FSharp.Core.UnverifiableAttribute: System.Type GetType() Microsoft.FSharp.Core.UnverifiableAttribute: Void .ctor() +Microsoft.FSharp.Core.ValueOption: Boolean Contains[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean Equals(System.Object) +Microsoft.FSharp.Core.ValueOption: Boolean Exists[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean ForAll[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean IsNone[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Boolean IsSome[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Int32 Count[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Int32 GetHashCode() +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Collections.FSharpList`1[T] ToList[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Bind[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpValueOption`1[TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map2[T1,T2,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,TResult]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map3[T1,T2,T3,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T1,Microsoft.FSharp.Core.FSharpFunc`2[T2,Microsoft.FSharp.Core.FSharpFunc`2[T3,TResult]]], Microsoft.FSharp.Core.FSharpValueOption`1[T1], Microsoft.FSharp.Core.FSharpValueOption`1[T2], Microsoft.FSharp.Core.FSharpValueOption`1[T3]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[TResult] Map[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Filter[T](Microsoft.FSharp.Core.FSharpFunc`2[T,System.Boolean], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] Flatten[T](Microsoft.FSharp.Core.FSharpValueOption`1[Microsoft.FSharp.Core.FSharpValueOption`1[T]]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfNullable[T](System.Nullable`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OfObj[T](T) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElseWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpValueOption`1[T]], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Microsoft.FSharp.Core.FSharpValueOption`1[T] OrElse[T](Microsoft.FSharp.Core.FSharpValueOption`1[T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: System.Nullable`1[T] ToNullable[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: System.String ToString() +Microsoft.FSharp.Core.ValueOption: System.Type GetType() +Microsoft.FSharp.Core.ValueOption: T DefaultValue[T](T, Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T DefaultWith[T](Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Core.Unit,T], Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T GetValue[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T ToObj[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: TState FoldBack[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.FSharpFunc`2[TState,TState]], Microsoft.FSharp.Core.FSharpValueOption`1[T], TState) +Microsoft.FSharp.Core.ValueOption: TState Fold[T,TState](Microsoft.FSharp.Core.FSharpFunc`2[TState,Microsoft.FSharp.Core.FSharpFunc`2[T,TState]], TState, Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: T[] ToArray[T](Microsoft.FSharp.Core.FSharpValueOption`1[T]) +Microsoft.FSharp.Core.ValueOption: Void Iterate[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], Microsoft.FSharp.Core.FSharpValueOption`1[T]) Microsoft.FSharp.Core.VolatileFieldAttribute: Boolean Equals(System.Object) Microsoft.FSharp.Core.VolatileFieldAttribute: Boolean IsDefaultAttribute() Microsoft.FSharp.Core.VolatileFieldAttribute: Boolean Match(System.Object) @@ -3400,20 +3401,20 @@ Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: System.String ToSt Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: System.Type GetType() Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: T MemberInitializationHelper[T](T) Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: T NewAnonymousObjectHelper[T](T) -Microsoft.FSharp.NativeInterop.NativePtrModule: T& ToByRefInlined[T](IntPtr) Microsoft.FSharp.NativeInterop.NativePtrModule: Boolean Equals(System.Object) Microsoft.FSharp.NativeInterop.NativePtrModule: Int32 GetHashCode() Microsoft.FSharp.NativeInterop.NativePtrModule: IntPtr AddPointerInlined[T](IntPtr, Int32) Microsoft.FSharp.NativeInterop.NativePtrModule: IntPtr OfNativeIntInlined[T](IntPtr) +Microsoft.FSharp.NativeInterop.NativePtrModule: IntPtr OfVoidPtrInlined[T](Void*) Microsoft.FSharp.NativeInterop.NativePtrModule: IntPtr StackAllocate[T](Int32) Microsoft.FSharp.NativeInterop.NativePtrModule: IntPtr ToNativeIntInlined[T](IntPtr) Microsoft.FSharp.NativeInterop.NativePtrModule: System.String ToString() Microsoft.FSharp.NativeInterop.NativePtrModule: System.Type GetType() Microsoft.FSharp.NativeInterop.NativePtrModule: T GetPointerInlined[T](IntPtr, Int32) Microsoft.FSharp.NativeInterop.NativePtrModule: T ReadPointerInlined[T](IntPtr) +Microsoft.FSharp.NativeInterop.NativePtrModule: T& ToByRefInlined[T](IntPtr) Microsoft.FSharp.NativeInterop.NativePtrModule: Void SetPointerInlined[T](IntPtr, Int32, T) Microsoft.FSharp.NativeInterop.NativePtrModule: Void WritePointerInlined[T](IntPtr, T) -Microsoft.FSharp.NativeInterop.NativePtrModule: IntPtr OfVoidPtrInlined[T](Void*) Microsoft.FSharp.NativeInterop.NativePtrModule: Void* ToVoidPtrInlined[T](IntPtr) Microsoft.FSharp.Quotations.DerivedPatternsModule: Boolean Equals(System.Object) Microsoft.FSharp.Quotations.DerivedPatternsModule: Int32 GetHashCode() From 522fc420f396393112b7ad8458f3881724837fb5 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Mon, 3 Jun 2019 13:17:04 -0700 Subject: [PATCH 088/286] Ensure that Language Version support flows to Parser (#6891) * update testing * Ensure Lange Feature can be used from the parser * remove comments on tests * repair tests.fs --- .../FSharp.Compiler.Service.fsproj | 6 + src/fsharp/CompileOps.fs | 91 +------- src/fsharp/CompileOps.fsi | 14 +- src/fsharp/CompileOptions.fs | 19 +- src/fsharp/FSComp.txt | 1 + src/fsharp/FSharp.Build/Fsc.fs | 2 +- .../FSharp.Compiler.Private.fsproj | 6 + src/fsharp/LanguageFeatures.fs | 90 ++++++++ src/fsharp/LanguageFeatures.fsi | 31 +++ src/fsharp/UnicodeLexing.fs | 21 +- src/fsharp/UnicodeLexing.fsi | 9 +- src/fsharp/ast.fs | 38 +++- src/fsharp/fsi/fsi.fs | 31 +-- src/fsharp/lex.fsl | 13 +- src/fsharp/pars.fsy | 20 +- src/fsharp/service/ServiceLexing.fs | 11 +- src/fsharp/service/service.fs | 14 +- src/fsharp/xlf/FSComp.txt.cs.xlf | 5 + src/fsharp/xlf/FSComp.txt.de.xlf | 5 + src/fsharp/xlf/FSComp.txt.es.xlf | 5 + src/fsharp/xlf/FSComp.txt.fr.xlf | 5 + src/fsharp/xlf/FSComp.txt.it.xlf | 5 + src/fsharp/xlf/FSComp.txt.ja.xlf | 5 + src/fsharp/xlf/FSComp.txt.ko.xlf | 5 + src/fsharp/xlf/FSComp.txt.pl.xlf | 5 + src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 5 + src/fsharp/xlf/FSComp.txt.ru.xlf | 5 + src/fsharp/xlf/FSComp.txt.tr.xlf | 5 + src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 5 + src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 5 + src/utils/CompilerLocationUtils.fs | 1 - src/utils/prim-lexing.fs | 49 ++-- src/utils/prim-lexing.fsi | 23 +- .../HashIfExpression.fs | 5 +- tests/fsharp/FSharpSuite.Tests.fsproj | 1 + tests/fsharp/HandleExpects.fs | 196 ++++++++++++++++ tests/fsharp/core/members/basics/test.fs | 214 +++++++++--------- .../members/self-identifier/version46/test.fs | 62 +++++ .../members/self-identifier/version47/test.fs | 58 +++++ tests/fsharp/single-test.fs | 69 ++++-- tests/fsharp/test-framework.fs | 3 +- tests/fsharp/tests.fs | 13 +- 42 files changed, 843 insertions(+), 333 deletions(-) create mode 100644 src/fsharp/LanguageFeatures.fs create mode 100644 src/fsharp/LanguageFeatures.fsi create mode 100644 tests/fsharp/HandleExpects.fs create mode 100644 tests/fsharp/core/members/self-identifier/version46/test.fs create mode 100644 tests/fsharp/core/members/self-identifier/version47/test.fs diff --git a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index 158dd62bfa..6bd595e682 100644 --- a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -78,6 +78,12 @@ ErrorText/sr.fs + + Driver\LanguageFeatures.fsi + + + Driver\LanguageFeatures.fs + LexYaccRuntime/prim-lexing.fsi diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 72332359d6..5d6e97782c 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -28,6 +28,7 @@ open FSharp.Compiler.AttributeChecking open FSharp.Compiler.ConstraintSolver open FSharp.Compiler.DiagnosticMessage open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Import open FSharp.Compiler.Infos open FSharp.Compiler.Lexhelp @@ -1735,7 +1736,7 @@ let CollectDiagnostic (implicitIncludeDir, showFullPaths, flattenErrors, errorSt let os = System.Text.StringBuilder() OutputPhasedDiagnostic os err flattenErrors suggestNames errors.Add( Diagnostic.Short(isError, os.ToString()) ) - + relatedErrors |> List.iter OutputRelatedError match err with @@ -1834,82 +1835,6 @@ let ComputeMakePathAbsolute implicitIncludeDir (path: string) = with :? System.ArgumentException -> path - -//------------------------------------------------------------------------------------------------------------------ -// Language version command line switch -//------------------------------------------------------------------------------------------------------------------ -// Add your features to this List - in code use languageVersion.SupportsFeature(LanguageFeatures.yourFeature) -// a return value of false means your feature is not supported by the user's language selection -// All new language features added from now on must be protected by this. -// Note: -// * The fslang design process will require a decision about feature name and whether it is required. -// * When a feature is assigned a release language, we will scrub the code of feature references and apply -// the Release Language version. - -/// LanguageFeature enumeration -[] -type LanguageFeature = - | LanguageVersion46 = 0 - | LanguageVersion47 = 1 - | Nullness = 1000 - | ScriptingPackageManagement = 1001 - -/// LanguageVersion management -type LanguageVersion (specifiedVersion) = - - // When we increment language versions here preview is higher than current RTM version - static let languageVersion46 = 4.6m - static let languageVersion47 = 4.7m - - static let previewVersion = languageVersion47 // Language version when preview specified - static let defaultVersion = languageVersion46 // Language version when default specified - static let latestVersion = defaultVersion // Language version when latest specified - static let latestMajorVersion = languageVersion46 // Language version when latestmajor specified - - static let validOptions = [| "preview"; "default"; "latest"; "latestmajor" |] - static let languageVersions = set [| latestVersion |] - - static let features = dict [| - // Add new LanguageVersions here ... - LanguageFeature.LanguageVersion47, 4.7m - LanguageFeature.LanguageVersion46, 4.6m - LanguageFeature.Nullness, previewVersion - LanguageFeature.ScriptingPackageManagement, previewVersion - // Add new LanguageFeatures here ... - |] - - static let dumpAllowedValues () = - printfn "%s" (FSComp.SR.optsSupportedLangVersions()) - for v in validOptions do printfn "%s" v - for v in languageVersions |> Seq.sort do - let label = if v = defaultVersion || v = latestVersion then "(Default)" else "" - printf "%M %s" v label - exit 0 - 0m - - let specified = - match specifiedVersion with - | "?" -> dumpAllowedValues() - | "preview" -> previewVersion - | "default" -> latestVersion - | "latest" -> latestVersion - | "latestmajor" -> latestMajorVersion - | _ -> - let raiseError () = error(Error(FSComp.SR.optsUnrecognizedLanguageVersion specifiedVersion, rangeCmdArgs)) - match Decimal.TryParse(specifiedVersion) with - | true, v -> - if languageVersions.Contains(v) then v - else raiseError (); 0m - | _ -> - raiseError () - 0m - - /// Check if this feature is supported by the selected langversion - member __.SupportsFeature featureId = - match features.TryGetValue featureId with - | true, v -> v <= specified - | false, _ -> false - //---------------------------------------------------------------------------- // Configuration //---------------------------------------------------------------------------- @@ -3556,8 +3481,8 @@ let ParseOneInputFile (tcConfig: TcConfig, lexResourceManager, conditionalCompil if List.exists (Filename.checkSuffix lower) (FSharpSigFileSuffixes@FSharpImplFileSuffixes) then if not(FileSystem.SafeExists filename) then error(Error(FSComp.SR.buildCouldNotFindSourceFile filename, rangeStartup)) - // bug 3155: if the file name is indirect, use a full path - let lexbuf = UnicodeLexing.UnicodeFileAsLexbuf(filename, tcConfig.inputCodePage, retryLocked) + let isFeatureSupported featureId = tcConfig.langVersion.SupportsFeature featureId + let lexbuf = UnicodeLexing.UnicodeFileAsLexbuf(isFeatureSupported, filename, tcConfig.inputCodePage, retryLocked) ParseOneInputLexbuf(tcConfig, lexResourceManager, conditionalCompilationDefines, lexbuf, filename, isLastCompiland, errorLogger) else error(Error(FSComp.SR.buildInvalidSourceFileExtension(SanitizeFileName filename tcConfig.implicitIncludeDir), rangeStartup)) with e -> (* errorR(Failure("parse failed")); *) errorRecovery e rangeStartup; None @@ -5080,11 +5005,13 @@ module private ScriptPreprocessClosure = | CodeContext.CompilationAndEvaluation -> ["INTERACTIVE"] | CodeContext.Compilation -> ["COMPILED"] | CodeContext.Editing -> "EDITING" :: (if IsScript filename then ["INTERACTIVE"] else ["COMPILED"]) - let lexbuf = UnicodeLexing.SourceTextAsLexbuf(sourceText) - + + let isFeatureSupported featureId = tcConfig.langVersion.SupportsFeature featureId + let lexbuf = UnicodeLexing.SourceTextAsLexbuf(isFeatureSupported, sourceText) + let isLastCompiland = (IsScript filename), tcConfig.target.IsExe // The root compiland is last in the list of compilands. ParseOneInputLexbuf (tcConfig, lexResourceManager, defines, lexbuf, filename, isLastCompiland, errorLogger) - + /// Create a TcConfig for load closure starting from a single .fsx file let CreateScriptTextTcConfig (legacyReferenceResolver, defaultFSharpBinariesDir, diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 1ebdab9a2a..51bcc2dc2a 100644 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -16,6 +16,7 @@ open FSharp.Compiler.TypeChecker open FSharp.Compiler.Range open FSharp.Compiler.Ast open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Tast open FSharp.Compiler.TcGlobals open FSharp.Compiler.Text @@ -217,19 +218,6 @@ type ICompilationThread = /// Enqueue work to be done on a compilation thread. abstract EnqueueWork: (CompilationThreadToken -> unit) -> unit -/// LanguageFeature enumeration -[] -type LanguageFeature = - | LanguageVersion46 = 0 - | LanguageVersion47 = 1 - | Nullness = 1000 - | ScriptingPackageManagement = 1001 - -/// LanguageVersion management -type LanguageVersion = - new: string -> LanguageVersion - member SupportsFeature: LanguageFeature-> bool - [] type CompilerTarget = | WinExe diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index a342275c47..d107c3f394 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -17,6 +17,7 @@ open FSharp.Compiler.TcGlobals open FSharp.Compiler.Tast open FSharp.Compiler.Tastops open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Lib open FSharp.Compiler.Range open FSharp.Compiler.IlxGen @@ -813,13 +814,27 @@ let codeGenerationFlags isFsi (tcConfigB: TcConfigBuilder) = //---------------------- let defineSymbol tcConfigB s = tcConfigB.conditionalCompilationDefines <- s :: tcConfigB.conditionalCompilationDefines - + let mlCompatibilityFlag (tcConfigB: TcConfigBuilder) = CompilerOption ("mlcompatibility", tagNone, OptionUnit (fun () -> tcConfigB.mlCompatibility<-true; tcConfigB.TurnWarningOff(rangeCmdArgs, "62")), None, Some (FSComp.SR.optsMlcompatibility())) +/// LanguageVersion management +let setLanguageVersion (specifiedVersion) = + + let languageVersion = new LanguageVersion(specifiedVersion) + let dumpAllowedValues () = + printfn "%s" (FSComp.SR.optsSupportedLangVersions()) + for v in languageVersion.ValidOptions do printfn "%s" v + for v in languageVersion.ValidVersions do printfn "%s" v + exit 0 + + if specifiedVersion = "?" then dumpAllowedValues () + if not (languageVersion.ContainsVersion specifiedVersion) then error(Error(FSComp.SR.optsUnrecognizedLanguageVersion specifiedVersion, rangeCmdArgs)) + languageVersion + let languageFlags tcConfigB = [ // -langversion:? Display the allowed values for language version @@ -828,7 +843,7 @@ let languageFlags tcConfigB = // 'latest' (latest version, including minor versions), // 'preview' (features for preview) // or specific versions like '4.7' - CompilerOption("langversion", tagLangVersionValues, OptionString (fun switch -> tcConfigB.langVersion <- LanguageVersion(switch)), None, Some (FSComp.SR.optsLangVersion())) + CompilerOption("langversion", tagLangVersionValues, OptionString (fun switch -> tcConfigB.langVersion <- setLanguageVersion(switch)), None, Some (FSComp.SR.optsLangVersion())) CompilerOption("checked", tagNone, OptionSwitch (fun switch -> tcConfigB.checkOverflow <- (switch = OptionSwitch.On)), None, Some (FSComp.SR.optsChecked())) CompilerOption("define", tagString, OptionString (defineSymbol tcConfigB), None, Some (FSComp.SR.optsDefine())) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 4e0f034aac..a324cc9ed4 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -421,6 +421,7 @@ parsAttributesMustComeBeforeVal,"Attributes should be placed before 'val'" 568,parsAllEnumFieldsRequireValues,"All enum fields must be given values" 569,parsInlineAssemblyCannotHaveVisibilityDeclarations,"Accessibility modifiers are not permitted on inline assembly code types" 571,parsUnexpectedIdentifier,"Unexpected identifier: '%s'" +10,parsUnexpectedSymbolDot,"Unexpected symbol '.' in member definition. Expected 'with', '=' or other token." 572,parsUnionCasesCannotHaveVisibilityDeclarations,"Accessibility modifiers are not permitted on union cases. Use 'type U = internal ...' or 'type U = private ...' to give an accessibility to the whole representation." 573,parsEnumFieldsCannotHaveVisibilityDeclarations,"Accessibility modifiers are not permitted on enumeration fields" parsConsiderUsingSeparateRecordType,"Consider using a separate record type instead" diff --git a/src/fsharp/FSharp.Build/Fsc.fs b/src/fsharp/FSharp.Build/Fsc.fs index 89e6a64db6..4f1a702d5a 100644 --- a/src/fsharp/FSharp.Build/Fsc.fs +++ b/src/fsharp/FSharp.Build/Fsc.fs @@ -108,7 +108,7 @@ type public Fsc () as this = for item in embeddedFiles do builder.AppendSwitchIfNotNull("--embed:", item.ItemSpec) builder.AppendSwitchIfNotNull("--sourcelink:", sourceLink) - builder.AppendSwitchIfNotNull("--langVersion:", langVersion) + builder.AppendSwitchIfNotNull("--langversion:", langVersion) // NoFramework if noFramework then builder.AppendSwitch("--noframework") diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index 365e7809f4..87b834d425 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -86,6 +86,12 @@ ErrorText\sr.fs + + Driver\LanguageFeatures.fsi + + + Driver\LanguageFeatures.fs + LexYaccRuntime\prim-lexing.fsi diff --git a/src/fsharp/LanguageFeatures.fs b/src/fsharp/LanguageFeatures.fs new file mode 100644 index 0000000000..15a30f6b61 --- /dev/null +++ b/src/fsharp/LanguageFeatures.fs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +/// Coordinating compiler operations - configuration, loading initial context, reporting errors etc. +module internal FSharp.Compiler.Features + +open System + +//------------------------------------------------------------------------------------------------------------------ +// Language version command line switch +//------------------------------------------------------------------------------------------------------------------ +// Add your features to this List - in code use languageVersion.SupportsFeature(LanguageFeatures.yourFeature) +// a return value of false means your feature is not supported by the user's language selection +// All new language features added from now on must be protected by this. +// Note: +// * The fslang design process will require a decision about feature name and whether it is required. +// * When a feature is assigned a release language, we will scrub the code of feature references and apply +// the Release Language version. + +/// LanguageFeature enumeration +[] +type LanguageFeature = + | LanguageVersion46 = 0 + | LanguageVersion47 = 1 + | SingleUnderscorePattern = 2 + | Nullness = 1000 + | ScriptingPackageManagement = 1001 + +/// LanguageVersion management +type LanguageVersion (specifiedVersion) = + + // When we increment language versions here preview is higher than current RTM version + static let languageVersion46 = 4.6m + static let languageVersion47 = 4.7m + + static let previewVersion = languageVersion47 // Language version when preview specified + static let defaultVersion = languageVersion46 // Language version when default specified + static let latestVersion = defaultVersion // Language version when latest specified + static let latestMajorVersion = languageVersion46 // Language version when latestmajor specified + + static let validOptions = [| "preview"; "default"; "latest"; "latestmajor" |] + static let languageVersions = set [| latestVersion |] + + static let features = dict [| + // Add new LanguageVersions here ... + LanguageFeature.LanguageVersion47, 4.7m + LanguageFeature.LanguageVersion46, 4.6m + LanguageFeature.Nullness, previewVersion + LanguageFeature.ScriptingPackageManagement, previewVersion + LanguageFeature.SingleUnderscorePattern, previewVersion + + // Add new LanguageFeatures here ... + |] + + let specified = + match specifiedVersion with + | "?" -> 0m + | "preview" -> previewVersion + | "default" -> latestVersion + | "latest" -> latestVersion + | "latestmajor" -> latestMajorVersion + | _ -> + match Decimal.TryParse(specifiedVersion) with + | true, v -> v + | _ -> 0m + + /// Check if this feature is supported by the selected langversion + member __.SupportsFeature featureId = + match features.TryGetValue featureId with + | true, v -> v <= specified + | false, _ -> false + + /// Does the languageVersion support this version string + member __.ContainsVersion version = + match version with + | "?" | "preview" | "default" | "latest" | "latestmajor" -> true + | _ -> + match Decimal.TryParse(specifiedVersion) with + | true, v -> languageVersions.Contains v + | _ -> false + + /// Get a list of valid strings for help text + member __.ValidOptions = validOptions + + /// Get a list of valid versions for help text + member __.ValidVersions = [| + for v in languageVersions |> Seq.sort do + let label = if v = defaultVersion || v = latestVersion then "(Default)" else "" + yield sprintf "%M %s" v label + |] + diff --git a/src/fsharp/LanguageFeatures.fsi b/src/fsharp/LanguageFeatures.fsi new file mode 100644 index 0000000000..a43ac24276 --- /dev/null +++ b/src/fsharp/LanguageFeatures.fsi @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +/// Coordinating compiler operations - configuration, loading initial context, reporting errors etc. +module internal FSharp.Compiler.Features + +/// LanguageFeature enumeration +[] +type LanguageFeature = + | LanguageVersion46 = 0 + | LanguageVersion47 = 1 + | SingleUnderscorePattern = 2 + | Nullness = 1000 + | ScriptingPackageManagement = 1001 + +/// LanguageVersion management +type LanguageVersion = + + /// Create a LanguageVersion management object + new: string -> LanguageVersion + + /// Get the list of valid versions + member ContainsVersion: string -> bool + + /// Does the specified LanguageVersion support the specified feature + member SupportsFeature: LanguageFeature -> bool + + /// Get the list of valid versions + member ValidVersions: string array + + /// Get the list of valid options + member ValidOptions: string array diff --git a/src/fsharp/UnicodeLexing.fs b/src/fsharp/UnicodeLexing.fs index ca2e5f19ce..d34092940e 100644 --- a/src/fsharp/UnicodeLexing.fs +++ b/src/fsharp/UnicodeLexing.fs @@ -7,6 +7,7 @@ module internal FSharp.Compiler.UnicodeLexing // open FSharp.Compiler.AbstractIL.Internal.Library +open FSharp.Compiler.Features open Internal.Utilities open System.IO @@ -14,15 +15,15 @@ open Internal.Utilities.Text.Lexing type Lexbuf = LexBuffer -let StringAsLexbuf (s:string) : Lexbuf = - LexBuffer<_>.FromChars (s.ToCharArray()) - -let FunctionAsLexbuf (bufferFiller: char[] * int * int -> int) : Lexbuf = - LexBuffer<_>.FromFunction bufferFiller +let StringAsLexbuf (supportsFeature: Features.LanguageFeature -> bool, s:string) : Lexbuf = + LexBuffer<_>.FromChars (supportsFeature, s.ToCharArray()) + +let FunctionAsLexbuf (supportsFeature: Features.LanguageFeature -> bool, bufferFiller: char[] * int * int -> int) : Lexbuf = + LexBuffer<_>.FromFunction(supportsFeature, bufferFiller) + +let SourceTextAsLexbuf (supportsFeature: Features.LanguageFeature -> bool, sourceText) = + LexBuffer.FromSourceText(supportsFeature, sourceText) -let SourceTextAsLexbuf sourceText = - LexBuffer.FromSourceText(sourceText) - // The choice of 60 retries times 50 ms is not arbitrary. The NTFS FILETIME structure // uses 2 second resolution for LastWriteTime. We retry long enough to surpass this threshold // plus 1 second. Once past the threshold the incremental builder will be able to retry asynchronously based @@ -41,7 +42,7 @@ let numRetries = 60 /// we can't just return the LexBuffer object, since the file it wraps wouldn't /// get closed when we're finished with the LexBuffer. Hence we return the stream, /// the reader and the LexBuffer. The caller should dispose the first two when done. -let UnicodeFileAsLexbuf (filename,codePage : int option, retryLocked:bool) : Lexbuf = +let UnicodeFileAsLexbuf (supportsFeature: Features.LanguageFeature -> bool, filename, codePage: int option, retryLocked: bool): Lexbuf = // Retry multiple times since other processes may be writing to this file. let rec getSource retryNumber = try @@ -68,5 +69,5 @@ let UnicodeFileAsLexbuf (filename,codePage : int option, retryLocked:bool) : Le else reraise() let source = getSource 0 - let lexbuf = LexBuffer<_>.FromChars(source.ToCharArray()) + let lexbuf = LexBuffer<_>.FromChars(supportsFeature, source.ToCharArray()) lexbuf diff --git a/src/fsharp/UnicodeLexing.fsi b/src/fsharp/UnicodeLexing.fsi index 7c0f0fb68d..2478c7f857 100644 --- a/src/fsharp/UnicodeLexing.fsi +++ b/src/fsharp/UnicodeLexing.fsi @@ -2,12 +2,13 @@ module internal FSharp.Compiler.UnicodeLexing +open FSharp.Compiler.Features open FSharp.Compiler.Text open Microsoft.FSharp.Text open Internal.Utilities.Text.Lexing type Lexbuf = LexBuffer -val internal StringAsLexbuf : string -> Lexbuf -val public FunctionAsLexbuf : (char [] * int * int -> int) -> Lexbuf -val public UnicodeFileAsLexbuf :string * int option * (*retryLocked*) bool -> Lexbuf -val public SourceTextAsLexbuf : ISourceText -> Lexbuf +val internal StringAsLexbuf: (Features.LanguageFeature -> bool) * string -> Lexbuf +val public FunctionAsLexbuf: (Features.LanguageFeature -> bool) * (char [] * int * int -> int) -> Lexbuf +val public UnicodeFileAsLexbuf: (Features.LanguageFeature -> bool) * string * int option * (*retryLocked*) bool -> Lexbuf +val public SourceTextAsLexbuf: (Features.LanguageFeature -> bool) * ISourceText -> Lexbuf diff --git a/src/fsharp/ast.fs b/src/fsharp/ast.fs index 94f4022621..a6623e07c1 100644 --- a/src/fsharp/ast.fs +++ b/src/fsharp/ast.fs @@ -12,6 +12,7 @@ open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler open FSharp.Compiler.UnicodeLexing open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.PrettyNaming open FSharp.Compiler.Range @@ -1966,36 +1967,51 @@ let PushCurriedPatternsToExpr synArgNameGenerator wholem isMember pats rhs = expr spatsl, expr -/// Helper for parsing the inline IL fragments. +let internal internalParseAssemblyCodeInstructions s isFeatureSupported m = #if NO_INLINE_IL_PARSER -let ParseAssemblyCodeInstructions _s m = + ignore s + ignore isFeatureSupported + errorR(Error((193, "Inline IL not valid in a hosted environment"), m)) [| |] #else -let ParseAssemblyCodeInstructions s m = - try FSharp.Compiler.AbstractIL.Internal.AsciiParser.ilInstrs + try + FSharp.Compiler.AbstractIL.Internal.AsciiParser.ilInstrs FSharp.Compiler.AbstractIL.Internal.AsciiLexer.token - (UnicodeLexing.StringAsLexbuf s) + (UnicodeLexing.StringAsLexbuf(isFeatureSupported, s)) with RecoverableParseError -> - errorR(Error(FSComp.SR.astParseEmbeddedILError(), m)); [| |] + errorR(Error(FSComp.SR.astParseEmbeddedILError(), m)); [||] #endif +let ParseAssemblyCodeInstructions s m = + // Public API can not answer the isFeatureSupported questions, so here we support everything + let isFeatureSupported (_featureId:LanguageFeature) = true + internalParseAssemblyCodeInstructions s isFeatureSupported m + +let internal internalParseAssemblyCodeType s isFeatureSupported m = + ignore s + ignore isFeatureSupported -/// Helper for parsing the inline IL fragments. #if NO_INLINE_IL_PARSER -let ParseAssemblyCodeType _s m = errorR(Error((193, "Inline IL not valid in a hosted environment"), m)) IL.EcmaMscorlibILGlobals.typ_Object #else -let ParseAssemblyCodeType s m = - try FSharp.Compiler.AbstractIL.Internal.AsciiParser.ilType + let isFeatureSupported (_featureId:LanguageFeature) = true + try + FSharp.Compiler.AbstractIL.Internal.AsciiParser.ilType FSharp.Compiler.AbstractIL.Internal.AsciiLexer.token - (UnicodeLexing.StringAsLexbuf s) + (UnicodeLexing.StringAsLexbuf(isFeatureSupported, s)) with RecoverableParseError -> errorR(Error(FSComp.SR.astParseEmbeddedILTypeError(), m)); IL.EcmaMscorlibILGlobals.typ_Object #endif +/// Helper for parsing the inline IL fragments. +let ParseAssemblyCodeType s m = + // Public API can not answer the isFeatureSupported questions, so here we support everything + let isFeatureSupported (_featureId:LanguageFeature) = true + internalParseAssemblyCodeType s isFeatureSupported m + //------------------------------------------------------------------------ // AST constructors //------------------------------------------------------------------------ diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index 7032d3a1ac..5ddfe1cc18 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -34,6 +34,7 @@ open FSharp.Compiler.Ast open FSharp.Compiler.CompileOptions open FSharp.Compiler.CompileOps open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Infos open FSharp.Compiler.InfoReader open FSharp.Compiler.NameResolution @@ -1691,9 +1692,11 @@ type internal FsiStdinLexerProvider let initialLightSyntaxStatus = tcConfigB.light <> Some false LightSyntaxStatus (initialLightSyntaxStatus, false (* no warnings *)) + let isFeatureSupported featureId = tcConfigB.langVersion.SupportsFeature featureId + let LexbufFromLineReader (fsiStdinSyphon: FsiStdinSyphon) readf = - UnicodeLexing.FunctionAsLexbuf - (fun (buf: char[], start, len) -> + UnicodeLexing.FunctionAsLexbuf + (isFeatureSupported, (fun (buf: char[], start, len) -> //fprintf fsiConsoleOutput.Out "Calling ReadLine\n" let inputOption = try Some(readf()) with :? EndOfStreamException -> None inputOption |> Option.iter (fun t -> fsiStdinSyphon.Add (t + "\n")) @@ -1709,7 +1712,7 @@ type internal FsiStdinLexerProvider for i = 0 to ntrimmed-1 do buf.[i+start] <- input.[i] ntrimmed - ) + )) //---------------------------------------------------------------------------- // Reading stdin as a lex stream @@ -1730,6 +1733,7 @@ type internal FsiStdinLexerProvider let tokenizer = LexFilter.LexFilter(interactiveInputLightSyntaxStatus, tcConfigB.compilingFslib, Lexer.token lexargs skip, lexbuf) tokenizer + let isFeatureSupported featureId = tcConfigB.langVersion.SupportsFeature featureId // Create a new lexer to read stdin member __.CreateStdinLexer (errorLogger) = @@ -1748,12 +1752,12 @@ type internal FsiStdinLexerProvider // Create a new lexer to read an "included" script file member __.CreateIncludedScriptLexer (sourceFileName, errorLogger) = - let lexbuf = UnicodeLexing.UnicodeFileAsLexbuf(sourceFileName,tcConfigB.inputCodePage,(*retryLocked*)false) + let lexbuf = UnicodeLexing.UnicodeFileAsLexbuf(isFeatureSupported, sourceFileName, tcConfigB.inputCodePage, (*retryLocked*)false) CreateLexerForLexBuffer (sourceFileName, lexbuf, errorLogger) // Create a new lexer to read a string member this.CreateStringLexer (sourceFileName, source, errorLogger) = - let lexbuf = UnicodeLexing.StringAsLexbuf(source) + let lexbuf = UnicodeLexing.StringAsLexbuf(isFeatureSupported, source) CreateLexerForLexBuffer (sourceFileName, lexbuf, errorLogger) member __.ConsoleInput = fsiConsoleInput @@ -1813,6 +1817,7 @@ type internal FsiInteractionProcessor stopProcessingRecovery e range0 istate,CompletedWithReportedError e + let isFeatureSupported featureId = tcConfigB.langVersion.SupportsFeature featureId let rangeStdin = rangeN Lexhelp.stdinMockFilename 0 @@ -2037,11 +2042,7 @@ type internal FsiInteractionProcessor let parseExpression (tokenizer:LexFilter.LexFilter) = reusingLexbufForParsing tokenizer.LexBuffer (fun () -> Parser.typedSeqExprEOF tokenizer.Lexer tokenizer.LexBuffer) - -// let parseType (tokenizer:LexFilter.LexFilter) = -// reusingLexbufForParsing tokenizer.LexBuffer (fun () -> -// Parser.typEOF tokenizer.Lexer tokenizer.LexBuffer) - + let mainThreadProcessParsedExpression ctok errorLogger (expr, istate) = istate |> InteractiveCatch errorLogger (fun istate -> istate |> mainThreadProcessAction ctok (fun ctok _tcConfig istate -> @@ -2171,7 +2172,7 @@ type internal FsiInteractionProcessor #if FX_LCIDFROMCODEPAGE use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID #endif - let lexbuf = UnicodeLexing.StringAsLexbuf(sourceText) + let lexbuf = UnicodeLexing.StringAsLexbuf(isFeatureSupported, sourceText) let tokenizer = fsiStdinLexerProvider.CreateBufferLexer(scriptFileName, lexbuf, errorLogger) currState |> InteractiveCatch errorLogger (fun istate -> @@ -2190,7 +2191,7 @@ type internal FsiInteractionProcessor #if FX_LCIDFROMCODEPAGE use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID #endif - let lexbuf = UnicodeLexing.StringAsLexbuf(sourceText) + let lexbuf = UnicodeLexing.StringAsLexbuf(isFeatureSupported, sourceText) let tokenizer = fsiStdinLexerProvider.CreateBufferLexer(scriptFileName, lexbuf, errorLogger) currState |> InteractiveCatch errorLogger (fun istate -> @@ -2645,8 +2646,8 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i member x.FormatValue(obj:obj, objTy) = fsiDynamicCompiler.FormatValue(obj, objTy) - member x.EvalExpression(sourceText) = - + member x.EvalExpression(sourceText) = + // Explanation: When the user of the FsiInteractiveSession object calls this method, the // code is parsed, checked and evaluated on the calling thread. This means EvalExpression // is not safe to call concurrently. @@ -2655,7 +2656,7 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i fsiInteractionProcessor.EvalExpression(ctok, sourceText, dummyScriptFileName, errorLogger) |> commitResult - member x.EvalExpressionNonThrowing(sourceText) = + member x.EvalExpressionNonThrowing(sourceText) = // Explanation: When the user of the FsiInteractiveSession object calls this method, the // code is parsed, checked and evaluated on the calling thread. This means EvalExpression // is not safe to call concurrently. diff --git a/src/fsharp/lex.fsl b/src/fsharp/lex.fsl index b72b15e8e9..58684e7465 100644 --- a/src/fsharp/lex.fsl +++ b/src/fsharp/lex.fsl @@ -23,6 +23,7 @@ open FSharp.Compiler open FSharp.Compiler.Range open FSharp.Compiler.Ast open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Parser open FSharp.Compiler.Lexhelp open FSharp.Compiler.Lib @@ -142,19 +143,17 @@ let tryAppendXmlDoc (buff:option) (s:string) = let shouldStartLine args lexbuf (m:range) err tok = if (m.StartColumn <> 0) then fail args lexbuf err tok else tok - + let shouldStartFile args lexbuf (m:range) err tok = if (m.StartColumn <> 0 || m.StartLine <> 1) then fail args lexbuf err tok else tok - -let evalIfDefExpression startPos args (lookup:string->bool) (lexed:string) = - let lexbuf = LexBuffer.FromChars (lexed.ToCharArray ()) + +let evalIfDefExpression startPos isFeatureSupported args (lookup:string->bool) (lexed:string) = + let lexbuf = LexBuffer.FromChars (isFeatureSupported, lexed.ToCharArray ()) lexbuf.StartPos <- startPos lexbuf.EndPos <- startPos let tokenStream = FSharp.Compiler.PPLexer.tokenstream args - let expr = FSharp.Compiler.PPParser.start tokenStream lexbuf - LexerIfdefEval lookup expr } @@ -608,7 +607,7 @@ rule token args skip = parse { let m = lexbuf.LexemeRange let lookup id = List.contains id args.defines let lexed = lexeme lexbuf - let isTrue = evalIfDefExpression lexbuf.StartPos args lookup lexed + let isTrue = evalIfDefExpression lexbuf.StartPos lexbuf.SupportsFeature args lookup lexed args.ifdefStack := (IfDefIf,m) :: !(args.ifdefStack) // Get the token; make sure it starts at zero position & return diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 03c8902b3e..d95f8ce5ce 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -18,6 +18,7 @@ open FSharp.Compiler.Ast open FSharp.Compiler.Lib open FSharp.Compiler.PrettyNaming open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features #if DEBUG let debugPrint(s) = @@ -1911,9 +1912,12 @@ opt_typ: | /* EMPTY */ { None } | COLON typ { Some $2 } - atomicPatternLongIdent: - | UNDERSCORE DOT pathOp { let (LongIdentWithDots(lid,dotms)) = $3 in (None,LongIdentWithDots(ident("_",rhs parseState 1)::lid, rhs parseState 2::dotms)) } + | UNDERSCORE DOT pathOp { + if not (parseState.LexBuffer.SupportsFeature LanguageFeature.SingleUnderscorePattern) then + raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnexpectedSymbolDot()) + let (LongIdentWithDots(lid,dotms)) = $3 in (None,LongIdentWithDots(ident("_",rhs parseState 1)::lid, rhs parseState 2::dotms)) + } | GLOBAL DOT pathOp { let (LongIdentWithDots(lid,dotms)) = $3 in (None,LongIdentWithDots(ident(MangledGlobalName,rhs parseState 1) :: lid, rhs parseState 2 :: dotms)) } | pathOp { (None,$1) } | access pathOp { (Some($1), $2) } @@ -2105,7 +2109,7 @@ inlineAssemblyTyconRepr: | HASH stringOrKeywordString HASH { libraryOnlyError (lhs parseState) let lhsm = lhs parseState - SynTypeDefnSimpleRepr.LibraryOnlyILAssembly (ParseAssemblyCodeType $2 (rhs parseState 2),lhsm) } + SynTypeDefnSimpleRepr.LibraryOnlyILAssembly (internalParseAssemblyCodeType $2 parseState.LexBuffer.SupportsFeature (rhs parseState 2),lhsm) } classOrInterfaceOrStruct: | CLASS { TyconClass } @@ -4001,11 +4005,11 @@ inlineAssemblyExpr: | HASH stringOrKeywordString opt_inlineAssemblyTypeArg opt_curriedArgExprs opt_inlineAssemblyReturnTypes HASH { libraryOnlyWarning (lhs parseState) let s,sm = $2,rhs parseState 2 - (fun m -> SynExpr.LibraryOnlyILAssembly (ParseAssemblyCodeInstructions s sm,$3,List.rev $4,$5,m)) } - -opt_curriedArgExprs: - | opt_curriedArgExprs argExpr %prec expr_args - { $2 :: $1 } + (fun m -> SynExpr.LibraryOnlyILAssembly (internalParseAssemblyCodeInstructions s parseState.LexBuffer.SupportsFeature sm, $3, List.rev $4, $5, m)) } + +opt_curriedArgExprs: + | opt_curriedArgExprs argExpr %prec expr_args + { $2 :: $1 } | { [] } diff --git a/src/fsharp/service/ServiceLexing.fs b/src/fsharp/service/ServiceLexing.fs index a03c1deeff..41e4b1c9e8 100644 --- a/src/fsharp/service/ServiceLexing.fs +++ b/src/fsharp/service/ServiceLexing.fs @@ -15,6 +15,7 @@ open FSharp.Compiler.Parser open FSharp.Compiler.Range open FSharp.Compiler.Ast open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Lexhelp open FSharp.Compiler.Lib open Internal.Utilities @@ -767,18 +768,22 @@ type FSharpLineTokenizer(lexbuf: UnicodeLexing.Lexbuf, [] type FSharpSourceTokenizer(defineConstants: string list, filename: string option) = + + // Public callers are unable to answer LanguageVersion feature support questions. + // External Tools including the VS IDE will enable the default LanguageVersion + let isFeatureSupported (_featureId:LanguageFeature) = true + let lexResourceManager = new Lexhelp.LexResourceManager() let lexArgsLightOn = mkLexargs(filename, defineConstants, LightSyntaxStatus(true, false), lexResourceManager, ref [], DiscardErrorsLogger, PathMap.empty) let lexArgsLightOff = mkLexargs(filename, defineConstants, LightSyntaxStatus(false, false), lexResourceManager, ref [], DiscardErrorsLogger, PathMap.empty) member this.CreateLineTokenizer(lineText: string) = - let lexbuf = UnicodeLexing.StringAsLexbuf lineText + let lexbuf = UnicodeLexing.StringAsLexbuf(isFeatureSupported, lineText) FSharpLineTokenizer(lexbuf, Some lineText.Length, filename, lexArgsLightOn, lexArgsLightOff) - member this.CreateBufferTokenizer bufferFiller = - let lexbuf = UnicodeLexing.FunctionAsLexbuf bufferFiller + let lexbuf = UnicodeLexing.FunctionAsLexbuf(isFeatureSupported, bufferFiller) FSharpLineTokenizer(lexbuf, None, filename, lexArgsLightOn, lexArgsLightOff) module Keywords = diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index a3afd792b8..76d28cd341 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -28,6 +28,7 @@ open FSharp.Compiler.CompileOps open FSharp.Compiler.CompileOptions open FSharp.Compiler.Driver open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Lib open FSharp.Compiler.PrettyNaming open FSharp.Compiler.Parser @@ -1533,8 +1534,11 @@ module internal Parser = let tokenizer = LexFilter.LexFilter(lightSyntaxStatus, options.CompilingFsLib, Lexer.token lexargs true, lexbuf) tokenizer.Lexer - let createLexbuf sourceText = - UnicodeLexing.SourceTextAsLexbuf(sourceText) + // Public callers are unable to answer LanguageVersion feature support questions. + // External Tools including the VS IDE will enable the default LanguageVersion + let isFeatureSupported (_featureId:LanguageFeature) = true + let createLexbuf sourceText isFeatureSupported = + UnicodeLexing.SourceTextAsLexbuf(isFeatureSupported, sourceText) let matchBraces(sourceText, fileName, options: FSharpParsingOptions, userOpName: string, suggestNamesForErrors: bool) = let delayedLogger = CapturingErrorLogger("matchBraces") @@ -1547,9 +1551,9 @@ module internal Parser = let delayedLogger = CapturingErrorLogger("matchBraces") use _unwindEL = PushErrorLoggerPhaseUntilUnwind (fun _ -> delayedLogger) use _unwindBP = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse - + let matchingBraces = new ResizeArray<_>() - Lexhelp.usingLexbufForParsing(createLexbuf sourceText, fileName) (fun lexbuf -> + Lexhelp.usingLexbufForParsing(createLexbuf sourceText isFeatureSupported, fileName) (fun lexbuf -> let errHandler = ErrorHandler(false, fileName, options.ErrorSeverityOptions, sourceText, suggestNamesForErrors) let lexfun = createLexerFunction fileName options lexbuf errHandler let parenTokensBalance t1 t2 = @@ -1585,7 +1589,7 @@ module internal Parser = use unwindBP = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse let parseResult = - Lexhelp.usingLexbufForParsing(createLexbuf sourceText, fileName) (fun lexbuf -> + Lexhelp.usingLexbufForParsing(createLexbuf sourceText isFeatureSupported, fileName) (fun lexbuf -> let lexfun = createLexerFunction fileName options lexbuf errHandler let isLastCompiland = fileName.Equals(options.LastFileName, StringComparison.CurrentCultureIgnoreCase) || diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 9abdabd61b..1776d71487 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -22,6 +22,11 @@ Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. Není definovaný obor názvů {0}. diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index e5f977192c..ae21fdf349 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -22,6 +22,11 @@ Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. Der Namespace "{0}" ist nicht definiert. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index e21d657eef..4c6094fc07 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -22,6 +22,11 @@ Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. El espacio de nombres "{0}" no está definido. diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index fd6cdbf549..1798dcf68f 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -22,6 +22,11 @@ Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. L'espace de noms '{0}' n'est pas défini. diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index f60b7905f5..1422a59d50 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -22,6 +22,11 @@ Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. Lo spazio dei nomi '{0}' non è definito. diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 0c19a13994..6234ab500c 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -22,6 +22,11 @@ Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. 名前空間 '{0}' が定義されていません。 diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index 7185fb2935..8df70a67ea 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -22,6 +22,11 @@ Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. '{0}' 네임스페이스가 정의되지 않았습니다. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index 340810b041..48e5861b74 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -22,6 +22,11 @@ Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. Nie zdefiniowano przestrzeni nazw „{0}”. diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 597b93b075..e94533db2f 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -22,6 +22,11 @@ Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. O namespace '{0}' não está definido. diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 7428d734b0..c877df99b2 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -22,6 +22,11 @@ Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. Пространство имен "{0}" не определено. diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index 1adde774d3..d9ecdae9d6 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -22,6 +22,11 @@ Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. '{0}' ad alanı tanımlı değil. diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index a1741df6fc..f4d2e63372 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -22,6 +22,11 @@ Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. 未定义命名空间“{0}”。 diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 0cf2857c69..02dc6ef625 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -22,6 +22,11 @@ Unrecognized value '{0}' for --langversion use --langversion:? for complete list + + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + + The namespace '{0}' is not defined. 未定義命名空間 '{0}'。 diff --git a/src/utils/CompilerLocationUtils.fs b/src/utils/CompilerLocationUtils.fs index da626b54c5..95aa5c5a31 100644 --- a/src/utils/CompilerLocationUtils.fs +++ b/src/utils/CompilerLocationUtils.fs @@ -207,7 +207,6 @@ module internal FSharpEnvironment = // For the prototype compiler, we can just use the current domain tryCurrentDomain() with e -> - System.Diagnostics.Debug.Assert(false, "Error while determining default location of F# compiler") None diff --git a/src/utils/prim-lexing.fs b/src/utils/prim-lexing.fs index fe71c12197..1f772d6e87 100644 --- a/src/utils/prim-lexing.fs +++ b/src/utils/prim-lexing.fs @@ -50,12 +50,12 @@ type StringText(str: string) = lazy getLines str member __.String = str - + override __.GetHashCode() = str.GetHashCode() override __.Equals(obj: obj) = str.Equals(obj) interface ISourceText with - + member __.Item with get index = str.[index] member __.GetLastCharacterPosition() = @@ -106,6 +106,7 @@ namespace Internal.Utilities.Text.Lexing open FSharp.Compiler.Text open Microsoft.FSharp.Core open Microsoft.FSharp.Collections + open FSharp.Compiler.Features open System.Collections.Generic [] @@ -168,11 +169,11 @@ namespace Internal.Utilities.Text.Lexing 0, 0) - type internal LexBufferFiller<'Char> = (LexBuffer<'Char> -> unit) - + type internal LexBufferFiller<'Char> = (LexBuffer<'Char> -> unit) + and [] - internal LexBuffer<'Char>(filler: LexBufferFiller<'Char>) = - let context = new Dictionary(1) + internal LexBuffer<'Char>(filler: LexBufferFiller<'Char>, supportsFeature:LanguageFeature -> bool) = + let context = new Dictionary(1) let mutable buffer = [||] /// number of valid characters beyond bufferScanStart. let mutable bufferMaxScanLength = 0 @@ -195,8 +196,7 @@ namespace Internal.Utilities.Text.Lexing Array.blit keep 0 buffer 0 nkeep bufferScanStart <- 0 bufferMaxScanLength <- nkeep - - + member lexbuf.EndOfScan () : int = //Printf.eprintf "endOfScan, lexBuffer.lexemeLength = %d\n" lexBuffer.lexemeLength; if bufferAcceptAction < 0 then @@ -211,13 +211,12 @@ namespace Internal.Utilities.Text.Lexing member lexbuf.StartPos with get() = startPos and set b = startPos <- b - + member lexbuf.EndPos with get() = endPos and set b = endPos <- b member lexbuf.Lexeme = Array.sub buffer bufferScanStart lexemeLength - member lexbuf.BufferLocalStore = (context :> IDictionary<_,_>) member lexbuf.LexemeLength with get() : int = lexemeLength and set v = lexemeLength <- v member lexbuf.Buffer with get() : 'Char[] = buffer and set v = buffer <- v @@ -238,45 +237,46 @@ namespace Internal.Utilities.Text.Lexing member x.BufferScanPos = bufferScanStart + bufferScanLength member lexbuf.EnsureBufferSize n = - if lexbuf.BufferScanPos + n >= buffer.Length then - let repl = Array.zeroCreate (lexbuf.BufferScanPos + n) + if lexbuf.BufferScanPos + n >= buffer.Length then + let repl = Array.zeroCreate (lexbuf.BufferScanPos + n) Array.blit buffer bufferScanStart repl bufferScanStart bufferScanLength buffer <- repl + member __.SupportsFeature featureId = supportsFeature featureId - static member FromFunction (f : 'Char[] * int * int -> int) : LexBuffer<'Char> = + static member FromFunction (supportsFeature:LanguageFeature -> bool, f : 'Char[] * int * int -> int) : LexBuffer<'Char> = let extension= Array.zeroCreate 4096 let filler (lexBuffer: LexBuffer<'Char>) = let n = f (extension,0,extension.Length) lexBuffer.EnsureBufferSize n Array.blit extension 0 lexBuffer.Buffer lexBuffer.BufferScanPos n lexBuffer.BufferMaxScanLength <- lexBuffer.BufferScanLength + n - new LexBuffer<'Char>(filler) - + new LexBuffer<'Char>(filler, supportsFeature) + // Important: This method takes ownership of the array - static member FromArrayNoCopy (buffer: 'Char[]) : LexBuffer<'Char> = - let lexBuffer = new LexBuffer<'Char>(fun _ -> ()) + static member FromArrayNoCopy (supportsFeature:LanguageFeature -> bool, buffer: 'Char[]) : LexBuffer<'Char> = + let lexBuffer = new LexBuffer<'Char>((fun _ -> ()), supportsFeature) lexBuffer.Buffer <- buffer lexBuffer.BufferMaxScanLength <- buffer.Length lexBuffer // Important: this method does copy the array - static member FromArray (s: 'Char[]) : LexBuffer<'Char> = + static member FromArray (supportsFeature: LanguageFeature -> bool, s: 'Char[]) : LexBuffer<'Char> = let buffer = Array.copy s - LexBuffer<'Char>.FromArrayNoCopy buffer + LexBuffer<'Char>.FromArrayNoCopy(supportsFeature, buffer) // Important: This method takes ownership of the array - static member FromChars (arr:char[]) = LexBuffer.FromArrayNoCopy arr - - static member FromSourceText (sourceText: ISourceText) = + static member FromChars (supportsFeature:LanguageFeature -> bool, arr:char[]) = LexBuffer.FromArrayNoCopy (supportsFeature, arr) + + static member FromSourceText (supportsFeature: LanguageFeature -> bool, sourceText: ISourceText) = let mutable currentSourceIndex = 0 - LexBuffer.FromFunction(fun (chars, start, length) -> + LexBuffer.FromFunction(supportsFeature, fun (chars, start, length) -> let lengthToCopy = if currentSourceIndex + length <= sourceText.Length then length else sourceText.Length - currentSourceIndex - + if lengthToCopy <= 0 then 0 else sourceText.CopyTo(currentSourceIndex, chars, start, lengthToCopy) @@ -312,7 +312,6 @@ namespace Internal.Utilities.Text.Lexing open GenericImplFragments - [] type internal UnicodeTables(trans: uint16[] array, accept: uint16[]) = let sentinel = 255 * 256 + 255 diff --git a/src/utils/prim-lexing.fsi b/src/utils/prim-lexing.fsi index 4b4fd58717..bf9eb3171c 100644 --- a/src/utils/prim-lexing.fsi +++ b/src/utils/prim-lexing.fsi @@ -39,6 +39,7 @@ open System.Collections.Generic open FSharp.Compiler.Text open Microsoft.FSharp.Core open Microsoft.FSharp.Control +open FSharp.Compiler.Features /// Position information stored for lexing tokens [] @@ -78,12 +79,12 @@ type internal Position = /// Apply a #line directive. member ApplyLineDirective : fileIdx:int * line:int -> Position - + /// Get an arbitrary position, with the empty string as filename. static member Empty : Position - + static member FirstLine : fileIdx:int -> Position - + [] /// Input buffers consumed by lexers generated by fslex.exe. /// The type must be generic to match the code generated by FsLex and FsYacc (if you would like to @@ -97,24 +98,28 @@ type internal LexBuffer<'Char> = /// The matched string. member Lexeme: 'Char [] - + /// Fast helper to turn the matched characters into a string, avoiding an intermediate array. static member LexemeString : LexBuffer -> string - + /// Dynamically typed, non-lexically scoped parameter table. member BufferLocalStore : IDictionary - + /// True if the refill of the buffer ever failed , or if explicitly set to True. member IsPastEndOfStream: bool with get,set + /// True if the refill of the buffer ever failed , or if explicitly set to True. + member SupportsFeature:LanguageFeature -> bool + /// Create a lex buffer suitable for Unicode lexing that reads characters from the given array. /// Important: does take ownership of the array. - static member FromChars: char[] -> LexBuffer + static member FromChars: (LanguageFeature -> bool) * char[] -> LexBuffer /// Create a lex buffer that reads character or byte inputs by using the given function. - static member FromFunction: ('Char[] * int * int -> int) -> LexBuffer<'Char> + static member FromFunction: (LanguageFeature -> bool) * ('Char[] * int * int -> int) -> LexBuffer<'Char> + /// Create a lex buffer backed by source text. - static member FromSourceText : ISourceText -> LexBuffer + static member FromSourceText : (LanguageFeature -> bool) * ISourceText -> LexBuffer /// The type of tables for an unicode lexer generated by fslex.exe. [] diff --git a/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs b/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs index 91d7bfcb8d..21667c727d 100644 --- a/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs +++ b/tests/FSharp.Compiler.UnitTests/HashIfExpression.fs @@ -12,7 +12,7 @@ open FSharp.Compiler open FSharp.Compiler.Lexer open FSharp.Compiler.Lexhelp open FSharp.Compiler.ErrorLogger -open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Ast open Internal.Utilities @@ -69,7 +69,8 @@ type HashIfExpression() = CompileThreadStatic.ErrorLogger <- errorLogger let parser (s : string) = - let lexbuf = LexBuffer.FromChars (s.ToCharArray ()) + let isFeatureSupported (_featureId:LanguageFeature) = true + let lexbuf = LexBuffer.FromChars (isFeatureSupported, s.ToCharArray ()) lexbuf.StartPos <- startPos lexbuf.EndPos <- startPos let tokenStream = PPLexer.tokenstream args diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 9376f62dcd..20f62687ca 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -27,6 +27,7 @@ NunitHelpers.fs + diff --git a/tests/fsharp/HandleExpects.fs b/tests/fsharp/HandleExpects.fs new file mode 100644 index 0000000000..9a11f90adc --- /dev/null +++ b/tests/fsharp/HandleExpects.fs @@ -0,0 +1,196 @@ +module HandleExpects + +open System +open System.IO +open System.Text.RegularExpressions +open System.Xml + +type Expects = { status:string; id:string; span:string; pattern:string; mutable matched:bool; line:string } +type ErrorMessage = { source:string; status:string; id:string; span:string; text:string; mutable matched:bool; line:string } +type Span = { startrow:int; startcol:int; endrow:int; endcol:int } + +let tryParseSpan (span:string) = + let s = span.Trim([| '('; ')' |]).Split(',') + match s.Length with + | 2 -> { startrow=Int32.Parse(s.[0]); startcol=Int32.Parse(s.[1]); endrow=Int32.MaxValue; endcol=Int32.MaxValue } + | 4 -> { startrow=Int32.Parse(s.[0]); startcol=Int32.Parse(s.[1]); endrow=Int32.Parse(s.[2]); endcol=Int32.Parse(s.[3]) } + | _ -> raise (InvalidDataException(sprintf "The span : '%s' is invalid" span)); + +let isStringEmpty s = String.IsNullOrWhiteSpace(s) +let isStringNotEmpty s = not (isStringEmpty s) +let stringToLower s = if isStringNotEmpty s then s.ToLower() else s +let areStringsEqual s1 s2 = String.Compare(s1, s2, StringComparison.OrdinalIgnoreCase) = 0 +let areSpansEqual s1 s2 = + let span1 = tryParseSpan s1 + let span2 = tryParseSpan s2 + if span1.startrow <> span2.startrow then false + elif span1.startcol <> span2.startcol then false + elif span1.endrow <> span2.endrow then false + elif span1.endcol <> span2.endcol then false + else true + +let stripFromFileExpectations source = + let readExpect expect = + let pattern = "(?]*>{1})(?.*)(?)" //"().)*-->|<\w*((?!\/<).)*\/>|<(?\w+)[^>]*>(?>[^<]|(?R))*<\/\k\s*>)" + let rx = new Regex(pattern) + let matched = rx.Match(expect) + if matched.Success then + // The content of the Expects group contains a lot of invalid Xml and the Xml reader fails when it sees it. + // So we just save it away, remove it from the xml, then read the xml and put it back + // Save away the contents of the element and strip it out of expect pattern + let content = (matched.Groups.[2]).ToString() + let nocontentxpect = + if isStringEmpty content then expect + else expect.Replace(content, "") + + let rdr = XmlReader.Create(new StringReader(nocontentxpect)) + let mutable element = { status="success"; id = ""; span = ""; pattern = content; matched = false; line=nocontentxpect } + let mutable insideExpects = false + let mutable foundOne = false + try + let rec loop () = + if rdr.Read() then + match rdr.NodeType with + | XmlNodeType.Element when String.Compare(rdr.Name, "Expects", StringComparison.OrdinalIgnoreCase) = 0 -> + insideExpects <- true + if rdr.AttributeCount > 0 then + let status = stringToLower (rdr.GetAttribute("status")) + let span = rdr.GetAttribute("span") + let id = stringToLower (rdr.GetAttribute("id")) + element <- {element with status=status; id=id; span=span } + foundOne <- true + | XmlNodeType.EndElement when String.Compare(rdr.Name, "Expects", StringComparison.OrdinalIgnoreCase) = 0 -> + insideExpects <- false + | _ -> () + loop () + else () + loop () + if foundOne then Some element + else None + with | e -> printfn "Oops !!! %A" e; reraise() + else None + + File.ReadAllLines(source) + |> Array.filter(fun line -> line.Trim().StartsWith(@"//")) + |> Array.map(fun line -> line.Trim().Substring(2).Trim()) + |> Array.filter(fun line -> line.StartsWith(@" Array.map(fun expect -> readExpect expect) + |> Array.filter(fun expect -> expect.IsSome) + |> Array.map(fun expect -> expect.Value) + +let readErrorMessagesFromOutput output = + //Formats of error messages + // Syntax error in code: + // 1. filename(row,col): (sometext perhaps typecheck) error|warning ErrorNo: ErrorText + // e.g: Program.fs(5,9): error ErrorNo: ErrorText + // 2. Program.fs(5,3,5,20): (sometext perhaps typecheck) error FS0039: ErrorText + // e.g: + // Program.fs(5,3,5,20): (sometext perhaps typecheck) error FS0039: PicturePoint ... + // 3. error ErrorNo: ErrorText + // e.g: error FS0207: No inputs specified + let getErrorMessage line pattern = + let rx = new Regex(pattern) + let matched = rx.Match(line) + let getMatchForName (name:string) = matched.Groups.[name].ToString() + + if matched.Success then Some { + source = (getMatchForName "tagSourceFileName") + status = stringToLower (getMatchForName "tagStatus") + id = stringToLower (getMatchForName "tagErrorNo") + span = (getMatchForName "tagSpan") + text = (getMatchForName "tagText") + matched = false + line = line + } + else None + + let rgxTagSourceFileName = "(?[^(]{1,})(?:[(]{1})" + let rgxTagSpan = "(?[^):]{1,})(?:[)]{1})(?:[(\s:]*)" + let rgxTagStatus = "(?(error|typecheck error|warning|success|notin))" + let rgxColonWhiteSpace = "(?:[\s:]*)" + let rgxWhiteSpace = "(?:[\s]*)" + let rgxTagErrorNo = "(?\s*[^:\s]*)" + let rgxTagText = "(?.*)" + let rgxTagTail = "(?\s\[.*\]$)" + + // E.g: Q:\version46\test.fs(25,13): error FS0010: Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. [Q:\Temp\FSharp.Cambridge\vaw2t1vp.cai\f0bi0hny.wwx.fsproj] + let rgxFull = rgxTagSourceFileName + rgxTagSpan + rgxColonWhiteSpace + rgxTagStatus + rgxWhiteSpace + rgxTagErrorNo + rgxColonWhiteSpace + rgxTagText + rgxWhiteSpace + rgxTagTail + + // E.g: FSC : error FS0010: Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. [Q:\Temp\FSharp.Cambridge\vaw2t1vp.cai\f0bi0hny.wwx.fsproj] + let rgxShort = rgxTagStatus + rgxTagErrorNo + rgxColonWhiteSpace + rgxTagText + rgxWhiteSpace + rgxTagTail + [| + for line in output do + let errorMessage = + getErrorMessage line rgxFull + |> Option.orElse (getErrorMessage line rgxShort) + match errorMessage with + | Some e -> yield e + | _ -> () + |] + +let compareResults output (expectations:Expects array) (errorMessages:ErrorMessage array) = + for expect in expectations do + match expect.status with + | "error" + | "typecheck error" + | "warning" -> + // Check for this error/warning in found errors list + for msg in errorMessages do + let matched = + if isStringNotEmpty expect.id && not (areStringsEqual expect.id msg.id) then false + elif isStringNotEmpty expect.status && not (areStringsEqual expect.status msg.status) then false + elif isStringNotEmpty expect.span && not (areSpansEqual expect.span msg.span) then false + elif isStringNotEmpty expect.pattern then + let regex = new Regex(expect.pattern) + let matched = regex.Match(msg.text) + matched.Success + else true + if matched then + expect.matched <- true + msg.matched <- true + | "success" -> + // In this case search for text in the page + let regex = new Regex(expect.pattern) + for line in output do + let matched = regex.Match(line) + if matched.Success then expect.matched <- true + | "notin" -> + // In this case search for text not appearing in the page + let regex = new Regex(expect.pattern) + let mutable found = false + for line in output do + let matched = regex.Match(line) + if matched.Success then found <- true + if not found then expect.matched <- true + | _ -> () + +let verifyResults source outputPath = + let output = File.ReadAllLines(outputPath) + let expectations = stripFromFileExpectations source + if expectations.Length > 0 then + // There must be at least one to do this testing + let errorMessages = readErrorMessagesFromOutput output + compareResults output expectations errorMessages + + // Print out discovered expects + let verifiedexpectations = + expectations + |> Seq.fold(fun result expects -> + if not (expects.matched) then + printfn "Failed to match expected result '%s'" expects.line + false + else result + ) true + let verifiederrormessages = + errorMessages + |> Seq.fold(fun result msg -> + if not (msg.matched) then + printfn "Failed to match produced error message: '%s'" msg.line + false + else result + ) true + + if not (verifiedexpectations && verifiederrormessages) then + failwith (sprintf "Failed validating error codes") + +//HandleExpects.verifyResults @"C:\Users\kevinr\AppData\Local\Temp\FSharp.Cambridge\bcnyzkvb.ict\test.fs" @"C:\Users\kevinr\AppData\Local\Temp\FSharp.Cambridge\bcnyzkvb.ict\buildoutput.txt" \ No newline at end of file diff --git a/tests/fsharp/core/members/basics/test.fs b/tests/fsharp/core/members/basics/test.fs index ee04812f83..27c9e6c3a4 100644 --- a/tests/fsharp/core/members/basics/test.fs +++ b/tests/fsharp/core/members/basics/test.fs @@ -54,8 +54,8 @@ open System.Windows.Forms //----------------------------------------- // Some simple object-expression tests -let x0 = { new System.Object() with member _.GetHashCode() = 3 } -let x1 = { new System.Windows.Forms.Form() with member _.GetHashCode() = 3 } +let x0 = { new System.Object() with member __.GetHashCode() = 3 } +let x1 = { new System.Windows.Forms.Form() with member __.GetHashCode() = 3 } //----------------------------------------- // Test defining an F# class @@ -72,16 +72,16 @@ type ClassType1 = abstract VirtualMethod2: string * string -> int abstract VirtualMethod1PostHoc: string -> int abstract VirtualMethod2PostHoc: string * string -> int - default _.VirtualMethod1(s) = 3 - default _.VirtualMethod2(s1,s2) = 3 + default x.VirtualMethod1(s) = 3 + default x.VirtualMethod2(s1,s2) = 3 new(s: string) = { inherit System.Object(); someField = "abc" } end type ClassType1 with - default _.VirtualMethod1PostHoc(s) = 3 - default _.VirtualMethod2PostHoc(s1,s2) = 3 + default x.VirtualMethod1PostHoc(s) = 3 + default x.VirtualMethod2PostHoc(s1,s2) = 3 new(s1,s2) = { inherit System.Object(); someField = "constructor2" + s1 + s2 } end @@ -93,11 +93,11 @@ type ClassType1 end -let x2 = { new ClassType1("a") with member _.GetHashCode() = 3 } -let x3 = { new ClassType1("a") with member _.VirtualMethod1(s) = 4 } +let x2 = { new ClassType1("a") with member __.GetHashCode() = 3 } +let x3 = { new ClassType1("a") with member __.VirtualMethod1(s) = 4 } let x4 = { new ClassType1("a") with - member _.VirtualMethod1(s) = 5 - member _.VirtualMethod2(s1,s2) = s1.Length + s2.Length } + member __.VirtualMethod1(s) = 5 + member __.VirtualMethod2(s1,s2) = s1.Length + s2.Length } @@ -119,18 +119,18 @@ type ClassType2 = inherit ClassType1 val someField2 : string - override _.VirtualMethod1(s) = 2001 + override x.VirtualMethod1(s) = 2001 override x.VirtualMethod2(s1,s2) = s1.Length + s2.Length + String.length x.someField2 new(s) = { inherit ClassType1(s); someField2 = s } end -let x22 = { new ClassType2("a") with member _.GetHashCode() = 3 } -let x32 = { new ClassType2("abc") with member _.VirtualMethod1(s) = 4002 } +let x22 = { new ClassType2("a") with member __.GetHashCode() = 3 } +let x32 = { new ClassType2("abc") with member __.VirtualMethod1(s) = 4002 } let x42 = { new ClassType2("abcd") with - member _.VirtualMethod1(s) = 5004 - member _.VirtualMethod2(s1,s2) = 500 + s1.Length + s2.Length } + member __.VirtualMethod1(s) = 5004 + member __.VirtualMethod2(s1,s2) = 500 + s1.Length + s2.Length } do test "e09wckj2ddwdw" (ignore(((x22 :> obj) :?> ClassType1)); true) do test "e09wckj2ddwdw" (ignore((x22 :> ClassType1)); true) @@ -166,7 +166,7 @@ module AbstractClassTest = begin type ClassType1 with interface IEnumerable with - member _.GetEnumerator() = failwith "no implementation" + member x.GetEnumerator() = failwith "no implementation" end end @@ -175,8 +175,8 @@ module AbstractClassTest = begin //let shouldGiveError2 = { new ClassType1("a") with AbstractMethod1(s) = 4 } //let shouldGiveError3a = new ClassType1("a") let x4 = { new ClassType1("a") with - member _.AbstractMethod1(s) = 5 - member _.AbstractMethod2(s1,s2) = s1.Length + s2.Length } + member __.AbstractMethod1(s) = 5 + member __.AbstractMethod2(s1,s2) = s1.Length + s2.Length } do test "e09wckj2d" (try ignore((x2 :> IEnumerable).GetEnumerator()); false with Failure "no implementation" -> true) @@ -191,18 +191,18 @@ module AbstractClassTest = begin inherit ClassType1 val someField2 : string - override _.AbstractMethod1(s) = 2001 + override x.AbstractMethod1(s) = 2001 override x.AbstractMethod2(s1,s2) = s1.Length + s2.Length + String.length x.someField2 new(s) = { inherit ClassType1(s); someField2 = s } end - let x22 = { new ClassType2("a") with member _.GetHashCode() = 3 } - let x32 = { new ClassType2("abc") with member _.AbstractMethod1(s) = 4002 } + let x22 = { new ClassType2("a") with member __.GetHashCode() = 3 } + let x32 = { new ClassType2("abc") with member __.AbstractMethod1(s) = 4002 } let x42 = { new ClassType2("abcd") with - member _.AbstractMethod1(s) = 5004 - member _.AbstractMethod2(s1,s2) = 500 + s1.Length + s2.Length } + member __.AbstractMethod1(s) = 5004 + member __.AbstractMethod2(s1,s2) = 500 + s1.Length + s2.Length } do test "e09wckj2ddwdw" (ignore(((x22 :> obj) :?> ClassType1)); true) do test "e09wckj2ddwdw" (ignore((x22 :> ClassType1)); true) @@ -218,7 +218,7 @@ module AbstractClassTest = begin inherit ClassType2 val someField3 : string - override _.AbstractMethod1(s) = 2001 + override x.AbstractMethod1(s) = 2001 override x.AbstractMethod2(s1,s2) = s1.Length + s2.Length + String.length x.someField2 + x.someField3.Length new(s) = { inherit ClassType2(s); someField3 = s } @@ -306,8 +306,8 @@ module RecordTypeTest = begin with get(idx) = x.instanceArray.[idx] member x.InstanceIndexer2 with get(idx1,idx2) = x.instanceArray2.[idx1].[idx2] - member _.InstanceIndexer2Count1 = 2 - member _.InstanceIndexer2Count2 = 2 + member x.InstanceIndexer2Count1 = 2 + member x.InstanceIndexer2Count2 = 2 member x.MutableInstanceIndexerCount = Array.length x.mutableInstanceArray @@ -318,8 +318,8 @@ module RecordTypeTest = begin member x.MutableInstanceIndexer2 with get (idx1,idx2) = x.mutableInstanceArray2.[idx1].[idx2] and set (idx1,idx2) (v:string) = x.mutableInstanceArray2.[idx1].[idx2] <- v - member _.MutableInstanceIndexer2Count1 = 2 - member _.MutableInstanceIndexer2Count2 = 2 + member x.MutableInstanceIndexer2Count1 = 2 + member x.MutableInstanceIndexer2Count2 = 2 static member StaticProperty = staticField static member MutableStaticProperty @@ -353,8 +353,8 @@ module RecordTypeTest = begin with get(idx) = x.instanceArray.[idx] member x.PrivateInstanceIndexer2 with get(idx1,idx2) = x.instanceArray2.[idx1].[idx2] - member _.PrivateInstanceIndexer2Count1 = 2 - member _.PrivateInstanceIndexer2Count2 = 2 + member x.PrivateInstanceIndexer2Count1 = 2 + member x.PrivateInstanceIndexer2Count2 = 2 member x.PrivateMutableInstanceIndexerCount = Array.length x.mutableInstanceArray @@ -365,8 +365,8 @@ module RecordTypeTest = begin member x.PrivateMutableInstanceIndexer2 with get (idx1,idx2) = x.mutableInstanceArray2.[idx1].[idx2] and set (idx1,idx2) (v:string) = x.mutableInstanceArray2.[idx1].[idx2] <- v - member _.PrivateMutableInstanceIndexer2Count1 = 2 - member _.PrivateMutableInstanceIndexer2Count2 = 2 + member x.PrivateMutableInstanceIndexer2Count1 = 2 + member x.PrivateMutableInstanceIndexer2Count2 = 2 static member PrivateStaticProperty = staticField static member PrivateMutableStaticProperty @@ -602,35 +602,35 @@ module UnionTypeTest = begin static member MutableStaticIndexerCount = Array.length mutableStaticArray // methods - member _.InstanceMethod(s1:string) = Printf.sprintf "InstanceMethod(%s)" s1 + member x.InstanceMethod(s1:string) = Printf.sprintf "InstanceMethod(%s)" s1 static member StaticMethod((s1:string),(s2:string)) = Printf.sprintf "AbstractType.StaticMethod(%s,%s)" s1 s2 // private versions of the above - member _.PrivateInstanceProperty = "InstanceProperty" - member _.PrivateMutableInstanceProperty + member x.PrivateInstanceProperty = "InstanceProperty" + member x.PrivateMutableInstanceProperty with get() = "a" and set(v:string) = Printf.printf "called mutator\n" - member _.PrivateInstanceIndexerCount = 1 + member x.PrivateInstanceIndexerCount = 1 - member _.PrivateInstanceIndexer + member x.PrivateInstanceIndexer with get(idx) = "b" - member _.PrivateInstanceIndexer2 + member x.PrivateInstanceIndexer2 with get(idx1,idx2) = "c" - member _.PrivateInstanceIndexer2Count1 = 1 - member _.PrivateInstanceIndexer2Count2 = 1 + member x.PrivateInstanceIndexer2Count1 = 1 + member x.PrivateInstanceIndexer2Count2 = 1 - member _.PrivateMutableInstanceIndexerCount = 3 + member x.PrivateMutableInstanceIndexerCount = 3 - member _.PrivateMutableInstanceIndexer + member x.PrivateMutableInstanceIndexer with get (idx1) = "a" and set (idx1) (v:string) = Printf.printf "called mutator\n" - member _.PrivateMutableInstanceIndexer2 + member x.PrivateMutableInstanceIndexer2 with get (idx1,idx2) = "a" and set (idx1,idx2) (v:string) = Printf.printf "called mutator\n" - member _.PrivateMutableInstanceIndexer2Count1 = 2 - member _.PrivateMutableInstanceIndexer2Count2 = 2 + member x.PrivateMutableInstanceIndexer2Count1 = 2 + member x.PrivateMutableInstanceIndexer2Count2 = 2 static member PrivateStaticProperty = staticField static member PrivateMutableStaticProperty @@ -649,7 +649,7 @@ module UnionTypeTest = begin static member PrivateMutableStaticIndexerCount = Array.length mutableStaticArray // methods - member _.PrivateInstanceMethod(s1:string) = Printf.sprintf "InstanceMethod(%s)" s1 + member x.PrivateInstanceMethod(s1:string) = Printf.sprintf "InstanceMethod(%s)" s1 static member PrivateStaticMethod((s1:string),(s2:string)) = Printf.sprintf "AbstractType.StaticMethod(%s,%s)" s1 s2 end @@ -1286,7 +1286,7 @@ open System.Windows.Forms type MyCanvas2 = class inherit Form - override _.OnPaint(args) = Printf.printf "OnPaint\n"; base.OnPaint(args) + override x.OnPaint(args) = Printf.printf "OnPaint\n"; base.OnPaint(args) new() = { inherit Form(); } end @@ -1443,10 +1443,10 @@ module MultiInterfaceTest = begin type C1 = class interface PrivateInterfaceA1 with - member _.M1() = () + member x.M1() = () end interface PrivateInterfaceA2 with - member _.M2() = () + member x.M2() = () end end end @@ -1458,10 +1458,10 @@ module MultiInterfaceTestNameConflict = begin type C1 = class interface PrivateInterfaceA1 with - member _.M() = () + member x.M() = () end interface PrivateInterfaceA2 with - member _.M() = () + member x.M() = () end end end @@ -1474,10 +1474,10 @@ module GenericMultiInterfaceTestNameConflict = begin type C1 = class interface PrivateInterfaceA1 with - member _.M(y) = y + member x.M(y) = y end interface PrivateInterfaceA2 with - member _.M(y) = y + member x.M(y) = y end end end @@ -1491,28 +1491,28 @@ module DeepInterfaceInheritance = begin type C1 = class interface InterfaceA2 with - member _.M1(y) = y - member _.M2(y) = y + y + member x.M1(y) = y + member x.M2(y) = y + y end new() = { inherit Object(); } end type C2 = class interface InterfaceA3 with - member _.M1(y) = y - member _.M2(y) = y + y - member _.M3(y) = y + y + y + member x.M1(y) = y + member x.M2(y) = y + y + member x.M3(y) = y + y + y end new() = { inherit Object(); } end type C3 = class interface InterfaceA2 with - member _.M1(y) = y - member _.M2(y) = y + y + member x.M1(y) = y + member x.M2(y) = y + y end interface InterfaceA3 with - member _.M3(y) = y + y + y + member x.M3(y) = y + y + y end new() = { inherit Object(); } end @@ -1542,28 +1542,28 @@ module DeepGenericInterfaceInheritance = begin type C1 = class interface InterfaceA2 with - member _.M1(y) = 1::y - member _.M2(x,y) = x::y + member obj.M1(y) = 1::y + member obj.M2(x,y) = x::y end new() = { inherit Object(); } end type C2 = class interface InterfaceA3 with - member _.M1(y) = "a" :: y - member _.M2(x,y) = x :: y - member _.M3(y) = "a" :: "b" :: "c" :: y + member obj.M1(y) = "a" :: y + member obj.M2(x,y) = x :: y + member obj.M3(y) = "a" :: "b" :: "c" :: y end new() = { inherit Object(); } end type C3 = class interface InterfaceA2 with - member _.M1(y) = "a" :: y - member _.M2(x,y) = x :: y + member obj.M1(y) = "a" :: y + member obj.M2(x,y) = x :: y end interface InterfaceA3 with - member _.M3(y) = "a" :: "b" :: "c" :: y + member obj.M3(y) = "a" :: "b" :: "c" :: y end new() = { inherit Object(); } end @@ -1892,12 +1892,12 @@ module Ralf = begin val PrecisionMean : float val Precision : float new (precisionMean, precision) = { PrecisionMean = 0.0; Precision = 0.0 } - override _.NumberOfDimensions() = 1 - override _.Density point = 1.0 - override _.AbsoluteDifference distribution = 0.0 - override _.Clone() = new Gaussian1D (0.0,0.0) :> Distribution + override x.NumberOfDimensions() = 1 + override x.Density point = 1.0 + override x.AbsoluteDifference distribution = 0.0 + override x.Clone() = new Gaussian1D (0.0,0.0) :> Distribution override x.CloneConstant() = new Gaussian1D (x.PrecisionMean,x.Precision) :> Distribution - override _.Sample numberOfSamples random = failwith "" // new Matrix (numberOfSamples,x.NumberOfDimensions) + override x.Sample numberOfSamples random = failwith "" // new Matrix (numberOfSamples,x.NumberOfDimensions) end end @@ -2015,19 +2015,19 @@ module PropertyOverrideTests = begin type CTest = class inherit A - override _.S1 with set v = () - override _.S2 with set s v = () - override _.S3 with set (s1,s2) v = () - override _.G1 with get () = 1.0 - override _.G2 with get (s:string) = 2.0 - override _.G3 with get (s1,s2) = 3.0 + override x.S1 with set v = () + override x.S2 with set s v = () + override x.S3 with set (s1,s2) v = () + override x.G1 with get () = 1.0 + override x.G2 with get (s:string) = 2.0 + override x.G3 with get (s1,s2) = 3.0 interface IA with - override _.S1 with set v = () - override _.S2 with set s v = () - override _.S3 with set (s1,s2) v = () - override _.G1 with get () = 1.0 - override _.G2 with get (s:string) = 2.0 - override _.G3 with get (s1,s2) = 3.0 + override x.S1 with set v = () + override x.S2 with set s v = () + override x.S3 with set (s1,s2) v = () + override x.G1 with get () = 1.0 + override x.G2 with get (s:string) = 2.0 + override x.G3 with get (s1,s2) = 3.0 end end @@ -2439,7 +2439,7 @@ module BaseCallTest = begin type C1 = class new() = {} abstract Blah : unit -> unit - default _.Blah () = + default this.Blah () = ignore <| printf "From C1\n"; res := !res + 2 end @@ -2447,7 +2447,7 @@ module BaseCallTest = begin type C2 = class inherit C1 new() = {inherit C1()} - override _.Blah() = + override this.Blah() = ignore <| printf "From C2\n"; res := !res + 1; base.Blah() @@ -2465,7 +2465,7 @@ module BaseCallTest2 = begin type C1 = class new() = {} abstract Blah : unit -> unit - default _.Blah () = + default this.Blah () = ignore <| printf "From C1b\n"; ignore <| printf "From C1b\n"; ignore <| printf "From C1b\n"; @@ -2478,7 +2478,7 @@ module BaseCallTest2 = begin type C2 = class inherit C1 new() = {inherit C1()} - override _.Blah() = + override this.Blah() = ignore <| printf "From C2b\n"; ignore <| printf "From C2b\n"; ignore <| printf "From C2b\n"; @@ -2492,7 +2492,7 @@ module BaseCallTest2 = begin type C3 = class inherit C2 new() = {inherit C2()} - override _.Blah() = + override this.Blah() = ignore <| printf "From C3c\n"; ignore <| printf "From C3c\n"; ignore <| printf "From C3c\n"; @@ -2559,7 +2559,7 @@ module SettingPropertiesInConstruction = begin val mutable q : int member x.Q with set v = x.q <- v abstract Foo : int -> int - default _.Foo(x) = x + default o.Foo(x) = x new() = { p = 0; q = 1 } end @@ -2728,7 +2728,7 @@ module StephenTolksdorfBug1112 = begin type Test() = class interface ITest2 with - member _.Foo<'t>(v:'t) : 't = v + member x.Foo<'t>(v:'t) : 't = v end end @@ -2751,7 +2751,7 @@ module Bug1281Test = begin val mutable key: int new (keyIn) = {key=keyIn} - member _.Item with get(i:int) = if i=0 then 1 else + member n.Item with get(i:int) = if i=0 then 1 else failwith "node has 2 items only" end let nd = new node (10) @@ -2772,11 +2772,11 @@ module Bug960Test1 = begin type C = class inherit B - override _.A + override x.A with get() = 3 and set(v : int) = (invalidArg "arg" "C.A.set" : unit) - override _.M() = 3 + override x.M() = 3 end end @@ -2804,7 +2804,7 @@ module Bug960Test2 = begin new() = { inherit B(3,4) } - override _.A + override x.A with get() = 3 and set(v : int) = (invalidArg "arg" "C.A.set" : unit) end end @@ -2815,19 +2815,19 @@ module RandomAdditionalNameResolutionTests = begin module M = begin type Foo() = class - member _.Name = "a" + member x.Name = "a" end type Foo<'a>() = class - member _.Name = "a" + member x.Name = "a" end type Goo<'a>() = class - member _.Name = "a" + member x.Name = "a" end type Goo() = class - member _.Name = "a" + member x.Name = "a" end end @@ -3103,9 +3103,9 @@ module CondensationTest = begin class [] - member _.Prop = "Hello" + member this.Prop = "Hello" [] - member _.Meth() = "Boo" + member this.Meth() = "Boo" end let getAttribute<'t> (memb: MemberInfo) = let attrib = memb.GetCustomAttributes(typeof<'t>, false) in @@ -3138,7 +3138,7 @@ module OptionalArgumentWithSubTyping = begin type Test(?bse: Base) = class let value = match bse with Some b -> b | _ -> new Base() - member _.Value = value + member t.Value = value end let t1 = new Test(bse=Base()) // should not trigger exception @@ -3254,7 +3254,7 @@ module NewConstraintUtilizedInTypeEstablishment_FSharp_1_0_4850 = begin type D() = class let f = 0 interface I with - member _.foo = f + 1 + member x.foo = f + 1 end end @@ -3264,8 +3264,8 @@ module TestTupleOverloadRules_Bug5985 = begin type C() = class - member _.CheckCooperativeLevel() = true - member _.CheckCooperativeLevel([] x:byref) = true + member device.CheckCooperativeLevel() = true + member device.CheckCooperativeLevel([] x:byref) = true end let c = C() diff --git a/tests/fsharp/core/members/self-identifier/version46/test.fs b/tests/fsharp/core/members/self-identifier/version46/test.fs new file mode 100644 index 0000000000..5a53a84a4c --- /dev/null +++ b/tests/fsharp/core/members/self-identifier/version46/test.fs @@ -0,0 +1,62 @@ +//Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. +//Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. +//Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. +//Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + +module Global + +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +//-------------------------------------------------------------- +// Test using "_" as the self identifier introduced in F# 4.7 +type MyTypeWithUnderscoreIdentifier () = + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + +[] +type MyStructWithUnderscoreIdentifier = + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + +type MyClassWithUnderscoreIdentifier () = + class + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + end + +type MyStructTypeWithUnderscoreIdentifier = + struct + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + end + + +#if TESTS_AS_APP +let RUN() = !failures +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif diff --git a/tests/fsharp/core/members/self-identifier/version47/test.fs b/tests/fsharp/core/members/self-identifier/version47/test.fs new file mode 100644 index 0000000000..99629250b6 --- /dev/null +++ b/tests/fsharp/core/members/self-identifier/version47/test.fs @@ -0,0 +1,58 @@ +module Global + +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +//-------------------------------------------------------------- +// Test using "_" as the self identifier introduced in F# 4.7 +type MyTypeWithUnderscoreIdentifier () = + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + +[] +type MyStructWithUnderscoreIdentifier = + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + +type MyClassWithUnderscoreIdentifier () = + class + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + end + +type MyStructTypeWithUnderscoreIdentifier = + struct + member _.MethodWithUnderscoreSelf() = true + member __.MethodWithDoubleUnderscoreSelf() = true + member _E.MethodWithUnderscoreESelf() = true + end + + +#if TESTS_AS_APP +let RUN() = !failures +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif + diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index d3dc0f0c83..0b48119807 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -5,15 +5,17 @@ open System.IO open System.Diagnostics open NUnit.Framework open TestFramework - +open HandleExpects type Permutation = | FSC_CORECLR + | FSC_CORECLR_BUILDONLY | FSI_CORECLR #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS | FSI_FILE | FSI_STDIN | GENERATED_SIGNATURE + | FSC_BUILDONLY | FSC_OPT_MINUS_DEBUG | FSC_OPT_PLUS_DEBUG | AS_DLL @@ -59,7 +61,6 @@ type ProjectConfiguration = { Optimize:bool } - let replaceTokens tag (replacement:string) (template:string) = template.Replace(tag, replacement) let generateProps testCompilerVersion configuration = @@ -97,7 +98,7 @@ let generateOverrides = // optimize = true or false // configuration = "Release" or "Debug" // -let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramework:string) configuration = +let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramework:string) configuration languageVersion= let fsharpCoreLocation = let compiler = if outputType = OutputType.Script then @@ -111,7 +112,6 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo "net45" (Path.GetFullPath(__SOURCE_DIRECTORY__) + "/../../artifacts/bin/" + compiler + "/" + configuration + "/" + targetCore + "/FSharp.Core.dll") - let computeSourceItems addDirectory addCondition (compileItem:CompileItem) sources = let computeInclude src = let fileName = if addDirectory then Path.Combine(pc.SourceDirectory, src) else src @@ -148,6 +148,7 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo false $(DEBUG) portable + $(LANGUAGEVERSION) $(OPTIMIZE) false NETCOREAPP @@ -201,12 +202,12 @@ let generateProjectArtifacts (pc:ProjectConfiguration) outputType (targetFramewo |> replaceTokens "$(OPTIMIZE)" optimize |> replaceTokens "$(DEBUG)" debug |> replaceTokens "$(TARGETFRAMEWORK)" targetFramework + |> replaceTokens "$(LANGUAGEVERSION)" languageVersion |> replaceTokens "$(RestoreFromArtifactsPath)" (Path.GetFullPath(__SOURCE_DIRECTORY__) + "/../../artifacts/packages/" + configuration) - generateProjBody let lockObj = obj() -let singleTestBuildAndRunCore cfg copyFiles p = +let singleTestBuildAndRunCore cfg copyFiles p languageVersion = let sources = [] let loadSources = [] let useSources = [] @@ -220,13 +221,13 @@ let singleTestBuildAndRunCore cfg copyFiles p = // compilerType = "coreclr" or "net40" // targetFramework optimize = "net472" OR NETCOREAPP2.1 etc ... // optimize = true or false - let executeSingleTestBuildAndRun outputType compilerType targetFramework optimize = + let executeSingleTestBuildAndRun outputType compilerType targetFramework optimize buildOnly = let mutable result = false let directory = let mutable result = "" lock lockObj <| (fun () -> let rec loop () = - let dir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()) + let dir = Path.Combine(Path.GetTempPath(), "FSharp.Cambridge", Path.GetRandomFileName()) if Directory.Exists(dir) then loop () else @@ -248,6 +249,13 @@ let singleTestBuildAndRunCore cfg copyFiles p = Optimize = optimize } + let findFirstSourceFile (pc:ProjectConfiguration) = + let sources = List.append pc.SourceItems pc.ExtraSourceItems + let found = sources |> List.tryFind(fun source -> File.Exists(Path.Combine(directory, source))) + match found with + | Some p -> Path.Combine(directory, p) + | None -> failwith "Missing SourceFile in test case" + let targetsBody = generateTargets let overridesBody = generateOverrides let targetsFileName = Path.Combine(directory, "Directory.Build.targets") @@ -261,27 +269,33 @@ let singleTestBuildAndRunCore cfg copyFiles p = try File.Delete(Path.Combine(directory, "FSharp.Core.dll")) with _ -> () emitFile targetsFileName targetsBody emitFile overridesFileName overridesBody + let buildOutputFile = Path.Combine(directory, "buildoutput.txt") if outputType = OutputType.Exe then let executeFsc testCompilerVersion targetFramework = let propsBody = generateProps testCompilerVersion cfg.BUILD_CONFIG emitFile propsFileName propsBody - let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG + let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG languageVersion emitFile projectFileName projectBody use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - exec { cfg with Directory = directory } cfg.DotNetExe (sprintf "run -f %s" targetFramework) - testOkFile.CheckExists() + let cfg = { cfg with Directory = directory } + let result = execBothToOutNoCheck cfg directory buildOutputFile cfg.DotNetExe (sprintf "run -f %s" targetFramework) + if not (buildOnly) then + result |> checkResult + testOkFile.CheckExists() executeFsc compilerType targetFramework + if buildOnly then verifyResults (findFirstSourceFile pc) buildOutputFile else let executeFsi testCompilerVersion targetFramework = let propsBody = generateProps testCompilerVersion cfg.BUILD_CONFIG emitFile propsFileName propsBody - let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG + let projectBody = generateProjectArtifacts pc outputType targetFramework cfg.BUILD_CONFIG languageVersion emitFile projectFileName projectBody use testOkFile = new FileGuard(Path.Combine(directory, "test.ok")) - exec { cfg with Directory = directory } cfg.DotNetExe "build /t:RunFSharpScript" + let cfg = { cfg with Directory = directory } + execBothToOut cfg directory buildOutputFile cfg.DotNetExe "build /t:RunFSharpScript" testOkFile.CheckExists() executeFsi compilerType targetFramework - result <- true + result <- true finally if result <> false then Directory.Delete(directory, true) @@ -291,13 +305,15 @@ let singleTestBuildAndRunCore cfg copyFiles p = printfn "Filename: %s" projectFileName match p with - | FSC_CORECLR -> executeSingleTestBuildAndRun OutputType.Exe "coreclr" "netcoreapp2.0" true - | FSI_CORECLR -> executeSingleTestBuildAndRun OutputType.Script "coreclr" "netcoreapp2.0" true + | FSC_CORECLR -> executeSingleTestBuildAndRun OutputType.Exe "coreclr" "netcoreapp2.0" true false + | FSC_CORECLR_BUILDONLY -> executeSingleTestBuildAndRun OutputType.Exe "coreclr" "netcoreapp2.0" true true + | FSI_CORECLR -> executeSingleTestBuildAndRun OutputType.Script "coreclr" "netcoreapp2.0" true false #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS - | FSC_OPT_PLUS_DEBUG -> executeSingleTestBuildAndRun OutputType.Exe "net40" "net472" true - | FSC_OPT_MINUS_DEBUG -> executeSingleTestBuildAndRun OutputType.Exe "net40" "net472" false - | FSI_FILE -> executeSingleTestBuildAndRun OutputType.Script "net40" "net472" true + | FSC_BUILDONLY -> executeSingleTestBuildAndRun OutputType.Exe "net40" "net472" false true + | FSC_OPT_PLUS_DEBUG -> executeSingleTestBuildAndRun OutputType.Exe "net40" "net472" true false + | FSC_OPT_MINUS_DEBUG -> executeSingleTestBuildAndRun OutputType.Exe "net40" "net472" false false + | FSI_FILE -> executeSingleTestBuildAndRun OutputType.Script "net40" "net472" true false | FSI_STDIN -> use cleanup = (cleanUpFSharpCore cfg) @@ -338,8 +354,8 @@ let singleTestBuildAndRunCore cfg copyFiles p = let sources = extraSources |> List.filter (fileExists cfg) - fsc cfg "%s --optimize -a -o:test--optimize-lib.dll -g" cfg.fsc_flags sources - fsc cfg "%s --optimize -r:test--optimize-lib.dll -o:test--optimize-client-of-lib.exe -g" cfg.fsc_flags sources + fsc cfg "%s --optimize -a -o:test--optimize-lib.dll -g --langversion:preview " cfg.fsc_flags sources + fsc cfg "%s --optimize -r:test--optimize-lib.dll -o:test--optimize-client-of-lib.exe -g --langversion:preview " cfg.fsc_flags sources peverify cfg "test--optimize-lib.dll" peverify cfg "test--optimize-client-of-lib.exe" @@ -348,17 +364,20 @@ let singleTestBuildAndRunCore cfg copyFiles p = testOkFile.CheckExists() #endif - + let singleTestBuildAndRunAux cfg p = - singleTestBuildAndRunCore cfg "" p + singleTestBuildAndRunCore cfg "" p "latest" let singleTestBuildAndRunWithCopyDlls cfg copyFiles p = - singleTestBuildAndRunCore cfg copyFiles p + singleTestBuildAndRunCore cfg copyFiles p "latest" let singleTestBuildAndRun dir p = let cfg = testConfig dir singleTestBuildAndRunAux cfg p +let singleTestBuildAndRunVersion dir p version = + let cfg = testConfig dir + singleTestBuildAndRunCore cfg "" p version let singleNegTest (cfg: TestConfig) testname = @@ -376,7 +395,7 @@ let singleNegTest (cfg: TestConfig) testname = testname + "b.mli"; testname + "b.fsi"; testname + "b.ml"; testname + "b.fs"; ] yield! src |> List.filter (fileExists cfg) - + if fileExists cfg "helloWorldProvider.dll" then yield "-r:helloWorldProvider.dll" diff --git a/tests/fsharp/test-framework.fs b/tests/fsharp/test-framework.fs index 1e3aa9b37a..cace5cf935 100644 --- a/tests/fsharp/test-framework.fs +++ b/tests/fsharp/test-framework.fs @@ -435,7 +435,8 @@ let execAppendIgnoreExitCode cfg stdoutPath stderrPath p = Command.exec cfg.Dire let exec cfg p = Command.exec cfg.Directory cfg.EnvironmentVariables execArgs p >> checkResult let execExpectFail cfg p = Command.exec cfg.Directory cfg.EnvironmentVariables execArgs p >> checkErrorLevel1 let execIn cfg workDir p = Command.exec workDir cfg.EnvironmentVariables execArgs p >> checkResult -let execBothToOut cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = OutputAndErrorToSameFile(Overwrite(outFile)) } p >> checkResult +let execBothToOutNoCheck cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = OutputAndErrorToSameFile(Overwrite(outFile)) } p +let execBothToOut cfg workDir outFile p = execBothToOutNoCheck cfg workDir outFile p >> checkResult let execAppendOutIgnoreExitCode cfg workDir outFile p = Command.exec workDir cfg.EnvironmentVariables { execArgs with Output = Output(Append(outFile)) } p >> alwaysSuccess let execAppendErrExpectFail cfg errPath p = Command.exec cfg.Directory cfg.EnvironmentVariables { execArgs with Output = Error(Overwrite(errPath)) } p >> checkErrorLevel1 let execStdin cfg l p = Command.exec cfg.Directory cfg.EnvironmentVariables { Output = Inherit; Input = Some(RedirectInput(l)) } p >> checkResult diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index e302a74377..01bc3f954e 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -16,10 +16,12 @@ open NUnit.Framework open TestFramework open Scripting open SingleTest +open HandleExpects #if FSHARP_SUITE_DRIVES_CORECLR_TESTS // Use these lines if you want to test CoreCLR let FSC_BASIC = FSC_CORECLR +let FSC_BUILDONLY = FSC_CORECLR_BUILDONLY let FSI_BASIC = FSI_CORECLR #else let FSC_BASIC = FSC_OPT_PLUS_DEBUG @@ -1699,7 +1701,7 @@ module CoreTests = csc cfg """/nologo /r:"%s" /r:lib--optimize.dll /out:test--optimize.exe""" cfg.FSCOREDLLPATH ["test.cs"] - let dicases = ["flag_deterministic_init1.fs"; "lib_deterministic_init1.fs"; "flag_deterministic_init2.fs"; "lib_deterministic_init2.fs"; "flag_deterministic_init3.fs"; "lib_deterministic_init3.fs"; "flag_deterministic_init4.fs"; "lib_deterministic_init4.fs"; "flag_deterministic_init5.fs"; "lib_deterministic_init5.fs"; "flag_deterministic_init6.fs"; "lib_deterministic_init6.fs"; "flag_deterministic_init7.fs"; "lib_deterministic_init7.fs"; "flag_deterministic_init8.fs"; "lib_deterministic_init8.fs"; "flag_deterministic_init9.fs"; "lib_deterministic_init9.fs"; "flag_deterministic_init10.fs"; "lib_deterministic_init10.fs"; "flag_deterministic_init11.fs"; "lib_deterministic_init11.fs"; "flag_deterministic_init12.fs"; "lib_deterministic_init12.fs"; "flag_deterministic_init13.fs"; "lib_deterministic_init13.fs"; "flag_deterministic_init14.fs"; "lib_deterministic_init14.fs"; "flag_deterministic_init15.fs"; "lib_deterministic_init15.fs"; "flag_deterministic_init16.fs"; "lib_deterministic_init16.fs"; "flag_deterministic_init17.fs"; "lib_deterministic_init17.fs"; "flag_deterministic_init18.fs"; "lib_deterministic_init18.fs"; "flag_deterministic_init19.fs"; "lib_deterministic_init19.fs"; "flag_deterministic_init20.fs"; "lib_deterministic_init20.fs"; "flag_deterministic_init21.fs"; "lib_deterministic_init21.fs"; "flag_deterministic_init22.fs"; "lib_deterministic_init22.fs"; "flag_deterministic_init23.fs"; "lib_deterministic_init23.fs"; "flag_deterministic_init24.fs"; "lib_deterministic_init24.fs"; "flag_deterministic_init25.fs"; "lib_deterministic_init25.fs"; "flag_deterministic_init26.fs"; "lib_deterministic_init26.fs"; "flag_deterministic_init27.fs"; "lib_deterministic_init27.fs"; "flag_deterministic_init28.fs"; "lib_deterministic_init28.fs"; "flag_deterministic_init29.fs"; "lib_deterministic_init29.fs"; "flag_deterministic_init30.fs"; "lib_deterministic_init30.fs"; "flag_deterministic_init31.fs"; "lib_deterministic_init31.fs"; "flag_deterministic_init32.fs"; "lib_deterministic_init32.fs"; "flag_deterministic_init33.fs"; "lib_deterministic_init33.fs"; "flag_deterministic_init34.fs"; "lib_deterministic_init34.fs"; "flag_deterministic_init35.fs"; "lib_deterministic_init35.fs"; "flag_deterministic_init36.fs"; "lib_deterministic_init36.fs"; "flag_deterministic_init37.fs"; "lib_deterministic_init37.fs"; "flag_deterministic_init38.fs"; "lib_deterministic_init38.fs"; "flag_deterministic_init39.fs"; "lib_deterministic_init39.fs"; "flag_deterministic_init40.fs"; "lib_deterministic_init40.fs"; "flag_deterministic_init41.fs"; "lib_deterministic_init41.fs"; "flag_deterministic_init42.fs"; "lib_deterministic_init42.fs"; "flag_deterministic_init43.fs"; "lib_deterministic_init43.fs"; "flag_deterministic_init44.fs"; "lib_deterministic_init44.fs"; "flag_deterministic_init45.fs"; "lib_deterministic_init45.fs"; "flag_deterministic_init46.fs"; "lib_deterministic_init46.fs"; "flag_deterministic_init47.fs"; "lib_deterministic_init47.fs"; "flag_deterministic_init48.fs"; "lib_deterministic_init48.fs"; "flag_deterministic_init49.fs"; "lib_deterministic_init49.fs"; "flag_deterministic_init50.fs"; "lib_deterministic_init50.fs"; "flag_deterministic_init51.fs"; "lib_deterministic_init51.fs"; "flag_deterministic_init52.fs"; "lib_deterministic_init52.fs"; "flag_deterministic_init53.fs"; "lib_deterministic_init53.fs"; "flag_deterministic_init54.fs"; "lib_deterministic_init54.fs"; "flag_deterministic_init55.fs"; "lib_deterministic_init55.fs"; "flag_deterministic_init56.fs"; "lib_deterministic_init56.fs"; "flag_deterministic_init57.fs"; "lib_deterministic_init57.fs"; "flag_deterministic_init58.fs"; "lib_deterministic_init58.fs"; "flag_deterministic_init59.fs"; "lib_deterministic_init59.fs"; "flag_deterministic_init60.fs"; "lib_deterministic_init60.fs"; "flag_deterministic_init61.fs"; "lib_deterministic_init61.fs"; "flag_deterministic_init62.fs"; "lib_deterministic_init62.fs"; "flag_deterministic_init63.fs"; "lib_deterministic_init63.fs"; "flag_deterministic_init64.fs"; "lib_deterministic_init64.fs"; "flag_deterministic_init65.fs"; "lib_deterministic_init65.fs"; "flag_deterministic_init66.fs"; "lib_deterministic_init66.fs"; "flag_deterministic_init67.fs"; "lib_deterministic_init67.fs"; "flag_deterministic_init68.fs"; "lib_deterministic_init68.fs"; "flag_deterministic_init69.fs"; "lib_deterministic_init69.fs"; "flag_deterministic_init70.fs"; "lib_deterministic_init70.fs"; "flag_deterministic_init71.fs"; "lib_deterministic_init71.fs"; "flag_deterministic_init72.fs"; "lib_deterministic_init72.fs"; "flag_deterministic_init73.fs"; "lib_deterministic_init73.fs"; "flag_deterministic_init74.fs"; "lib_deterministic_init74.fs"; "flag_deterministic_init75.fs"; "lib_deterministic_init75.fs"; "flag_deterministic_init76.fs"; "lib_deterministic_init76.fs"; "flag_deterministic_init77.fs"; "lib_deterministic_init77.fs"; "flag_deterministic_init78.fs"; "lib_deterministic_init78.fs"; "flag_deterministic_init79.fs"; "lib_deterministic_init79.fs"; "flag_deterministic_init80.fs"; "lib_deterministic_init80.fs"; "flag_deterministic_init81.fs"; "lib_deterministic_init81.fs"; "flag_deterministic_init82.fs"; "lib_deterministic_init82.fs"; "flag_deterministic_init83.fs"; "lib_deterministic_init83.fs"; "flag_deterministic_init84.fs"; "lib_deterministic_init84.fs"; "flag_deterministic_init85.fs"; "lib_deterministic_init85.fs"] + let dicases = ["flag_deterministic_init1.fs"; "lib_deterministic_init1.fs"; "flag_deterministic_init2.fs"; "lib_deterministic_init2.fs"; "flag_deterministic_init3.fs"; "lib_deterministic_init3.fs"; "flag_deterministic_init4.fs"; "lib_deterministic_init4.fs"; "flag_deterministic_init5.fs"; "lib_deterministic_init5.fs"; "flag_deterministic_init6.fs"; "lib_deterministic_init6.fs"; "flag_deterministic_init7.fs"; "lib_deterministic_init7.fs"; "flag_deterministic_init8.fs"; "lib_deterministic_init8.fs"; "flag_deterministic_init9.fs"; "lib_deterministic_init9.fs"; "flag_deterministic_init10.fs"; "lib_deterministic_init10.fs"; "flag_deterministic_init11.fs"; "lib_deterministic_init11.fs"; "flag_deterministic_init12.fs"; "lib_deterministic_init12.fs"; "flag_deterministic_init13.fs"; "lib_deterministic_init13.fs"; "flag_deterministic_init14.fs"; "lib_deterministic_init14.fs"; "flag_deterministic_init15.fs"; "lib_deterministic_init15.fs"; "flag_deterministic_init16.fs"; "lib_deterministic_init16.fs"; "flag_deterministic_init17.fs"; "lib_deterministic_init17.fs"; "flag_deterministic_init18.fs"; "lib_deterministic_init18.fs"; "flag_deterministic_init19.fs"; "lib_deterministic_init19.fs"; "flag_deterministic_init20.fs"; "lib_deterministic_init20.fs"; "flag_deterministic_init21.fs"; "lib_deterministic_init21.fs"; "flag_deterministic_init22.fs"; "lib_deterministic_init22.fs"; "flag_deterministic_init23.fs"; "lib_deterministic_init23.fs"; "flag_deterministic_init24.fs"; "lib_deterministic_init24.fs"; "flag_deterministic_init25.fs"; "lib_deterministic_init25.fs"; "flag_deterministic_init26.fs"; "lib_deterministic_init26.fs"; "flag_deterministic_init27.fs"; "lib_deterministic_init27.fs"; "flag_deterministic_init28.fs"; "lib_deterministic_init28.fs"; "flag_deterministic_init29.fs"; "lib_deterministic_init29.fs"; "flag_deterministic_init30.fs"; "lib_deterministic_init30.fs"; "flag_deterministic_init31.fs"; "lib_deterministic_init31.fs"; "flag_deterministic_init32.fs"; "lib_deterministic_init32.fs"; "flag_deterministic_init33.fs"; "lib_deterministic_init33.fs"; "flag_deterministic_init34.fs"; "lib_deterministic_init34.fs"; "flag_deterministic_init35.fs"; "lib_deterministic_init35.fs"; "flag_deterministic_init36.fs"; "lib_deterministic_init36.fs"; "flag_deterministic_init37.fs"; "lib_deterministic_init37.fs"; "flag_deterministic_init38.fs"; "lib_deterministic_init38.fs"; "flag_deterministic_init39.fs"; "lib_deterministic_init39.fs"; "flag_deterministic_init40.fs"; "lib_deterministic_init40.fs"; "flag_deterministic_init41.fs"; "lib_deterministic_init41.fs"; "flag_deterministic_init42.fs"; "lib_deterministic_init42.fs"; "flag_deterministic_init43.fs"; "lib_deterministic_init43.fs"; "flag_deterministic_init44.fs"; "lib_deterministic_init44.fs"; "flag_deterministic_init45.fs"; "lib_deterministic_init45.fs"; "flag_deterministic_init46.fs"; "lib_deterministic_init46.fs"; "flag_deterministic_init47.fs"; "lib_deterministic_init47.fs"; "flag_deterministic_init48.fs"; "lib_deterministic_init48.fs"; "flag_deterministic_init49.fs"; "lib_deterministic_init49.fs"; "flag_deterministic_init50.fs"; "lib_deterministic_init50.fs"; "flag_deterministic_init51.fs"; "lib_deterministic_init51.fs"; "flag_deterministic_init52.fs"; "lib_deterministic_init52.fs"; "flag_deterministic_init53.fs"; "lib_deterministic_init53.fs"; "flag_deterministic_init54.fs"; "lib_deterministic_init54.fs"; "flag_deterministic_init55.fs"; "lib_deterministic_init55.fs"; "flag_deterministic_init56.fs"; "lib_deterministic_init56.fs"; "flag_deterministic_init57.fs"; "lib_deterministic_init57.fs"; "flag_deterministic_init58.fs"; "lib_deterministic_init58.fs"; "flag_deterministic_init59.fs"; "lib_deterministic_init59.fs"; "flag_deterministic_init60.fs"; "lib_deterministic_init60.fs"; "flag_deterministic_init61.fs"; "lib_deterministic_init61.fs"; "flag_deterministic_init62.fs"; "lib_deterministic_init62.fs"; "flag_deterministic_init63.fs"; "lib_deterministic_init63.fs"; "flag_deterministic_init64.fs"; "lib_deterministic_init64.fs"; "flag_deterministic_init65.fs"; "lib_deterministic_init65.fs"; "flag_deterministic_init66.fs"; "lib_deterministic_init66.fs"; "flag_deterministic_init67.fs"; "lib_deterministic_init67.fs"; "flag_deterministic_init68.fs"; "lib_deterministic_init68.fs"; "flag_deterministic_init69.fs"; "lib_deterministic_init69.fs"; "flag_deterministic_init70.fs"; "lib_deterministic_init70.fs"; "flag_deterministic_init71.fs"; "lib_deterministic_init71.fs"; "flag_deterministic_init72.fs"; "lib_deterministic_init72.fs"; "flag_deterministic_init73.fs"; "lib_deterministic_init73.fs"; "flag_deterministic_init74.fs"; "lib_deterministic_init74.fs"; "flag_deterministic_init75.fs"; "lib_deterministic_init75.fs"; "flag_deterministic_init76.fs"; "lib_deterministic_init76.fs"; "flag_deterministic_init77.fs"; "lib_deterministic_init77.fs"; "flag_deterministic_init78.fs"; "lib_deterministic_init78.fs"; "flag_deterministic_init79.fs"; "lib_deterministic_init79.fs"; "flag_deterministic_init80.fs"; "lib_deterministic_init80.fs"; "flag_deterministic_init81.fs"; "lib_deterministic_init81.fs"; "flag_deterministic_init82.fs"; "lib_deterministic_init82.fs"; "flag_deterministic_init83.fs"; "lib_deterministic_init83.fs"; "flag_deterministic_init84.fs"; "lib_deterministic_init84.fs"; "flag_deterministic_init85.fs"; "lib_deterministic_init85.fs"] fsc cfg "%s --optimize- -o test_deterministic_init.exe" cfg.fsc_flags (dicases @ ["test_deterministic_init.fs"]) @@ -1784,7 +1786,7 @@ module CoreTests = exec cfg ("." ++ "test.exe") "" testOkFile.CheckExists() - + [] let verify () = let cfg = testConfig "core/verify" @@ -1802,6 +1804,13 @@ module CoreTests = peverifyWithArgs cfg "/nologo" "xmlverify.exe" #endif +module VersionTests = + [] + let ``member-selfidentifier-version4.6``() = singleTestBuildAndRunVersion "core/members/self-identifier/version46" FSC_BUILDONLY "4.6" + + [] + let ``member-selfidentifier-version4.7``() = singleTestBuildAndRunVersion "core/members/self-identifier/version47" FSC_BUILDONLY "preview" + #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS module ToolsTests = From 4a8685e359ec7c6325991d553183ee1051c5d8a2 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Mon, 3 Jun 2019 15:57:51 -0700 Subject: [PATCH 089/286] Enable LangVersion on 'Add missing case for underscore in for _ feature (#6931) --- src/fsharp/LanguageFeatures.fs | 6 +-- src/fsharp/LanguageFeatures.fsi | 3 +- src/fsharp/pars.fsy | 9 ++-- tests/fsharp/core/forexpression/test.fsx | 13 ------ .../core/forexpression/version46/test.fs | 41 ++++++++++++++++++ .../core/forexpression/version47/test.fs | 43 +++++++++++++++++++ tests/fsharp/single-test.fs | 2 +- 7 files changed, 93 insertions(+), 24 deletions(-) create mode 100644 tests/fsharp/core/forexpression/version46/test.fs create mode 100644 tests/fsharp/core/forexpression/version47/test.fs diff --git a/src/fsharp/LanguageFeatures.fs b/src/fsharp/LanguageFeatures.fs index 15a30f6b61..a51e21843e 100644 --- a/src/fsharp/LanguageFeatures.fs +++ b/src/fsharp/LanguageFeatures.fs @@ -22,8 +22,7 @@ type LanguageFeature = | LanguageVersion46 = 0 | LanguageVersion47 = 1 | SingleUnderscorePattern = 2 - | Nullness = 1000 - | ScriptingPackageManagement = 1001 + | WildCardInForLoop = 3 /// LanguageVersion management type LanguageVersion (specifiedVersion) = @@ -44,9 +43,8 @@ type LanguageVersion (specifiedVersion) = // Add new LanguageVersions here ... LanguageFeature.LanguageVersion47, 4.7m LanguageFeature.LanguageVersion46, 4.6m - LanguageFeature.Nullness, previewVersion - LanguageFeature.ScriptingPackageManagement, previewVersion LanguageFeature.SingleUnderscorePattern, previewVersion + LanguageFeature.WildCardInForLoop, previewVersion // Add new LanguageFeatures here ... |] diff --git a/src/fsharp/LanguageFeatures.fsi b/src/fsharp/LanguageFeatures.fsi index a43ac24276..63ad5915c2 100644 --- a/src/fsharp/LanguageFeatures.fsi +++ b/src/fsharp/LanguageFeatures.fsi @@ -9,8 +9,7 @@ type LanguageFeature = | LanguageVersion46 = 0 | LanguageVersion47 = 1 | SingleUnderscorePattern = 2 - | Nullness = 1000 - | ScriptingPackageManagement = 1001 + | WildCardInForLoop = 3 /// LanguageVersion management type LanguageVersion = diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index d95f8ce5ce..7984f55e5e 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -130,10 +130,11 @@ let mkDefnBindings (mWhole,BindingSetPreAttrs(_,isRec,isUse,declsPreAttrs,_bindi let attrDecls = if not (isNil freeAttrs) then [ SynModuleDecl.Attributes (freeAttrs,attrsm) ] else [] attrDecls @ letDecls -let idOfPat m p = +let idOfPat (parseState:IParseState) m p = match p with - | SynPat.Wild r -> mkSynId r "_" - | SynPat.Named (SynPat.Wild _,id,false,_,_) -> id + | SynPat.Wild r when parseState.LexBuffer.SupportsFeature LanguageFeature.WildCardInForLoop -> + mkSynId r "_" + | SynPat.Named (SynPat.Wild _,id,false,_,_) -> id | SynPat.LongIdent(LongIdentWithDots([id],_),_,None, SynConstructorArgs.Pats [], None,_) -> id | _ -> raiseParseErrorAt m (FSComp.SR.parsIntegerForLoopRequiresSimpleIdentifier()) @@ -3992,7 +3993,7 @@ forLoopBinder: forLoopRange: | parenPattern EQUALS declExpr forLoopDirection declExpr - { idOfPat (rhs parseState 1) $1,$3,$4,$5 } + { idOfPat parseState (rhs parseState 1) $1,$3,$4,$5 } | parenPattern EQUALS rangeSequenceExpr { raiseParseErrorAt (rhs parseState 2) (FSComp.SR.parsUnexpectedSymbolEqualsInsteadOfIn()) } diff --git a/tests/fsharp/core/forexpression/test.fsx b/tests/fsharp/core/forexpression/test.fsx index 437f62b971..0fada85b01 100644 --- a/tests/fsharp/core/forexpression/test.fsx +++ b/tests/fsharp/core/forexpression/test.fsx @@ -110,18 +110,7 @@ let sumOverRange () = let sumOverString () = let mutable sum = 0 for i in testString do -#if NETCOREAPP - sum <- sum + ((int (i :?> char)) - (int '0')) -#else sum <- sum + ((int i) - (int '0')) -#endif - sum - -// usingWildcard counts using a wildcard in a for loop -let usingWildcard () = - let mutable sum = 0 - for _ = 0 to count do - sum <- sum + 1 sum let arraySum = sumOverArray () @@ -132,7 +121,6 @@ let listSum = sumOverList () let ilistSum = sumOverIList () let rangeSum = sumOverRange () let stringSum = sumOverString () -let wildCard = usingWildcard () do test "arraySum" (expectedArraySum = arraySum ) do test "seqSum" (expectedArraySum = seqSum ) @@ -142,7 +130,6 @@ do test "listSum" (expectedArraySum = listSum ) do test "ilistSum" (expectedArraySum = ilistSum ) do test "rangeSum" (expectedRangeSum = rangeSum ) do test "stringSum" (expectedStringSum = stringSum ) -do test "wildCard" (expectedWildCard = wildCard ) #if TESTS_AS_APP let RUN() = !failures diff --git a/tests/fsharp/core/forexpression/version46/test.fs b/tests/fsharp/core/forexpression/version46/test.fs new file mode 100644 index 0000000000..c2042a9f0c --- /dev/null +++ b/tests/fsharp/core/forexpression/version46/test.fs @@ -0,0 +1,41 @@ +//An integer for loop must use a simple identifier +module Global + +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +// usingWildcard counts using a wildcard in a for loop +let usingWildcard () = + let mutable sum = 0 + for _ = 0 to count do + sum <- sum + 1 + + printfn "usingWildcards expected to produce sum of 4 : sum='%d'"sum + +do test "wildCard" (4 = usingWildcard () ) + +#if TESTS_AS_APP +let RUN() = !failures +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif + diff --git a/tests/fsharp/core/forexpression/version47/test.fs b/tests/fsharp/core/forexpression/version47/test.fs new file mode 100644 index 0000000000..868a4757ce --- /dev/null +++ b/tests/fsharp/core/forexpression/version47/test.fs @@ -0,0 +1,43 @@ +//usingWildcards expected to produce sum of 4 : sum='4' +#if TESTS_AS_APP +module Core_forexpression_47 +#endif + +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +// usingWildcard counts using a wildcard in a for loop +let usingWildcard () = + let mutable sum = 0 + for _ = 0 to count do + sum <- sum + 1 + + printfn "usingWildcards expected to produce sum of 4 : sum='%d'"sum + +do test "wildCard" (4 = usingWildcard () ) + +#if TESTS_AS_APP +let RUN() = !failures +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif + diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index 0b48119807..c1707f619e 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -298,7 +298,7 @@ let singleTestBuildAndRunCore cfg copyFiles p languageVersion = result <- true finally if result <> false then - Directory.Delete(directory, true) + try Directory.Delete(directory, true) with _ -> () else printfn "Configuration: %s" cfg.Directory printfn "Directory: %s" directory From b99db084e4f251705d0e59cefacc53a52aa6b715 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Mon, 3 Jun 2019 16:57:11 -0700 Subject: [PATCH 090/286] fix test --- .../Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs index a9acc46819..4fba967006 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/E_NameOfAsAFunction.fs @@ -1,6 +1,6 @@ // #Regression #Conformance #DataExpressions // Verify that nameof can't be used as a function. -//First-class uses of the 'nameof' operator is not permitted +//Using the 'nameof' operator as a first-class function value is not permitted let f = nameof From af9145b6d905c737aa4e4094e5d470c5778b3906 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Mon, 3 Jun 2019 17:10:19 -0700 Subject: [PATCH 091/286] dd langversion support for whitespace indent feature (#6933) --- .gitignore | 4 +- src/fsharp/LanguageFeatures.fs | 2 + src/fsharp/LanguageFeatures.fsi | 1 + src/fsharp/LexFilter.fs | 7 +- tests/fsharp/HandleExpects.fs | 2 +- tests/fsharp/core/indent/version46/test.fsx | 121 ++++++++++++++++++++ tests/fsharp/core/indent/version47/test.fsx | 93 +++++++++++++++ tests/fsharp/tests.fs | 9 +- tests/fsharp/typecheck/sigs/neg77.bsl | 12 -- tests/fsharp/typecheck/sigs/neg77.fsx | 54 --------- tests/fsharp/typecheck/sigs/neg77.vsbsl | 24 ---- 11 files changed, 234 insertions(+), 95 deletions(-) create mode 100644 tests/fsharp/core/indent/version46/test.fsx create mode 100644 tests/fsharp/core/indent/version47/test.fsx diff --git a/.gitignore b/.gitignore index e6feea6dfc..d48410b873 100644 --- a/.gitignore +++ b/.gitignore @@ -100,7 +100,9 @@ ossreadme*.txt *.log *.jrs *.chk -*.bak +*.bak +*.vserr +*.err *.orig *.mdf *.ldf diff --git a/src/fsharp/LanguageFeatures.fs b/src/fsharp/LanguageFeatures.fs index a51e21843e..4257cbca9a 100644 --- a/src/fsharp/LanguageFeatures.fs +++ b/src/fsharp/LanguageFeatures.fs @@ -23,6 +23,7 @@ type LanguageFeature = | LanguageVersion47 = 1 | SingleUnderscorePattern = 2 | WildCardInForLoop = 3 + | RelaxWhitespace = 4 /// LanguageVersion management type LanguageVersion (specifiedVersion) = @@ -45,6 +46,7 @@ type LanguageVersion (specifiedVersion) = LanguageFeature.LanguageVersion46, 4.6m LanguageFeature.SingleUnderscorePattern, previewVersion LanguageFeature.WildCardInForLoop, previewVersion + LanguageFeature.RelaxWhitespace, previewVersion // Add new LanguageFeatures here ... |] diff --git a/src/fsharp/LanguageFeatures.fsi b/src/fsharp/LanguageFeatures.fsi index 63ad5915c2..9d1690c7d8 100644 --- a/src/fsharp/LanguageFeatures.fsi +++ b/src/fsharp/LanguageFeatures.fsi @@ -10,6 +10,7 @@ type LanguageFeature = | LanguageVersion47 = 1 | SingleUnderscorePattern = 2 | WildCardInForLoop = 3 + | RelaxWhitespace = 4 /// LanguageVersion management type LanguageVersion = diff --git a/src/fsharp/LexFilter.fs b/src/fsharp/LexFilter.fs index a125a64d7b..e37b0c35b1 100755 --- a/src/fsharp/LexFilter.fs +++ b/src/fsharp/LexFilter.fs @@ -12,9 +12,9 @@ open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.Ast open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Parser open FSharp.Compiler.Lexhelp - let debug = false let stringOfPos (p: Position) = sprintf "(%d:%d)" p.OriginalLine p.Column @@ -765,13 +765,16 @@ type LexFilterImpl (lightSyntaxStatus: LightSyntaxStatus, compilingFsLib, lexer, // 'type C = interface ... ' limited by 'type' // 'type C = struct ... ' limited by 'type' | _, (CtxtParen ((CLASS | STRUCT | INTERFACE), _) :: CtxtSeqBlock _ :: (CtxtTypeDefns _ as limitCtxt) :: _) + -> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol + 1) + // 'type C(' limited by 'type' | _, (CtxtSeqBlock _ :: CtxtParen(LPAREN, _) :: (CtxtTypeDefns _ as limitCtxt) :: _ ) // 'static member C(' limited by 'static', likewise others | _, (CtxtSeqBlock _ :: CtxtParen(LPAREN, _) :: (CtxtMemberHead _ as limitCtxt) :: _ ) // 'static member P with get() = ' limited by 'static', likewise others | _, (CtxtWithAsLet _ :: (CtxtMemberHead _ as limitCtxt) :: _ ) - -> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol + 1) + when lexbuf.SupportsFeature LanguageFeature.RelaxWhitespace + -> PositionWithColumn(limitCtxt.StartPos, limitCtxt.StartCol + 1) // REVIEW: document these | _, (CtxtSeqBlock _ :: CtxtParen((BEGIN | LPAREN | LBRACK | LBRACK_BAR), _) :: CtxtVanilla _ :: (CtxtSeqBlock _ as limitCtxt) :: _) diff --git a/tests/fsharp/HandleExpects.fs b/tests/fsharp/HandleExpects.fs index 9a11f90adc..76c5267bac 100644 --- a/tests/fsharp/HandleExpects.fs +++ b/tests/fsharp/HandleExpects.fs @@ -44,7 +44,7 @@ let stripFromFileExpectations source = else expect.Replace(content, "") let rdr = XmlReader.Create(new StringReader(nocontentxpect)) - let mutable element = { status="success"; id = ""; span = ""; pattern = content; matched = false; line=nocontentxpect } + let mutable element = { status="success"; id = ""; span = ""; pattern = content; matched = false; line=expect } let mutable insideExpects = false let mutable foundOne = false try diff --git a/tests/fsharp/core/indent/version46/test.fsx b/tests/fsharp/core/indent/version46/test.fsx new file mode 100644 index 0000000000..7afc6f1dd5 --- /dev/null +++ b/tests/fsharp/core/indent/version46/test.fsx @@ -0,0 +1,121 @@ +//Possible incorrect indentation: this token is offside of context started at position \(59:19\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(59:19\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(63:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(63:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(69:23\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(69:23\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(77:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(77:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(83:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(83:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(88:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(88:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(91:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(91:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(95:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(95:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(100:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(100:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(104:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(104:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(59:19\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(59:19\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(63:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(63:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(69:23\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(69:23\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(77:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(77:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(83:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(83:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(88:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(88:25\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(91:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(91:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(95:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(95:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(100:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(100:20\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(104:21\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(104:21\). Try indenting this token further or using standard formatting conventions. + + +module Global + +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +type OffsideCheck(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = 1 + +module M = + type OffsideCheck(a:int, + b:int, c:int, // 4.6 warning: 4.7 warning + d:int, e:int, + f:int) = + class end + +module M2 = + type OffsideCheck() = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 warning + d:int, e:int, + f:int) = 1 + +type C() = + static member P with get() = + 1 // 4.6 warning: 4.7 no warning + +module M3 = + type C() = + static member P with get() = + 1 // warning + +type OffsideCheck2(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = 1 + +type OffsideCheck3(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = 1 + +#if TESTS_AS_APP +let RUN() = !failures +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif diff --git a/tests/fsharp/core/indent/version47/test.fsx b/tests/fsharp/core/indent/version47/test.fsx new file mode 100644 index 0000000000..97b226e9e5 --- /dev/null +++ b/tests/fsharp/core/indent/version47/test.fsx @@ -0,0 +1,93 @@ +//Possible incorrect indentation: this token is offside of context started at position \(41:5\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(41:5\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(49:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(49:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(60:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(60:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(41:5\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(41:5\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(49:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(49:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(60:9\). Try indenting this token further or using standard formatting conventions. +//Possible incorrect indentation: this token is offside of context started at position \(60:9\). Try indenting this token further or using standard formatting conventions. + + +module Global + +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +type OffsideCheck(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = 1 + +module M = + type OffsideCheck(a:int, + b:int, c:int, // 4.6 warning: 4.7 warning + d:int, e:int, + f:int) = + class end + +module M2 = + type OffsideCheck() = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 warning + d:int, e:int, + f:int) = 1 + +type C() = + static member P with get() = + 1 // 4.6 warning: 4.7 no warning + +module M3 = + type C() = + static member P with get() = + 1 // warning + +type OffsideCheck2(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = 1 + +type OffsideCheck3(a:int, + b:int, c:int, // no warning + d:int, e:int, + f:int) = + static member M(a:int, + b:int, c:int, // 4.6 warning: 4.7 no warning + d:int, e:int, + f:int) = 1 + +#if TESTS_AS_APP +let RUN() = !failures +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 01bc3f954e..cd9a7c8b68 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -1811,6 +1811,13 @@ module VersionTests = [] let ``member-selfidentifier-version4.7``() = singleTestBuildAndRunVersion "core/members/self-identifier/version47" FSC_BUILDONLY "preview" + [] + let ``indent-version4.6``() = singleTestBuildAndRunVersion "core/indent/version46" FSC_BUILDONLY "4.6" + + [] + let ``indent-version4.7``() = singleTestBuildAndRunVersion "core/indent/version47" FSC_BUILDONLY "preview" + + #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS module ToolsTests = @@ -1820,7 +1827,7 @@ module ToolsTests = let cfg = testConfig "tools/bundle" fsc cfg "%s --progress --standalone -o:test-one-fsharp-module.exe -g" cfg.fsc_flags ["test-one-fsharp-module.fs"] - + peverify cfg "test-one-fsharp-module.exe" fsc cfg "%s -a -o:test_two_fsharp_modules_module_1.dll -g" cfg.fsc_flags ["test_two_fsharp_modules_module_1.fs"] diff --git a/tests/fsharp/typecheck/sigs/neg77.bsl b/tests/fsharp/typecheck/sigs/neg77.bsl index 3598ff0c93..922e6b6695 100644 --- a/tests/fsharp/typecheck/sigs/neg77.bsl +++ b/tests/fsharp/typecheck/sigs/neg77.bsl @@ -4,15 +4,3 @@ neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: th neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions. neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression - -neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions. diff --git a/tests/fsharp/typecheck/sigs/neg77.fsx b/tests/fsharp/typecheck/sigs/neg77.fsx index 2f38101f2d..c354321cde 100644 --- a/tests/fsharp/typecheck/sigs/neg77.fsx +++ b/tests/fsharp/typecheck/sigs/neg77.fsx @@ -243,60 +243,6 @@ do Application.Run(form) #endif -open System - -type OffsideCheck(a:int, - b:int, c:int, // no warning - d:int, e:int, - f:int) = - static member M(a:int, - b:int, c:int, // no warning - d:int, e:int, - f:int) = 1 - -module M = - type OffsideCheck(a:int, - b:int, c:int, // warning - d:int, e:int, - f:int) = - class end - -module M2 = - type OffsideCheck() = - static member M(a:int, - b:int, c:int, // warning - d:int, e:int, - f:int) = 1 - -type C() = - static member P with get() = - 1 // no warning - -module M3 = - type C() = - static member P with get() = - 1 // warning - - -type OffsideCheck2(a:int, - b:int, c:int, // no warning - d:int, e:int, - f:int) = - static member M(a:int, - b:int, c:int, // no warning - d:int, e:int, - f:int) = 1 - -type OffsideCheck3(a:int, - b:int, c:int, // no warning - d:int, e:int, - f:int) = - static member M(a:int, - b:int, c:int, // no warning - d:int, e:int, - f:int) = 1 - - diff --git a/tests/fsharp/typecheck/sigs/neg77.vsbsl b/tests/fsharp/typecheck/sigs/neg77.vsbsl index 32adc1f3b9..4483229805 100644 --- a/tests/fsharp/typecheck/sigs/neg77.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg77.vsbsl @@ -5,34 +5,10 @@ neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: th neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression -neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions. - neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions. neg77.fsx(134,15,134,16): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (133:19). Try indenting this token further or using standard formatting conventions. neg77.fsx(134,15,134,16): parse error FS0010: Unexpected symbol '|' in expression -neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(259,3,259,4): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (258:5). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(267,7,267,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (266:9). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions. - -neg77.fsx(278,7,278,8): parse error FS0058: Possible incorrect indentation: this token is offside of context started at position (277:9). Try indenting this token further or using standard formatting conventions. - neg77.fsx(153,75,153,79): typecheck error FS0001: The type 'Planet * 'a' is not compatible with the type 'Planet' From 6e23fd5ef00815990fa042a5aa727087dd40c138 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Mon, 3 Jun 2019 18:06:18 -0700 Subject: [PATCH 092/286] update surface area tests --- tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs | 3 ++- tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs index 4d1c570e6f..ed6ee35df2 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.coreclr.fs @@ -755,9 +755,9 @@ Microsoft.FSharp.Control.ObservableModule: System.Type GetType() Microsoft.FSharp.Control.ObservableModule: Void Add[T](Microsoft.FSharp.Core.FSharpFunc`2[T,Microsoft.FSharp.Core.Unit], System.IObservable`1[T]) Microsoft.FSharp.Control.WebExtensions: Boolean Equals(System.Object) Microsoft.FSharp.Control.WebExtensions: Int32 GetHashCode() -Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[System.Net.WebResponse] AsyncGetResponse(System.Net.WebRequest) Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[Microsoft.FSharp.Core.Unit] AsyncDownloadFile(System.Net.WebClient, System.Uri, System.String) Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[System.Byte[]] AsyncDownloadData(System.Net.WebClient, System.Uri) +Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[System.Net.WebResponse] AsyncGetResponse(System.Net.WebRequest) Microsoft.FSharp.Control.WebExtensions: Microsoft.FSharp.Control.FSharpAsync`1[System.String] AsyncDownloadString(System.Net.WebClient, System.Uri) Microsoft.FSharp.Control.WebExtensions: System.String ToString() Microsoft.FSharp.Control.WebExtensions: System.Type GetType() @@ -2732,6 +2732,7 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" +Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) diff --git a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs index 945b341a37..408fc3955f 100644 --- a/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs +++ b/tests/FSharp.Core.UnitTests/SurfaceArea.net40.fs @@ -2732,6 +2732,7 @@ Microsoft.FSharp.Core.Operators: System.Object Box[T](T)" + Microsoft.FSharp.Core.Operators: System.RuntimeMethodHandle MethodHandleOf[T,TResult](Microsoft.FSharp.Core.FSharpFunc`2[T,TResult])" + #endif @" +Microsoft.FSharp.Core.Operators: System.String NameOf[T](T) Microsoft.FSharp.Core.Operators: System.String ToString() Microsoft.FSharp.Core.Operators: System.String ToString[T](T) Microsoft.FSharp.Core.Operators: System.String op_Concatenate(System.String, System.String) From d6e8fab084ddb7167d3705578c1b856ce52ef52e Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Mon, 3 Jun 2019 20:19:45 -0700 Subject: [PATCH 093/286] revert build --- FSharpBuild.Directory.Build.props | 11 +++++---- FSharpTests.Directory.Build.props | 6 ++--- eng/Build.ps1 | 6 ++--- eng/build-utils.ps1 | 16 +++++++----- eng/build.sh | 41 ++++++------------------------- proto.proj | 4 --- src/buildtools/buildtools.proj | 13 +++++----- src/buildtools/buildtools.targets | 4 +-- 8 files changed, 37 insertions(+), 64 deletions(-) diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index 515de9bbdc..a1ba7ab156 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -11,7 +11,8 @@ $(RepoRoot)src $(ArtifactsDir)\SymStore - $(ArtifactsDir)\Bootstrap + $(ArtifactsDir)\Bootstrap + $(ArtifactsDir)/fsc/Proto/netcoreapp2.1 4.4.0 1182;0025;$(WarningsAsErrors) @@ -95,10 +96,10 @@ - $(ProtoOutputPath)\fsc\Microsoft.FSharp.Targets - $(ProtoOutputPath)\fsc\Microsoft.FSharp.NetSdk.props - $(ProtoOutputPath)\fsc\Microsoft.FSharp.NetSdk.targets - $(ProtoOutputPath)\fsc\Microsoft.FSharp.Overrides.NetSdk.targets + $(ProtoOutputPath)\Microsoft.FSharp.Targets + $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.props + $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets + $(ProtoOutputPath)\Microsoft.FSharp.Overrides.NetSdk.targets diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index 8a7a832a43..7c00805dda 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -32,9 +32,9 @@ - <_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'!='Core'">net472 - <_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'=='Core'">netcoreapp2.1 - <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\$(_FSharpBuildTargetFramework) + <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'net40'">net472 + <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netcoreapp2.1 + <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\FSharp.Build\$(Configuration)\$(_FSharpBuildTargetFramework) $(_FSharpBuildBinPath)\FSharp.Build.dll diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 33e522a657..a296764692 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -68,7 +68,6 @@ function Print-Usage() { Write-Host "" Write-Host "Actions:" Write-Host " -restore Restore packages (short: -r)" - Write-Host " -norestore Don't restore packages" Write-Host " -build Build main solution (short: -b)" Write-Host " -rebuild Rebuild main solution" Write-Host " -pack Build NuGet packages, VS insertion manifests and installer" @@ -107,7 +106,6 @@ function Process-Arguments() { Print-Usage exit 0 } - $script:nodeReuse = $False; if ($testAll) { $script:testDesktop = $True @@ -179,10 +177,10 @@ function BuildSolution() { /p:Publish=$publish ` /p:ContinuousIntegrationBuild=$ci ` /p:OfficialBuildId=$officialBuildId ` + /p:BootstrapBuildPath=$bootstrapDir ` /p:QuietRestore=$quietRestore ` /p:QuietRestoreBinaryLog=$binaryLog ` /p:TestTargetFrameworks=$testTargetFrameworks ` - /v:$verbosity ` $suppressExtensionDeployment ` @properties } @@ -213,7 +211,7 @@ function UpdatePath() { } function VerifyAssemblyVersions() { - $fsiPath = Join-Path $ArtifactsDir "bin\fsi\Proto\net472\publish\fsi.exe" + $fsiPath = Join-Path $ArtifactsDir "bin\fsi\Proto\net472\fsi.exe" # Only verify versions on CI or official build if ($ci -or $official) { diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index c16e31ebfc..d1e5dd85d5 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -216,6 +216,10 @@ function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string] $args += " /p:ContinuousIntegrationBuild=true" } + if ($bootstrapDir -ne "") { + $args += " /p:BootstrapBuildPath=$bootstrapDir" + } + $args += " $buildArgs" $args += " $projectFilePath" $args += " $properties" @@ -237,15 +241,15 @@ function Make-BootstrapBuild() { Create-Directory $dir # prepare FsLex and Fsyacc - Run-MSBuild "$RepoRoot\src\buildtools\buildtools.proj" "/restore /t:Publish" -logFileName "BuildTools" -configuration $bootstrapConfiguration - Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\fslex" -Force -Recurse - Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\fsyacc" -Force -Recurse + Run-MSBuild "$RepoRoot\src\buildtools\buildtools.proj" "/restore /t:Build" -logFileName "BuildTools" -configuration $bootstrapConfiguration + Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\netcoreapp2.1\*" -Destination $dir + Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\netcoreapp2.1\*" -Destination $dir # prepare compiler $projectPath = "$RepoRoot\proto.proj" - Run-MSBuild $projectPath "/restore /t:Publish" -logFileName "Bootstrap" -configuration $bootstrapConfiguration - Copy-Item "$ArtifactsDir\bin\fsc\$bootstrapConfiguration\$bootstrapTfm\publish" -Destination "$dir\fsc" -Force -Recurse - Copy-Item "$ArtifactsDir\bin\fsi\$bootstrapConfiguration\$bootstrapTfm\publish" -Destination "$dir\fsi" -Force -Recurse + Run-MSBuild $projectPath "/restore /t:Build" -logFileName "Bootstrap" -configuration $bootstrapConfiguration + Copy-Item "$ArtifactsDir\bin\fsc\$bootstrapConfiguration\$bootstrapTfm\*" -Destination $dir + Copy-Item "$ArtifactsDir\bin\fsi\$bootstrapConfiguration\$bootstrapTfm\*" -Destination $dir return $dir } diff --git a/eng/build.sh b/eng/build.sh index f5d5577ccb..8ce74bfa52 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -13,9 +13,7 @@ usage() echo " --binaryLog Create MSBuild binary log (short: -bl)" echo "" echo "Actions:" - echo " --bootstrap Force the build of the bootstrap compiler" echo " --restore Restore projects required to build (short: -r)" - echo " --norestore Don't restore projects required to build" echo " --build Build all projects (short: -b)" echo " --rebuild Rebuild all projects" echo " --pack Build nuget packages" @@ -56,7 +54,6 @@ test_core_clr=false configuration="Debug" verbosity='minimal' binary_log=false -force_bootstrap=false ci=false skip_analyzers=false prepare_machine=false @@ -91,9 +88,6 @@ while [[ $# > 0 ]]; do --binarylog|-bl) binary_log=true ;; - --bootstrap) - force_bootstrap=true - ;; --restore|-r) restore=true ;; @@ -211,40 +205,21 @@ function BuildSolution { quiet_restore=true fi - # Node reuse fails because multiple different versions of FSharp.Build.dll get loaded into MSBuild nodes - node_reuse=false - # build bootstrap tools bootstrap_config=Proto - bootstrap_dir=$artifacts_dir/Bootstrap - if [[ "$force_bootstrap" == true ]]; then - rm -fr $bootstrap_dir - fi - if [ ! -f "$bootstrap_dir/fslex.dll" ]; then - MSBuild "$repo_root/src/buildtools/buildtools.proj" \ - /restore \ - /v:$verbosity \ - /p:Configuration=$bootstrap_config \ - /t:Publish + MSBuild "$repo_root/src/buildtools/buildtools.proj" \ + /restore \ + /p:Configuration=$bootstrap_config \ + /t:Build - mkdir -p "$bootstrap_dir" - cp -pr $artifacts_dir/bin/fslex/$bootstrap_config/netcoreapp2.1/publish $bootstrap_dir/fslex - cp -pr $artifacts_dir/bin/fsyacc/$bootstrap_config/netcoreapp2.1/publish $bootstrap_dir/fsyacc - fi - if [ ! -f "$bootstrap_dir/fsc.exe" ]; then - MSBuild "$repo_root/proto.proj" \ - /restore \ - /v:$verbosity \ - /p:Configuration=$bootstrap_config \ - /t:Publish - - cp -pr $artifacts_dir/bin/fsc/$bootstrap_config/netcoreapp2.1/publish $bootstrap_dir/fsc - fi + bootstrap_dir=$artifacts_dir/Bootstrap + mkdir -p "$bootstrap_dir" + cp $artifacts_dir/bin/fslex/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir + cp $artifacts_dir/bin/fsyacc/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir # do real build MSBuild $toolset_build_proj \ $bl \ - /v:$verbosity \ /p:Configuration=$configuration \ /p:Projects="$projects" \ /p:RepoRoot="$repo_root" \ diff --git a/proto.proj b/proto.proj index b0ee288977..84103f6fdf 100644 --- a/proto.proj +++ b/proto.proj @@ -28,10 +28,6 @@ - - - - diff --git a/src/buildtools/buildtools.proj b/src/buildtools/buildtools.proj index 630bb67856..593f086dd0 100644 --- a/src/buildtools/buildtools.proj +++ b/src/buildtools/buildtools.proj @@ -2,8 +2,7 @@ Debug - true - + @@ -11,23 +10,23 @@ - + - + - + - + - + diff --git a/src/buildtools/buildtools.targets b/src/buildtools/buildtools.targets index 185fd4d059..303ab00825 100644 --- a/src/buildtools/buildtools.targets +++ b/src/buildtools/buildtools.targets @@ -20,7 +20,7 @@ BeforeTargets="CoreCompile"> - $(ArtifactsDir)\Bootstrap\fslex\fslex.dll + $(ArtifactsDir)\Bootstrap\fslex.dll @@ -43,7 +43,7 @@ BeforeTargets="CoreCompile"> - $(ArtifactsDir)\Bootstrap\fsyacc\fsyacc.dll + $(ArtifactsDir)\Bootstrap\fsyacc.dll From 37b638e21e7f07c84c56b59527435da83a4f65c1 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Tue, 4 Jun 2019 00:36:25 -0700 Subject: [PATCH 094/286] Build proto compiler --- eng/build.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eng/build.sh b/eng/build.sh index 8ce74bfa52..a3a7647e88 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -217,6 +217,15 @@ function BuildSolution { cp $artifacts_dir/bin/fslex/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir cp $artifacts_dir/bin/fsyacc/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir + bootstrap_config=Proto + MSBuild "$repo_root/proto.proj" \ + /restore \ + /p:Configuration=$bootstrap_config \ + /t:Build + + cp $artifacts_dir/bin/fsc/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir + cp $artifacts_dir/bin/fsi/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir + # do real build MSBuild $toolset_build_proj \ $bl \ @@ -251,3 +260,4 @@ if [[ "$test_core_clr" == true ]]; then fi ExitWithExitCode 0 + From d445116bdf335e05861df96544856ee8e01f78e3 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Thu, 13 Jun 2019 11:48:05 -0700 Subject: [PATCH 095/286] update version number for VS 16.3 (#6991) --- eng/Versions.props | 4 ++-- src/fsharp/fsi/fsi.fsproj | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 3cd88abc9b..ec774de2cd 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -23,14 +23,14 @@ $(FSCorePackageVersion)-$(PreReleaseVersionLabel).* - 10.5 + 10.6 $(FSPackageMajorVersion).0 $(FSPackageVersion) $(FSPackageVersion).0 16 - 2 + 3 $(VSMajorVersion).0 $(VSMajorVersion).$(VSMinorVersion).0 $(VSAssemblyVersionPrefix).0 diff --git a/src/fsharp/fsi/fsi.fsproj b/src/fsharp/fsi/fsi.fsproj index cace3785d0..fb55d4d898 100644 --- a/src/fsharp/fsi/fsi.fsproj +++ b/src/fsharp/fsi/fsi.fsproj @@ -33,9 +33,6 @@ - - - From 34a1a425135b990f15831d1dbd87084cd9a3865a Mon Sep 17 00:00:00 2001 From: reacheight Date: Sat, 15 Jun 2019 02:51:53 +0300 Subject: [PATCH 096/286] fixed devguide linux test typo (#7003) --- DEVGUIDE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEVGUIDE.md b/DEVGUIDE.md index 36f7f2d718..f9ebde61e5 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -60,7 +60,7 @@ For Linux/Mac: Running tests: - ./build.sh -test + ./build.sh --test ### Developing the Visual F# IDE Tools (Windows Only) From 338267cb01ac9e8ef578cb497ca94eaeda1c63d3 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Sat, 15 Jun 2019 13:44:38 +0200 Subject: [PATCH 097/286] fix build --- fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj | 6 +++--- .../FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index 93344f7036..5e0d2250f7 100644 --- a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -269,6 +269,9 @@ AbsIL/ilreflect.fs + + ReferenceResolution/reshapedmsbuild.fs + ReferenceResolution/ReferenceResolver.fs @@ -593,9 +596,6 @@ Service/ServiceUntypedParse.fs - - Service/reshapedmsbuild.fs - Service/ServiceDeclarationLists.fsi diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index d2540094c4..5ad482ce08 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -277,6 +277,9 @@ ReferenceResolution\ReferenceResolver.fs + + ReferenceResolution/reshapedmsbuild.fs + ReferenceResolution/LegacyMSBuildReferenceResolver.fsi @@ -640,9 +643,6 @@ Service/ServiceXmlDocParser.fs - - Service/reshapedmsbuild.fs - Service/ExternalSymbol.fsi From a98e85c3d12e06b7addd1be3a8d0fa471d2d87e8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 17 Jun 2019 10:23:50 -0700 Subject: [PATCH 098/286] Update dependencies from https://github.com/dotnet/arcade build 20190615.2 (#7010) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19315.2 --- eng/Version.Details.xml | 4 +- eng/Versions.props | 2 +- eng/common/PublishToPackageFeed.proj | 1 + eng/common/build.ps1 | 7 +- eng/common/build.sh | 5 + eng/common/cross/armel/tizen-fetch.sh | 6 +- eng/common/cross/build-rootfs.sh | 2 +- eng/common/darc-init.ps1 | 8 +- eng/common/dotnet-install.ps1 | 11 +- eng/common/generate-graph-files.ps1 | 20 +- eng/common/init-tools-native.ps1 | 21 +- eng/common/native/CommonLibrary.psm1 | 2 +- eng/common/pipeline-logging-functions.ps1 | 233 ++++++++++++++++++ eng/common/pipeline-logging-functions.sh | 102 ++++++++ eng/common/post-build/dotnetsymbol-init.ps1 | 29 +++ eng/common/post-build/sourcelink-cli-init.ps1 | 29 +++ .../post-build/sourcelink-validation.ps1 | 224 +++++++++++++++++ eng/common/post-build/symbols-validation.ps1 | 186 ++++++++++++++ eng/common/sdl/NuGet.config | 13 + eng/common/sdl/execute-all-sdl-tools.ps1 | 97 ++++++++ eng/common/sdl/init-sdl.ps1 | 48 ++++ eng/common/sdl/packages.config | 4 + eng/common/sdl/push-gdn.ps1 | 51 ++++ eng/common/sdl/run-sdl.ps1 | 65 +++++ .../templates/job/publish-build-assets.yml | 25 ++ .../channels/public-dev-release.yml | 146 +++++++++++ .../channels/public-validation-release.yml | 92 +++++++ .../templates/post-build/common-variables.yml | 9 + .../templates/post-build/post-build.yml | 59 +++++ .../templates/post-build/promote-build.yml | 28 +++ .../post-build/setup-maestro-vars.yml | 26 ++ eng/common/templates/steps/send-to-helix.yml | 3 + eng/common/tools.ps1 | 101 ++++---- eng/common/tools.sh | 50 +++- global.json | 2 +- 35 files changed, 1613 insertions(+), 98 deletions(-) create mode 100644 eng/common/pipeline-logging-functions.ps1 create mode 100644 eng/common/pipeline-logging-functions.sh create mode 100644 eng/common/post-build/dotnetsymbol-init.ps1 create mode 100644 eng/common/post-build/sourcelink-cli-init.ps1 create mode 100644 eng/common/post-build/sourcelink-validation.ps1 create mode 100644 eng/common/post-build/symbols-validation.ps1 create mode 100644 eng/common/sdl/NuGet.config create mode 100644 eng/common/sdl/execute-all-sdl-tools.ps1 create mode 100644 eng/common/sdl/init-sdl.ps1 create mode 100644 eng/common/sdl/packages.config create mode 100644 eng/common/sdl/push-gdn.ps1 create mode 100644 eng/common/sdl/run-sdl.ps1 create mode 100644 eng/common/templates/post-build/channels/public-dev-release.yml create mode 100644 eng/common/templates/post-build/channels/public-validation-release.yml create mode 100644 eng/common/templates/post-build/common-variables.yml create mode 100644 eng/common/templates/post-build/post-build.yml create mode 100644 eng/common/templates/post-build/promote-build.yml create mode 100644 eng/common/templates/post-build/setup-maestro-vars.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index dcd15fa1e8..0091420aa1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 670f6ee1a619a2a7c84cfdfe2a1c84fbe94e1c6b + aa4285be7fab64e2b6e62e4d5688ea50931c407c diff --git a/eng/Versions.props b/eng/Versions.props index e4ae8526a0..3fc7a08c13 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -178,4 +178,4 @@ 5.22.2.1 2.0.187 - \ No newline at end of file + diff --git a/eng/common/PublishToPackageFeed.proj b/eng/common/PublishToPackageFeed.proj index 9120b2d212..a1b1333723 100644 --- a/eng/common/PublishToPackageFeed.proj +++ b/eng/common/PublishToPackageFeed.proj @@ -54,6 +54,7 @@ https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json https://dotnetfeed.blob.core.windows.net/nuget-nugetclient/index.json https://dotnetfeed.blob.core.windows.net/aspnet-entityframework6/index.json + https://dotnetfeed.blob.core.windows.net/aspnet-blazor/index.json Build configuration: 'Debug' or 'Release' (short: -c)" + Write-Host " -platform Platform configuration: 'x86', 'x64' or any valid Platform value to pass to msbuild" Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" Write-Host " -binaryLog Output binary log (short: -bl)" Write-Host " -help Print help and exit" @@ -77,6 +79,7 @@ function Build { InitializeCustomToolset $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "Build.binlog") } else { "" } + $platformArg = if ($platform) { "/p:Platform=$platform" } else { "" } if ($projects) { # Re-assign properties to a new variable because PowerShell doesn't let us append properties directly for unclear reasons. @@ -88,6 +91,7 @@ function Build { MSBuild $toolsetBuildProj ` $bl ` + $platformArg ` /p:Configuration=$configuration ` /p:RepoRoot=$RepoRoot ` /p:Restore=$restore ` @@ -129,9 +133,8 @@ try { Build } catch { - Write-Host $_ - Write-Host $_.Exception Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category "InitializeToolset" -Message $_ ExitWithExitCode 1 } diff --git a/eng/common/build.sh b/eng/common/build.sh index ce846d888d..6236fc4d38 100644 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -66,6 +66,7 @@ ci=false warn_as_error=true node_reuse=true binary_log=false +pipelines_log=false projects='' configuration='Debug' @@ -92,6 +93,9 @@ while [[ $# > 0 ]]; do -binarylog|-bl) binary_log=true ;; + -pipelineslog|-pl) + pipelines_log=true + ;; -restore|-r) restore=true ;; @@ -146,6 +150,7 @@ while [[ $# > 0 ]]; do done if [[ "$ci" == true ]]; then + pipelines_log=true binary_log=true node_reuse=false fi diff --git a/eng/common/cross/armel/tizen-fetch.sh b/eng/common/cross/armel/tizen-fetch.sh index ba16e991c7..ed70e0a86e 100644 --- a/eng/common/cross/armel/tizen-fetch.sh +++ b/eng/common/cross/armel/tizen-fetch.sh @@ -157,15 +157,15 @@ fetch_tizen_pkgs() Inform "Initialize arm base" fetch_tizen_pkgs_init standard base Inform "fetch common packages" -fetch_tizen_pkgs armv7l gcc glibc glibc-devel libicu libicu-devel +fetch_tizen_pkgs armv7l gcc glibc glibc-devel libicu libicu-devel libatomic fetch_tizen_pkgs noarch linux-glibc-devel Inform "fetch coreclr packages" -fetch_tizen_pkgs armv7l lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel tizen-release lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu +fetch_tizen_pkgs armv7l lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu Inform "fetch corefx packages" fetch_tizen_pkgs armv7l libcom_err libcom_err-devel zlib zlib-devel libopenssl libopenssl-devel krb5 krb5-devel libcurl libcurl-devel Inform "Initialize standard unified" fetch_tizen_pkgs_init standard unified Inform "fetch corefx packages" -fetch_tizen_pkgs armv7l gssdp gssdp-devel +fetch_tizen_pkgs armv7l gssdp gssdp-devel tizen-release diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 34d3d2ba1f..7c4e122651 100644 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -181,7 +181,7 @@ if [ -z "$__RootfsDir" ] && [ ! -z "$ROOTFS_DIR" ]; then fi if [ -z "$__RootfsDir" ]; then - __RootfsDir="$__CrossDir/rootfs/$__BuildArch" + __RootfsDir="$__CrossDir/../../../.tools/rootfs/$__BuildArch" fi if [ -d "$__RootfsDir" ]; then diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index dea7cdd903..8854d979f3 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -11,10 +11,10 @@ function InstallDarcCli ($darcVersion) { $dotnetRoot = InitializeDotNetCli -install:$true $dotnet = "$dotnetRoot\dotnet.exe" - $toolList = Invoke-Expression "& `"$dotnet`" tool list -g" + $toolList = & "$dotnet" tool list -g if ($toolList -like "*$darcCliPackageName*") { - Invoke-Expression "& `"$dotnet`" tool uninstall $darcCliPackageName -g" + & "$dotnet" tool uninstall $darcCliPackageName -g } # If the user didn't explicitly specify the darc version, @@ -22,12 +22,12 @@ function InstallDarcCli ($darcVersion) { if (-not $darcVersion) { $darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content } - + $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json' Write-Host "Installing Darc CLI version $darcVersion..." Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." - Invoke-Expression "& `"$dotnet`" tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g" + & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g } InstallDarcCli $darcVersion diff --git a/eng/common/dotnet-install.ps1 b/eng/common/dotnet-install.ps1 index 5987943fd6..0b629b8301 100644 --- a/eng/common/dotnet-install.ps1 +++ b/eng/common/dotnet-install.ps1 @@ -8,9 +8,14 @@ Param( . $PSScriptRoot\tools.ps1 +$dotnetRoot = Join-Path $RepoRoot ".dotnet" + +$installdir = $dotnetRoot try { - $dotnetRoot = Join-Path $RepoRoot ".dotnet" - InstallDotNet $dotnetRoot $version $architecture $runtime $true + if ($architecture -and $architecture.Trim() -eq "x86") { + $installdir = Join-Path $installdir "x86" + } + InstallDotNet $installdir $version $architecture $runtime $true } catch { Write-Host $_ @@ -19,4 +24,4 @@ catch { ExitWithExitCode 1 } -ExitWithExitCode 0 \ No newline at end of file +ExitWithExitCode 0 diff --git a/eng/common/generate-graph-files.ps1 b/eng/common/generate-graph-files.ps1 index a05b84f798..b056e4c1ac 100644 --- a/eng/common/generate-graph-files.ps1 +++ b/eng/common/generate-graph-files.ps1 @@ -25,7 +25,7 @@ function CheckExitCode ([string]$stage) try { Push-Location $PSScriptRoot - + Write-Host "Installing darc..." . .\darc-init.ps1 -darcVersion $darcVersion CheckExitCode "Running darc-init" @@ -40,9 +40,9 @@ try { $darcExe = "$env:USERPROFILE\.dotnet\tools" $darcExe = Resolve-Path "$darcExe\darc.exe" - + Create-Directory $outputFolder - + # Generate 3 graph descriptions: # 1. Flat with coherency information # 2. Graphviz (dot) file @@ -51,26 +51,26 @@ try { $graphVizImageFilePath = "$outputFolder\graph.png" $normalGraphFilePath = "$outputFolder\graph-full.txt" $flatGraphFilePath = "$outputFolder\graph-flat.txt" - $baseOptions = "get-dependency-graph --github-pat $gitHubPat --azdev-pat $azdoPat --password $barToken" - + $baseOptions = @( "--github-pat", "$gitHubPat", "--azdev-pat", "$azdoPat", "--password", "$barToken" ) + if ($includeToolset) { Write-Host "Toolsets will be included in the graph..." - $baseOptions += " --include-toolset" + $baseOptions += @( "--include-toolset" ) } Write-Host "Generating standard dependency graph..." - Invoke-Expression "& `"$darcExe`" $baseOptions --output-file $normalGraphFilePath" + & "$darcExe" get-dependency-graph @baseOptions --output-file $normalGraphFilePath CheckExitCode "Generating normal dependency graph" Write-Host "Generating flat dependency graph and graphviz file..." - Invoke-Expression "& `"$darcExe`" $baseOptions --flat --coherency --graphviz $graphVizFilePath --output-file $flatGraphFilePath" + & "$darcExe" get-dependency-graph @baseOptions --flat --coherency --graphviz $graphVizFilePath --output-file $flatGraphFilePath CheckExitCode "Generating flat and graphviz dependency graph" Write-Host "Generating graph image $graphVizFilePath" $dotFilePath = Join-Path $installBin "graphviz\$graphvizVersion\release\bin\dot.exe" - Invoke-Expression "& `"$dotFilePath`" -Tpng -o'$graphVizImageFilePath' `"$graphVizFilePath`"" + & "$dotFilePath" -Tpng -o"$graphVizImageFilePath" "$graphVizFilePath" CheckExitCode "Generating graphviz image" - + Write-Host "'$graphVizFilePath', '$flatGraphFilePath', '$normalGraphFilePath' and '$graphVizImageFilePath' created!" } catch { diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index a4306bd37e..9d18645f45 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -79,28 +79,27 @@ try { $NativeTools.PSObject.Properties | ForEach-Object { $ToolName = $_.Name $ToolVersion = $_.Value - $LocalInstallerCommand = $InstallerPath - $LocalInstallerCommand += " -ToolName $ToolName" - $LocalInstallerCommand += " -InstallPath $InstallBin" - $LocalInstallerCommand += " -BaseUri $BaseUri" - $LocalInstallerCommand += " -CommonLibraryDirectory $EngCommonBaseDir" - $LocalInstallerCommand += " -Version $ToolVersion" + $LocalInstallerArguments = @{ ToolName = "$ToolName" } + $LocalInstallerArguments += @{ InstallPath = "$InstallBin" } + $LocalInstallerArguments += @{ BaseUri = "$BaseUri" } + $LocalInstallerArguments += @{ CommonLibraryDirectory = "$EngCommonBaseDir" } + $LocalInstallerArguments += @{ Version = "$ToolVersion" } if ($Verbose) { - $LocalInstallerCommand += " -Verbose" + $LocalInstallerArguments += @{ Verbose = $True } } if (Get-Variable 'Force' -ErrorAction 'SilentlyContinue') { if($Force) { - $LocalInstallerCommand += " -Force" + $LocalInstallerArguments += @{ Force = $True } } } if ($Clean) { - $LocalInstallerCommand += " -Clean" + $LocalInstallerArguments += @{ Clean = $True } } Write-Verbose "Installing $ToolName version $ToolVersion" - Write-Verbose "Executing '$LocalInstallerCommand'" - Invoke-Expression "$LocalInstallerCommand" + Write-Verbose "Executing '$InstallerPath $LocalInstallerArguments'" + & $InstallerPath @LocalInstallerArguments if ($LASTEXITCODE -Ne "0") { $errMsg = "$ToolName installation failed" if ((Get-Variable 'DoNotAbortNativeToolsInstallationOnFailure' -ErrorAction 'SilentlyContinue') -and $DoNotAbortNativeToolsInstallationOnFailure) { diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 index f286ae0cde..7a34c7e8a4 100644 --- a/eng/common/native/CommonLibrary.psm1 +++ b/eng/common/native/CommonLibrary.psm1 @@ -209,7 +209,7 @@ function New-ScriptShim { Remove-Item (Join-Path $ShimDirectory "$ShimName.exe") } - Invoke-Expression "$ShimDirectory\WinShimmer\winshimmer.exe $ShimName $ToolFilePath $ShimDirectory" + & "$ShimDirectory\WinShimmer\winshimmer.exe" $ShimName $ToolFilePath $ShimDirectory return $True } catch { diff --git a/eng/common/pipeline-logging-functions.ps1 b/eng/common/pipeline-logging-functions.ps1 new file mode 100644 index 0000000000..7b61376f8a --- /dev/null +++ b/eng/common/pipeline-logging-functions.ps1 @@ -0,0 +1,233 @@ +# Source for this file was taken from https://github.com/microsoft/azure-pipelines-task-lib/blob/11c9439d4af17e6475d9fe058e6b2e03914d17e6/powershell/VstsTaskSdk/LoggingCommandFunctions.ps1 and modified. + +# NOTE: You should not be calling these method directly as they are likely to change. Instead you should be calling the Write-Pipeline* functions defined in tools.ps1 + +$script:loggingCommandPrefix = '##vso[' +$script:loggingCommandEscapeMappings = @( # TODO: WHAT ABOUT "="? WHAT ABOUT "%"? + New-Object psobject -Property @{ Token = ';' ; Replacement = '%3B' } + New-Object psobject -Property @{ Token = "`r" ; Replacement = '%0D' } + New-Object psobject -Property @{ Token = "`n" ; Replacement = '%0A' } + New-Object psobject -Property @{ Token = "]" ; Replacement = '%5D' } +) +# TODO: BUG: Escape % ??? +# TODO: Add test to verify don't need to escape "=". + +function Write-PipelineTelemetryError { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string]$Category, + [Parameter(Mandatory = $true)] + [string]$Message, + [Parameter(Mandatory = $false)] + [string]$Type = 'error', + [string]$ErrCode, + [string]$SourcePath, + [string]$LineNumber, + [string]$ColumnNumber, + [switch]$AsOutput) + + $PSBoundParameters.Remove("Category") | Out-Null + + $Message = "(NETCORE_ENGINEERING_TELEMETRY=$Category) $Message" + $PSBoundParameters.Remove("Message") | Out-Null + $PSBoundParameters.Add("Message", $Message) + + Write-PipelineTaskError @PSBoundParameters +} + +function Write-PipelineTaskError { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string]$Message, + [Parameter(Mandatory = $false)] + [string]$Type = 'error', + [string]$ErrCode, + [string]$SourcePath, + [string]$LineNumber, + [string]$ColumnNumber, + [switch]$AsOutput) + + if(!$ci) { + if($Type -eq 'error') { + Write-Host $Message -ForegroundColor Red + return + } + elseif ($Type -eq 'warning') { + Write-Host $Message -ForegroundColor Yellow + return + } + } + + if(($Type -ne 'error') -and ($Type -ne 'warning')) { + Write-Host $Message + return + } + if(-not $PSBoundParameters.ContainsKey('Type')) { + $PSBoundParameters.Add('Type', 'error') + } + Write-LogIssue @PSBoundParameters + } + + function Write-PipelineSetVariable { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string]$Name, + [string]$Value, + [switch]$Secret, + [switch]$AsOutput) + + if($ci) { + Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ + 'variable' = $Name + 'isSecret' = $Secret + 'isOutput' = 'true' + } -AsOutput:$AsOutput + } + } + + function Write-PipelinePrependPath { + [CmdletBinding()] + param( + [Parameter(Mandatory=$true)] + [string]$Path, + [switch]$AsOutput) + if($ci) { + Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput + } + } + +<######################################## +# Private functions. +########################################> +function Format-LoggingCommandData { + [CmdletBinding()] + param([string]$Value, [switch]$Reverse) + + if (!$Value) { + return '' + } + + if (!$Reverse) { + foreach ($mapping in $script:loggingCommandEscapeMappings) { + $Value = $Value.Replace($mapping.Token, $mapping.Replacement) + } + } else { + for ($i = $script:loggingCommandEscapeMappings.Length - 1 ; $i -ge 0 ; $i--) { + $mapping = $script:loggingCommandEscapeMappings[$i] + $Value = $Value.Replace($mapping.Replacement, $mapping.Token) + } + } + + return $Value +} + +function Format-LoggingCommand { + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [string]$Area, + [Parameter(Mandatory = $true)] + [string]$Event, + [string]$Data, + [hashtable]$Properties) + + # Append the preamble. + [System.Text.StringBuilder]$sb = New-Object -TypeName System.Text.StringBuilder + $null = $sb.Append($script:loggingCommandPrefix).Append($Area).Append('.').Append($Event) + + # Append the properties. + if ($Properties) { + $first = $true + foreach ($key in $Properties.Keys) { + [string]$value = Format-LoggingCommandData $Properties[$key] + if ($value) { + if ($first) { + $null = $sb.Append(' ') + $first = $false + } else { + $null = $sb.Append(';') + } + + $null = $sb.Append("$key=$value") + } + } + } + + # Append the tail and output the value. + $Data = Format-LoggingCommandData $Data + $sb.Append(']').Append($Data).ToString() +} + +function Write-LoggingCommand { + [CmdletBinding(DefaultParameterSetName = 'Parameters')] + param( + [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] + [string]$Area, + [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] + [string]$Event, + [Parameter(ParameterSetName = 'Parameters')] + [string]$Data, + [Parameter(ParameterSetName = 'Parameters')] + [hashtable]$Properties, + [Parameter(Mandatory = $true, ParameterSetName = 'Object')] + $Command, + [switch]$AsOutput) + + if ($PSCmdlet.ParameterSetName -eq 'Object') { + Write-LoggingCommand -Area $Command.Area -Event $Command.Event -Data $Command.Data -Properties $Command.Properties -AsOutput:$AsOutput + return + } + + $command = Format-LoggingCommand -Area $Area -Event $Event -Data $Data -Properties $Properties + if ($AsOutput) { + $command + } else { + Write-Host $command + } +} + +function Write-LogIssue { + [CmdletBinding()] + param( + [ValidateSet('warning', 'error')] + [Parameter(Mandatory = $true)] + [string]$Type, + [string]$Message, + [string]$ErrCode, + [string]$SourcePath, + [string]$LineNumber, + [string]$ColumnNumber, + [switch]$AsOutput) + + $command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{ + 'type' = $Type + 'code' = $ErrCode + 'sourcepath' = $SourcePath + 'linenumber' = $LineNumber + 'columnnumber' = $ColumnNumber + } + if ($AsOutput) { + return $command + } + + if ($Type -eq 'error') { + $foregroundColor = $host.PrivateData.ErrorForegroundColor + $backgroundColor = $host.PrivateData.ErrorBackgroundColor + if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { + $foregroundColor = [System.ConsoleColor]::Red + $backgroundColor = [System.ConsoleColor]::Black + } + } else { + $foregroundColor = $host.PrivateData.WarningForegroundColor + $backgroundColor = $host.PrivateData.WarningBackgroundColor + if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { + $foregroundColor = [System.ConsoleColor]::Yellow + $backgroundColor = [System.ConsoleColor]::Black + } + } + + Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor +} \ No newline at end of file diff --git a/eng/common/pipeline-logging-functions.sh b/eng/common/pipeline-logging-functions.sh new file mode 100644 index 0000000000..6098f9a543 --- /dev/null +++ b/eng/common/pipeline-logging-functions.sh @@ -0,0 +1,102 @@ +#!/usr/bin/env bash + +function Write-PipelineTelemetryError { + local telemetry_category='' + local function_args=() + local message='' + while [[ $# -gt 0 ]]; do + opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" + case "$opt" in + -category|-c) + telemetry_category=$2 + shift + ;; + -*) + function_args+=("$1 $2") + shift + ;; + *) + message=$* + ;; + esac + shift + done + + if [[ "$ci" != true ]]; then + echo "$message" >&2 + return + fi + + message="(NETCORE_ENGINEERING_TELEMETRY=$telemetry_category) $message" + function_args+=("$message") + + Write-PipelineTaskError $function_args +} + +function Write-PipelineTaskError { + if [[ "$ci" != true ]]; then + echo "$@" >&2 + return + fi + + message_type="error" + sourcepath='' + linenumber='' + columnnumber='' + error_code='' + + while [[ $# -gt 0 ]]; do + opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" + case "$opt" in + -type|-t) + message_type=$2 + shift + ;; + -sourcepath|-s) + sourcepath=$2 + shift + ;; + -linenumber|-ln) + linenumber=$2 + shift + ;; + -columnnumber|-cn) + columnnumber=$2 + shift + ;; + -errcode|-e) + error_code=$2 + shift + ;; + *) + break + ;; + esac + + shift + done + + message="##vso[task.logissue" + + message="$message type=$message_type" + + if [ -n "$sourcepath" ]; then + message="$message;sourcepath=$sourcepath" + fi + + if [ -n "$linenumber" ]; then + message="$message;linenumber=$linenumber" + fi + + if [ -n "$columnnumber" ]; then + message="$message;columnnumber=$columnnumber" + fi + + if [ -n "$error_code" ]; then + message="$message;code=$error_code" + fi + + message="$message]$*" + echo "$message" +} + diff --git a/eng/common/post-build/dotnetsymbol-init.ps1 b/eng/common/post-build/dotnetsymbol-init.ps1 new file mode 100644 index 0000000000..e7659b98c8 --- /dev/null +++ b/eng/common/post-build/dotnetsymbol-init.ps1 @@ -0,0 +1,29 @@ +param ( + $dotnetsymbolVersion = $null +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 + +. $PSScriptRoot\..\tools.ps1 + +$verbosity = "minimal" + +function Installdotnetsymbol ($dotnetsymbolVersion) { + $dotnetsymbolPackageName = "dotnet-symbol" + + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + $toolList = & "$dotnet" tool list --global + + if (($toolList -like "*$dotnetsymbolPackageName*") -and ($toolList -like "*$dotnetsymbolVersion*")) { + Write-Host "dotnet-symbol version $dotnetsymbolVersion is already installed." + } + else { + Write-Host "Installing dotnet-symbol version $dotnetsymbolVersion..." + Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." + & "$dotnet" tool install $dotnetsymbolPackageName --version $dotnetsymbolVersion --verbosity $verbosity --global + } +} + +Installdotnetsymbol $dotnetsymbolVersion diff --git a/eng/common/post-build/sourcelink-cli-init.ps1 b/eng/common/post-build/sourcelink-cli-init.ps1 new file mode 100644 index 0000000000..9eaa25b3b5 --- /dev/null +++ b/eng/common/post-build/sourcelink-cli-init.ps1 @@ -0,0 +1,29 @@ +param ( + $sourcelinkCliVersion = $null +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 + +. $PSScriptRoot\..\tools.ps1 + +$verbosity = "minimal" + +function InstallSourcelinkCli ($sourcelinkCliVersion) { + $sourcelinkCliPackageName = "sourcelink" + + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + $toolList = & "$dotnet" tool list --global + + if (($toolList -like "*$sourcelinkCliPackageName*") -and ($toolList -like "*$sourcelinkCliVersion*")) { + Write-Host "SourceLink CLI version $sourcelinkCliVersion is already installed." + } + else { + Write-Host "Installing SourceLink CLI version $sourcelinkCliVersion..." + Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." + & "$dotnet" tool install $sourcelinkCliPackageName --version $sourcelinkCliVersion --verbosity $verbosity --global + } +} + +InstallSourcelinkCli $sourcelinkCliVersion diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 new file mode 100644 index 0000000000..8abd684e9e --- /dev/null +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -0,0 +1,224 @@ +param( + [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where Symbols.NuGet packages to be checked are stored + [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation + [Parameter(Mandatory=$true)][string] $GHRepoName, # GitHub name of the repo including the Org. E.g., dotnet/arcade + [Parameter(Mandatory=$true)][string] $GHCommit, # GitHub commit SHA used to build the packages + [Parameter(Mandatory=$true)][string] $SourcelinkCliVersion # Version of SourceLink CLI to use +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 + +. $PSScriptRoot\..\tools.ps1 + +# Cache/HashMap (File -> Exist flag) used to consult whether a file exist +# in the repository at a specific commit point. This is populated by inserting +# all files present in the repo at a specific commit point. +$global:RepoFiles = @{} + +$ValidatePackage = { + param( + [string] $PackagePath # Full path to a Symbols.NuGet package + ) + + . $using:PSScriptRoot\..\tools.ps1 + + # Ensure input file exist + if (!(Test-Path $PackagePath)) { + Write-PipelineTaskError "Input file does not exist: $PackagePath" + ExitWithExitCode 1 + } + + # Extensions for which we'll look for SourceLink information + # For now we'll only care about Portable & Embedded PDBs + $RelevantExtensions = @(".dll", ".exe", ".pdb") + + Write-Host -NoNewLine "Validating" ([System.IO.Path]::GetFileName($PackagePath)) "... " + + $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) + $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId + $FailedFiles = 0 + + Add-Type -AssemblyName System.IO.Compression.FileSystem + + [System.IO.Directory]::CreateDirectory($ExtractPath); + + try { + $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) + + $zip.Entries | + Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | + ForEach-Object { + $FileName = $_.FullName + $Extension = [System.IO.Path]::GetExtension($_.Name) + $FakeName = -Join((New-Guid), $Extension) + $TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName + + # We ignore resource DLLs + if ($FileName.EndsWith(".resources.dll")) { + return + } + + [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) + + $ValidateFile = { + param( + [string] $FullPath, # Full path to the module that has to be checked + [string] $RealPath, + [ref] $FailedFiles + ) + + $sourcelinkExe = "$env:USERPROFILE\.dotnet\tools" + $sourcelinkExe = Resolve-Path "$sourcelinkExe\sourcelink.exe" + $SourceLinkInfos = & $sourcelinkExe print-urls $FullPath | Out-String + + if ($LASTEXITCODE -eq 0 -and -not ([string]::IsNullOrEmpty($SourceLinkInfos))) { + $NumFailedLinks = 0 + + # We only care about Http addresses + $Matches = (Select-String '(http[s]?)(:\/\/)([^\s,]+)' -Input $SourceLinkInfos -AllMatches).Matches + + if ($Matches.Count -ne 0) { + $Matches.Value | + ForEach-Object { + $Link = $_ + $CommitUrl = "https://raw.githubusercontent.com/${using:GHRepoName}/${using:GHCommit}/" + + $FilePath = $Link.Replace($CommitUrl, "") + $Status = 200 + $Cache = $using:RepoFiles + + if ( !($Cache.ContainsKey($FilePath)) ) { + try { + $Uri = $Link -as [System.URI] + + # Only GitHub links are valid + if ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match "github" -or $Uri.Host -match "githubusercontent")) { + $Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode + } + else { + $Status = 0 + } + } + catch { + write-host $_ + $Status = 0 + } + } + + if ($Status -ne 200) { + if ($NumFailedLinks -eq 0) { + if ($FailedFiles.Value -eq 0) { + Write-Host + } + + Write-Host "`tFile $RealPath has broken links:" + } + + Write-Host "`t`tFailed to retrieve $Link" + + $NumFailedLinks++ + } + } + } + + if ($NumFailedLinks -ne 0) { + $FailedFiles.value++ + $global:LASTEXITCODE = 1 + } + } + } + + &$ValidateFile $TargetFile $FileName ([ref]$FailedFiles) + } + } + catch { + + } + finally { + $zip.Dispose() + } + + if ($FailedFiles -eq 0) { + Write-Host "Passed." + } + else { + Write-PipelineTaskError "$PackagePath has broken SourceLink links." + } +} + +function ValidateSourceLinkLinks { + if (!($GHRepoName -Match "^[^\s\/]+/[^\s\/]+$")) { + if (!($GHRepoName -Match "^[^\s-]+-[^\s]+$")) { + Write-PipelineTaskError "GHRepoName should be in the format / or -" + ExitWithExitCode 1 + } + else { + $GHRepoName = $GHRepoName -replace '^([^\s-]+)-([^\s]+)$', '$1/$2'; + } + } + + if (!($GHCommit -Match "^[0-9a-fA-F]{40}$")) { + Write-PipelineTaskError "GHCommit should be a 40 chars hexadecimal string" + ExitWithExitCode 1 + } + + $RepoTreeURL = -Join("http://api.github.com/repos/", $GHRepoName, "/git/trees/", $GHCommit, "?recursive=1") + $CodeExtensions = @(".cs", ".vb", ".fs", ".fsi", ".fsx", ".fsscript") + + try { + # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash + $Data = Invoke-WebRequest $RepoTreeURL -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty tree + + foreach ($file in $Data) { + $Extension = [System.IO.Path]::GetExtension($file.path) + + if ($CodeExtensions.Contains($Extension)) { + $RepoFiles[$file.path] = 1 + } + } + } + catch { + Write-PipelineTaskError "Problems downloading the list of files from the repo. Url used: $RepoTreeURL" + Write-Host $_ + ExitWithExitCode 1 + } + + if (Test-Path $ExtractPath) { + Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue + } + + # Process each NuGet package in parallel + $Jobs = @() + Get-ChildItem "$InputPath\*.symbols.nupkg" | + ForEach-Object { + $Jobs += Start-Job -ScriptBlock $ValidatePackage -ArgumentList $_.FullName + } + + foreach ($Job in $Jobs) { + Wait-Job -Id $Job.Id | Receive-Job + } +} + +function CheckExitCode ([string]$stage) { + $exitCode = $LASTEXITCODE + if ($exitCode -ne 0) { + Write-PipelineTaskError "Something failed while '$stage'. Check for errors above. Exiting now..." + ExitWithExitCode $exitCode + } +} + +try { + Write-Host "Installing SourceLink CLI..." + Get-Location + . $PSScriptRoot\sourcelink-cli-init.ps1 -sourcelinkCliVersion $SourcelinkCliVersion + CheckExitCode "Running sourcelink-cli-init" + + Measure-Command { ValidateSourceLinkLinks } +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1 new file mode 100644 index 0000000000..69456854e0 --- /dev/null +++ b/eng/common/post-build/symbols-validation.ps1 @@ -0,0 +1,186 @@ +param( + [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where NuGet packages to be checked are stored + [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation + [Parameter(Mandatory=$true)][string] $DotnetSymbolVersion # Version of dotnet symbol to use +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 + +. $PSScriptRoot\..\tools.ps1 + +Add-Type -AssemblyName System.IO.Compression.FileSystem + +function FirstMatchingSymbolDescriptionOrDefault { + param( + [string] $FullPath, # Full path to the module that has to be checked + [string] $TargetServerParam, # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols + [string] $SymbolsPath + ) + + $FileName = [System.IO.Path]::GetFileName($FullPath) + $Extension = [System.IO.Path]::GetExtension($FullPath) + + # Those below are potential symbol files that the `dotnet symbol` might + # return. Which one will be returned depend on the type of file we are + # checking and which type of file was uploaded. + + # The file itself is returned + $SymbolPath = $SymbolsPath + "\" + $FileName + + # PDB file for the module + $PdbPath = $SymbolPath.Replace($Extension, ".pdb") + + # PDB file for R2R module (created by crossgen) + $NGenPdb = $SymbolPath.Replace($Extension, ".ni.pdb") + + # DBG file for a .so library + $SODbg = $SymbolPath.Replace($Extension, ".so.dbg") + + # DWARF file for a .dylib + $DylibDwarf = $SymbolPath.Replace($Extension, ".dylib.dwarf") + + $dotnetsymbolExe = "$env:USERPROFILE\.dotnet\tools" + $dotnetsymbolExe = Resolve-Path "$dotnetsymbolExe\dotnet-symbol.exe" + + & $dotnetsymbolExe --symbols --modules --windows-pdbs $TargetServerParam $FullPath -o $SymbolsPath | Out-Null + + if (Test-Path $PdbPath) { + return "PDB" + } + elseif (Test-Path $NGenPdb) { + return "NGen PDB" + } + elseif (Test-Path $SODbg) { + return "DBG for SO" + } + elseif (Test-Path $DylibDwarf) { + return "Dwarf for Dylib" + } + elseif (Test-Path $SymbolPath) { + return "Module" + } + else { + return $null + } +} + +function CountMissingSymbols { + param( + [string] $PackagePath # Path to a NuGet package + ) + + # Ensure input file exist + if (!(Test-Path $PackagePath)) { + Write-PipelineTaskError "Input file does not exist: $PackagePath" + ExitWithExitCode 1 + } + + # Extensions for which we'll look for symbols + $RelevantExtensions = @(".dll", ".exe", ".so", ".dylib") + + # How many files are missing symbol information + $MissingSymbols = 0 + + $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) + $PackageGuid = New-Guid + $ExtractPath = Join-Path -Path $ExtractPath -ChildPath $PackageGuid + $SymbolsPath = Join-Path -Path $ExtractPath -ChildPath "Symbols" + + [System.IO.Compression.ZipFile]::ExtractToDirectory($PackagePath, $ExtractPath) + + Get-ChildItem -Recurse $ExtractPath | + Where-Object {$RelevantExtensions -contains $_.Extension} | + ForEach-Object { + if ($_.FullName -Match "\\ref\\") { + Write-Host "`t Ignoring reference assembly file" $_.FullName + return + } + + $SymbolsOnMSDL = FirstMatchingSymbolDescriptionOrDefault $_.FullName "--microsoft-symbol-server" $SymbolsPath + $SymbolsOnSymWeb = FirstMatchingSymbolDescriptionOrDefault $_.FullName "--internal-server" $SymbolsPath + + Write-Host -NoNewLine "`t Checking file" $_.FullName "... " + + if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null) { + Write-Host "Symbols found on MSDL (" $SymbolsOnMSDL ") and SymWeb (" $SymbolsOnSymWeb ")" + } + else { + $MissingSymbols++ + + if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null) { + Write-Host "No symbols found on MSDL or SymWeb!" + } + else { + if ($SymbolsOnMSDL -eq $null) { + Write-Host "No symbols found on MSDL!" + } + else { + Write-Host "No symbols found on SymWeb!" + } + } + } + } + + Pop-Location + + return $MissingSymbols +} + +function CheckSymbolsAvailable { + if (Test-Path $ExtractPath) { + Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue + } + + Get-ChildItem "$InputPath\*.nupkg" | + ForEach-Object { + $FileName = $_.Name + + # These packages from Arcade-Services include some native libraries that + # our current symbol uploader can't handle. Below is a workaround until + # we get issue: https://github.com/dotnet/arcade/issues/2457 sorted. + if ($FileName -Match "Microsoft\.DotNet\.Darc\.") { + Write-Host "Ignoring Arcade-services file: $FileName" + Write-Host + return + } + elseif ($FileName -Match "Microsoft\.DotNet\.Maestro\.Tasks\.") { + Write-Host "Ignoring Arcade-services file: $FileName" + Write-Host + return + } + + Write-Host "Validating $FileName " + $Status = CountMissingSymbols "$InputPath\$FileName" + + if ($Status -ne 0) { + Write-PipelineTaskError "Missing symbols for $Status modules in the package $FileName" + ExitWithExitCode $exitCode + } + + Write-Host + } +} + +function CheckExitCode ([string]$stage) { + $exitCode = $LASTEXITCODE + if ($exitCode -ne 0) { + Write-PipelineTaskError "Something failed while '$stage'. Check for errors above. Exiting now..." + ExitWithExitCode $exitCode + } +} + +try { + Write-Host "Installing dotnet symbol ..." + Get-Location + . $PSScriptRoot\dotnetsymbol-init.ps1 -dotnetsymbolVersion $DotnetSymbolVersion + CheckExitCode "Running dotnetsymbol-init" + + CheckSymbolsAvailable +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} diff --git a/eng/common/sdl/NuGet.config b/eng/common/sdl/NuGet.config new file mode 100644 index 0000000000..0c5451c114 --- /dev/null +++ b/eng/common/sdl/NuGet.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 new file mode 100644 index 0000000000..74080f22d1 --- /dev/null +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -0,0 +1,97 @@ +Param( + [string] $GuardianPackageName, # Required: the name of guardian CLI pacakge (not needed if GuardianCliLocation is specified) + [string] $NugetPackageDirectory, # Required: directory where NuGet packages are installed (not needed if GuardianCliLocation is specified) + [string] $GuardianCliLocation, # Optional: Direct location of Guardian CLI executable if GuardianPackageName & NugetPackageDirectory are not specified + [string] $Repository, # Required: the name of the repository (e.g. dotnet/arcade) + [string] $BranchName="master", # Optional: name of branch or version of gdn settings; defaults to master + [string] $SourceDirectory, # Required: the directory where source files are located + [string] $ArtifactsDirectory, # Required: the directory where build artifacts are located + [string] $DncEngAccessToken, # Required: access token for dnceng; should be provided via KeyVault + [string[]] $SourceToolsList, # Optional: list of SDL tools to run on source code + [string[]] $ArtifactToolsList, # Optional: list of SDL tools to run on built artifacts + [bool] $TsaPublish=$False, # Optional: true will publish results to TSA; only set to true after onboarding to TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaBranchName=$env:BUILD_SOURCEBRANCHNAME, # Optional: required for TSA publish; defaults to $(Build.SourceBranchName); TSA is the automated framework used to upload test results as bugs. + [string] $TsaRepositoryName, # Optional: TSA repository name; will be generated automatically if not submitted; TSA is the automated framework used to upload test results as bugs. + [string] $BuildNumber=$env:BUILD_BUILDNUMBER, # Optional: required for TSA publish; defaults to $(Build.BuildNumber) + [bool] $UpdateBaseline=$False, # Optional: if true, will update the baseline in the repository; should only be run after fixing any issues which need to be fixed + [bool] $TsaOnboard=$False, # Optional: if true, will onboard the repository to TSA; should only be run once; TSA is the automated framework used to upload test results as bugs. + [string] $TsaInstanceUrl, # Optional: only needed if TsaOnboard or TsaPublish is true; the instance-url registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaCodebaseName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the codebase registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaProjectName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the project registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaNotificationEmail, # Optional: only needed if TsaOnboard is true; the email(s) which will receive notifications of TSA bug filings (e.g. alias@microsoft.com); TSA is the automated framework used to upload test results as bugs. + [string] $TsaCodebaseAdmin, # Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs. + [string] $TsaBugAreaPath, # Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. + [string] $TsaIterationPath, # Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. + [string] $GuardianLoggerLevel="Standard" # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 +$LASTEXITCODE = 0 + +#Replace repo names to the format of org/repo +if (!($Repository.contains('/'))) { + $RepoName = $Repository -replace '(.*?)-(.*)', '$1/$2'; +} +else{ + $RepoName = $Repository; +} + +if ($GuardianPackageName) { + $guardianCliLocation = Join-Path $NugetPackageDirectory (Join-Path $GuardianPackageName (Join-Path "tools" "guardian.cmd")) +} else { + $guardianCliLocation = $GuardianCliLocation +} + +$ValidPath = Test-Path $guardianCliLocation + +if ($ValidPath -eq $False) +{ + Write-Host "Invalid Guardian CLI Location." + exit 1 +} + +& $(Join-Path $PSScriptRoot "init-sdl.ps1") -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $ArtifactsDirectory -DncEngAccessToken $DncEngAccessToken -GuardianLoggerLevel $GuardianLoggerLevel +$gdnFolder = Join-Path $ArtifactsDirectory ".gdn" + +if ($TsaOnboard) { + if ($TsaCodebaseName -and $TsaNotificationEmail -and $TsaCodebaseAdmin -and $TsaBugAreaPath) { + Write-Host "$guardianCliLocation tsa-onboard --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel" + & $guardianCliLocation tsa-onboard --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel + if ($LASTEXITCODE -ne 0) { + Write-Host "Guardian tsa-onboard failed with exit code $LASTEXITCODE." + exit $LASTEXITCODE + } + } else { + Write-Host "Could not onboard to TSA -- not all required values ($$TsaCodebaseName, $$TsaNotificationEmail, $$TsaCodebaseAdmin, $$TsaBugAreaPath) were specified." + exit 1 + } +} + +if ($ArtifactToolsList -and $ArtifactToolsList.Count -gt 0) { + & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $ArtifactsDirectory -GdnFolder $gdnFolder -ToolsList $ArtifactToolsList -DncEngAccessToken $DncEngAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel +} +if ($SourceToolsList -and $SourceToolsList.Count -gt 0) { + & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $SourceDirectory -GdnFolder $gdnFolder -ToolsList $SourceToolsList -DncEngAccessToken $DncEngAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel +} + +if ($UpdateBaseline) { + & (Join-Path $PSScriptRoot "push-gdn.ps1") -Repository $RepoName -BranchName $BranchName -GdnFolder $GdnFolder -DncEngAccessToken $DncEngAccessToken -PushReason "Update baseline" +} + +if ($TsaPublish) { + if ($TsaBranchName -and $BuildNumber) { + if (-not $TsaRepositoryName) { + $TsaRepositoryName = "$($Repository)-$($BranchName)" + } + Write-Host "$guardianCliLocation tsa-publish --all-tools --repository-name `"$TsaRepositoryName`" --branch-name `"$TsaBranchName`" --build-number `"$BuildNumber`" --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $SourceDirectory --logger-level $GuardianLoggerLevel" + & $guardianCliLocation tsa-publish --all-tools --repository-name "$TsaRepositoryName" --branch-name "$TsaBranchName" --build-number "$BuildNumber" --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel + if ($LASTEXITCODE -ne 0) { + Write-Host "Guardian tsa-publish failed with exit code $LASTEXITCODE." + exit $LASTEXITCODE + } + } else { + Write-Host "Could not publish to TSA -- not all required values ($$TsaBranchName, $$BuildNumber) were specified." + exit 1 + } +} diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1 new file mode 100644 index 0000000000..cbf5c36a8f --- /dev/null +++ b/eng/common/sdl/init-sdl.ps1 @@ -0,0 +1,48 @@ +Param( + [string] $GuardianCliLocation, + [string] $Repository, + [string] $BranchName="master", + [string] $WorkingDirectory, + [string] $DncEngAccessToken, + [string] $GuardianLoggerLevel="Standard" +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 +$LASTEXITCODE = 0 + +# Construct basic auth from AzDO access token; construct URI to the repository's gdn folder stored in that repository; construct location of zip file +$encodedPat = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$DncEngAccessToken")) +$escapedRepository = [Uri]::EscapeDataString("/$Repository/$BranchName/.gdn") +$uri = "https://dev.azure.com/dnceng/internal/_apis/git/repositories/sdl-tool-cfg/Items?path=$escapedRepository&versionDescriptor[versionOptions]=0&`$format=zip&api-version=5.0-preview.1" +$zipFile = "$WorkingDirectory/gdn.zip" + +Add-Type -AssemblyName System.IO.Compression.FileSystem +$gdnFolder = (Join-Path $WorkingDirectory ".gdn") +Try +{ + # We try to download the zip; if the request fails (e.g. the file doesn't exist), we catch it and init guardian instead + Write-Host "Downloading gdn folder from internal config repostiory..." + Invoke-WebRequest -Headers @{ "Accept"="application/zip"; "Authorization"="Basic $encodedPat" } -Uri $uri -OutFile $zipFile + if (Test-Path $gdnFolder) { + # Remove the gdn folder if it exists (it shouldn't unless there's too much caching; this is just in case) + Remove-Item -Force -Recurse $gdnFolder + } + [System.IO.Compression.ZipFile]::ExtractToDirectory($zipFile, $WorkingDirectory) + Write-Host $gdnFolder +} Catch [System.Net.WebException] { + # if the folder does not exist, we'll do a guardian init and push it to the remote repository + Write-Host "Initializing Guardian..." + Write-Host "$GuardianCliLocation init --working-directory $WorkingDirectory --logger-level $GuardianLoggerLevel" + & $GuardianCliLocation init --working-directory $WorkingDirectory --logger-level $GuardianLoggerLevel + if ($LASTEXITCODE -ne 0) { + Write-Error "Guardian init failed with exit code $LASTEXITCODE." + } + # We create the mainbaseline so it can be edited later + Write-Host "$GuardianCliLocation baseline --working-directory $WorkingDirectory --name mainbaseline" + & $GuardianCliLocation baseline --working-directory $WorkingDirectory --name mainbaseline + if ($LASTEXITCODE -ne 0) { + Write-Error "Guardian baseline failed with exit code $LASTEXITCODE." + } + & $(Join-Path $PSScriptRoot "push-gdn.ps1") -Repository $Repository -BranchName $BranchName -GdnFolder $gdnFolder -DncEngAccessToken $DncEngAccessToken -PushReason "Initialize gdn folder" +} \ No newline at end of file diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config new file mode 100644 index 0000000000..b054737df1 --- /dev/null +++ b/eng/common/sdl/packages.config @@ -0,0 +1,4 @@ + + + + diff --git a/eng/common/sdl/push-gdn.ps1 b/eng/common/sdl/push-gdn.ps1 new file mode 100644 index 0000000000..cacaf8e912 --- /dev/null +++ b/eng/common/sdl/push-gdn.ps1 @@ -0,0 +1,51 @@ +Param( + [string] $Repository, + [string] $BranchName="master", + [string] $GdnFolder, + [string] $DncEngAccessToken, + [string] $PushReason +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 +$LASTEXITCODE = 0 + +# We create the temp directory where we'll store the sdl-config repository +$sdlDir = Join-Path $env:TEMP "sdl" +if (Test-Path $sdlDir) { + Remove-Item -Force -Recurse $sdlDir +} + +Write-Host "git clone https://dnceng:`$DncEngAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir" +git clone https://dnceng:$DncEngAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir +if ($LASTEXITCODE -ne 0) { + Write-Error "Git clone failed with exit code $LASTEXITCODE." +} +# We copy the .gdn folder from our local run into the git repository so it can be committed +$sdlRepositoryFolder = Join-Path (Join-Path (Join-Path $sdlDir $Repository) $BranchName) ".gdn" +if (Get-Command Robocopy) { + Robocopy /S $GdnFolder $sdlRepositoryFolder +} else { + rsync -r $GdnFolder $sdlRepositoryFolder +} +# cd to the sdl-config directory so we can run git there +Push-Location $sdlDir +# git add . --> git commit --> git push +Write-Host "git add ." +git add . +if ($LASTEXITCODE -ne 0) { + Write-Error "Git add failed with exit code $LASTEXITCODE." +} +Write-Host "git -c user.email=`"dn-bot@microsoft.com`" -c user.name=`"Dotnet Bot`" commit -m `"$PushReason for $Repository/$BranchName`"" +git -c user.email="dn-bot@microsoft.com" -c user.name="Dotnet Bot" commit -m "$PushReason for $Repository/$BranchName" +if ($LASTEXITCODE -ne 0) { + Write-Error "Git commit failed with exit code $LASTEXITCODE." +} +Write-Host "git push" +git push +if ($LASTEXITCODE -ne 0) { + Write-Error "Git push failed with exit code $LASTEXITCODE." +} + +# Return to the original directory +Pop-Location \ No newline at end of file diff --git a/eng/common/sdl/run-sdl.ps1 b/eng/common/sdl/run-sdl.ps1 new file mode 100644 index 0000000000..e6a86d03a2 --- /dev/null +++ b/eng/common/sdl/run-sdl.ps1 @@ -0,0 +1,65 @@ +Param( + [string] $GuardianCliLocation, + [string] $WorkingDirectory, + [string] $TargetDirectory, + [string] $GdnFolder, + [string[]] $ToolsList, + [string] $UpdateBaseline, + [string] $GuardianLoggerLevel="Standard" +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 +$LASTEXITCODE = 0 + +# We store config files in the r directory of .gdn +Write-Host $ToolsList +$gdnConfigPath = Join-Path $GdnFolder "r" +$ValidPath = Test-Path $GuardianCliLocation + +if ($ValidPath -eq $False) +{ + Write-Host "Invalid Guardian CLI Location." + exit 1 +} + +foreach ($tool in $ToolsList) { + $gdnConfigFile = Join-Path $gdnConfigPath "$tool-configure.gdnconfig" + $config = $False + Write-Host $tool + # We have to manually configure tools that run on source to look at the source directory only + if ($tool -eq "credscan") { + Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory : $TargetDirectory `"" + & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory : $TargetDirectory " + if ($LASTEXITCODE -ne 0) { + Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." + exit $LASTEXITCODE + } + $config = $True + } + if ($tool -eq "policheck") { + Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target : $TargetDirectory `"" + & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target : $TargetDirectory " + if ($LASTEXITCODE -ne 0) { + Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." + exit $LASTEXITCODE + } + $config = $True + } + + Write-Host "$GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel --config $gdnConfigFile $config" + if ($config) { + & $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel --config $gdnConfigFile + if ($LASTEXITCODE -ne 0) { + Write-Host "Guardian run for $tool using $gdnConfigFile failed with exit code $LASTEXITCODE." + exit $LASTEXITCODE + } + } else { + & $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel + if ($LASTEXITCODE -ne 0) { + Write-Host "Guardian run for $tool failed with exit code $LASTEXITCODE." + exit $LASTEXITCODE + } + } +} + diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 620bd3c62e..619ec68aa4 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -57,8 +57,33 @@ jobs: /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:Configuration=$(_BuildConfig) + /v:detailed condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} + - task: powershell@2 + displayName: Create BARBuildId Artifact + inputs: + targetType: inline + script: | + Add-Content -Path "$(Build.StagingDirectory)/BARBuildId.txt" -Value $(BARBuildId) + - task: powershell@2 + displayName: Create Channels Artifact + inputs: + targetType: inline + script: | + Add-Content -Path "$(Build.StagingDirectory)/Channels.txt" -Value "$(DefaultChannels)" + - task: PublishBuildArtifacts@1 + displayName: Publish BAR BuildId to VSTS + inputs: + PathtoPublish: '$(Build.StagingDirectory)/BARBuildId.txt' + PublishLocation: Container + ArtifactName: ReleaseConfigs + - task: PublishBuildArtifacts@1 + displayName: Publish Channels to VSTS + inputs: + PathtoPublish: '$(Build.StagingDirectory)/Channels.txt' + PublishLocation: Container + ArtifactName: ReleaseConfigs - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: - task: PublishBuildArtifacts@1 displayName: Publish Logs to VSTS diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml new file mode 100644 index 0000000000..b332cb5173 --- /dev/null +++ b/eng/common/templates/post-build/channels/public-dev-release.yml @@ -0,0 +1,146 @@ +parameters: + enableSymbolValidation: true + +stages: +- stage: Publish + dependsOn: validate + variables: + - template: ../common-variables.yml + displayName: Developer Channel + jobs: + - template: ../setup-maestro-vars.yml + + - job: + displayName: Symbol Publishing + dependsOn: setupMaestroVars + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicDevRelease_30_Channel_Id) + variables: + - group: DotNet-Symbol-Server-Pats + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download PDB Artifacts + inputs: + buildType: current + artifactName: PDBArtifacts + continueOnError: true + + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: current + artifactName: BlobArtifacts + + - task: PowerShell@2 + displayName: Publish + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:Configuration=Release + + - job: + displayName: Publish to Static Feed + dependsOn: setupMaestroVars + variables: + - group: DotNet-Blob-Feed + - group: Publish-Build-Assets + - name: BARBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicDevRelease_30_Channel_Id) + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: current + artifactName: PackageArtifacts + + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: current + artifactName: BlobArtifacts + + - task: DownloadBuildArtifacts@0 + displayName: Download Asset Manifests + inputs: + buildType: current + artifactName: AssetManifests + + - task: PowerShell@2 + displayName: Publish + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishToPackageFeed -restore -msbuildEngine dotnet + /p:AccountKeyToStaticFeed='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' + /p:BuildAssetRegistryToken='$(MaestroAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:ArtifactsCategory='$(_DotNetArtifactsCategory)' + /p:OverrideAssetsWithSameName=true + /p:PassIfExistingItemIdentical=true + /p:Configuration=Release + + +- stage: PublishValidation + displayName: Publish Validation + variables: + - template: ../common-variables.yml + jobs: + - template: ../setup-maestro-vars.yml + + - ${{ if eq(parameters.enableSymbolValidation, 'true') }}: + - job: + displayName: Symbol Availability + dependsOn: setupMaestroVars + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicDevRelease_30_Channel_Id) + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: current + artifactName: PackageArtifacts + + - task: PowerShell@2 + displayName: Check Symbol Availability + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) + + - job: + displayName: Gather Drop + dependsOn: setupMaestroVars + variables: + BARBuildId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicDevRelease_30_Channel_Id) + pool: + vmImage: 'windows-2019' + steps: + - task: PowerShell@2 + displayName: Setup Darc CLI + inputs: + targetType: filePath + filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1' + + - task: PowerShell@2 + displayName: Run Darc gather-drop + inputs: + targetType: inline + script: | + darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) + continueOnError: true + + - template: ../promote-build.yml + parameters: + ChannelId: ${{ variables.PublicDevRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml new file mode 100644 index 0000000000..0b9719da82 --- /dev/null +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -0,0 +1,92 @@ +stages: +- stage: PVR_Publish + dependsOn: validate + variables: + - template: ../common-variables.yml + displayName: Validation Channel + jobs: + - template: ../setup-maestro-vars.yml + + - job: + displayName: Publish to Static Feed + dependsOn: setupMaestroVars + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicValidationRelease_30_Channel_Id) + variables: + - group: DotNet-Blob-Feed + - group: Publish-Build-Assets + - name: BARBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: current + artifactName: PackageArtifacts + + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: current + artifactName: BlobArtifacts + + - task: DownloadBuildArtifacts@0 + displayName: Download Asset Manifests + inputs: + buildType: current + artifactName: AssetManifests + + - task: PowerShell@2 + displayName: Publish + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishToPackageFeed -restore -msbuildEngine dotnet + /p:AccountKeyToStaticFeed='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' + /p:BuildAssetRegistryToken='$(MaestroAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:ArtifactsCategory='$(_DotNetArtifactsCategory)' + /p:OverrideAssetsWithSameName=true + /p:PassIfExistingItemIdentical=true + /p:Configuration=Release + + +- stage: PVR_PublishValidation + displayName: Publish Validation + variables: + - template: ../common-variables.yml + jobs: + - template: ../setup-maestro-vars.yml + + - job: + displayName: Gather Drop + dependsOn: setupMaestroVars + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicValidationRelease_30_Channel_Id) + variables: + - name: BARBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + - group: Publish-Build-Assets + pool: + vmImage: 'windows-2019' + steps: + - task: PowerShell@2 + displayName: Setup Darc CLI + inputs: + targetType: filePath + filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1' + + - task: PowerShell@2 + displayName: Run Darc gather-drop + inputs: + targetType: inline + script: | + darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com --password $(MaestroAccessToken) + continueOnError: true + + - template: ../promote-build.yml + parameters: + ChannelId: ${{ variables.PublicValidationRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml new file mode 100644 index 0000000000..97b48d97fe --- /dev/null +++ b/eng/common/templates/post-build/common-variables.yml @@ -0,0 +1,9 @@ +variables: + # .NET Core 3 Dev + PublicDevRelease_30_Channel_Id: 3 + + # .NET Tools - Validation + PublicValidationRelease_30_Channel_Id: 9 + + SourceLinkCLIVersion: 3.0.0 + SymbolToolVersion: 1.0.1 diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml new file mode 100644 index 0000000000..6b74475a6f --- /dev/null +++ b/eng/common/templates/post-build/post-build.yml @@ -0,0 +1,59 @@ +parameters: + enableSourceLinkValidation: true + enableSigningValidation: true + enableSymbolValidation: true + +stages: +- stage: validate + dependsOn: build + displayName: Validate + jobs: + - ${{ if eq(parameters.enableSigningValidation, 'true') }}: + - job: + displayName: Signing Validation + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: current + artifactName: PackageArtifacts + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task SigningValidation -restore -msbuildEngine dotnet + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' + /p:Configuration=Release + + - ${{ if eq(parameters.enableSourceLinkValidation, 'true') }}: + - job: + displayName: SourceLink Validation + variables: + - template: common-variables.yml + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: current + artifactName: BlobArtifacts + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -ExtractPath $(Agent.BuildDirectory)/Extract/ + -GHRepoName $(Build.Repository.Name) + -GHCommit $(Build.SourceVersion) + -SourcelinkCliVersion $(SourceLinkCLIVersion) + +- template: \eng\common\templates\post-build\channels\public-dev-release.yml + parameters: + enableSymbolValidation: ${{ parameters.enableSymbolValidation }} + +- template: \eng\common\templates\post-build\channels\public-validation-release.yml diff --git a/eng/common/templates/post-build/promote-build.yml b/eng/common/templates/post-build/promote-build.yml new file mode 100644 index 0000000000..d00317003b --- /dev/null +++ b/eng/common/templates/post-build/promote-build.yml @@ -0,0 +1,28 @@ +parameters: + ChannelId: 0 + +jobs: +- job: + displayName: Promote Build + dependsOn: setupMaestroVars + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], ${{ parameters.ChannelId }}) + variables: + - name: BARBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + - name: ChannelId + value: ${{ parameters.ChannelId }} + - group: Publish-Build-Assets + pool: + vmImage: 'windows-2019' + steps: + - task: PowerShell@2 + displayName: Add Build to Channel + inputs: + targetType: inline + script: | + $headers = @{ + "Accept" = "application/json" + "Authorization" = "Bearer $(MaestroAccessToken)" + } + Invoke-RestMethod -Method Post -Headers $headers -Uri https://maestro-prod.westus2.cloudapp.azure.com/api/channels/$(ChannelId)/builds/$(BARBuildId)?api-version=2019-01-16 + enabled: false diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml new file mode 100644 index 0000000000..b40e0260a3 --- /dev/null +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -0,0 +1,26 @@ +jobs: +- job: setupMaestroVars + displayName: Setup Maestro Vars + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Release Configs + inputs: + buildType: current + artifactName: ReleaseConfigs + + - task: PowerShell@2 + name: setReleaseVars + displayName: Set Release Configs Vars + inputs: + targetType: inline + script: | + . "$(Build.SourcesDirectory)/eng/common/tools.ps1" + + $BarId = Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/BARBuildId.txt" + Write-PipelineSetVariable -Name 'BARBuildId' -Value $BarId + + $Channels = "" + Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/Channels.txt" | ForEach-Object { $Channels += "$_ ," } + Write-PipelineSetVariable -Name 'InitialChannels' -Value "$Channels" diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index d1ce577db5..05df886f55 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -5,6 +5,7 @@ parameters: HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number HelixTargetQueues: '' # required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group + HelixConfiguration: '' # optional -- additional property attached to a job HelixPreCommands: '' # optional -- commands to run before Helix work item execution HelixPostCommands: '' # optional -- commands to run after Helix work item execution WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects @@ -35,6 +36,7 @@ steps: HelixSource: ${{ parameters.HelixSource }} HelixType: ${{ parameters.HelixType }} HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} HelixTargetQueues: ${{ parameters.HelixTargetQueues }} HelixAccessToken: ${{ parameters.HelixAccessToken }} HelixPreCommands: ${{ parameters.HelixPreCommands }} @@ -64,6 +66,7 @@ steps: HelixSource: ${{ parameters.HelixSource }} HelixType: ${{ parameters.HelixType }} HelixBuild: ${{ parameters.HelixBuild }} + HelixConfiguration: ${{ parameters.HelixConfiguration }} HelixTargetQueues: ${{ parameters.HelixTargetQueues }} HelixAccessToken: ${{ parameters.HelixAccessToken }} HelixPreCommands: ${{ parameters.HelixPreCommands }} diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 9ca177b82a..60741f0390 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -35,7 +35,7 @@ # Specifies which msbuild engine to use for build: 'vs', 'dotnet' or unspecified (determined based on presence of tools.vs in global.json). [string]$msbuildEngine = if (Test-Path variable:msbuildEngine) { $msbuildEngine } else { $null } -# True to attempt using .NET Core already that meets requirements specified in global.json +# True to attempt using .NET Core already that meets requirements specified in global.json # installed on the machine instead of downloading one. [bool]$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true } @@ -76,7 +76,7 @@ function Exec-Process([string]$command, [string]$commandArgs) { $finished = $false try { - while (-not $process.WaitForExit(100)) { + while (-not $process.WaitForExit(100)) { # Non-blocking loop done to allow ctr-c interrupts } @@ -134,7 +134,7 @@ function InitializeDotNetCli([bool]$install) { if ($install) { InstallDotNetSdk $dotnetRoot $dotnetSdkVersion } else { - Write-Host "Unable to find dotnet with SDK version '$dotnetSdkVersion'" -ForegroundColor Red + Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Unable to find dotnet with SDK version '$dotnetSdkVersion'" ExitWithExitCode 1 } } @@ -147,12 +147,10 @@ function InitializeDotNetCli([bool]$install) { # It also ensures that VS msbuild will use the downloaded sdk targets. $env:PATH = "$dotnetRoot;$env:PATH" - if ($ci) { - # Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build - Write-Host "##vso[task.prependpath]$dotnetRoot" - Write-Host "##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]0" - Write-Host "##vso[task.setvariable variable=DOTNET_SKIP_FIRST_TIME_EXPERIENCE]1" - } + # Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build + Write-PipelinePrependPath -Path $dotnetRoot + Write-PipelineSetVariable -Name 'DOTNET_MULTILEVEL_LOOKUP' -Value '0' + Write-PipelineSetVariable -Name 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' -Value '1' return $global:_DotNetInstallDir = $dotnetRoot } @@ -184,13 +182,13 @@ function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $archit & $installScript @installParameters if ($lastExitCode -ne 0) { - Write-Host "Failed to install dotnet cli (exit code '$lastExitCode')." -ForegroundColor Red + Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Failed to install dotnet cli (exit code '$lastExitCode')." ExitWithExitCode $lastExitCode } } # -# Locates Visual Studio MSBuild installation. +# Locates Visual Studio MSBuild installation. # The preference order for MSBuild to use is as follows: # # 1. MSBuild from an active VS command prompt @@ -207,13 +205,17 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { "15.9" } - $vsMinVersion = [Version]::new($vsMinVersionStr) + $vsMinVersion = [Version]::new($vsMinVersionStr) # Try msbuild command available in the environment. if ($env:VSINSTALLDIR -ne $null) { $msbuildCmd = Get-Command "msbuild.exe" -ErrorAction SilentlyContinue if ($msbuildCmd -ne $null) { - if ($msbuildCmd.Version -ge $vsMinVersion) { + # Workaround for https://github.com/dotnet/roslyn/issues/35793 + # Due to this issue $msbuildCmd.Version returns 0.0.0.0 for msbuild.exe 16.2+ + $msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split(@('-', '+'))[0]) + + if ($msbuildVersion -ge $vsMinVersion) { return $global:_MSBuildExe = $msbuildCmd.Path } @@ -252,7 +254,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [string] $vsMajorVersion) { $env:VSINSTALLDIR = $vsInstallDir Set-Item "env:VS$($vsMajorVersion)0COMNTOOLS" (Join-Path $vsInstallDir "Common7\Tools\") - + $vsSdkInstallDir = Join-Path $vsInstallDir "VSSDK\" if (Test-Path $vsSdkInstallDir) { Set-Item "env:VSSDK$($vsMajorVersion)0Install" $vsSdkInstallDir @@ -287,13 +289,13 @@ function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { # Locates Visual Studio instance that meets the minimal requirements specified by tools.vs object in global.json. # # The following properties of tools.vs are recognized: -# "version": "{major}.{minor}" +# "version": "{major}.{minor}" # Two part minimal VS version, e.g. "15.9", "16.0", etc. -# "components": ["componentId1", "componentId2", ...] +# "components": ["componentId1", "componentId2", ...] # Array of ids of workload components that must be available in the VS instance. # See e.g. https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-enterprise?view=vs-2017 # -# Returns JSON describing the located VS instance (same format as returned by vswhere), +# Returns JSON describing the located VS instance (same format as returned by vswhere), # or $null if no instance meeting the requirements is found on the machine. # function LocateVisualStudio([object]$vsRequirements = $null){ @@ -313,8 +315,8 @@ function LocateVisualStudio([object]$vsRequirements = $null){ } if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } - $args = @("-latest", "-prerelease", "-format", "json", "-requires", "Microsoft.Component.MSBuild") - + $args = @("-latest", "-prerelease", "-format", "json", "-requires", "Microsoft.Component.MSBuild", "-products", "*") + if (Get-Member -InputObject $vsRequirements -Name "version") { $args += "-version" $args += $vsRequirements.version @@ -324,7 +326,7 @@ function LocateVisualStudio([object]$vsRequirements = $null){ foreach ($component in $vsRequirements.components) { $args += "-requires" $args += $component - } + } } $vsInfo =& $vsWhereExe $args | ConvertFrom-Json @@ -354,7 +356,7 @@ function InitializeBuildTool() { if ($msbuildEngine -eq "dotnet") { if (!$dotnetRoot) { - Write-Host "/global.json must specify 'tools.dotnet'." -ForegroundColor Red + Write-PipelineTelemetryError -Category "InitializeToolset" -Message "/global.json must specify 'tools.dotnet'." ExitWithExitCode 1 } @@ -363,13 +365,13 @@ function InitializeBuildTool() { try { $msbuildPath = InitializeVisualStudioMSBuild -install:$restore } catch { - Write-Host $_ -ForegroundColor Red + Write-PipelineTelemetryError -Category "InitializeToolset" -Message $_ ExitWithExitCode 1 } $buildTool = @{ Path = $msbuildPath; Command = ""; Tool = "vs"; Framework = "net472" } } else { - Write-Host "Unexpected value of -msbuildEngine: '$msbuildEngine'." -ForegroundColor Red + Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Unexpected value of -msbuildEngine: '$msbuildEngine'." ExitWithExitCode 1 } @@ -381,12 +383,12 @@ function GetDefaultMSBuildEngine() { if (Get-Member -InputObject $GlobalJson.tools -Name "vs") { return "vs" } - + if (Get-Member -InputObject $GlobalJson.tools -Name "dotnet") { return "dotnet" } - Write-Host "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." -ForegroundColor Red + Write-PipelineTelemetryError -Category "InitializeToolset" -Message "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." ExitWithExitCode 1 } @@ -411,11 +413,13 @@ function GetSdkTaskProject([string]$taskName) { function InitializeNativeTools() { if (Get-Member -InputObject $GlobalJson -Name "native-tools") { - $nativeArgs="" + $nativeArgs= @{} if ($ci) { - $nativeArgs = "-InstallDirectory $ToolsDir" + $nativeArgs = @{ + InstallDirectory = "$ToolsDir" + } } - Invoke-Expression "& `"$PSScriptRoot/init-tools-native.ps1`" $nativeArgs" + & "$PSScriptRoot/init-tools-native.ps1" @nativeArgs } } @@ -437,7 +441,7 @@ function InitializeToolset() { } if (-not $restore) { - Write-Host "Toolset version $toolsetVersion has not been restored." -ForegroundColor Red + Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Toolset version $toolsetVersion has not been restored." ExitWithExitCode 1 } @@ -497,11 +501,13 @@ function MSBuild() { function MSBuild-Core() { if ($ci) { if (!$binaryLog) { - throw "Binary log must be enabled in CI build." + Write-PipelineTaskError -Message "Binary log must be enabled in CI build." + ExitWithExitCode 1 } if ($nodeReuse) { - throw "Node reuse must be disabled in CI build." + Write-PipelineTaskError -Message "Node reuse must be disabled in CI build." + ExitWithExitCode 1 } } @@ -509,8 +515,8 @@ function MSBuild-Core() { $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" - if ($warnAsError) { - $cmdArgs += " /warnaserror /p:TreatWarningsAsErrors=true" + if ($warnAsError) { + $cmdArgs += " /warnaserror /p:TreatWarningsAsErrors=true" } foreach ($arg in $args) { @@ -518,29 +524,29 @@ function MSBuild-Core() { $cmdArgs += " `"$arg`"" } } - + $exitCode = Exec-Process $buildTool.Path $cmdArgs if ($exitCode -ne 0) { - Write-Host "Build failed." -ForegroundColor Red + Write-PipelineTaskError -Message "Build failed." $buildLog = GetMSBuildBinaryLogCommandLineArgument $args - if ($buildLog -ne $null) { - Write-Host "See log: $buildLog" -ForegroundColor DarkGray + if ($buildLog -ne $null) { + Write-Host "See log: $buildLog" -ForegroundColor DarkGray } ExitWithExitCode $exitCode } } -function GetMSBuildBinaryLogCommandLineArgument($arguments) { +function GetMSBuildBinaryLogCommandLineArgument($arguments) { foreach ($argument in $arguments) { if ($argument -ne $null) { $arg = $argument.Trim() if ($arg.StartsWith("/bl:", "OrdinalIgnoreCase")) { return $arg.Substring("/bl:".Length) - } - + } + if ($arg.StartsWith("/binaryLogger:", "OrdinalIgnoreCase")) { return $arg.Substring("/binaryLogger:".Length) } @@ -550,6 +556,8 @@ function GetMSBuildBinaryLogCommandLineArgument($arguments) { return $null } +. $PSScriptRoot\pipeline-logging-functions.ps1 + $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") $EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..") $ArtifactsDir = Join-Path $RepoRoot "artifacts" @@ -565,11 +573,8 @@ Create-Directory $ToolsetDir Create-Directory $TempDir Create-Directory $LogDir -if ($ci) { - Write-Host "##vso[task.setvariable variable=Artifacts]$ArtifactsDir" - Write-Host "##vso[task.setvariable variable=Artifacts.Toolset]$ToolsetDir" - Write-Host "##vso[task.setvariable variable=Artifacts.Log]$LogDir" - - $env:TEMP = $TempDir - $env:TMP = $TempDir -} +Write-PipelineSetVariable -Name 'Artifacts' -Value $ArtifactsDir +Write-PipelineSetVariable -Name 'Artifacts.Toolset' -Value $ToolsetDir +Write-PipelineSetVariable -Name 'Artifacts.Log' -Value $LogDir +Write-PipelineSetVariable -Name 'TEMP' -Value $TempDir +Write-PipelineSetVariable -Name 'TMP' -Value $TempDir diff --git a/eng/common/tools.sh b/eng/common/tools.sh index df3eb8bce0..f39aab57b9 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -1,8 +1,20 @@ +#!/usr/bin/env bash + # Initialize variables if they aren't already defined. # CI mode - set to true on CI server for PR validation build or official build. ci=${ci:-false} +# Set to true to use the pipelines logger which will enable Azure logging output. +# https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md +# This flag is meant as a temporary opt-opt for the feature while validate it across +# our consumers. It will be deleted in the future. +if [[ "$ci" == true ]]; then + pipelines_log=${pipelines_log:-true} +else + pipelines_log=${pipelines_log:-false} +fi + # Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. configuration=${configuration:-'Debug'} @@ -65,7 +77,7 @@ function ReadGlobalVersion { local pattern="\"$key\" *: *\"(.*)\"" if [[ ! $line =~ $pattern ]]; then - echo "Error: Cannot find \"$key\" in $global_json_file" >&2 + Write-PipelineTelemetryError -category 'InitializeTools' "Error: Cannot find \"$key\" in $global_json_file" ExitWithExitCode 1 fi @@ -126,7 +138,7 @@ function InitializeDotNetCli { if [[ "$install" == true ]]; then InstallDotNetSdk "$dotnet_root" "$dotnet_sdk_version" else - echo "Unable to find dotnet with SDK version '$dotnet_sdk_version'" >&2 + Write-PipelineTelemetryError -category 'InitializeToolset' "Unable to find dotnet with SDK version '$dotnet_sdk_version'" ExitWithExitCode 1 fi fi @@ -137,7 +149,7 @@ function InitializeDotNetCli { export PATH="$dotnet_root:$PATH" if [[ $ci == true ]]; then - # Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build + # Make Sure that our bootstrapped dotnet cli is available in future steps of the Azure Pipelines build echo "##vso[task.prependpath]$dotnet_root" echo "##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]0" echo "##vso[task.setvariable variable=DOTNET_SKIP_FIRST_TIME_EXPERIENCE]1" @@ -179,7 +191,7 @@ function InstallDotNet { fi bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg || { local exit_code=$? - echo "Failed to install dotnet SDK (exit code '$exit_code')." >&2 + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK (exit code '$exit_code')." ExitWithExitCode $exit_code } } @@ -216,6 +228,7 @@ function InitializeBuildTool { # return values _InitializeBuildTool="$_InitializeDotNetCli/dotnet" _InitializeBuildToolCommand="msbuild" + _InitializeBuildToolFramework="netcoreapp2.1" } function GetNuGetPackageCachePath { @@ -264,7 +277,7 @@ function InitializeToolset { fi if [[ "$restore" != true ]]; then - echo "Toolset version $toolsetVersion has not been restored." >&2 + Write-PipelineTelemetryError -category 'InitializeToolset' "Toolset version $toolset_version has not been restored." ExitWithExitCode 2 fi @@ -276,12 +289,12 @@ function InitializeToolset { fi echo '' > "$proj" - MSBuild "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file" + MSBuild-Core "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file" local toolset_build_proj=`cat "$toolset_location_file"` if [[ ! -a "$toolset_build_proj" ]]; then - echo "Invalid toolset path: $toolset_build_proj" >&2 + Write-PipelineTelemetryError -category 'InitializeToolset' "Invalid toolset path: $toolset_build_proj" ExitWithExitCode 3 fi @@ -304,14 +317,27 @@ function StopProcesses { } function MSBuild { + local args=$@ + if [[ "$pipelines_log" == true ]]; then + InitializeBuildTool + InitializeToolset + local toolset_dir="${_InitializeToolset%/*}" + local logger_path="$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" + args=( "${args[@]}" "-logger:$logger_path" ) + fi + + MSBuild-Core ${args[@]} +} + +function MSBuild-Core { if [[ "$ci" == true ]]; then if [[ "$binary_log" != true ]]; then - echo "Binary log must be enabled in CI build." >&2 + Write-PipelineTaskError "Binary log must be enabled in CI build." ExitWithExitCode 1 fi if [[ "$node_reuse" == true ]]; then - echo "Node reuse must be disabled in CI build." >&2 + Write-PipelineTaskError "Node reuse must be disabled in CI build." ExitWithExitCode 1 fi fi @@ -325,11 +351,13 @@ function MSBuild { "$_InitializeBuildTool" "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" || { local exit_code=$? - echo "Build failed (exit code '$exit_code')." >&2 + Write-PipelineTaskError "Build failed (exit code '$exit_code')." ExitWithExitCode $exit_code } } +. "$scriptroot/pipeline-logging-functions.sh" + ResolvePath "${BASH_SOURCE[0]}" _script_dir=`dirname "$_ResolvePath"` @@ -362,4 +390,4 @@ mkdir -p "$log_dir" if [[ $ci == true ]]; then export TEMP="$temp_dir" export TMP="$temp_dir" -fi \ No newline at end of file +fi diff --git a/global.json b/global.json index 6d63a523a7..ace8d4fc82 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19264.13", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19315.2", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 41fbea777c9b1199cfb165034b273c025a8101ad Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Mon, 17 Jun 2019 12:06:55 -0700 Subject: [PATCH 099/286] Remove IVT to FSharp.Compiler.Server (#6997) --- .../FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index 2a4a221870..2c005c363f 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -46,7 +46,6 @@ - From 30d3f7eaaf3dae776bf1efd8360526d0930fc80e Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Mon, 17 Jun 2019 12:10:31 -0700 Subject: [PATCH 100/286] No IVTs to legacy project system or property pages (#6999) --- .../FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index 2c005c363f..9b24fac60d 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -42,9 +42,6 @@ - - - From 395a1f472575b0a54ffd6b822201c930d4101b65 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Mon, 17 Jun 2019 22:11:13 +0300 Subject: [PATCH 101/286] PatternMatchCompilation cleanup (#6993) * PatternMatchCompilation cleanup * More cleanup --- src/fsharp/PatternMatchCompilation.fs | 220 ++++++++++++------------- src/fsharp/PatternMatchCompilation.fsi | 22 +-- 2 files changed, 119 insertions(+), 123 deletions(-) diff --git a/src/fsharp/PatternMatchCompilation.fs b/src/fsharp/PatternMatchCompilation.fs index ddd8fc129c..0bf4df1c25 100644 --- a/src/fsharp/PatternMatchCompilation.fs +++ b/src/fsharp/PatternMatchCompilation.fs @@ -30,7 +30,6 @@ type ActionOnFailure = | FailFilter [] -/// Represents type-checked patterns type Pattern = | TPat_const of Const * range | TPat_wild of range (* note = TPat_disjs([], m), but we haven't yet removed that duplication *) @@ -720,7 +719,9 @@ let rec erasePartialPatterns inpp = | TPat_range _ | TPat_null _ | TPat_isinst _ -> inpp -and erasePartials inps = List.map erasePartialPatterns inps + +and erasePartials inps = + List.map erasePartialPatterns inps //--------------------------------------------------------------------------- @@ -740,118 +741,115 @@ let CompilePatternBasic (clausesL: TypedMatchClause list) inputTy resultTy = - // Add the targets to a match builder - // Note the input expression has already been evaluated and saved into a variable. - // Hence no need for a new sequence point. - let mbuilder = new MatchBuilder(NoSequencePointAtInvisibleBinding, exprm) - clausesL |> List.iteri (fun _i c -> mbuilder.AddTarget c.Target |> ignore) - - // Add the incomplete or rethrow match clause on demand, printing a - // warning if necessary (only if it is ever exercised) - let incompleteMatchClauseOnce = ref None + // Add the targets to a match builder. + // Note the input expression has already been evaluated and saved into a variable, + // hence no need for a new sequence point. + let matchBuilder = MatchBuilder (NoSequencePointAtInvisibleBinding, exprm) + clausesL |> List.iter (fun c -> matchBuilder.AddTarget c.Target |> ignore) + + // Add the incomplete or rethrow match clause on demand, + // printing a warning if necessary (only if it is ever exercised). + let mutable incompleteMatchClauseOnce = None let getIncompleteMatchClause refuted = - // This is lazy because emit a - // warning when the lazy thunk gets evaluated - match !incompleteMatchClauseOnce with + // This is lazy because emit a warning when the lazy thunk gets evaluated. + match incompleteMatchClauseOnce with | None -> - (* Emit the incomplete match warning *) - if warnOnIncomplete then - match actionOnFailure with - | ThrowIncompleteMatchException | IgnoreWithWarning -> - let ignoreWithWarning = (actionOnFailure = IgnoreWithWarning) - match ShowCounterExample g denv matchm refuted with - | Some(text, failingWhenClause, true) -> - warning (EnumMatchIncomplete(ignoreWithWarning, Some(text, failingWhenClause), matchm)) - | Some(text, failingWhenClause, false) -> - warning (MatchIncomplete(ignoreWithWarning, Some(text, failingWhenClause), matchm)) - | None -> - warning (MatchIncomplete(ignoreWithWarning, None, matchm)) - | _ -> - () - - let throwExpr = - match actionOnFailure with - | FailFilter -> - // Return 0 from the .NET exception filter - mkInt g matchm 0 - - | Rethrow -> - // Rethrow unmatched try-catch exn. No sequence point at the target since its not - // real code. - mkReraise matchm resultTy - - | Throw -> - // We throw instead of rethrow on unmatched try-catch in a computation expression. But why? - // Because this isn't a real .NET exception filter/handler but just a function we're passing - // to a computation expression builder to simulate one. - mkThrow matchm resultTy (exprForVal matchm origInputVal) - - | ThrowIncompleteMatchException -> - mkThrow matchm resultTy - (mkExnExpr(mk_MFCore_tcref g.fslibCcu "MatchFailureException", - [ mkString g matchm matchm.FileName - mkInt g matchm matchm.StartLine - mkInt g matchm matchm.StartColumn], matchm)) - - | IgnoreWithWarning -> - mkUnit g matchm - - // We don't emit a sequence point at any of the above cases because they don't correspond to - // user code. - // - // Note we don't emit sequence points at either the succeeding or failing - // targets of filters since if the exception is filtered successfully then we - // will run the handler and hit the sequence point there. - // That sequence point will have the pattern variables bound, which is exactly what we want. - let tg = TTarget(List.empty, throwExpr, SuppressSequencePointAtTarget ) - mbuilder.AddTarget tg |> ignore - let clause = TClause(TPat_wild matchm, None, tg, matchm) - incompleteMatchClauseOnce := Some clause - clause + // Emit the incomplete match warning. + if warnOnIncomplete then + match actionOnFailure with + | ThrowIncompleteMatchException | IgnoreWithWarning -> + let ignoreWithWarning = (actionOnFailure = IgnoreWithWarning) + match ShowCounterExample g denv matchm refuted with + | Some(text, failingWhenClause, true) -> + warning (EnumMatchIncomplete(ignoreWithWarning, Some(text, failingWhenClause), matchm)) + | Some(text, failingWhenClause, false) -> + warning (MatchIncomplete(ignoreWithWarning, Some(text, failingWhenClause), matchm)) + | None -> + warning (MatchIncomplete(ignoreWithWarning, None, matchm)) + | _ -> + () + + let throwExpr = + match actionOnFailure with + | FailFilter -> + // Return 0 from the .NET exception filter. + mkInt g matchm 0 + + | Rethrow -> + // Rethrow unmatched try-catch exn. No sequence point at the target since its not real code. + mkReraise matchm resultTy + + | Throw -> + // We throw instead of rethrow on unmatched try-catch in a computation expression. But why? + // Because this isn't a real .NET exception filter/handler but just a function we're passing + // to a computation expression builder to simulate one. + mkThrow matchm resultTy (exprForVal matchm origInputVal) + + | ThrowIncompleteMatchException -> + mkThrow matchm resultTy + (mkExnExpr(mk_MFCore_tcref g.fslibCcu "MatchFailureException", + [ mkString g matchm matchm.FileName + mkInt g matchm matchm.StartLine + mkInt g matchm matchm.StartColumn], matchm)) + + | IgnoreWithWarning -> + mkUnit g matchm + + // We don't emit a sequence point at any of the above cases because they don't correspond to user code. + // + // Note we don't emit sequence points at either the succeeding or failing targets of filters since if + // the exception is filtered successfully then we will run the handler and hit the sequence point there. + // That sequence point will have the pattern variables bound, which is exactly what we want. + let tg = TTarget(List.empty, throwExpr, SuppressSequencePointAtTarget) + let _ = matchBuilder.AddTarget tg + let clause = TClause(TPat_wild matchm, None, tg, matchm) + incompleteMatchClauseOnce <- Some clause + clause | Some c -> c - // Helpers to get the variables bound at a target. We conceptually add a dummy clause that will always succeed with a "throw" + // Helpers to get the variables bound at a target. + // We conceptually add a dummy clause that will always succeed with a "throw" let clausesA = Array.ofList clausesL - let nclauses = clausesA.Length + let nClauses = clausesA.Length let GetClause i refuted = - if i < nclauses then + if i < nClauses then clausesA.[i] - elif i = nclauses then getIncompleteMatchClause refuted + elif i = nClauses then getIncompleteMatchClause refuted else failwith "GetClause" let GetValsBoundByClause i refuted = (GetClause i refuted).BoundVals let GetWhenGuardOfClause i refuted = (GetClause i refuted).GuardExpr - // Different uses of parameterized active patterns have different identities as far as paths - // are concerned. Here we generate unique numbers that are completely different to any stamp - // by usig negative numbers. + // Different uses of parameterized active patterns have different identities as far as paths are concerned. + // Here we generate unique numbers that are completely different to any stamp by using negative numbers. let genUniquePathId() = - (newUnique()) - // Build versions of these functions which apply a dummy instantiation to the overall type arguments + // Build versions of these functions which apply a dummy instantiation to the overall type arguments. let GetSubExprOfInput, getDiscrimOfPattern = let tyargs = List.map (fun _ -> g.unit_ty) origInputValTypars let unit_tpinst = mkTyparInst origInputValTypars tyargs GetSubExprOfInput g (origInputValTypars, tyargs, unit_tpinst), getDiscrimOfPattern g unit_tpinst - // The main recursive loop of the pattern match compiler + // The main recursive loop of the pattern match compiler. let rec InvestigateFrontiers refuted frontiers = match frontiers with | [] -> failwith "CompilePattern: compile - empty clauses: at least the final clause should always succeed" - | (Frontier (i, active, valMap)) :: rest -> + | Frontier (i, active, valMap) :: rest -> - // Check to see if we've got a succeeding clause. There may still be a 'when' condition for the clause + // Check to see if we've got a succeeding clause. There may still be a 'when' condition for the clause. match active with | [] -> CompileSuccessPointAndGuard i refuted valMap rest | _ -> - (* Otherwise choose a point (i.e. a path) to investigate. *) + // Otherwise choose a point (i.e. a path) to investigate. let (Active(path, subexpr, pat)) = ChooseInvestigationPointLeftToRight frontiers match pat with // All these constructs should have been eliminated in BindProjectionPattern - | TPat_as _ | TPat_tuple _ | TPat_wild _ | TPat_disjs _ | TPat_conjs _ | TPat_recd _ -> failwith "Unexpected pattern" + | TPat_as _ | TPat_tuple _ | TPat_wild _ | TPat_disjs _ | TPat_conjs _ | TPat_recd _ -> + failwith "Unexpected pattern" - // Leaving the ones where we have real work to do + // Leaving the ones where we have real work to do. | _ -> let simulSetOfEdgeDiscrims, fallthroughPathFrontiers = ChooseSimultaneousEdges frontiers path @@ -879,7 +877,6 @@ let CompilePatternBasic finalDecisionTree and CompileSuccessPointAndGuard i refuted valMap rest = - let vs2 = GetValsBoundByClause i refuted let es2 = vs2 |> List.map (fun v -> @@ -907,25 +904,25 @@ let CompilePatternBasic | None -> rhs' - /// Select the set of discriminators which we can handle in one test, or as a series of - /// iterated tests, e.g. in the case of TPat_isinst. Ensure we only take at most one class of `TPat_query` at a time. + /// Select the set of discriminators which we can handle in one test, or as a series of iterated tests, + /// e.g. in the case of TPat_isinst. Ensure we only take at most one class of `TPat_query` at a time. /// Record the rule numbers so we know which rule the TPat_query cam from, so that when we project through /// the frontier we only project the right rule. and ChooseSimultaneousEdges frontiers path = frontiers |> chooseSimultaneousEdgeSet None (fun prevOpt (Frontier (i', active', _)) -> - if isMemOfActives path active' then - let p = lookupActive path active' |> snd - match getDiscrimOfPattern p with - | Some discrim -> - if (match prevOpt with None -> true | Some (EdgeDiscrim(_, discrimPrev, _)) -> discrimsHaveSameSimultaneousClass g discrim discrimPrev) then - Some (EdgeDiscrim(i', discrim, p.Range)), true - else - None, false - - | None -> - None, true - else - None, true) + if isMemOfActives path active' then + let _, p = lookupActive path active' + match getDiscrimOfPattern p with + | Some discrim -> + if (match prevOpt with None -> true | Some (EdgeDiscrim(_, discrimPrev, _)) -> discrimsHaveSameSimultaneousClass g discrim discrimPrev) then + Some (EdgeDiscrim(i', discrim, p.Range)), true + else + None, false + + | None -> + None, true + else + None, true) and IsCopyableInputExpr origInputExpr = match origInputExpr with @@ -1298,13 +1295,13 @@ let CompilePatternBasic mkFrontiers investigations i) |> List.concat) @ - mkFrontiers [([], ValMap<_>.Empty)] nclauses) + mkFrontiers [([], ValMap<_>.Empty)] nClauses) let dtree = InvestigateFrontiers [] frontiers - let targets = mbuilder.CloseTargets() + let targets = matchBuilder.CloseTargets() // Report unused targets @@ -1320,13 +1317,13 @@ let isPartialOrWhenClause (c: TypedMatchClause) = isPatternPartial c.Pattern || let rec CompilePattern g denv amap exprm matchm warnOnUnused actionOnFailure (origInputVal, origInputValTypars, origInputExprOpt) (clausesL: TypedMatchClause list) inputTy resultTy = - match clausesL with - | _ when List.exists isPartialOrWhenClause clausesL -> + match clausesL with + | _ when List.exists isPartialOrWhenClause clausesL -> // Partial clauses cause major code explosion if treated naively // Hence treat any pattern matches with any partial clauses clause-by-clause // First make sure we generate at least some of the obvious incomplete match warnings. - let warnOnUnused = false in (* we can't turn this on since we're pretending all partial's fail in order to control the complexity of this. *) + let warnOnUnused = false // we can't turn this on since we're pretending all partials fail in order to control the complexity of this. let warnOnIncomplete = true let clausesPretendAllPartialFail = List.collect (fun (TClause(p, whenOpt, tg, m)) -> [TClause(erasePartialPatterns p, whenOpt, tg, m)]) clausesL let _ = CompilePatternBasic g denv amap exprm matchm warnOnUnused warnOnIncomplete actionOnFailure (origInputVal, origInputValTypars, origInputExprOpt) clausesPretendAllPartialFail inputTy resultTy @@ -1334,19 +1331,18 @@ let rec CompilePattern g denv amap exprm matchm warnOnUnused actionOnFailure (o let rec atMostOnePartialAtATime clauses = match List.takeUntil isPartialOrWhenClause clauses with - | l, [] -> + | l, [] -> CompilePatternBasic g denv amap exprm matchm warnOnUnused warnOnIncomplete actionOnFailure (origInputVal, origInputValTypars, origInputExprOpt) l inputTy resultTy | l, (h :: t) -> - // Add the partial clause + // Add the partial clause. doGroupWithAtMostOnePartial (l @ [h]) t and doGroupWithAtMostOnePartial group rest = + // Compile the remaining clauses. + let decisionTree, targets = atMostOnePartialAtATime rest - // Compile the remaining clauses - let dtree, targets = atMostOnePartialAtATime rest - - // Make the expression that represents the remaining cases of the pattern match - let expr = mkAndSimplifyMatch NoSequencePointAtInvisibleBinding exprm matchm resultTy dtree targets + // Make the expression that represents the remaining cases of the pattern match. + let expr = mkAndSimplifyMatch NoSequencePointAtInvisibleBinding exprm matchm resultTy decisionTree targets // If the remainder of the match boiled away to nothing interesting. // We measure this simply by seeing if the range of the resulting expression is identical to matchm. @@ -1362,5 +1358,5 @@ let rec CompilePattern g denv amap exprm matchm warnOnUnused actionOnFailure (o atMostOnePartialAtATime clausesL - | _ -> - CompilePatternBasic g denv amap exprm matchm warnOnUnused true actionOnFailure (origInputVal, origInputValTypars, origInputExprOpt) clausesL inputTy resultTy + | _ -> + CompilePatternBasic g denv amap exprm matchm warnOnUnused true actionOnFailure (origInputVal, origInputValTypars, origInputExprOpt) clausesL inputTy resultTy diff --git a/src/fsharp/PatternMatchCompilation.fsi b/src/fsharp/PatternMatchCompilation.fsi index 8394611a16..b35b5f42b2 100644 --- a/src/fsharp/PatternMatchCompilation.fsi +++ b/src/fsharp/PatternMatchCompilation.fsi @@ -9,7 +9,6 @@ open FSharp.Compiler.Tastops open FSharp.Compiler.TcGlobals open FSharp.Compiler.Range - /// What should the decision tree contain for any incomplete match? type ActionOnFailure = | ThrowIncompleteMatchException @@ -23,19 +22,20 @@ type ActionOnFailure = type Pattern = | TPat_const of Const * range | TPat_wild of range - | TPat_as of Pattern * PatternValBinding * range - | TPat_disjs of Pattern list * range - | TPat_conjs of Pattern list * range + | TPat_as of Pattern * PatternValBinding * range + | TPat_disjs of Pattern list * range + | TPat_conjs of Pattern list * range | TPat_query of (Expr * TType list * (ValRef * TypeInst) option * int * PrettyNaming.ActivePatternInfo) * Pattern * range | TPat_unioncase of UnionCaseRef * TypeInst * Pattern list * range | TPat_exnconstr of TyconRef * Pattern list * range - | TPat_tuple of TupInfo * Pattern list * TType list * range - | TPat_array of Pattern list * TType * range + | TPat_tuple of TupInfo * Pattern list * TType list * range + | TPat_array of Pattern list * TType * range | TPat_recd of TyconRef * TypeInst * Pattern list * range | TPat_range of char * char * range | TPat_null of range | TPat_isinst of TType * TType * PatternValBinding option * range - member Range : range + + member Range: range and PatternValBinding = | PBind of Val * TypeScheme @@ -43,10 +43,10 @@ and PatternValBinding = and TypedMatchClause = | TClause of Pattern * Expr option * DecisionTreeTarget * range -val ilFieldToTastConst : ILFieldInit -> Tast.Const +val ilFieldToTastConst: ILFieldInit -> Tast.Const /// Compile a pattern into a decision tree and a set of targets. -val internal CompilePattern : +val internal CompilePattern: TcGlobals -> DisplayEnv -> Import.ImportMap -> @@ -66,8 +66,8 @@ val internal CompilePattern : TType -> // result type TType -> - // produce TAST nodes - DecisionTree * DecisionTreeTarget list + // produce TAST nodes + DecisionTree * DecisionTreeTarget list exception internal MatchIncomplete of bool * (string * bool) option * range exception internal RuleNeverMatched of range From cec5b256f29f33e27d37fb3c27e4614d4cf8df61 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Mon, 17 Jun 2019 17:48:19 -0700 Subject: [PATCH 102/286] Remove IVT to fsi interactive settings (#6998) --- .../FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index 9b24fac60d..443f6c6efd 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -42,7 +42,6 @@ - From 31bbe4277d2e78e1e7a83bf87456f17ccb9a07dc Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Tue, 18 Jun 2019 08:20:35 +0100 Subject: [PATCH 103/286] merge --- FSharpBuild.Directory.Build.props | 11 +++++------ FSharpTests.Directory.Build.props | 6 +++--- eng/Build.ps1 | 6 ++++-- eng/build-utils.ps1 | 16 ++++++---------- eng/build.sh | 10 ++++++++++ proto.proj | 4 ++++ src/buildtools/buildtools.proj | 13 +++++++------ src/buildtools/buildtools.targets | 4 ++-- 8 files changed, 41 insertions(+), 29 deletions(-) diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index a1ba7ab156..515de9bbdc 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -11,8 +11,7 @@ $(RepoRoot)src $(ArtifactsDir)\SymStore - $(ArtifactsDir)\Bootstrap - $(ArtifactsDir)/fsc/Proto/netcoreapp2.1 + $(ArtifactsDir)\Bootstrap 4.4.0 1182;0025;$(WarningsAsErrors) @@ -96,10 +95,10 @@ - $(ProtoOutputPath)\Microsoft.FSharp.Targets - $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.props - $(ProtoOutputPath)\Microsoft.FSharp.NetSdk.targets - $(ProtoOutputPath)\Microsoft.FSharp.Overrides.NetSdk.targets + $(ProtoOutputPath)\fsc\Microsoft.FSharp.Targets + $(ProtoOutputPath)\fsc\Microsoft.FSharp.NetSdk.props + $(ProtoOutputPath)\fsc\Microsoft.FSharp.NetSdk.targets + $(ProtoOutputPath)\fsc\Microsoft.FSharp.Overrides.NetSdk.targets diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index 7c00805dda..8a7a832a43 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -32,9 +32,9 @@ - <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'net40'">net472 - <_FSharpBuildTargetFramework Condition="'$(FSharpTestCompilerVersion)' == 'coreclr'">netcoreapp2.1 - <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\FSharp.Build\$(Configuration)\$(_FSharpBuildTargetFramework) + <_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'!='Core'">net472 + <_FSharpBuildTargetFramework Condition="'$(MSBuildRuntimeType)'=='Core'">netcoreapp2.1 + <_FSharpBuildBinPath>$(MSBuildThisFileDirectory)artifacts\bin\fsc\$(Configuration)\$(_FSharpBuildTargetFramework) $(_FSharpBuildBinPath)\FSharp.Build.dll diff --git a/eng/Build.ps1 b/eng/Build.ps1 index f79e59fef1..9f6d5dd045 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -68,6 +68,7 @@ function Print-Usage() { Write-Host "" Write-Host "Actions:" Write-Host " -restore Restore packages (short: -r)" + Write-Host " -norestore Don't restore packages" Write-Host " -build Build main solution (short: -b)" Write-Host " -rebuild Rebuild main solution" Write-Host " -pack Build NuGet packages, VS insertion manifests and installer" @@ -106,6 +107,7 @@ function Process-Arguments() { Print-Usage exit 0 } + $script:nodeReuse = $False; if ($testAll) { $script:testDesktop = $True @@ -177,10 +179,10 @@ function BuildSolution() { /p:Publish=$publish ` /p:ContinuousIntegrationBuild=$ci ` /p:OfficialBuildId=$officialBuildId ` - /p:BootstrapBuildPath=$bootstrapDir ` /p:QuietRestore=$quietRestore ` /p:QuietRestoreBinaryLog=$binaryLog ` /p:TestTargetFrameworks=$testTargetFrameworks ` + /v:$verbosity ` $suppressExtensionDeployment ` @properties } @@ -211,7 +213,7 @@ function UpdatePath() { } function VerifyAssemblyVersions() { - $fsiPath = Join-Path $ArtifactsDir "bin\fsi\Proto\net472\fsi.exe" + $fsiPath = Join-Path $ArtifactsDir "bin\fsi\Proto\net472\publish\fsi.exe" # Only verify versions on CI or official build if ($ci -or $official) { diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index 72e191ca1a..335379b2f7 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -216,10 +216,6 @@ function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string] $args += " /p:ContinuousIntegrationBuild=true" } - if ($bootstrapDir -ne "") { - $args += " /p:BootstrapBuildPath=$bootstrapDir" - } - $args += " $buildArgs" $args += " $projectFilePath" $args += " $properties" @@ -241,15 +237,15 @@ function Make-BootstrapBuild() { Create-Directory $dir # prepare FsLex and Fsyacc - Run-MSBuild "$RepoRoot\src\buildtools\buildtools.proj" "/restore /t:Build" -logFileName "BuildTools" -configuration $bootstrapConfiguration - Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\netcoreapp2.1\*" -Destination $dir - Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\netcoreapp2.1\*" -Destination $dir + Run-MSBuild "$RepoRoot\src\buildtools\buildtools.proj" "/restore /t:Publish" -logFileName "BuildTools" -configuration $bootstrapConfiguration + Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\fslex" -Force -Recurse + Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\fsyacc" -Force -Recurse # prepare compiler $projectPath = "$RepoRoot\proto.proj" - Run-MSBuild $projectPath "/restore /t:Build" -logFileName "Bootstrap" -configuration $bootstrapConfiguration - Copy-Item "$ArtifactsDir\bin\fsc\$bootstrapConfiguration\$bootstrapTfm\*" -Destination $dir - Copy-Item "$ArtifactsDir\bin\fsi\$bootstrapConfiguration\$bootstrapTfm\*" -Destination $dir + Run-MSBuild $projectPath "/restore /t:Publish" -logFileName "Bootstrap" -configuration $bootstrapConfiguration + Copy-Item "$ArtifactsDir\bin\fsc\$bootstrapConfiguration\$bootstrapTfm\publish" -Destination "$dir\fsc" -Force -Recurse + Copy-Item "$ArtifactsDir\bin\fsi\$bootstrapConfiguration\$bootstrapTfm\publish" -Destination "$dir\fsi" -Force -Recurse return $dir } diff --git a/eng/build.sh b/eng/build.sh index 24ac2d8e45..11d4ea2ca6 100644 --- a/eng/build.sh +++ b/eng/build.sh @@ -13,7 +13,9 @@ usage() echo " --binaryLog Create MSBuild binary log (short: -bl)" echo "" echo "Actions:" + echo " --bootstrap Force the build of the bootstrap compiler" echo " --restore Restore projects required to build (short: -r)" + echo " --norestore Don't restore projects required to build" echo " --build Build all projects (short: -b)" echo " --rebuild Rebuild all projects" echo " --pack Build nuget packages" @@ -54,6 +56,7 @@ test_core_clr=false configuration="Debug" verbosity='minimal' binary_log=false +force_bootstrap=false ci=false skip_analyzers=false prepare_machine=false @@ -88,6 +91,9 @@ while [[ $# > 0 ]]; do --binarylog|-bl) binary_log=true ;; + --bootstrap) + force_bootstrap=true + ;; --restore|-r) restore=true ;; @@ -205,6 +211,9 @@ function BuildSolution { quiet_restore=true fi + # Node reuse fails because multiple different versions of FSharp.Build.dll get loaded into MSBuild nodes + node_reuse=false + # build bootstrap tools bootstrap_config=Proto bootstrap_dir=$artifacts_dir/Bootstrap @@ -233,6 +242,7 @@ function BuildSolution { # do real build MSBuild $toolset_build_proj \ $bl \ + /v:$verbosity \ /p:Configuration=$configuration \ /p:Projects="$projects" \ /p:RepoRoot="$repo_root" \ diff --git a/proto.proj b/proto.proj index 84103f6fdf..b0ee288977 100644 --- a/proto.proj +++ b/proto.proj @@ -28,6 +28,10 @@ + + + + diff --git a/src/buildtools/buildtools.proj b/src/buildtools/buildtools.proj index 593f086dd0..630bb67856 100644 --- a/src/buildtools/buildtools.proj +++ b/src/buildtools/buildtools.proj @@ -2,7 +2,8 @@ Debug - + true + @@ -10,23 +11,23 @@ - + - + - + - + - + diff --git a/src/buildtools/buildtools.targets b/src/buildtools/buildtools.targets index 303ab00825..185fd4d059 100644 --- a/src/buildtools/buildtools.targets +++ b/src/buildtools/buildtools.targets @@ -20,7 +20,7 @@ BeforeTargets="CoreCompile"> - $(ArtifactsDir)\Bootstrap\fslex.dll + $(ArtifactsDir)\Bootstrap\fslex\fslex.dll @@ -43,7 +43,7 @@ BeforeTargets="CoreCompile"> - $(ArtifactsDir)\Bootstrap\fsyacc.dll + $(ArtifactsDir)\Bootstrap\fsyacc\fsyacc.dll From 520043574cb243ca98bb42b94e42f242c0d3595d Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Tue, 18 Jun 2019 10:01:56 +0100 Subject: [PATCH 104/286] tweaks --- eng/build.sh | 4 ++-- eng/common/dotnet-install.sh | 0 2 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 eng/build.sh mode change 100644 => 100755 eng/common/dotnet-install.sh diff --git a/eng/build.sh b/eng/build.sh old mode 100644 new mode 100755 index 11d4ea2ca6..4d3e87fcba --- a/eng/build.sh +++ b/eng/build.sh @@ -236,8 +236,8 @@ function BuildSolution { /p:Configuration=$bootstrap_config \ /t:Publish - cp $artifacts_dir/bin/fsc/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir - cp $artifacts_dir/bin/fsi/$bootstrap_config/netcoreapp2.1/* $bootstrap_dir + cp -pr $artifacts_dir/bin/fsc/$bootstrap_config/netcoreapp2.1/publish $bootstrap_dir/fsc + fi # do real build MSBuild $toolset_build_proj \ diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh old mode 100644 new mode 100755 From e95cf678991f87ab842708cfd98da0ee1fc756a1 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Tue, 18 Jun 2019 10:57:02 +0100 Subject: [PATCH 105/286] restore --- eng/common/PublishToPackageFeed.proj | 1 - eng/common/build.ps1 | 7 +- eng/common/build.sh | 5 - eng/common/cross/armel/tizen-fetch.sh | 6 +- eng/common/cross/build-rootfs.sh | 2 +- eng/common/darc-init.ps1 | 8 +- eng/common/dotnet-install.ps1 | 11 +- eng/common/generate-graph-files.ps1 | 20 +- eng/common/init-tools-native.ps1 | 21 +- eng/common/native/CommonLibrary.psm1 | 2 +- eng/common/pipeline-logging-functions.ps1 | 233 ------------------ eng/common/pipeline-logging-functions.sh | 102 -------- eng/common/post-build/dotnetsymbol-init.ps1 | 29 --- eng/common/post-build/sourcelink-cli-init.ps1 | 29 --- .../post-build/sourcelink-validation.ps1 | 224 ----------------- eng/common/post-build/symbols-validation.ps1 | 186 -------------- eng/common/sdl/NuGet.config | 13 - eng/common/sdl/execute-all-sdl-tools.ps1 | 97 -------- eng/common/sdl/init-sdl.ps1 | 48 ---- eng/common/sdl/packages.config | 4 - eng/common/sdl/push-gdn.ps1 | 51 ---- eng/common/sdl/run-sdl.ps1 | 65 ----- .../templates/job/publish-build-assets.yml | 25 -- .../channels/public-dev-release.yml | 146 ----------- .../channels/public-validation-release.yml | 92 ------- .../templates/post-build/common-variables.yml | 9 - .../templates/post-build/post-build.yml | 59 ----- .../templates/post-build/promote-build.yml | 28 --- .../post-build/setup-maestro-vars.yml | 26 -- eng/common/templates/steps/send-to-helix.yml | 3 - eng/common/tools.ps1 | 101 ++++---- eng/common/tools.sh | 50 +--- 32 files changed, 94 insertions(+), 1609 deletions(-) delete mode 100644 eng/common/pipeline-logging-functions.ps1 delete mode 100644 eng/common/pipeline-logging-functions.sh delete mode 100644 eng/common/post-build/dotnetsymbol-init.ps1 delete mode 100644 eng/common/post-build/sourcelink-cli-init.ps1 delete mode 100644 eng/common/post-build/sourcelink-validation.ps1 delete mode 100644 eng/common/post-build/symbols-validation.ps1 delete mode 100644 eng/common/sdl/NuGet.config delete mode 100644 eng/common/sdl/execute-all-sdl-tools.ps1 delete mode 100644 eng/common/sdl/init-sdl.ps1 delete mode 100644 eng/common/sdl/packages.config delete mode 100644 eng/common/sdl/push-gdn.ps1 delete mode 100644 eng/common/sdl/run-sdl.ps1 delete mode 100644 eng/common/templates/post-build/channels/public-dev-release.yml delete mode 100644 eng/common/templates/post-build/channels/public-validation-release.yml delete mode 100644 eng/common/templates/post-build/common-variables.yml delete mode 100644 eng/common/templates/post-build/post-build.yml delete mode 100644 eng/common/templates/post-build/promote-build.yml delete mode 100644 eng/common/templates/post-build/setup-maestro-vars.yml diff --git a/eng/common/PublishToPackageFeed.proj b/eng/common/PublishToPackageFeed.proj index a1b1333723..9120b2d212 100644 --- a/eng/common/PublishToPackageFeed.proj +++ b/eng/common/PublishToPackageFeed.proj @@ -54,7 +54,6 @@ https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json https://dotnetfeed.blob.core.windows.net/nuget-nugetclient/index.json https://dotnetfeed.blob.core.windows.net/aspnet-entityframework6/index.json - https://dotnetfeed.blob.core.windows.net/aspnet-blazor/index.json Build configuration: 'Debug' or 'Release' (short: -c)" - Write-Host " -platform Platform configuration: 'x86', 'x64' or any valid Platform value to pass to msbuild" Write-Host " -verbosity Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)" Write-Host " -binaryLog Output binary log (short: -bl)" Write-Host " -help Print help and exit" @@ -79,7 +77,6 @@ function Build { InitializeCustomToolset $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "Build.binlog") } else { "" } - $platformArg = if ($platform) { "/p:Platform=$platform" } else { "" } if ($projects) { # Re-assign properties to a new variable because PowerShell doesn't let us append properties directly for unclear reasons. @@ -91,7 +88,6 @@ function Build { MSBuild $toolsetBuildProj ` $bl ` - $platformArg ` /p:Configuration=$configuration ` /p:RepoRoot=$RepoRoot ` /p:Restore=$restore ` @@ -133,8 +129,9 @@ try { Build } catch { + Write-Host $_ + Write-Host $_.Exception Write-Host $_.ScriptStackTrace - Write-PipelineTelemetryError -Category "InitializeToolset" -Message $_ ExitWithExitCode 1 } diff --git a/eng/common/build.sh b/eng/common/build.sh index 6236fc4d38..ce846d888d 100644 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -66,7 +66,6 @@ ci=false warn_as_error=true node_reuse=true binary_log=false -pipelines_log=false projects='' configuration='Debug' @@ -93,9 +92,6 @@ while [[ $# > 0 ]]; do -binarylog|-bl) binary_log=true ;; - -pipelineslog|-pl) - pipelines_log=true - ;; -restore|-r) restore=true ;; @@ -150,7 +146,6 @@ while [[ $# > 0 ]]; do done if [[ "$ci" == true ]]; then - pipelines_log=true binary_log=true node_reuse=false fi diff --git a/eng/common/cross/armel/tizen-fetch.sh b/eng/common/cross/armel/tizen-fetch.sh index ed70e0a86e..ba16e991c7 100644 --- a/eng/common/cross/armel/tizen-fetch.sh +++ b/eng/common/cross/armel/tizen-fetch.sh @@ -157,15 +157,15 @@ fetch_tizen_pkgs() Inform "Initialize arm base" fetch_tizen_pkgs_init standard base Inform "fetch common packages" -fetch_tizen_pkgs armv7l gcc glibc glibc-devel libicu libicu-devel libatomic +fetch_tizen_pkgs armv7l gcc glibc glibc-devel libicu libicu-devel fetch_tizen_pkgs noarch linux-glibc-devel Inform "fetch coreclr packages" -fetch_tizen_pkgs armv7l lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu +fetch_tizen_pkgs armv7l lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel tizen-release lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu Inform "fetch corefx packages" fetch_tizen_pkgs armv7l libcom_err libcom_err-devel zlib zlib-devel libopenssl libopenssl-devel krb5 krb5-devel libcurl libcurl-devel Inform "Initialize standard unified" fetch_tizen_pkgs_init standard unified Inform "fetch corefx packages" -fetch_tizen_pkgs armv7l gssdp gssdp-devel tizen-release +fetch_tizen_pkgs armv7l gssdp gssdp-devel diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 7c4e122651..34d3d2ba1f 100644 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -181,7 +181,7 @@ if [ -z "$__RootfsDir" ] && [ ! -z "$ROOTFS_DIR" ]; then fi if [ -z "$__RootfsDir" ]; then - __RootfsDir="$__CrossDir/../../../.tools/rootfs/$__BuildArch" + __RootfsDir="$__CrossDir/rootfs/$__BuildArch" fi if [ -d "$__RootfsDir" ]; then diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 8854d979f3..dea7cdd903 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -11,10 +11,10 @@ function InstallDarcCli ($darcVersion) { $dotnetRoot = InitializeDotNetCli -install:$true $dotnet = "$dotnetRoot\dotnet.exe" - $toolList = & "$dotnet" tool list -g + $toolList = Invoke-Expression "& `"$dotnet`" tool list -g" if ($toolList -like "*$darcCliPackageName*") { - & "$dotnet" tool uninstall $darcCliPackageName -g + Invoke-Expression "& `"$dotnet`" tool uninstall $darcCliPackageName -g" } # If the user didn't explicitly specify the darc version, @@ -22,12 +22,12 @@ function InstallDarcCli ($darcVersion) { if (-not $darcVersion) { $darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content } - + $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json' Write-Host "Installing Darc CLI version $darcVersion..." Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." - & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g + Invoke-Expression "& `"$dotnet`" tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g" } InstallDarcCli $darcVersion diff --git a/eng/common/dotnet-install.ps1 b/eng/common/dotnet-install.ps1 index 0b629b8301..5987943fd6 100644 --- a/eng/common/dotnet-install.ps1 +++ b/eng/common/dotnet-install.ps1 @@ -8,14 +8,9 @@ Param( . $PSScriptRoot\tools.ps1 -$dotnetRoot = Join-Path $RepoRoot ".dotnet" - -$installdir = $dotnetRoot try { - if ($architecture -and $architecture.Trim() -eq "x86") { - $installdir = Join-Path $installdir "x86" - } - InstallDotNet $installdir $version $architecture $runtime $true + $dotnetRoot = Join-Path $RepoRoot ".dotnet" + InstallDotNet $dotnetRoot $version $architecture $runtime $true } catch { Write-Host $_ @@ -24,4 +19,4 @@ catch { ExitWithExitCode 1 } -ExitWithExitCode 0 +ExitWithExitCode 0 \ No newline at end of file diff --git a/eng/common/generate-graph-files.ps1 b/eng/common/generate-graph-files.ps1 index b056e4c1ac..a05b84f798 100644 --- a/eng/common/generate-graph-files.ps1 +++ b/eng/common/generate-graph-files.ps1 @@ -25,7 +25,7 @@ function CheckExitCode ([string]$stage) try { Push-Location $PSScriptRoot - + Write-Host "Installing darc..." . .\darc-init.ps1 -darcVersion $darcVersion CheckExitCode "Running darc-init" @@ -40,9 +40,9 @@ try { $darcExe = "$env:USERPROFILE\.dotnet\tools" $darcExe = Resolve-Path "$darcExe\darc.exe" - + Create-Directory $outputFolder - + # Generate 3 graph descriptions: # 1. Flat with coherency information # 2. Graphviz (dot) file @@ -51,26 +51,26 @@ try { $graphVizImageFilePath = "$outputFolder\graph.png" $normalGraphFilePath = "$outputFolder\graph-full.txt" $flatGraphFilePath = "$outputFolder\graph-flat.txt" - $baseOptions = @( "--github-pat", "$gitHubPat", "--azdev-pat", "$azdoPat", "--password", "$barToken" ) - + $baseOptions = "get-dependency-graph --github-pat $gitHubPat --azdev-pat $azdoPat --password $barToken" + if ($includeToolset) { Write-Host "Toolsets will be included in the graph..." - $baseOptions += @( "--include-toolset" ) + $baseOptions += " --include-toolset" } Write-Host "Generating standard dependency graph..." - & "$darcExe" get-dependency-graph @baseOptions --output-file $normalGraphFilePath + Invoke-Expression "& `"$darcExe`" $baseOptions --output-file $normalGraphFilePath" CheckExitCode "Generating normal dependency graph" Write-Host "Generating flat dependency graph and graphviz file..." - & "$darcExe" get-dependency-graph @baseOptions --flat --coherency --graphviz $graphVizFilePath --output-file $flatGraphFilePath + Invoke-Expression "& `"$darcExe`" $baseOptions --flat --coherency --graphviz $graphVizFilePath --output-file $flatGraphFilePath" CheckExitCode "Generating flat and graphviz dependency graph" Write-Host "Generating graph image $graphVizFilePath" $dotFilePath = Join-Path $installBin "graphviz\$graphvizVersion\release\bin\dot.exe" - & "$dotFilePath" -Tpng -o"$graphVizImageFilePath" "$graphVizFilePath" + Invoke-Expression "& `"$dotFilePath`" -Tpng -o'$graphVizImageFilePath' `"$graphVizFilePath`"" CheckExitCode "Generating graphviz image" - + Write-Host "'$graphVizFilePath', '$flatGraphFilePath', '$normalGraphFilePath' and '$graphVizImageFilePath' created!" } catch { diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index 9d18645f45..a4306bd37e 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -79,27 +79,28 @@ try { $NativeTools.PSObject.Properties | ForEach-Object { $ToolName = $_.Name $ToolVersion = $_.Value - $LocalInstallerArguments = @{ ToolName = "$ToolName" } - $LocalInstallerArguments += @{ InstallPath = "$InstallBin" } - $LocalInstallerArguments += @{ BaseUri = "$BaseUri" } - $LocalInstallerArguments += @{ CommonLibraryDirectory = "$EngCommonBaseDir" } - $LocalInstallerArguments += @{ Version = "$ToolVersion" } + $LocalInstallerCommand = $InstallerPath + $LocalInstallerCommand += " -ToolName $ToolName" + $LocalInstallerCommand += " -InstallPath $InstallBin" + $LocalInstallerCommand += " -BaseUri $BaseUri" + $LocalInstallerCommand += " -CommonLibraryDirectory $EngCommonBaseDir" + $LocalInstallerCommand += " -Version $ToolVersion" if ($Verbose) { - $LocalInstallerArguments += @{ Verbose = $True } + $LocalInstallerCommand += " -Verbose" } if (Get-Variable 'Force' -ErrorAction 'SilentlyContinue') { if($Force) { - $LocalInstallerArguments += @{ Force = $True } + $LocalInstallerCommand += " -Force" } } if ($Clean) { - $LocalInstallerArguments += @{ Clean = $True } + $LocalInstallerCommand += " -Clean" } Write-Verbose "Installing $ToolName version $ToolVersion" - Write-Verbose "Executing '$InstallerPath $LocalInstallerArguments'" - & $InstallerPath @LocalInstallerArguments + Write-Verbose "Executing '$LocalInstallerCommand'" + Invoke-Expression "$LocalInstallerCommand" if ($LASTEXITCODE -Ne "0") { $errMsg = "$ToolName installation failed" if ((Get-Variable 'DoNotAbortNativeToolsInstallationOnFailure' -ErrorAction 'SilentlyContinue') -and $DoNotAbortNativeToolsInstallationOnFailure) { diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 index 7a34c7e8a4..f286ae0cde 100644 --- a/eng/common/native/CommonLibrary.psm1 +++ b/eng/common/native/CommonLibrary.psm1 @@ -209,7 +209,7 @@ function New-ScriptShim { Remove-Item (Join-Path $ShimDirectory "$ShimName.exe") } - & "$ShimDirectory\WinShimmer\winshimmer.exe" $ShimName $ToolFilePath $ShimDirectory + Invoke-Expression "$ShimDirectory\WinShimmer\winshimmer.exe $ShimName $ToolFilePath $ShimDirectory" return $True } catch { diff --git a/eng/common/pipeline-logging-functions.ps1 b/eng/common/pipeline-logging-functions.ps1 deleted file mode 100644 index 7b61376f8a..0000000000 --- a/eng/common/pipeline-logging-functions.ps1 +++ /dev/null @@ -1,233 +0,0 @@ -# Source for this file was taken from https://github.com/microsoft/azure-pipelines-task-lib/blob/11c9439d4af17e6475d9fe058e6b2e03914d17e6/powershell/VstsTaskSdk/LoggingCommandFunctions.ps1 and modified. - -# NOTE: You should not be calling these method directly as they are likely to change. Instead you should be calling the Write-Pipeline* functions defined in tools.ps1 - -$script:loggingCommandPrefix = '##vso[' -$script:loggingCommandEscapeMappings = @( # TODO: WHAT ABOUT "="? WHAT ABOUT "%"? - New-Object psobject -Property @{ Token = ';' ; Replacement = '%3B' } - New-Object psobject -Property @{ Token = "`r" ; Replacement = '%0D' } - New-Object psobject -Property @{ Token = "`n" ; Replacement = '%0A' } - New-Object psobject -Property @{ Token = "]" ; Replacement = '%5D' } -) -# TODO: BUG: Escape % ??? -# TODO: Add test to verify don't need to escape "=". - -function Write-PipelineTelemetryError { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Category, - [Parameter(Mandatory = $true)] - [string]$Message, - [Parameter(Mandatory = $false)] - [string]$Type = 'error', - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - $PSBoundParameters.Remove("Category") | Out-Null - - $Message = "(NETCORE_ENGINEERING_TELEMETRY=$Category) $Message" - $PSBoundParameters.Remove("Message") | Out-Null - $PSBoundParameters.Add("Message", $Message) - - Write-PipelineTaskError @PSBoundParameters -} - -function Write-PipelineTaskError { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Message, - [Parameter(Mandatory = $false)] - [string]$Type = 'error', - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - if(!$ci) { - if($Type -eq 'error') { - Write-Host $Message -ForegroundColor Red - return - } - elseif ($Type -eq 'warning') { - Write-Host $Message -ForegroundColor Yellow - return - } - } - - if(($Type -ne 'error') -and ($Type -ne 'warning')) { - Write-Host $Message - return - } - if(-not $PSBoundParameters.ContainsKey('Type')) { - $PSBoundParameters.Add('Type', 'error') - } - Write-LogIssue @PSBoundParameters - } - - function Write-PipelineSetVariable { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Name, - [string]$Value, - [switch]$Secret, - [switch]$AsOutput) - - if($ci) { - Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ - 'variable' = $Name - 'isSecret' = $Secret - 'isOutput' = 'true' - } -AsOutput:$AsOutput - } - } - - function Write-PipelinePrependPath { - [CmdletBinding()] - param( - [Parameter(Mandatory=$true)] - [string]$Path, - [switch]$AsOutput) - if($ci) { - Write-LoggingCommand -Area 'task' -Event 'prependpath' -Data $Path -AsOutput:$AsOutput - } - } - -<######################################## -# Private functions. -########################################> -function Format-LoggingCommandData { - [CmdletBinding()] - param([string]$Value, [switch]$Reverse) - - if (!$Value) { - return '' - } - - if (!$Reverse) { - foreach ($mapping in $script:loggingCommandEscapeMappings) { - $Value = $Value.Replace($mapping.Token, $mapping.Replacement) - } - } else { - for ($i = $script:loggingCommandEscapeMappings.Length - 1 ; $i -ge 0 ; $i--) { - $mapping = $script:loggingCommandEscapeMappings[$i] - $Value = $Value.Replace($mapping.Replacement, $mapping.Token) - } - } - - return $Value -} - -function Format-LoggingCommand { - [CmdletBinding()] - param( - [Parameter(Mandatory = $true)] - [string]$Area, - [Parameter(Mandatory = $true)] - [string]$Event, - [string]$Data, - [hashtable]$Properties) - - # Append the preamble. - [System.Text.StringBuilder]$sb = New-Object -TypeName System.Text.StringBuilder - $null = $sb.Append($script:loggingCommandPrefix).Append($Area).Append('.').Append($Event) - - # Append the properties. - if ($Properties) { - $first = $true - foreach ($key in $Properties.Keys) { - [string]$value = Format-LoggingCommandData $Properties[$key] - if ($value) { - if ($first) { - $null = $sb.Append(' ') - $first = $false - } else { - $null = $sb.Append(';') - } - - $null = $sb.Append("$key=$value") - } - } - } - - # Append the tail and output the value. - $Data = Format-LoggingCommandData $Data - $sb.Append(']').Append($Data).ToString() -} - -function Write-LoggingCommand { - [CmdletBinding(DefaultParameterSetName = 'Parameters')] - param( - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Area, - [Parameter(Mandatory = $true, ParameterSetName = 'Parameters')] - [string]$Event, - [Parameter(ParameterSetName = 'Parameters')] - [string]$Data, - [Parameter(ParameterSetName = 'Parameters')] - [hashtable]$Properties, - [Parameter(Mandatory = $true, ParameterSetName = 'Object')] - $Command, - [switch]$AsOutput) - - if ($PSCmdlet.ParameterSetName -eq 'Object') { - Write-LoggingCommand -Area $Command.Area -Event $Command.Event -Data $Command.Data -Properties $Command.Properties -AsOutput:$AsOutput - return - } - - $command = Format-LoggingCommand -Area $Area -Event $Event -Data $Data -Properties $Properties - if ($AsOutput) { - $command - } else { - Write-Host $command - } -} - -function Write-LogIssue { - [CmdletBinding()] - param( - [ValidateSet('warning', 'error')] - [Parameter(Mandatory = $true)] - [string]$Type, - [string]$Message, - [string]$ErrCode, - [string]$SourcePath, - [string]$LineNumber, - [string]$ColumnNumber, - [switch]$AsOutput) - - $command = Format-LoggingCommand -Area 'task' -Event 'logissue' -Data $Message -Properties @{ - 'type' = $Type - 'code' = $ErrCode - 'sourcepath' = $SourcePath - 'linenumber' = $LineNumber - 'columnnumber' = $ColumnNumber - } - if ($AsOutput) { - return $command - } - - if ($Type -eq 'error') { - $foregroundColor = $host.PrivateData.ErrorForegroundColor - $backgroundColor = $host.PrivateData.ErrorBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Red - $backgroundColor = [System.ConsoleColor]::Black - } - } else { - $foregroundColor = $host.PrivateData.WarningForegroundColor - $backgroundColor = $host.PrivateData.WarningBackgroundColor - if ($foregroundColor -isnot [System.ConsoleColor] -or $backgroundColor -isnot [System.ConsoleColor]) { - $foregroundColor = [System.ConsoleColor]::Yellow - $backgroundColor = [System.ConsoleColor]::Black - } - } - - Write-Host $command -ForegroundColor $foregroundColor -BackgroundColor $backgroundColor -} \ No newline at end of file diff --git a/eng/common/pipeline-logging-functions.sh b/eng/common/pipeline-logging-functions.sh deleted file mode 100644 index 6098f9a543..0000000000 --- a/eng/common/pipeline-logging-functions.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env bash - -function Write-PipelineTelemetryError { - local telemetry_category='' - local function_args=() - local message='' - while [[ $# -gt 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" - case "$opt" in - -category|-c) - telemetry_category=$2 - shift - ;; - -*) - function_args+=("$1 $2") - shift - ;; - *) - message=$* - ;; - esac - shift - done - - if [[ "$ci" != true ]]; then - echo "$message" >&2 - return - fi - - message="(NETCORE_ENGINEERING_TELEMETRY=$telemetry_category) $message" - function_args+=("$message") - - Write-PipelineTaskError $function_args -} - -function Write-PipelineTaskError { - if [[ "$ci" != true ]]; then - echo "$@" >&2 - return - fi - - message_type="error" - sourcepath='' - linenumber='' - columnnumber='' - error_code='' - - while [[ $# -gt 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" - case "$opt" in - -type|-t) - message_type=$2 - shift - ;; - -sourcepath|-s) - sourcepath=$2 - shift - ;; - -linenumber|-ln) - linenumber=$2 - shift - ;; - -columnnumber|-cn) - columnnumber=$2 - shift - ;; - -errcode|-e) - error_code=$2 - shift - ;; - *) - break - ;; - esac - - shift - done - - message="##vso[task.logissue" - - message="$message type=$message_type" - - if [ -n "$sourcepath" ]; then - message="$message;sourcepath=$sourcepath" - fi - - if [ -n "$linenumber" ]; then - message="$message;linenumber=$linenumber" - fi - - if [ -n "$columnnumber" ]; then - message="$message;columnnumber=$columnnumber" - fi - - if [ -n "$error_code" ]; then - message="$message;code=$error_code" - fi - - message="$message]$*" - echo "$message" -} - diff --git a/eng/common/post-build/dotnetsymbol-init.ps1 b/eng/common/post-build/dotnetsymbol-init.ps1 deleted file mode 100644 index e7659b98c8..0000000000 --- a/eng/common/post-build/dotnetsymbol-init.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -param ( - $dotnetsymbolVersion = $null -) - -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 - -. $PSScriptRoot\..\tools.ps1 - -$verbosity = "minimal" - -function Installdotnetsymbol ($dotnetsymbolVersion) { - $dotnetsymbolPackageName = "dotnet-symbol" - - $dotnetRoot = InitializeDotNetCli -install:$true - $dotnet = "$dotnetRoot\dotnet.exe" - $toolList = & "$dotnet" tool list --global - - if (($toolList -like "*$dotnetsymbolPackageName*") -and ($toolList -like "*$dotnetsymbolVersion*")) { - Write-Host "dotnet-symbol version $dotnetsymbolVersion is already installed." - } - else { - Write-Host "Installing dotnet-symbol version $dotnetsymbolVersion..." - Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." - & "$dotnet" tool install $dotnetsymbolPackageName --version $dotnetsymbolVersion --verbosity $verbosity --global - } -} - -Installdotnetsymbol $dotnetsymbolVersion diff --git a/eng/common/post-build/sourcelink-cli-init.ps1 b/eng/common/post-build/sourcelink-cli-init.ps1 deleted file mode 100644 index 9eaa25b3b5..0000000000 --- a/eng/common/post-build/sourcelink-cli-init.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -param ( - $sourcelinkCliVersion = $null -) - -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 - -. $PSScriptRoot\..\tools.ps1 - -$verbosity = "minimal" - -function InstallSourcelinkCli ($sourcelinkCliVersion) { - $sourcelinkCliPackageName = "sourcelink" - - $dotnetRoot = InitializeDotNetCli -install:$true - $dotnet = "$dotnetRoot\dotnet.exe" - $toolList = & "$dotnet" tool list --global - - if (($toolList -like "*$sourcelinkCliPackageName*") -and ($toolList -like "*$sourcelinkCliVersion*")) { - Write-Host "SourceLink CLI version $sourcelinkCliVersion is already installed." - } - else { - Write-Host "Installing SourceLink CLI version $sourcelinkCliVersion..." - Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." - & "$dotnet" tool install $sourcelinkCliPackageName --version $sourcelinkCliVersion --verbosity $verbosity --global - } -} - -InstallSourcelinkCli $sourcelinkCliVersion diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 deleted file mode 100644 index 8abd684e9e..0000000000 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ /dev/null @@ -1,224 +0,0 @@ -param( - [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where Symbols.NuGet packages to be checked are stored - [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation - [Parameter(Mandatory=$true)][string] $GHRepoName, # GitHub name of the repo including the Org. E.g., dotnet/arcade - [Parameter(Mandatory=$true)][string] $GHCommit, # GitHub commit SHA used to build the packages - [Parameter(Mandatory=$true)][string] $SourcelinkCliVersion # Version of SourceLink CLI to use -) - -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 - -. $PSScriptRoot\..\tools.ps1 - -# Cache/HashMap (File -> Exist flag) used to consult whether a file exist -# in the repository at a specific commit point. This is populated by inserting -# all files present in the repo at a specific commit point. -$global:RepoFiles = @{} - -$ValidatePackage = { - param( - [string] $PackagePath # Full path to a Symbols.NuGet package - ) - - . $using:PSScriptRoot\..\tools.ps1 - - # Ensure input file exist - if (!(Test-Path $PackagePath)) { - Write-PipelineTaskError "Input file does not exist: $PackagePath" - ExitWithExitCode 1 - } - - # Extensions for which we'll look for SourceLink information - # For now we'll only care about Portable & Embedded PDBs - $RelevantExtensions = @(".dll", ".exe", ".pdb") - - Write-Host -NoNewLine "Validating" ([System.IO.Path]::GetFileName($PackagePath)) "... " - - $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) - $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId - $FailedFiles = 0 - - Add-Type -AssemblyName System.IO.Compression.FileSystem - - [System.IO.Directory]::CreateDirectory($ExtractPath); - - try { - $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) - - $zip.Entries | - Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | - ForEach-Object { - $FileName = $_.FullName - $Extension = [System.IO.Path]::GetExtension($_.Name) - $FakeName = -Join((New-Guid), $Extension) - $TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName - - # We ignore resource DLLs - if ($FileName.EndsWith(".resources.dll")) { - return - } - - [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) - - $ValidateFile = { - param( - [string] $FullPath, # Full path to the module that has to be checked - [string] $RealPath, - [ref] $FailedFiles - ) - - $sourcelinkExe = "$env:USERPROFILE\.dotnet\tools" - $sourcelinkExe = Resolve-Path "$sourcelinkExe\sourcelink.exe" - $SourceLinkInfos = & $sourcelinkExe print-urls $FullPath | Out-String - - if ($LASTEXITCODE -eq 0 -and -not ([string]::IsNullOrEmpty($SourceLinkInfos))) { - $NumFailedLinks = 0 - - # We only care about Http addresses - $Matches = (Select-String '(http[s]?)(:\/\/)([^\s,]+)' -Input $SourceLinkInfos -AllMatches).Matches - - if ($Matches.Count -ne 0) { - $Matches.Value | - ForEach-Object { - $Link = $_ - $CommitUrl = "https://raw.githubusercontent.com/${using:GHRepoName}/${using:GHCommit}/" - - $FilePath = $Link.Replace($CommitUrl, "") - $Status = 200 - $Cache = $using:RepoFiles - - if ( !($Cache.ContainsKey($FilePath)) ) { - try { - $Uri = $Link -as [System.URI] - - # Only GitHub links are valid - if ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match "github" -or $Uri.Host -match "githubusercontent")) { - $Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode - } - else { - $Status = 0 - } - } - catch { - write-host $_ - $Status = 0 - } - } - - if ($Status -ne 200) { - if ($NumFailedLinks -eq 0) { - if ($FailedFiles.Value -eq 0) { - Write-Host - } - - Write-Host "`tFile $RealPath has broken links:" - } - - Write-Host "`t`tFailed to retrieve $Link" - - $NumFailedLinks++ - } - } - } - - if ($NumFailedLinks -ne 0) { - $FailedFiles.value++ - $global:LASTEXITCODE = 1 - } - } - } - - &$ValidateFile $TargetFile $FileName ([ref]$FailedFiles) - } - } - catch { - - } - finally { - $zip.Dispose() - } - - if ($FailedFiles -eq 0) { - Write-Host "Passed." - } - else { - Write-PipelineTaskError "$PackagePath has broken SourceLink links." - } -} - -function ValidateSourceLinkLinks { - if (!($GHRepoName -Match "^[^\s\/]+/[^\s\/]+$")) { - if (!($GHRepoName -Match "^[^\s-]+-[^\s]+$")) { - Write-PipelineTaskError "GHRepoName should be in the format / or -" - ExitWithExitCode 1 - } - else { - $GHRepoName = $GHRepoName -replace '^([^\s-]+)-([^\s]+)$', '$1/$2'; - } - } - - if (!($GHCommit -Match "^[0-9a-fA-F]{40}$")) { - Write-PipelineTaskError "GHCommit should be a 40 chars hexadecimal string" - ExitWithExitCode 1 - } - - $RepoTreeURL = -Join("http://api.github.com/repos/", $GHRepoName, "/git/trees/", $GHCommit, "?recursive=1") - $CodeExtensions = @(".cs", ".vb", ".fs", ".fsi", ".fsx", ".fsscript") - - try { - # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash - $Data = Invoke-WebRequest $RepoTreeURL -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty tree - - foreach ($file in $Data) { - $Extension = [System.IO.Path]::GetExtension($file.path) - - if ($CodeExtensions.Contains($Extension)) { - $RepoFiles[$file.path] = 1 - } - } - } - catch { - Write-PipelineTaskError "Problems downloading the list of files from the repo. Url used: $RepoTreeURL" - Write-Host $_ - ExitWithExitCode 1 - } - - if (Test-Path $ExtractPath) { - Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue - } - - # Process each NuGet package in parallel - $Jobs = @() - Get-ChildItem "$InputPath\*.symbols.nupkg" | - ForEach-Object { - $Jobs += Start-Job -ScriptBlock $ValidatePackage -ArgumentList $_.FullName - } - - foreach ($Job in $Jobs) { - Wait-Job -Id $Job.Id | Receive-Job - } -} - -function CheckExitCode ([string]$stage) { - $exitCode = $LASTEXITCODE - if ($exitCode -ne 0) { - Write-PipelineTaskError "Something failed while '$stage'. Check for errors above. Exiting now..." - ExitWithExitCode $exitCode - } -} - -try { - Write-Host "Installing SourceLink CLI..." - Get-Location - . $PSScriptRoot\sourcelink-cli-init.ps1 -sourcelinkCliVersion $SourcelinkCliVersion - CheckExitCode "Running sourcelink-cli-init" - - Measure-Command { ValidateSourceLinkLinks } -} -catch { - Write-Host $_ - Write-Host $_.Exception - Write-Host $_.ScriptStackTrace - ExitWithExitCode 1 -} diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1 deleted file mode 100644 index 69456854e0..0000000000 --- a/eng/common/post-build/symbols-validation.ps1 +++ /dev/null @@ -1,186 +0,0 @@ -param( - [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where NuGet packages to be checked are stored - [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation - [Parameter(Mandatory=$true)][string] $DotnetSymbolVersion # Version of dotnet symbol to use -) - -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 - -. $PSScriptRoot\..\tools.ps1 - -Add-Type -AssemblyName System.IO.Compression.FileSystem - -function FirstMatchingSymbolDescriptionOrDefault { - param( - [string] $FullPath, # Full path to the module that has to be checked - [string] $TargetServerParam, # Parameter to pass to `Symbol Tool` indicating the server to lookup for symbols - [string] $SymbolsPath - ) - - $FileName = [System.IO.Path]::GetFileName($FullPath) - $Extension = [System.IO.Path]::GetExtension($FullPath) - - # Those below are potential symbol files that the `dotnet symbol` might - # return. Which one will be returned depend on the type of file we are - # checking and which type of file was uploaded. - - # The file itself is returned - $SymbolPath = $SymbolsPath + "\" + $FileName - - # PDB file for the module - $PdbPath = $SymbolPath.Replace($Extension, ".pdb") - - # PDB file for R2R module (created by crossgen) - $NGenPdb = $SymbolPath.Replace($Extension, ".ni.pdb") - - # DBG file for a .so library - $SODbg = $SymbolPath.Replace($Extension, ".so.dbg") - - # DWARF file for a .dylib - $DylibDwarf = $SymbolPath.Replace($Extension, ".dylib.dwarf") - - $dotnetsymbolExe = "$env:USERPROFILE\.dotnet\tools" - $dotnetsymbolExe = Resolve-Path "$dotnetsymbolExe\dotnet-symbol.exe" - - & $dotnetsymbolExe --symbols --modules --windows-pdbs $TargetServerParam $FullPath -o $SymbolsPath | Out-Null - - if (Test-Path $PdbPath) { - return "PDB" - } - elseif (Test-Path $NGenPdb) { - return "NGen PDB" - } - elseif (Test-Path $SODbg) { - return "DBG for SO" - } - elseif (Test-Path $DylibDwarf) { - return "Dwarf for Dylib" - } - elseif (Test-Path $SymbolPath) { - return "Module" - } - else { - return $null - } -} - -function CountMissingSymbols { - param( - [string] $PackagePath # Path to a NuGet package - ) - - # Ensure input file exist - if (!(Test-Path $PackagePath)) { - Write-PipelineTaskError "Input file does not exist: $PackagePath" - ExitWithExitCode 1 - } - - # Extensions for which we'll look for symbols - $RelevantExtensions = @(".dll", ".exe", ".so", ".dylib") - - # How many files are missing symbol information - $MissingSymbols = 0 - - $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) - $PackageGuid = New-Guid - $ExtractPath = Join-Path -Path $ExtractPath -ChildPath $PackageGuid - $SymbolsPath = Join-Path -Path $ExtractPath -ChildPath "Symbols" - - [System.IO.Compression.ZipFile]::ExtractToDirectory($PackagePath, $ExtractPath) - - Get-ChildItem -Recurse $ExtractPath | - Where-Object {$RelevantExtensions -contains $_.Extension} | - ForEach-Object { - if ($_.FullName -Match "\\ref\\") { - Write-Host "`t Ignoring reference assembly file" $_.FullName - return - } - - $SymbolsOnMSDL = FirstMatchingSymbolDescriptionOrDefault $_.FullName "--microsoft-symbol-server" $SymbolsPath - $SymbolsOnSymWeb = FirstMatchingSymbolDescriptionOrDefault $_.FullName "--internal-server" $SymbolsPath - - Write-Host -NoNewLine "`t Checking file" $_.FullName "... " - - if ($SymbolsOnMSDL -ne $null -and $SymbolsOnSymWeb -ne $null) { - Write-Host "Symbols found on MSDL (" $SymbolsOnMSDL ") and SymWeb (" $SymbolsOnSymWeb ")" - } - else { - $MissingSymbols++ - - if ($SymbolsOnMSDL -eq $null -and $SymbolsOnSymWeb -eq $null) { - Write-Host "No symbols found on MSDL or SymWeb!" - } - else { - if ($SymbolsOnMSDL -eq $null) { - Write-Host "No symbols found on MSDL!" - } - else { - Write-Host "No symbols found on SymWeb!" - } - } - } - } - - Pop-Location - - return $MissingSymbols -} - -function CheckSymbolsAvailable { - if (Test-Path $ExtractPath) { - Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue - } - - Get-ChildItem "$InputPath\*.nupkg" | - ForEach-Object { - $FileName = $_.Name - - # These packages from Arcade-Services include some native libraries that - # our current symbol uploader can't handle. Below is a workaround until - # we get issue: https://github.com/dotnet/arcade/issues/2457 sorted. - if ($FileName -Match "Microsoft\.DotNet\.Darc\.") { - Write-Host "Ignoring Arcade-services file: $FileName" - Write-Host - return - } - elseif ($FileName -Match "Microsoft\.DotNet\.Maestro\.Tasks\.") { - Write-Host "Ignoring Arcade-services file: $FileName" - Write-Host - return - } - - Write-Host "Validating $FileName " - $Status = CountMissingSymbols "$InputPath\$FileName" - - if ($Status -ne 0) { - Write-PipelineTaskError "Missing symbols for $Status modules in the package $FileName" - ExitWithExitCode $exitCode - } - - Write-Host - } -} - -function CheckExitCode ([string]$stage) { - $exitCode = $LASTEXITCODE - if ($exitCode -ne 0) { - Write-PipelineTaskError "Something failed while '$stage'. Check for errors above. Exiting now..." - ExitWithExitCode $exitCode - } -} - -try { - Write-Host "Installing dotnet symbol ..." - Get-Location - . $PSScriptRoot\dotnetsymbol-init.ps1 -dotnetsymbolVersion $DotnetSymbolVersion - CheckExitCode "Running dotnetsymbol-init" - - CheckSymbolsAvailable -} -catch { - Write-Host $_ - Write-Host $_.Exception - Write-Host $_.ScriptStackTrace - ExitWithExitCode 1 -} diff --git a/eng/common/sdl/NuGet.config b/eng/common/sdl/NuGet.config deleted file mode 100644 index 0c5451c114..0000000000 --- a/eng/common/sdl/NuGet.config +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 deleted file mode 100644 index 74080f22d1..0000000000 --- a/eng/common/sdl/execute-all-sdl-tools.ps1 +++ /dev/null @@ -1,97 +0,0 @@ -Param( - [string] $GuardianPackageName, # Required: the name of guardian CLI pacakge (not needed if GuardianCliLocation is specified) - [string] $NugetPackageDirectory, # Required: directory where NuGet packages are installed (not needed if GuardianCliLocation is specified) - [string] $GuardianCliLocation, # Optional: Direct location of Guardian CLI executable if GuardianPackageName & NugetPackageDirectory are not specified - [string] $Repository, # Required: the name of the repository (e.g. dotnet/arcade) - [string] $BranchName="master", # Optional: name of branch or version of gdn settings; defaults to master - [string] $SourceDirectory, # Required: the directory where source files are located - [string] $ArtifactsDirectory, # Required: the directory where build artifacts are located - [string] $DncEngAccessToken, # Required: access token for dnceng; should be provided via KeyVault - [string[]] $SourceToolsList, # Optional: list of SDL tools to run on source code - [string[]] $ArtifactToolsList, # Optional: list of SDL tools to run on built artifacts - [bool] $TsaPublish=$False, # Optional: true will publish results to TSA; only set to true after onboarding to TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaBranchName=$env:BUILD_SOURCEBRANCHNAME, # Optional: required for TSA publish; defaults to $(Build.SourceBranchName); TSA is the automated framework used to upload test results as bugs. - [string] $TsaRepositoryName, # Optional: TSA repository name; will be generated automatically if not submitted; TSA is the automated framework used to upload test results as bugs. - [string] $BuildNumber=$env:BUILD_BUILDNUMBER, # Optional: required for TSA publish; defaults to $(Build.BuildNumber) - [bool] $UpdateBaseline=$False, # Optional: if true, will update the baseline in the repository; should only be run after fixing any issues which need to be fixed - [bool] $TsaOnboard=$False, # Optional: if true, will onboard the repository to TSA; should only be run once; TSA is the automated framework used to upload test results as bugs. - [string] $TsaInstanceUrl, # Optional: only needed if TsaOnboard or TsaPublish is true; the instance-url registered with TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaCodebaseName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the codebase registered with TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaProjectName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the project registered with TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaNotificationEmail, # Optional: only needed if TsaOnboard is true; the email(s) which will receive notifications of TSA bug filings (e.g. alias@microsoft.com); TSA is the automated framework used to upload test results as bugs. - [string] $TsaCodebaseAdmin, # Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs. - [string] $TsaBugAreaPath, # Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. - [string] $TsaIterationPath, # Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. - [string] $GuardianLoggerLevel="Standard" # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error -) - -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 -$LASTEXITCODE = 0 - -#Replace repo names to the format of org/repo -if (!($Repository.contains('/'))) { - $RepoName = $Repository -replace '(.*?)-(.*)', '$1/$2'; -} -else{ - $RepoName = $Repository; -} - -if ($GuardianPackageName) { - $guardianCliLocation = Join-Path $NugetPackageDirectory (Join-Path $GuardianPackageName (Join-Path "tools" "guardian.cmd")) -} else { - $guardianCliLocation = $GuardianCliLocation -} - -$ValidPath = Test-Path $guardianCliLocation - -if ($ValidPath -eq $False) -{ - Write-Host "Invalid Guardian CLI Location." - exit 1 -} - -& $(Join-Path $PSScriptRoot "init-sdl.ps1") -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $ArtifactsDirectory -DncEngAccessToken $DncEngAccessToken -GuardianLoggerLevel $GuardianLoggerLevel -$gdnFolder = Join-Path $ArtifactsDirectory ".gdn" - -if ($TsaOnboard) { - if ($TsaCodebaseName -and $TsaNotificationEmail -and $TsaCodebaseAdmin -and $TsaBugAreaPath) { - Write-Host "$guardianCliLocation tsa-onboard --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel" - & $guardianCliLocation tsa-onboard --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel - if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian tsa-onboard failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE - } - } else { - Write-Host "Could not onboard to TSA -- not all required values ($$TsaCodebaseName, $$TsaNotificationEmail, $$TsaCodebaseAdmin, $$TsaBugAreaPath) were specified." - exit 1 - } -} - -if ($ArtifactToolsList -and $ArtifactToolsList.Count -gt 0) { - & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $ArtifactsDirectory -GdnFolder $gdnFolder -ToolsList $ArtifactToolsList -DncEngAccessToken $DncEngAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel -} -if ($SourceToolsList -and $SourceToolsList.Count -gt 0) { - & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $SourceDirectory -GdnFolder $gdnFolder -ToolsList $SourceToolsList -DncEngAccessToken $DncEngAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel -} - -if ($UpdateBaseline) { - & (Join-Path $PSScriptRoot "push-gdn.ps1") -Repository $RepoName -BranchName $BranchName -GdnFolder $GdnFolder -DncEngAccessToken $DncEngAccessToken -PushReason "Update baseline" -} - -if ($TsaPublish) { - if ($TsaBranchName -and $BuildNumber) { - if (-not $TsaRepositoryName) { - $TsaRepositoryName = "$($Repository)-$($BranchName)" - } - Write-Host "$guardianCliLocation tsa-publish --all-tools --repository-name `"$TsaRepositoryName`" --branch-name `"$TsaBranchName`" --build-number `"$BuildNumber`" --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $SourceDirectory --logger-level $GuardianLoggerLevel" - & $guardianCliLocation tsa-publish --all-tools --repository-name "$TsaRepositoryName" --branch-name "$TsaBranchName" --build-number "$BuildNumber" --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel - if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian tsa-publish failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE - } - } else { - Write-Host "Could not publish to TSA -- not all required values ($$TsaBranchName, $$BuildNumber) were specified." - exit 1 - } -} diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1 deleted file mode 100644 index cbf5c36a8f..0000000000 --- a/eng/common/sdl/init-sdl.ps1 +++ /dev/null @@ -1,48 +0,0 @@ -Param( - [string] $GuardianCliLocation, - [string] $Repository, - [string] $BranchName="master", - [string] $WorkingDirectory, - [string] $DncEngAccessToken, - [string] $GuardianLoggerLevel="Standard" -) - -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 -$LASTEXITCODE = 0 - -# Construct basic auth from AzDO access token; construct URI to the repository's gdn folder stored in that repository; construct location of zip file -$encodedPat = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$DncEngAccessToken")) -$escapedRepository = [Uri]::EscapeDataString("/$Repository/$BranchName/.gdn") -$uri = "https://dev.azure.com/dnceng/internal/_apis/git/repositories/sdl-tool-cfg/Items?path=$escapedRepository&versionDescriptor[versionOptions]=0&`$format=zip&api-version=5.0-preview.1" -$zipFile = "$WorkingDirectory/gdn.zip" - -Add-Type -AssemblyName System.IO.Compression.FileSystem -$gdnFolder = (Join-Path $WorkingDirectory ".gdn") -Try -{ - # We try to download the zip; if the request fails (e.g. the file doesn't exist), we catch it and init guardian instead - Write-Host "Downloading gdn folder from internal config repostiory..." - Invoke-WebRequest -Headers @{ "Accept"="application/zip"; "Authorization"="Basic $encodedPat" } -Uri $uri -OutFile $zipFile - if (Test-Path $gdnFolder) { - # Remove the gdn folder if it exists (it shouldn't unless there's too much caching; this is just in case) - Remove-Item -Force -Recurse $gdnFolder - } - [System.IO.Compression.ZipFile]::ExtractToDirectory($zipFile, $WorkingDirectory) - Write-Host $gdnFolder -} Catch [System.Net.WebException] { - # if the folder does not exist, we'll do a guardian init and push it to the remote repository - Write-Host "Initializing Guardian..." - Write-Host "$GuardianCliLocation init --working-directory $WorkingDirectory --logger-level $GuardianLoggerLevel" - & $GuardianCliLocation init --working-directory $WorkingDirectory --logger-level $GuardianLoggerLevel - if ($LASTEXITCODE -ne 0) { - Write-Error "Guardian init failed with exit code $LASTEXITCODE." - } - # We create the mainbaseline so it can be edited later - Write-Host "$GuardianCliLocation baseline --working-directory $WorkingDirectory --name mainbaseline" - & $GuardianCliLocation baseline --working-directory $WorkingDirectory --name mainbaseline - if ($LASTEXITCODE -ne 0) { - Write-Error "Guardian baseline failed with exit code $LASTEXITCODE." - } - & $(Join-Path $PSScriptRoot "push-gdn.ps1") -Repository $Repository -BranchName $BranchName -GdnFolder $gdnFolder -DncEngAccessToken $DncEngAccessToken -PushReason "Initialize gdn folder" -} \ No newline at end of file diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config deleted file mode 100644 index b054737df1..0000000000 --- a/eng/common/sdl/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/eng/common/sdl/push-gdn.ps1 b/eng/common/sdl/push-gdn.ps1 deleted file mode 100644 index cacaf8e912..0000000000 --- a/eng/common/sdl/push-gdn.ps1 +++ /dev/null @@ -1,51 +0,0 @@ -Param( - [string] $Repository, - [string] $BranchName="master", - [string] $GdnFolder, - [string] $DncEngAccessToken, - [string] $PushReason -) - -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 -$LASTEXITCODE = 0 - -# We create the temp directory where we'll store the sdl-config repository -$sdlDir = Join-Path $env:TEMP "sdl" -if (Test-Path $sdlDir) { - Remove-Item -Force -Recurse $sdlDir -} - -Write-Host "git clone https://dnceng:`$DncEngAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir" -git clone https://dnceng:$DncEngAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir -if ($LASTEXITCODE -ne 0) { - Write-Error "Git clone failed with exit code $LASTEXITCODE." -} -# We copy the .gdn folder from our local run into the git repository so it can be committed -$sdlRepositoryFolder = Join-Path (Join-Path (Join-Path $sdlDir $Repository) $BranchName) ".gdn" -if (Get-Command Robocopy) { - Robocopy /S $GdnFolder $sdlRepositoryFolder -} else { - rsync -r $GdnFolder $sdlRepositoryFolder -} -# cd to the sdl-config directory so we can run git there -Push-Location $sdlDir -# git add . --> git commit --> git push -Write-Host "git add ." -git add . -if ($LASTEXITCODE -ne 0) { - Write-Error "Git add failed with exit code $LASTEXITCODE." -} -Write-Host "git -c user.email=`"dn-bot@microsoft.com`" -c user.name=`"Dotnet Bot`" commit -m `"$PushReason for $Repository/$BranchName`"" -git -c user.email="dn-bot@microsoft.com" -c user.name="Dotnet Bot" commit -m "$PushReason for $Repository/$BranchName" -if ($LASTEXITCODE -ne 0) { - Write-Error "Git commit failed with exit code $LASTEXITCODE." -} -Write-Host "git push" -git push -if ($LASTEXITCODE -ne 0) { - Write-Error "Git push failed with exit code $LASTEXITCODE." -} - -# Return to the original directory -Pop-Location \ No newline at end of file diff --git a/eng/common/sdl/run-sdl.ps1 b/eng/common/sdl/run-sdl.ps1 deleted file mode 100644 index e6a86d03a2..0000000000 --- a/eng/common/sdl/run-sdl.ps1 +++ /dev/null @@ -1,65 +0,0 @@ -Param( - [string] $GuardianCliLocation, - [string] $WorkingDirectory, - [string] $TargetDirectory, - [string] $GdnFolder, - [string[]] $ToolsList, - [string] $UpdateBaseline, - [string] $GuardianLoggerLevel="Standard" -) - -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 -$LASTEXITCODE = 0 - -# We store config files in the r directory of .gdn -Write-Host $ToolsList -$gdnConfigPath = Join-Path $GdnFolder "r" -$ValidPath = Test-Path $GuardianCliLocation - -if ($ValidPath -eq $False) -{ - Write-Host "Invalid Guardian CLI Location." - exit 1 -} - -foreach ($tool in $ToolsList) { - $gdnConfigFile = Join-Path $gdnConfigPath "$tool-configure.gdnconfig" - $config = $False - Write-Host $tool - # We have to manually configure tools that run on source to look at the source directory only - if ($tool -eq "credscan") { - Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory : $TargetDirectory `"" - & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory : $TargetDirectory " - if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE - } - $config = $True - } - if ($tool -eq "policheck") { - Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target : $TargetDirectory `"" - & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target : $TargetDirectory " - if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE - } - $config = $True - } - - Write-Host "$GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel --config $gdnConfigFile $config" - if ($config) { - & $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel --config $gdnConfigFile - if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian run for $tool using $gdnConfigFile failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE - } - } else { - & $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel - if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian run for $tool failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE - } - } -} - diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 619ec68aa4..620bd3c62e 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -57,33 +57,8 @@ jobs: /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:Configuration=$(_BuildConfig) - /v:detailed condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - - task: powershell@2 - displayName: Create BARBuildId Artifact - inputs: - targetType: inline - script: | - Add-Content -Path "$(Build.StagingDirectory)/BARBuildId.txt" -Value $(BARBuildId) - - task: powershell@2 - displayName: Create Channels Artifact - inputs: - targetType: inline - script: | - Add-Content -Path "$(Build.StagingDirectory)/Channels.txt" -Value "$(DefaultChannels)" - - task: PublishBuildArtifacts@1 - displayName: Publish BAR BuildId to VSTS - inputs: - PathtoPublish: '$(Build.StagingDirectory)/BARBuildId.txt' - PublishLocation: Container - ArtifactName: ReleaseConfigs - - task: PublishBuildArtifacts@1 - displayName: Publish Channels to VSTS - inputs: - PathtoPublish: '$(Build.StagingDirectory)/Channels.txt' - PublishLocation: Container - ArtifactName: ReleaseConfigs - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: - task: PublishBuildArtifacts@1 displayName: Publish Logs to VSTS diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml deleted file mode 100644 index b332cb5173..0000000000 --- a/eng/common/templates/post-build/channels/public-dev-release.yml +++ /dev/null @@ -1,146 +0,0 @@ -parameters: - enableSymbolValidation: true - -stages: -- stage: Publish - dependsOn: validate - variables: - - template: ../common-variables.yml - displayName: Developer Channel - jobs: - - template: ../setup-maestro-vars.yml - - - job: - displayName: Symbol Publishing - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicDevRelease_30_Channel_Id) - variables: - - group: DotNet-Symbol-Server-Pats - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download PDB Artifacts - inputs: - buildType: current - artifactName: PDBArtifacts - continueOnError: true - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: current - artifactName: BlobArtifacts - - - task: PowerShell@2 - displayName: Publish - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) - /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:Configuration=Release - - - job: - displayName: Publish to Static Feed - dependsOn: setupMaestroVars - variables: - - group: DotNet-Blob-Feed - - group: Publish-Build-Assets - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicDevRelease_30_Channel_Id) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: current - artifactName: BlobArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Asset Manifests - inputs: - buildType: current - artifactName: AssetManifests - - - task: PowerShell@2 - displayName: Publish - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishToPackageFeed -restore -msbuildEngine dotnet - /p:AccountKeyToStaticFeed='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' - /p:BuildAssetRegistryToken='$(MaestroAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:ArtifactsCategory='$(_DotNetArtifactsCategory)' - /p:OverrideAssetsWithSameName=true - /p:PassIfExistingItemIdentical=true - /p:Configuration=Release - - -- stage: PublishValidation - displayName: Publish Validation - variables: - - template: ../common-variables.yml - jobs: - - template: ../setup-maestro-vars.yml - - - ${{ if eq(parameters.enableSymbolValidation, 'true') }}: - - job: - displayName: Symbol Availability - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicDevRelease_30_Channel_Id) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: PowerShell@2 - displayName: Check Symbol Availability - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - - job: - displayName: Gather Drop - dependsOn: setupMaestroVars - variables: - BARBuildId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicDevRelease_30_Channel_Id) - pool: - vmImage: 'windows-2019' - steps: - - task: PowerShell@2 - displayName: Setup Darc CLI - inputs: - targetType: filePath - filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1' - - - task: PowerShell@2 - displayName: Run Darc gather-drop - inputs: - targetType: inline - script: | - darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) - continueOnError: true - - - template: ../promote-build.yml - parameters: - ChannelId: ${{ variables.PublicDevRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml deleted file mode 100644 index 0b9719da82..0000000000 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ /dev/null @@ -1,92 +0,0 @@ -stages: -- stage: PVR_Publish - dependsOn: validate - variables: - - template: ../common-variables.yml - displayName: Validation Channel - jobs: - - template: ../setup-maestro-vars.yml - - - job: - displayName: Publish to Static Feed - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicValidationRelease_30_Channel_Id) - variables: - - group: DotNet-Blob-Feed - - group: Publish-Build-Assets - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: current - artifactName: BlobArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Asset Manifests - inputs: - buildType: current - artifactName: AssetManifests - - - task: PowerShell@2 - displayName: Publish - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishToPackageFeed -restore -msbuildEngine dotnet - /p:AccountKeyToStaticFeed='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' - /p:BuildAssetRegistryToken='$(MaestroAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:ArtifactsCategory='$(_DotNetArtifactsCategory)' - /p:OverrideAssetsWithSameName=true - /p:PassIfExistingItemIdentical=true - /p:Configuration=Release - - -- stage: PVR_PublishValidation - displayName: Publish Validation - variables: - - template: ../common-variables.yml - jobs: - - template: ../setup-maestro-vars.yml - - - job: - displayName: Gather Drop - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicValidationRelease_30_Channel_Id) - variables: - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - - group: Publish-Build-Assets - pool: - vmImage: 'windows-2019' - steps: - - task: PowerShell@2 - displayName: Setup Darc CLI - inputs: - targetType: filePath - filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1' - - - task: PowerShell@2 - displayName: Run Darc gather-drop - inputs: - targetType: inline - script: | - darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com --password $(MaestroAccessToken) - continueOnError: true - - - template: ../promote-build.yml - parameters: - ChannelId: ${{ variables.PublicValidationRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml deleted file mode 100644 index 97b48d97fe..0000000000 --- a/eng/common/templates/post-build/common-variables.yml +++ /dev/null @@ -1,9 +0,0 @@ -variables: - # .NET Core 3 Dev - PublicDevRelease_30_Channel_Id: 3 - - # .NET Tools - Validation - PublicValidationRelease_30_Channel_Id: 9 - - SourceLinkCLIVersion: 3.0.0 - SymbolToolVersion: 1.0.1 diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml deleted file mode 100644 index 6b74475a6f..0000000000 --- a/eng/common/templates/post-build/post-build.yml +++ /dev/null @@ -1,59 +0,0 @@ -parameters: - enableSourceLinkValidation: true - enableSigningValidation: true - enableSymbolValidation: true - -stages: -- stage: validate - dependsOn: build - displayName: Validate - jobs: - - ${{ if eq(parameters.enableSigningValidation, 'true') }}: - - job: - displayName: Signing Validation - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task SigningValidation -restore -msbuildEngine dotnet - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' - /p:Configuration=Release - - - ${{ if eq(parameters.enableSourceLinkValidation, 'true') }}: - - job: - displayName: SourceLink Validation - variables: - - template: common-variables.yml - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: current - artifactName: BlobArtifacts - - - task: PowerShell@2 - displayName: Validate - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/sourcelink-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -ExtractPath $(Agent.BuildDirectory)/Extract/ - -GHRepoName $(Build.Repository.Name) - -GHCommit $(Build.SourceVersion) - -SourcelinkCliVersion $(SourceLinkCLIVersion) - -- template: \eng\common\templates\post-build\channels\public-dev-release.yml - parameters: - enableSymbolValidation: ${{ parameters.enableSymbolValidation }} - -- template: \eng\common\templates\post-build\channels\public-validation-release.yml diff --git a/eng/common/templates/post-build/promote-build.yml b/eng/common/templates/post-build/promote-build.yml deleted file mode 100644 index d00317003b..0000000000 --- a/eng/common/templates/post-build/promote-build.yml +++ /dev/null @@ -1,28 +0,0 @@ -parameters: - ChannelId: 0 - -jobs: -- job: - displayName: Promote Build - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], ${{ parameters.ChannelId }}) - variables: - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - - name: ChannelId - value: ${{ parameters.ChannelId }} - - group: Publish-Build-Assets - pool: - vmImage: 'windows-2019' - steps: - - task: PowerShell@2 - displayName: Add Build to Channel - inputs: - targetType: inline - script: | - $headers = @{ - "Accept" = "application/json" - "Authorization" = "Bearer $(MaestroAccessToken)" - } - Invoke-RestMethod -Method Post -Headers $headers -Uri https://maestro-prod.westus2.cloudapp.azure.com/api/channels/$(ChannelId)/builds/$(BARBuildId)?api-version=2019-01-16 - enabled: false diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml deleted file mode 100644 index b40e0260a3..0000000000 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ /dev/null @@ -1,26 +0,0 @@ -jobs: -- job: setupMaestroVars - displayName: Setup Maestro Vars - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Release Configs - inputs: - buildType: current - artifactName: ReleaseConfigs - - - task: PowerShell@2 - name: setReleaseVars - displayName: Set Release Configs Vars - inputs: - targetType: inline - script: | - . "$(Build.SourcesDirectory)/eng/common/tools.ps1" - - $BarId = Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/BARBuildId.txt" - Write-PipelineSetVariable -Name 'BARBuildId' -Value $BarId - - $Channels = "" - Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/Channels.txt" | ForEach-Object { $Channels += "$_ ," } - Write-PipelineSetVariable -Name 'InitialChannels' -Value "$Channels" diff --git a/eng/common/templates/steps/send-to-helix.yml b/eng/common/templates/steps/send-to-helix.yml index 05df886f55..d1ce577db5 100644 --- a/eng/common/templates/steps/send-to-helix.yml +++ b/eng/common/templates/steps/send-to-helix.yml @@ -5,7 +5,6 @@ parameters: HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number HelixTargetQueues: '' # required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group - HelixConfiguration: '' # optional -- additional property attached to a job HelixPreCommands: '' # optional -- commands to run before Helix work item execution HelixPostCommands: '' # optional -- commands to run after Helix work item execution WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects @@ -36,7 +35,6 @@ steps: HelixSource: ${{ parameters.HelixSource }} HelixType: ${{ parameters.HelixType }} HelixBuild: ${{ parameters.HelixBuild }} - HelixConfiguration: ${{ parameters.HelixConfiguration }} HelixTargetQueues: ${{ parameters.HelixTargetQueues }} HelixAccessToken: ${{ parameters.HelixAccessToken }} HelixPreCommands: ${{ parameters.HelixPreCommands }} @@ -66,7 +64,6 @@ steps: HelixSource: ${{ parameters.HelixSource }} HelixType: ${{ parameters.HelixType }} HelixBuild: ${{ parameters.HelixBuild }} - HelixConfiguration: ${{ parameters.HelixConfiguration }} HelixTargetQueues: ${{ parameters.HelixTargetQueues }} HelixAccessToken: ${{ parameters.HelixAccessToken }} HelixPreCommands: ${{ parameters.HelixPreCommands }} diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 60741f0390..9ca177b82a 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -35,7 +35,7 @@ # Specifies which msbuild engine to use for build: 'vs', 'dotnet' or unspecified (determined based on presence of tools.vs in global.json). [string]$msbuildEngine = if (Test-Path variable:msbuildEngine) { $msbuildEngine } else { $null } -# True to attempt using .NET Core already that meets requirements specified in global.json +# True to attempt using .NET Core already that meets requirements specified in global.json # installed on the machine instead of downloading one. [bool]$useInstalledDotNetCli = if (Test-Path variable:useInstalledDotNetCli) { $useInstalledDotNetCli } else { $true } @@ -76,7 +76,7 @@ function Exec-Process([string]$command, [string]$commandArgs) { $finished = $false try { - while (-not $process.WaitForExit(100)) { + while (-not $process.WaitForExit(100)) { # Non-blocking loop done to allow ctr-c interrupts } @@ -134,7 +134,7 @@ function InitializeDotNetCli([bool]$install) { if ($install) { InstallDotNetSdk $dotnetRoot $dotnetSdkVersion } else { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Unable to find dotnet with SDK version '$dotnetSdkVersion'" + Write-Host "Unable to find dotnet with SDK version '$dotnetSdkVersion'" -ForegroundColor Red ExitWithExitCode 1 } } @@ -147,10 +147,12 @@ function InitializeDotNetCli([bool]$install) { # It also ensures that VS msbuild will use the downloaded sdk targets. $env:PATH = "$dotnetRoot;$env:PATH" - # Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build - Write-PipelinePrependPath -Path $dotnetRoot - Write-PipelineSetVariable -Name 'DOTNET_MULTILEVEL_LOOKUP' -Value '0' - Write-PipelineSetVariable -Name 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' -Value '1' + if ($ci) { + # Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build + Write-Host "##vso[task.prependpath]$dotnetRoot" + Write-Host "##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]0" + Write-Host "##vso[task.setvariable variable=DOTNET_SKIP_FIRST_TIME_EXPERIENCE]1" + } return $global:_DotNetInstallDir = $dotnetRoot } @@ -182,13 +184,13 @@ function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $archit & $installScript @installParameters if ($lastExitCode -ne 0) { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Failed to install dotnet cli (exit code '$lastExitCode')." + Write-Host "Failed to install dotnet cli (exit code '$lastExitCode')." -ForegroundColor Red ExitWithExitCode $lastExitCode } } # -# Locates Visual Studio MSBuild installation. +# Locates Visual Studio MSBuild installation. # The preference order for MSBuild to use is as follows: # # 1. MSBuild from an active VS command prompt @@ -205,17 +207,13 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } $vsMinVersionStr = if ($vsRequirements.version) { $vsRequirements.version } else { "15.9" } - $vsMinVersion = [Version]::new($vsMinVersionStr) + $vsMinVersion = [Version]::new($vsMinVersionStr) # Try msbuild command available in the environment. if ($env:VSINSTALLDIR -ne $null) { $msbuildCmd = Get-Command "msbuild.exe" -ErrorAction SilentlyContinue if ($msbuildCmd -ne $null) { - # Workaround for https://github.com/dotnet/roslyn/issues/35793 - # Due to this issue $msbuildCmd.Version returns 0.0.0.0 for msbuild.exe 16.2+ - $msbuildVersion = [Version]::new((Get-Item $msbuildCmd.Path).VersionInfo.ProductVersion.Split(@('-', '+'))[0]) - - if ($msbuildVersion -ge $vsMinVersion) { + if ($msbuildCmd.Version -ge $vsMinVersion) { return $global:_MSBuildExe = $msbuildCmd.Path } @@ -254,7 +252,7 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements = function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [string] $vsMajorVersion) { $env:VSINSTALLDIR = $vsInstallDir Set-Item "env:VS$($vsMajorVersion)0COMNTOOLS" (Join-Path $vsInstallDir "Common7\Tools\") - + $vsSdkInstallDir = Join-Path $vsInstallDir "VSSDK\" if (Test-Path $vsSdkInstallDir) { Set-Item "env:VSSDK$($vsMajorVersion)0Install" $vsSdkInstallDir @@ -289,13 +287,13 @@ function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { # Locates Visual Studio instance that meets the minimal requirements specified by tools.vs object in global.json. # # The following properties of tools.vs are recognized: -# "version": "{major}.{minor}" +# "version": "{major}.{minor}" # Two part minimal VS version, e.g. "15.9", "16.0", etc. -# "components": ["componentId1", "componentId2", ...] +# "components": ["componentId1", "componentId2", ...] # Array of ids of workload components that must be available in the VS instance. # See e.g. https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-enterprise?view=vs-2017 # -# Returns JSON describing the located VS instance (same format as returned by vswhere), +# Returns JSON describing the located VS instance (same format as returned by vswhere), # or $null if no instance meeting the requirements is found on the machine. # function LocateVisualStudio([object]$vsRequirements = $null){ @@ -315,8 +313,8 @@ function LocateVisualStudio([object]$vsRequirements = $null){ } if (!$vsRequirements) { $vsRequirements = $GlobalJson.tools.vs } - $args = @("-latest", "-prerelease", "-format", "json", "-requires", "Microsoft.Component.MSBuild", "-products", "*") - + $args = @("-latest", "-prerelease", "-format", "json", "-requires", "Microsoft.Component.MSBuild") + if (Get-Member -InputObject $vsRequirements -Name "version") { $args += "-version" $args += $vsRequirements.version @@ -326,7 +324,7 @@ function LocateVisualStudio([object]$vsRequirements = $null){ foreach ($component in $vsRequirements.components) { $args += "-requires" $args += $component - } + } } $vsInfo =& $vsWhereExe $args | ConvertFrom-Json @@ -356,7 +354,7 @@ function InitializeBuildTool() { if ($msbuildEngine -eq "dotnet") { if (!$dotnetRoot) { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "/global.json must specify 'tools.dotnet'." + Write-Host "/global.json must specify 'tools.dotnet'." -ForegroundColor Red ExitWithExitCode 1 } @@ -365,13 +363,13 @@ function InitializeBuildTool() { try { $msbuildPath = InitializeVisualStudioMSBuild -install:$restore } catch { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message $_ + Write-Host $_ -ForegroundColor Red ExitWithExitCode 1 } $buildTool = @{ Path = $msbuildPath; Command = ""; Tool = "vs"; Framework = "net472" } } else { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Unexpected value of -msbuildEngine: '$msbuildEngine'." + Write-Host "Unexpected value of -msbuildEngine: '$msbuildEngine'." -ForegroundColor Red ExitWithExitCode 1 } @@ -383,12 +381,12 @@ function GetDefaultMSBuildEngine() { if (Get-Member -InputObject $GlobalJson.tools -Name "vs") { return "vs" } - + if (Get-Member -InputObject $GlobalJson.tools -Name "dotnet") { return "dotnet" } - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." + Write-Host "-msbuildEngine must be specified, or /global.json must specify 'tools.dotnet' or 'tools.vs'." -ForegroundColor Red ExitWithExitCode 1 } @@ -413,13 +411,11 @@ function GetSdkTaskProject([string]$taskName) { function InitializeNativeTools() { if (Get-Member -InputObject $GlobalJson -Name "native-tools") { - $nativeArgs= @{} + $nativeArgs="" if ($ci) { - $nativeArgs = @{ - InstallDirectory = "$ToolsDir" - } + $nativeArgs = "-InstallDirectory $ToolsDir" } - & "$PSScriptRoot/init-tools-native.ps1" @nativeArgs + Invoke-Expression "& `"$PSScriptRoot/init-tools-native.ps1`" $nativeArgs" } } @@ -441,7 +437,7 @@ function InitializeToolset() { } if (-not $restore) { - Write-PipelineTelemetryError -Category "InitializeToolset" -Message "Toolset version $toolsetVersion has not been restored." + Write-Host "Toolset version $toolsetVersion has not been restored." -ForegroundColor Red ExitWithExitCode 1 } @@ -501,13 +497,11 @@ function MSBuild() { function MSBuild-Core() { if ($ci) { if (!$binaryLog) { - Write-PipelineTaskError -Message "Binary log must be enabled in CI build." - ExitWithExitCode 1 + throw "Binary log must be enabled in CI build." } if ($nodeReuse) { - Write-PipelineTaskError -Message "Node reuse must be disabled in CI build." - ExitWithExitCode 1 + throw "Node reuse must be disabled in CI build." } } @@ -515,8 +509,8 @@ function MSBuild-Core() { $cmdArgs = "$($buildTool.Command) /m /nologo /clp:Summary /v:$verbosity /nr:$nodeReuse /p:ContinuousIntegrationBuild=$ci" - if ($warnAsError) { - $cmdArgs += " /warnaserror /p:TreatWarningsAsErrors=true" + if ($warnAsError) { + $cmdArgs += " /warnaserror /p:TreatWarningsAsErrors=true" } foreach ($arg in $args) { @@ -524,29 +518,29 @@ function MSBuild-Core() { $cmdArgs += " `"$arg`"" } } - + $exitCode = Exec-Process $buildTool.Path $cmdArgs if ($exitCode -ne 0) { - Write-PipelineTaskError -Message "Build failed." + Write-Host "Build failed." -ForegroundColor Red $buildLog = GetMSBuildBinaryLogCommandLineArgument $args - if ($buildLog -ne $null) { - Write-Host "See log: $buildLog" -ForegroundColor DarkGray + if ($buildLog -ne $null) { + Write-Host "See log: $buildLog" -ForegroundColor DarkGray } ExitWithExitCode $exitCode } } -function GetMSBuildBinaryLogCommandLineArgument($arguments) { +function GetMSBuildBinaryLogCommandLineArgument($arguments) { foreach ($argument in $arguments) { if ($argument -ne $null) { $arg = $argument.Trim() if ($arg.StartsWith("/bl:", "OrdinalIgnoreCase")) { return $arg.Substring("/bl:".Length) - } - + } + if ($arg.StartsWith("/binaryLogger:", "OrdinalIgnoreCase")) { return $arg.Substring("/binaryLogger:".Length) } @@ -556,8 +550,6 @@ function GetMSBuildBinaryLogCommandLineArgument($arguments) { return $null } -. $PSScriptRoot\pipeline-logging-functions.ps1 - $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") $EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..") $ArtifactsDir = Join-Path $RepoRoot "artifacts" @@ -573,8 +565,11 @@ Create-Directory $ToolsetDir Create-Directory $TempDir Create-Directory $LogDir -Write-PipelineSetVariable -Name 'Artifacts' -Value $ArtifactsDir -Write-PipelineSetVariable -Name 'Artifacts.Toolset' -Value $ToolsetDir -Write-PipelineSetVariable -Name 'Artifacts.Log' -Value $LogDir -Write-PipelineSetVariable -Name 'TEMP' -Value $TempDir -Write-PipelineSetVariable -Name 'TMP' -Value $TempDir +if ($ci) { + Write-Host "##vso[task.setvariable variable=Artifacts]$ArtifactsDir" + Write-Host "##vso[task.setvariable variable=Artifacts.Toolset]$ToolsetDir" + Write-Host "##vso[task.setvariable variable=Artifacts.Log]$LogDir" + + $env:TEMP = $TempDir + $env:TMP = $TempDir +} diff --git a/eng/common/tools.sh b/eng/common/tools.sh index f39aab57b9..df3eb8bce0 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -1,20 +1,8 @@ -#!/usr/bin/env bash - # Initialize variables if they aren't already defined. # CI mode - set to true on CI server for PR validation build or official build. ci=${ci:-false} -# Set to true to use the pipelines logger which will enable Azure logging output. -# https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md -# This flag is meant as a temporary opt-opt for the feature while validate it across -# our consumers. It will be deleted in the future. -if [[ "$ci" == true ]]; then - pipelines_log=${pipelines_log:-true} -else - pipelines_log=${pipelines_log:-false} -fi - # Build configuration. Common values include 'Debug' and 'Release', but the repository may use other names. configuration=${configuration:-'Debug'} @@ -77,7 +65,7 @@ function ReadGlobalVersion { local pattern="\"$key\" *: *\"(.*)\"" if [[ ! $line =~ $pattern ]]; then - Write-PipelineTelemetryError -category 'InitializeTools' "Error: Cannot find \"$key\" in $global_json_file" + echo "Error: Cannot find \"$key\" in $global_json_file" >&2 ExitWithExitCode 1 fi @@ -138,7 +126,7 @@ function InitializeDotNetCli { if [[ "$install" == true ]]; then InstallDotNetSdk "$dotnet_root" "$dotnet_sdk_version" else - Write-PipelineTelemetryError -category 'InitializeToolset' "Unable to find dotnet with SDK version '$dotnet_sdk_version'" + echo "Unable to find dotnet with SDK version '$dotnet_sdk_version'" >&2 ExitWithExitCode 1 fi fi @@ -149,7 +137,7 @@ function InitializeDotNetCli { export PATH="$dotnet_root:$PATH" if [[ $ci == true ]]; then - # Make Sure that our bootstrapped dotnet cli is available in future steps of the Azure Pipelines build + # Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build echo "##vso[task.prependpath]$dotnet_root" echo "##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]0" echo "##vso[task.setvariable variable=DOTNET_SKIP_FIRST_TIME_EXPERIENCE]1" @@ -191,7 +179,7 @@ function InstallDotNet { fi bash "$install_script" --version $version --install-dir "$root" $archArg $runtimeArg $skipNonVersionedFilesArg || { local exit_code=$? - Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to install dotnet SDK (exit code '$exit_code')." + echo "Failed to install dotnet SDK (exit code '$exit_code')." >&2 ExitWithExitCode $exit_code } } @@ -228,7 +216,6 @@ function InitializeBuildTool { # return values _InitializeBuildTool="$_InitializeDotNetCli/dotnet" _InitializeBuildToolCommand="msbuild" - _InitializeBuildToolFramework="netcoreapp2.1" } function GetNuGetPackageCachePath { @@ -277,7 +264,7 @@ function InitializeToolset { fi if [[ "$restore" != true ]]; then - Write-PipelineTelemetryError -category 'InitializeToolset' "Toolset version $toolset_version has not been restored." + echo "Toolset version $toolsetVersion has not been restored." >&2 ExitWithExitCode 2 fi @@ -289,12 +276,12 @@ function InitializeToolset { fi echo '' > "$proj" - MSBuild-Core "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file" + MSBuild "$proj" $bl /t:__WriteToolsetLocation /clp:ErrorsOnly\;NoSummary /p:__ToolsetLocationOutputFile="$toolset_location_file" local toolset_build_proj=`cat "$toolset_location_file"` if [[ ! -a "$toolset_build_proj" ]]; then - Write-PipelineTelemetryError -category 'InitializeToolset' "Invalid toolset path: $toolset_build_proj" + echo "Invalid toolset path: $toolset_build_proj" >&2 ExitWithExitCode 3 fi @@ -317,27 +304,14 @@ function StopProcesses { } function MSBuild { - local args=$@ - if [[ "$pipelines_log" == true ]]; then - InitializeBuildTool - InitializeToolset - local toolset_dir="${_InitializeToolset%/*}" - local logger_path="$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" - args=( "${args[@]}" "-logger:$logger_path" ) - fi - - MSBuild-Core ${args[@]} -} - -function MSBuild-Core { if [[ "$ci" == true ]]; then if [[ "$binary_log" != true ]]; then - Write-PipelineTaskError "Binary log must be enabled in CI build." + echo "Binary log must be enabled in CI build." >&2 ExitWithExitCode 1 fi if [[ "$node_reuse" == true ]]; then - Write-PipelineTaskError "Node reuse must be disabled in CI build." + echo "Node reuse must be disabled in CI build." >&2 ExitWithExitCode 1 fi fi @@ -351,13 +325,11 @@ function MSBuild-Core { "$_InitializeBuildTool" "$_InitializeBuildToolCommand" /m /nologo /clp:Summary /v:$verbosity /nr:$node_reuse $warnaserror_switch /p:TreatWarningsAsErrors=$warn_as_error /p:ContinuousIntegrationBuild=$ci "$@" || { local exit_code=$? - Write-PipelineTaskError "Build failed (exit code '$exit_code')." + echo "Build failed (exit code '$exit_code')." >&2 ExitWithExitCode $exit_code } } -. "$scriptroot/pipeline-logging-functions.sh" - ResolvePath "${BASH_SOURCE[0]}" _script_dir=`dirname "$_ResolvePath"` @@ -390,4 +362,4 @@ mkdir -p "$log_dir" if [[ $ci == true ]]; then export TEMP="$temp_dir" export TMP="$temp_dir" -fi +fi \ No newline at end of file From 06cde973744da65d379e876b0ecc81c5055165ba Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Tue, 18 Jun 2019 11:50:01 +0100 Subject: [PATCH 106/286] issues --- .../FSharp.Compiler.Private.fsproj | 8 ++++---- src/fsharp/service/FSharpCheckerResults.fs | 13 +++++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index d54b08a99f..fc8202ba44 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -271,7 +271,10 @@ ReferenceResolution\ReferenceResolver.fs - + + Service/reshapedmsbuild.fs + + ReferenceResolution/LegacyMSBuildReferenceResolver.fsi @@ -635,9 +638,6 @@ Service/ServiceXmlDocParser.fs - - Service/reshapedmsbuild.fs - Service/ExternalSymbol.fsi diff --git a/src/fsharp/service/FSharpCheckerResults.fs b/src/fsharp/service/FSharpCheckerResults.fs index d8cfe81430..278467ca06 100644 --- a/src/fsharp/service/FSharpCheckerResults.fs +++ b/src/fsharp/service/FSharpCheckerResults.fs @@ -21,6 +21,7 @@ open FSharp.Compiler.Ast open FSharp.Compiler.CompileOps open FSharp.Compiler.CompileOptions open FSharp.Compiler.ErrorLogger +open FSharp.Compiler.Features open FSharp.Compiler.Lib open FSharp.Compiler.PrettyNaming open FSharp.Compiler.Parser @@ -1525,8 +1526,12 @@ module internal ParseAndCheckFile = let tokenizer = LexFilter.LexFilter(lightSyntaxStatus, options.CompilingFsLib, Lexer.token lexargs true, lexbuf) tokenizer.Lexer - let createLexbuf sourceText = - UnicodeLexing.SourceTextAsLexbuf(sourceText) + // Public callers are unable to answer LanguageVersion feature support questions. + // External Tools including the VS IDE will enable the default LanguageVersion + let isFeatureSupported (_featureId:LanguageFeature) = true + + let createLexbuf sourceText isFeatureSupported = + UnicodeLexing.SourceTextAsLexbuf(isFeatureSupported, sourceText) let matchBraces(sourceText: ISourceText, fileName, options: FSharpParsingOptions, userOpName: string, suggestNamesForErrors: bool) = let delayedLogger = CapturingErrorLogger("matchBraces") @@ -1541,7 +1546,7 @@ module internal ParseAndCheckFile = use _unwindBP = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse let matchingBraces = new ResizeArray<_>() - Lexhelp.usingLexbufForParsing(createLexbuf sourceText, fileName) (fun lexbuf -> + Lexhelp.usingLexbufForParsing(createLexbuf sourceText isFeatureSupported, fileName) (fun lexbuf -> let errHandler = ErrorHandler(false, fileName, options.ErrorSeverityOptions, sourceText, suggestNamesForErrors) let lexfun = createLexerFunction fileName options lexbuf errHandler let parenTokensBalance t1 t2 = @@ -1577,7 +1582,7 @@ module internal ParseAndCheckFile = use unwindBP = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse let parseResult = - Lexhelp.usingLexbufForParsing(createLexbuf sourceText, fileName) (fun lexbuf -> + Lexhelp.usingLexbufForParsing(createLexbuf sourceText isFeatureSupported, fileName) (fun lexbuf -> let lexfun = createLexerFunction fileName options lexbuf errHandler let isLastCompiland = fileName.Equals(options.LastFileName, StringComparison.CurrentCultureIgnoreCase) || From ce98492ff47d27ff2134d4da30597786c2582788 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Tue, 18 Jun 2019 12:34:19 -0700 Subject: [PATCH 107/286] properly fail the build on unix failures (#7015) I discovered that unix (linux/macos) failures would report the failing tests via the `Tests` tab in ADO, but the specific build step would appear green which made diagnosing failures difficult. --- eng/build.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eng/build.sh b/eng/build.sh index c467296d3d..fceb485349 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -176,7 +176,11 @@ function TestUsingNUnit() { 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\"" - "$DOTNET_INSTALL_DIR/dotnet" $args + "$DOTNET_INSTALL_DIR/dotnet" $args || { + local exit_code=$? + echo "dotnet test failed (exit code '$exit_code')." >&2 + ExitWithExitCode $exit_code + } } function BuildSolution { From cb880d582d76c72087722a4b3e0cff17e7ac0f91 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Tue, 18 Jun 2019 16:32:29 -0700 Subject: [PATCH 108/286] Fixed line directive ranges when not applying a line directive (#7011) * Fixed line directive ranges when not applying a line directive * Update ProjectAnalysisTests.fs --- src/fsharp/lex.fsl | 10 +++++++--- tests/service/ProjectAnalysisTests.fs | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/fsharp/lex.fsl b/src/fsharp/lex.fsl index 0af96d71c9..c32c9a641b 100644 --- a/src/fsharp/lex.fsl +++ b/src/fsharp/lex.fsl @@ -524,10 +524,14 @@ rule token args skip = parse // Construct the new position if args.applyLineDirectives then lexbuf.EndPos <- pos.ApplyLineDirective((match file with Some f -> fileIndexOfFile f | None -> pos.FileIndex), line) - + else + // add a newline when we don't apply a directive since we consumed a newline getting here + newline lexbuf token args skip lexbuf - else - if not skip then (HASH_LINE (LexCont.Token !args.ifdefStack)) else token args skip lexbuf } + else + // add a newline when we don't apply a directive since we consumed a newline getting here + newline lexbuf + (HASH_LINE (LexCont.Token !args.ifdefStack)) } | "<@" { checkExprOp lexbuf; LQUOTE ("<@ @>", false) } | "<@@" { checkExprOp lexbuf; LQUOTE ("<@@ @@>", true) } diff --git a/tests/service/ProjectAnalysisTests.fs b/tests/service/ProjectAnalysisTests.fs index 16ef433e69..c9635c7083 100644 --- a/tests/service/ProjectAnalysisTests.fs +++ b/tests/service/ProjectAnalysisTests.fs @@ -5291,7 +5291,7 @@ let ``Test line directives in foreground analysis`` () = // see https://github.c for e in checkResults1.Errors do printfn "ProjectLineDirectives checkResults1 error file: <<<%s>>>" e.FileName - [ for e in checkResults1.Errors -> e.StartLineAlternate, e.EndLineAlternate, e.FileName ] |> shouldEqual [(4, 4, ProjectLineDirectives.fileName1)] + [ for e in checkResults1.Errors -> e.StartLineAlternate, e.EndLineAlternate, e.FileName ] |> shouldEqual [(5, 5, ProjectLineDirectives.fileName1)] //------------------------------------------------------ From b90096809218283f325143708914de2658cd2dc1 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Wed, 19 Jun 2019 02:22:53 -0700 Subject: [PATCH 109/286] Remove IVTs to legacy language service (#7001) * Remove IVTs to legacy language service * Use public API and remove seemingly useless test --- .../FSharp.Compiler.Private.fsproj | 2 -- .../FSharp.LanguageService/GotoDefinition.fs | 13 ++++++------- .../FSharp.LanguageService/Intellisense.fs | 2 +- .../Tests.LanguageService.General.fs | 19 ------------------- 4 files changed, 7 insertions(+), 29 deletions(-) diff --git a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj index 443f6c6efd..d468a8a996 100644 --- a/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj +++ b/src/fsharp/FSharp.Compiler.Private/FSharp.Compiler.Private.fsproj @@ -40,8 +40,6 @@ - - diff --git a/vsintegration/src/FSharp.LanguageService/GotoDefinition.fs b/vsintegration/src/FSharp.LanguageService/GotoDefinition.fs index ca720f0927..aa4e9441f8 100644 --- a/vsintegration/src/FSharp.LanguageService/GotoDefinition.fs +++ b/vsintegration/src/FSharp.LanguageService/GotoDefinition.fs @@ -5,15 +5,10 @@ namespace Microsoft.VisualStudio.FSharp.LanguageService open System -open System.IO -open System.Collections.Generic open System.Diagnostics open Microsoft.VisualStudio -open Microsoft.VisualStudio.Shell -open Microsoft.VisualStudio.Shell.Interop open Microsoft.VisualStudio.TextManager.Interop open FSharp.Compiler -open FSharp.Compiler.Lib open FSharp.Compiler.SourceCodeServices module internal OperatorToken = @@ -21,7 +16,9 @@ module internal OperatorToken = let asIdentifier_DEPRECATED (token : TokenInfo) = // Typechecker reports information about all values in the same fashion no matter whether it is named value (let binding) or operator // here we piggyback on this fact and just pretend that we need data time for identifier - let tagOfIdentToken = FSharp.Compiler.Parser.tagOfToken(FSharp.Compiler.Parser.IDENT "") + + let tagOfIdentToken = FSharpTokenTag.IDENT + let endCol = token.EndIndex + 1 // EndIndex from GetTokenInfoAt points to the last operator char, but here it should point to column 'after' the last char tagOfIdentToken, token.StartIndex, endCol @@ -69,7 +66,9 @@ module internal GotoDefinition = |> GotoDefinitionResult_DEPRECATED.MakeError | Some(colIdent, tag, qualId) -> if typedResults.HasFullTypeCheckInfo then - if Parser.tokenTagToTokenId tag <> Parser.TOKEN_IDENT then + // Used to be the Parser's internal definition, now hard-coded to avoid an IVT into the parser itsef. + // Dead code (aside from legacy tests), ignore + if tag <> FSharpTokenTag.IDENT then Strings.GotoDefinitionFailed_NotIdentifier() |> GotoDefinitionResult_DEPRECATED.MakeError else diff --git a/vsintegration/src/FSharp.LanguageService/Intellisense.fs b/vsintegration/src/FSharp.LanguageService/Intellisense.fs index b380bf13e2..dbf9d7fa5a 100644 --- a/vsintegration/src/FSharp.LanguageService/Intellisense.fs +++ b/vsintegration/src/FSharp.LanguageService/Intellisense.fs @@ -224,7 +224,7 @@ type internal FSharpDeclarations_DEPRECATED(documentationBuilder, declarations: // We intercept this call only to get the initial extent // of what was committed to the source buffer. let result = decl.GetName(filterText, index) - FSharp.Compiler.Lexhelp.Keywords.QuoteIdentifierIfNeeded result + Keywords.QuoteIdentifierIfNeeded result override decl.IsCommitChar(commitCharacter) = // Usual language identifier rules... diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs index 47e8e3b113..6bc62eda15 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.General.fs @@ -101,25 +101,6 @@ type UsingMSBuild() = n ) 0 - - [] - member public this.``PublicSurfaceArea.DotNetReflection``() = - let ps = publicTypesInAsm @"FSharp.ProjectSystem.FSharp.dll" - Assert.AreEqual(1, ps) // BuildPropertyDescriptor - let ls = publicTypesInAsm @"FSharp.LanguageService.dll" - Assert.AreEqual(0, ls) - let compis = publicTypesInAsm @"FSharp.Compiler.Interactive.Settings.dll" - Assert.AreEqual(5, compis) - let compserver = publicTypesInAsm @"FSharp.Compiler.Server.Shared.dll" - Assert.AreEqual(0, compserver) - let lsbase = publicTypesInAsm @"FSharp.LanguageService.Base.dll" - Assert.AreEqual(0, lsbase) - let psbase = publicTypesInAsm @"FSharp.ProjectSystem.Base.dll" - Assert.AreEqual(17, psbase) - let fsi = publicTypesInAsm @"FSharp.VS.FSI.dll" - Assert.AreEqual(1, fsi) - - [] member public this.``ReconcileErrors.Test1``() = let (_solution, project, file) = this.CreateSingleFileProject(["erroneous"]) From 66a209afac4f9b0dd041bc99aed49d68a78b1990 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 19 Jun 2019 15:02:44 -0700 Subject: [PATCH 110/286] [master] Update dependencies from dotnet/arcade (#7013) * Update dependencies from https://github.com/dotnet/arcade build 20190618.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19318.2 * Update dependencies from https://github.com/dotnet/arcade build 20190619.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19319.1 --- eng/Version.Details.xml | 4 +- eng/common/PSScriptAnalyzerSettings.psd1 | 11 ++ eng/common/internal-feed-operations.ps1 | 135 +++++++++++++++++ eng/common/internal-feed-operations.sh | 142 ++++++++++++++++++ .../templates/job/publish-build-assets.yml | 1 - .../channels/public-dev-release.yml | 3 +- .../channels/public-validation-release.yml | 3 +- .../post-build/setup-maestro-vars.yml | 28 +++- global.json | 2 +- 9 files changed, 313 insertions(+), 16 deletions(-) create mode 100644 eng/common/PSScriptAnalyzerSettings.psd1 create mode 100644 eng/common/internal-feed-operations.ps1 create mode 100644 eng/common/internal-feed-operations.sh diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0091420aa1..d4aef6fd56 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - aa4285be7fab64e2b6e62e4d5688ea50931c407c + 209388b8a700bb99690ae7fbbabe7e55f1999a8f diff --git a/eng/common/PSScriptAnalyzerSettings.psd1 b/eng/common/PSScriptAnalyzerSettings.psd1 new file mode 100644 index 0000000000..4c1ea7c98e --- /dev/null +++ b/eng/common/PSScriptAnalyzerSettings.psd1 @@ -0,0 +1,11 @@ +@{ + IncludeRules=@('PSAvoidUsingCmdletAliases', + 'PSAvoidUsingWMICmdlet', + 'PSAvoidUsingPositionalParameters', + 'PSAvoidUsingInvokeExpression', + 'PSUseDeclaredVarsMoreThanAssignments', + 'PSUseCmdletCorrectly', + 'PSStandardDSCFunctionsInResource', + 'PSUseIdenticalMandatoryParametersForDSC', + 'PSUseIdenticalParametersForDSC') +} \ No newline at end of file diff --git a/eng/common/internal-feed-operations.ps1 b/eng/common/internal-feed-operations.ps1 new file mode 100644 index 0000000000..8b8bafd6a8 --- /dev/null +++ b/eng/common/internal-feed-operations.ps1 @@ -0,0 +1,135 @@ +param( + [Parameter(Mandatory=$true)][string] $Operation, + [string] $AuthToken, + [string] $CommitSha, + [string] $RepoName, + [switch] $IsFeedPrivate +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 + +. $PSScriptRoot\tools.ps1 + +# Sets VSS_NUGET_EXTERNAL_FEED_ENDPOINTS based on the "darc-int-*" feeds defined in NuGet.config. This is needed +# in build agents by CredProvider to authenticate the restore requests to internal feeds as specified in +# https://github.com/microsoft/artifacts-credprovider/blob/0f53327cd12fd893d8627d7b08a2171bf5852a41/README.md#environment-variables. This should ONLY be called from identified +# internal builds +function SetupCredProvider { + param( + [string] $AuthToken + ) + + # Install the Cred Provider NuGet plugin + Write-Host "Setting up Cred Provider NuGet plugin in the agent..." + Write-Host "Getting 'installcredprovider.ps1' from 'https://github.com/microsoft/artifacts-credprovider'..." + + $url = 'https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.ps1' + + Write-Host "Writing the contents of 'installcredprovider.ps1' locally..." + Invoke-WebRequest $url -OutFile installcredprovider.ps1 + + Write-Host "Installing plugin..." + .\installcredprovider.ps1 -Force + + Write-Host "Deleting local copy of 'installcredprovider.ps1'..." + Remove-Item .\installcredprovider.ps1 + + if (-Not("$env:USERPROFILE\.nuget\plugins\netcore")) { + Write-Host "CredProvider plugin was not installed correctly!" + ExitWithExitCode 1 + } + else { + Write-Host "CredProvider plugin was installed correctly!" + } + + # Then, we set the 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' environment variable to restore from the stable + # feeds successfully + + $nugetConfigPath = "$RepoRoot\NuGet.config" + + if (-Not (Test-Path -Path $nugetConfigPath)) { + Write-Host "NuGet.config file not found in repo's root!" + ExitWithExitCode 1 + } + + $endpoints = New-Object System.Collections.ArrayList + $nugetConfigPackageSources = Select-Xml -Path $nugetConfigPath -XPath "//packageSources/add[contains(@key, 'darc-int-')]/@value" | foreach{$_.Node.Value} + + if (($nugetConfigPackageSources | Measure-Object).Count -gt 0 ) { + foreach ($stableRestoreResource in $nugetConfigPackageSources) { + $trimmedResource = ([string]$stableRestoreResource).Trim() + [void]$endpoints.Add(@{endpoint="$trimmedResource"; password="$AuthToken"}) + } + } + + if (($endpoints | Measure-Object).Count -gt 0) { + # Create the JSON object. It should look like '{"endpointCredentials": [{"endpoint":"http://example.index.json", "username":"optional", "password":"accesstoken"}]}' + $endpointCredentials = @{endpointCredentials=$endpoints} | ConvertTo-Json -Compress + + # Create the environment variables the AzDo way + Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $endpointCredentials -Properties @{ + 'variable' = 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' + 'issecret' = 'false' + } + + # We don't want sessions cached since we will be updating the endpoints quite frequently + Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data 'False' -Properties @{ + 'variable' = 'NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED' + 'issecret' = 'false' + } + } + else + { + Write-Host "No internal endpoints found in NuGet.config" + } +} + +#Workaround for https://github.com/microsoft/msbuild/issues/4430 +function InstallDotNetSdkAndRestoreArcade { + $dotnetTempDir = "$RepoRoot\dotnet" + $dotnetSdkVersion="2.1.507" # After experimentation we know this version works when restoring the SDK (compared to 3.0.*) + $dotnet = "$dotnetTempDir\dotnet.exe" + $restoreProjPath = "$PSScriptRoot\restore.proj" + + Write-Host "Installing dotnet SDK version $dotnetSdkVersion to restore Arcade SDK..." + InstallDotNetSdk "$dotnetTempDir" "$dotnetSdkVersion" + + '' | Out-File "$restoreProjPath" + + & $dotnet restore $restoreProjPath + + Write-Host "Arcade SDK restored!" + + if (Test-Path -Path $restoreProjPath) { + Remove-Item $restoreProjPath + } + + if (Test-Path -Path $dotnetTempDir) { + Remove-Item $dotnetTempDir -Recurse + } +} + +try { + Push-Location $PSScriptRoot + + if ($Operation -like "setup") { + SetupCredProvider $AuthToken + } + elseif ($Operation -like "install-restore") { + InstallDotNetSdkAndRestoreArcade + } + else { + Write-Host "Unknown operation '$Operation'!" + ExitWithExitCode 1 + } +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} +finally { + Pop-Location +} diff --git a/eng/common/internal-feed-operations.sh b/eng/common/internal-feed-operations.sh new file mode 100644 index 0000000000..1ff654d2ff --- /dev/null +++ b/eng/common/internal-feed-operations.sh @@ -0,0 +1,142 @@ +#!/usr/bin/env bash + +set -e + +# Sets VSS_NUGET_EXTERNAL_FEED_ENDPOINTS based on the "darc-int-*" feeds defined in NuGet.config. This is needed +# in build agents by CredProvider to authenticate the restore requests to internal feeds as specified in +# https://github.com/microsoft/artifacts-credprovider/blob/0f53327cd12fd893d8627d7b08a2171bf5852a41/README.md#environment-variables. +# This should ONLY be called from identified internal builds +function SetupCredProvider { + local authToken=$1 + + # Install the Cred Provider NuGet plugin + echo "Setting up Cred Provider NuGet plugin in the agent..."... + echo "Getting 'installcredprovider.ps1' from 'https://github.com/microsoft/artifacts-credprovider'..." + + local url="https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh" + + echo "Writing the contents of 'installcredprovider.ps1' locally..." + local installcredproviderPath="installcredprovider.sh" + if command -v curl > /dev/null; then + curl $url > "$installcredproviderPath" + else + wget -q -O "$installcredproviderPath" "$url" + fi + + echo "Installing plugin..." + . "$installcredproviderPath" + + echo "Deleting local copy of 'installcredprovider.sh'..." + rm installcredprovider.sh + + if [ ! -d "$HOME/.nuget/plugins" ]; then + echo "CredProvider plugin was not installed correctly!" + ExitWithExitCode 1 + else + echo "CredProvider plugin was installed correctly!" + fi + + # Then, we set the 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' environment variable to restore from the stable + # feeds successfully + + local nugetConfigPath="$repo_root/NuGet.config" + + if [ ! "$nugetConfigPath" ]; then + echo "NuGet.config file not found in repo's root!" + ExitWithExitCode 1 + fi + + local endpoints='[' + local nugetConfigPackageValues=`cat "$nugetConfigPath" | grep "key=\"darc-int-"` + local pattern="value=\"(.*)\"" + + for value in $nugetConfigPackageValues + do + if [[ $value =~ $pattern ]]; then + local endpoint="${BASH_REMATCH[1]}" + endpoints+="{\"endpoint\": \"$endpoint\", \"password\": \"$authToken\"}," + fi + done + + endpoints=${endpoints%?} + endpoints+=']' + + if [ ${#endpoints} -gt 2 ]; then + # Create the JSON object. It should look like '{"endpointCredentials": [{"endpoint":"http://example.index.json", "username":"optional", "password":"accesstoken"}]}' + local endpointCredentials="{\"endpointCredentials\": "$endpoints"}" + + echo "##vso[task.setvariable variable=VSS_NUGET_EXTERNAL_FEED_ENDPOINTS]$endpointCredentials" + echo "##vso[task.setvariable variable=NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED]False" + else + echo "No internal endpoints found in NuGet.config" + fi +} + +# Workaround for https://github.com/microsoft/msbuild/issues/4430 +function InstallDotNetSdkAndRestoreArcade { + local dotnetTempDir="$repo_root/dotnet" + local dotnetSdkVersion="2.1.507" # After experimentation we know this version works when restoring the SDK (compared to 3.0.*) + local restoreProjPath="$repo_root/eng/common/restore.proj" + + echo "Installing dotnet SDK version $dotnetSdkVersion to restore Arcade SDK..." + echo "" > "$restoreProjPath" + + InstallDotNetSdk "$dotnetTempDir" "$dotnetSdkVersion" + + local res=`$dotnetTempDir/dotnet restore $restoreProjPath` + echo "Arcade SDK restored!" + + # Cleanup + if [ "$restoreProjPath" ]; then + rm "$restoreProjPath" + fi + + if [ "$dotnetTempDir" ]; then + rm -r $dotnetTempDir + fi +} + +source="${BASH_SOURCE[0]}" +operation='' +authToken='' +repoName='' + +while [[ $# > 0 ]]; do + opt="$(echo "$1" | awk '{print tolower($0)}')" + case "$opt" in + --operation) + operation=$2 + shift + ;; + --authtoken) + authToken=$2 + shift + ;; + *) + echo "Invalid argument: $1" + usage + exit 1 + ;; + esac + + shift +done + +while [[ -h "$source" ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + +. "$scriptroot/tools.sh" + +if [ "$operation" = "setup" ]; then + SetupCredProvider $authToken +elif [ "$operation" = "install-restore" ]; then + InstallDotNetSdkAndRestoreArcade +else + echo "Unknown operation '$operation'!" +fi diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 619ec68aa4..0144221681 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -57,7 +57,6 @@ jobs: /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:Configuration=$(_BuildConfig) - /v:detailed condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - task: powershell@2 diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml index b332cb5173..c61eaa927d 100644 --- a/eng/common/templates/post-build/channels/public-dev-release.yml +++ b/eng/common/templates/post-build/channels/public-dev-release.yml @@ -138,8 +138,7 @@ stages: inputs: targetType: inline script: | - darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) - continueOnError: true + darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) --latest-location - template: ../promote-build.yml parameters: diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index 0b9719da82..23725c6d62 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -84,8 +84,7 @@ stages: inputs: targetType: inline script: | - darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com --password $(MaestroAccessToken) - continueOnError: true + darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com --password $(MaestroAccessToken) --latest-location - template: ../promote-build.yml parameters: diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml index b40e0260a3..9de585a94a 100644 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -16,11 +16,23 @@ jobs: inputs: targetType: inline script: | - . "$(Build.SourcesDirectory)/eng/common/tools.ps1" - - $BarId = Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/BARBuildId.txt" - Write-PipelineSetVariable -Name 'BARBuildId' -Value $BarId - - $Channels = "" - Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/Channels.txt" | ForEach-Object { $Channels += "$_ ," } - Write-PipelineSetVariable -Name 'InitialChannels' -Value "$Channels" + # This is needed to make Write-PipelineSetVariable works in this context + if ($env:BUILD_BUILDNUMBER -ne "" -and $env:BUILD_BUILDNUMBER -ne $null) { + $ci = $true + + . "$(Build.SourcesDirectory)/eng/common/tools.ps1" + + $BarId = Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/BARBuildId.txt" + Write-PipelineSetVariable -Name 'BARBuildId' -Value $BarId + + Write-Host "Asked Write-PipelineSetVariable to create BARBuildId with value '$BarId'" + + $Channels = "" + Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/Channels.txt" | ForEach-Object { $Channels += "$_ ," } + Write-PipelineSetVariable -Name 'InitialChannels' -Value "$Channels" + + Write-Host "Asked Write-PipelineSetVariable to create InitialChannels with value '$Channels'" + } + else { + Write-Host "This step can only be run in an Azure DevOps CI environment." + } diff --git a/global.json b/global.json index ace8d4fc82..586531e486 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19315.2", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19319.1", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 51684d453cc08f63f93a5646604e22737e553e41 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Wed, 19 Jun 2019 22:44:35 -0700 Subject: [PATCH 111/286] Add get/set to item description tooltip (#7016) * Add get/set to item description tooltip * Fix QuickInfo test * Adjust gettersetter layout * Tag the keyword again --- src/fsharp/NicePrint.fs | 14 +++++++++++++- vsintegration/tests/UnitTests/QuickInfoTests.fs | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/fsharp/NicePrint.fs b/src/fsharp/NicePrint.fs index ab45f12c13..5d56543e99 100644 --- a/src/fsharp/NicePrint.fs +++ b/src/fsharp/NicePrint.fs @@ -1405,12 +1405,24 @@ module InfoMemberPrinting = | None -> tagProperty | Some vref -> tagProperty >> mkNav vref.DefinitionRange let nameL = DemangleOperatorNameAsLayout tagProp pinfo.PropertyName + let getterSetter = + match pinfo.HasGetter, pinfo.HasSetter with + | (true, false) -> + wordL (tagKeyword "with") ^^ wordL (tagText "get") + | (false, true) -> + wordL (tagKeyword "with") ^^ wordL (tagText "set") + | (true, true) -> + wordL (tagKeyword "with") ^^ wordL (tagText "get, set") + | (false, false) -> + emptyL + wordL (tagText (FSComp.SR.typeInfoProperty())) ^^ layoutTyconRef denv pinfo.ApparentEnclosingTyconRef ^^ SepL.dot ^^ nameL ^^ RightL.colon ^^ - layoutType denv rty + layoutType denv rty ^^ + getterSetter let formatMethInfoToBufferFreeStyle amap m denv os (minfo: MethInfo) = let _, resL = prettyLayoutOfMethInfoFreeStyle amap m denv emptyTyparInst minfo diff --git a/vsintegration/tests/UnitTests/QuickInfoTests.fs b/vsintegration/tests/UnitTests/QuickInfoTests.fs index 19d140de88..bfa6c7df72 100644 --- a/vsintegration/tests/UnitTests/QuickInfoTests.fs +++ b/vsintegration/tests/UnitTests/QuickInfoTests.fs @@ -440,6 +440,6 @@ module Test = } """ let quickInfo = GetQuickInfoTextFromCode code - let expected = "property MyDistance.asNautical: MyDistance" + let expected = "property MyDistance.asNautical: MyDistance with get" Assert.AreEqual(expected, quickInfo) () From fa5ef919b8ee2a1604538ade5dce8e1a0e977ae8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 21 Jun 2019 10:01:41 -0700 Subject: [PATCH 112/286] [master] Update dependencies from dotnet/arcade (#7023) * Update dependencies from https://github.com/dotnet/arcade build 20190619.25 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19319.25 * Update dependencies from https://github.com/dotnet/arcade build 20190620.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19320.1 --- eng/Version.Details.xml | 4 +- eng/common/sdl/execute-all-sdl-tools.ps1 | 56 ++++++++++++------------ eng/common/sdl/init-sdl.ps1 | 6 +-- eng/common/sdl/push-gdn.ps1 | 6 +-- eng/common/templates/job/execute-sdl.yml | 37 ++++++++++++++++ global.json | 2 +- 6 files changed, 74 insertions(+), 37 deletions(-) create mode 100644 eng/common/templates/job/execute-sdl.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d4aef6fd56..3f53c799b2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 209388b8a700bb99690ae7fbbabe7e55f1999a8f + b21c24996a73aa62b7a1ee69f546b9d2eb084f29 diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 index 74080f22d1..0635f26fb6 100644 --- a/eng/common/sdl/execute-all-sdl-tools.ps1 +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -1,28 +1,28 @@ Param( - [string] $GuardianPackageName, # Required: the name of guardian CLI pacakge (not needed if GuardianCliLocation is specified) - [string] $NugetPackageDirectory, # Required: directory where NuGet packages are installed (not needed if GuardianCliLocation is specified) - [string] $GuardianCliLocation, # Optional: Direct location of Guardian CLI executable if GuardianPackageName & NugetPackageDirectory are not specified - [string] $Repository, # Required: the name of the repository (e.g. dotnet/arcade) - [string] $BranchName="master", # Optional: name of branch or version of gdn settings; defaults to master - [string] $SourceDirectory, # Required: the directory where source files are located - [string] $ArtifactsDirectory, # Required: the directory where build artifacts are located - [string] $DncEngAccessToken, # Required: access token for dnceng; should be provided via KeyVault - [string[]] $SourceToolsList, # Optional: list of SDL tools to run on source code - [string[]] $ArtifactToolsList, # Optional: list of SDL tools to run on built artifacts - [bool] $TsaPublish=$False, # Optional: true will publish results to TSA; only set to true after onboarding to TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaBranchName=$env:BUILD_SOURCEBRANCHNAME, # Optional: required for TSA publish; defaults to $(Build.SourceBranchName); TSA is the automated framework used to upload test results as bugs. - [string] $TsaRepositoryName, # Optional: TSA repository name; will be generated automatically if not submitted; TSA is the automated framework used to upload test results as bugs. - [string] $BuildNumber=$env:BUILD_BUILDNUMBER, # Optional: required for TSA publish; defaults to $(Build.BuildNumber) - [bool] $UpdateBaseline=$False, # Optional: if true, will update the baseline in the repository; should only be run after fixing any issues which need to be fixed - [bool] $TsaOnboard=$False, # Optional: if true, will onboard the repository to TSA; should only be run once; TSA is the automated framework used to upload test results as bugs. - [string] $TsaInstanceUrl, # Optional: only needed if TsaOnboard or TsaPublish is true; the instance-url registered with TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaCodebaseName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the codebase registered with TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaProjectName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the project registered with TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaNotificationEmail, # Optional: only needed if TsaOnboard is true; the email(s) which will receive notifications of TSA bug filings (e.g. alias@microsoft.com); TSA is the automated framework used to upload test results as bugs. - [string] $TsaCodebaseAdmin, # Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs. - [string] $TsaBugAreaPath, # Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. - [string] $TsaIterationPath, # Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. - [string] $GuardianLoggerLevel="Standard" # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error + [string] $GuardianPackageName, # Required: the name of guardian CLI package (not needed if GuardianCliLocation is specified) + [string] $NugetPackageDirectory, # Required: directory where NuGet packages are installed (not needed if GuardianCliLocation is specified) + [string] $GuardianCliLocation, # Optional: Direct location of Guardian CLI executable if GuardianPackageName & NugetPackageDirectory are not specified + [string] $Repository=$env:BUILD_REPOSITORY_NAME, # Required: the name of the repository (e.g. dotnet/arcade) + [string] $BranchName=$env:BUILD_SOURCEBRANCH, # Optional: name of branch or version of gdn settings; defaults to master + [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, # Required: the directory where source files are located + [string] $ArtifactsDirectory = (Join-Path $env:BUILD_SOURCESDIRECTORY ("artifacts")), # Required: the directory where build artifacts are located + [string] $AzureDevOpsAccessToken, # Required: access token for dnceng; should be provided via KeyVault + [string[]] $SourceToolsList, # Optional: list of SDL tools to run on source code + [string[]] $ArtifactToolsList, # Optional: list of SDL tools to run on built artifacts + [bool] $TsaPublish=$False, # Optional: true will publish results to TSA; only set to true after onboarding to TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaBranchName=$env:BUILD_SOURCEBRANCH, # Optional: required for TSA publish; defaults to $(Build.SourceBranchName); TSA is the automated framework used to upload test results as bugs. + [string] $TsaRepositoryName=$env:BUILD_REPOSITORY_NAME, # Optional: TSA repository name; will be generated automatically if not submitted; TSA is the automated framework used to upload test results as bugs. + [string] $BuildNumber=$env:BUILD_BUILDNUMBER, # Optional: required for TSA publish; defaults to $(Build.BuildNumber) + [bool] $UpdateBaseline=$False, # Optional: if true, will update the baseline in the repository; should only be run after fixing any issues which need to be fixed + [bool] $TsaOnboard=$False, # Optional: if true, will onboard the repository to TSA; should only be run once; TSA is the automated framework used to upload test results as bugs. + [string] $TsaInstanceUrl, # Optional: only needed if TsaOnboard or TsaPublish is true; the instance-url registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaCodebaseName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the codebase registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaProjectName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the project registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaNotificationEmail, # Optional: only needed if TsaOnboard is true; the email(s) which will receive notifications of TSA bug filings (e.g. alias@microsoft.com); TSA is the automated framework used to upload test results as bugs. + [string] $TsaCodebaseAdmin, # Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs. + [string] $TsaBugAreaPath, # Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. + [string] $TsaIterationPath, # Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. + [string] $GuardianLoggerLevel="Standard" # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error ) $ErrorActionPreference = "Stop" @@ -51,7 +51,7 @@ if ($ValidPath -eq $False) exit 1 } -& $(Join-Path $PSScriptRoot "init-sdl.ps1") -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $ArtifactsDirectory -DncEngAccessToken $DncEngAccessToken -GuardianLoggerLevel $GuardianLoggerLevel +& $(Join-Path $PSScriptRoot "init-sdl.ps1") -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $ArtifactsDirectory -AzureDevOpsAccessToken $AzureDevOpsAccessToken -GuardianLoggerLevel $GuardianLoggerLevel $gdnFolder = Join-Path $ArtifactsDirectory ".gdn" if ($TsaOnboard) { @@ -69,14 +69,14 @@ if ($TsaOnboard) { } if ($ArtifactToolsList -and $ArtifactToolsList.Count -gt 0) { - & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $ArtifactsDirectory -GdnFolder $gdnFolder -ToolsList $ArtifactToolsList -DncEngAccessToken $DncEngAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel + & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $ArtifactsDirectory -GdnFolder $gdnFolder -ToolsList $ArtifactToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel } if ($SourceToolsList -and $SourceToolsList.Count -gt 0) { - & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $SourceDirectory -GdnFolder $gdnFolder -ToolsList $SourceToolsList -DncEngAccessToken $DncEngAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel + & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $SourceDirectory -GdnFolder $gdnFolder -ToolsList $SourceToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel } if ($UpdateBaseline) { - & (Join-Path $PSScriptRoot "push-gdn.ps1") -Repository $RepoName -BranchName $BranchName -GdnFolder $GdnFolder -DncEngAccessToken $DncEngAccessToken -PushReason "Update baseline" + & (Join-Path $PSScriptRoot "push-gdn.ps1") -Repository $RepoName -BranchName $BranchName -GdnFolder $GdnFolder -AzureDevOpsAccessToken $AzureDevOpsAccessToken -PushReason "Update baseline" } if ($TsaPublish) { diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1 index cbf5c36a8f..26e01c0673 100644 --- a/eng/common/sdl/init-sdl.ps1 +++ b/eng/common/sdl/init-sdl.ps1 @@ -3,7 +3,7 @@ Param( [string] $Repository, [string] $BranchName="master", [string] $WorkingDirectory, - [string] $DncEngAccessToken, + [string] $AzureDevOpsAccessToken, [string] $GuardianLoggerLevel="Standard" ) @@ -12,7 +12,7 @@ Set-StrictMode -Version 2.0 $LASTEXITCODE = 0 # Construct basic auth from AzDO access token; construct URI to the repository's gdn folder stored in that repository; construct location of zip file -$encodedPat = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$DncEngAccessToken")) +$encodedPat = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$AzureDevOpsAccessToken")) $escapedRepository = [Uri]::EscapeDataString("/$Repository/$BranchName/.gdn") $uri = "https://dev.azure.com/dnceng/internal/_apis/git/repositories/sdl-tool-cfg/Items?path=$escapedRepository&versionDescriptor[versionOptions]=0&`$format=zip&api-version=5.0-preview.1" $zipFile = "$WorkingDirectory/gdn.zip" @@ -44,5 +44,5 @@ Try if ($LASTEXITCODE -ne 0) { Write-Error "Guardian baseline failed with exit code $LASTEXITCODE." } - & $(Join-Path $PSScriptRoot "push-gdn.ps1") -Repository $Repository -BranchName $BranchName -GdnFolder $gdnFolder -DncEngAccessToken $DncEngAccessToken -PushReason "Initialize gdn folder" + & $(Join-Path $PSScriptRoot "push-gdn.ps1") -Repository $Repository -BranchName $BranchName -GdnFolder $gdnFolder -AzureDevOpsAccessToken $AzureDevOpsAccessToken -PushReason "Initialize gdn folder" } \ No newline at end of file diff --git a/eng/common/sdl/push-gdn.ps1 b/eng/common/sdl/push-gdn.ps1 index cacaf8e912..79c707d6d8 100644 --- a/eng/common/sdl/push-gdn.ps1 +++ b/eng/common/sdl/push-gdn.ps1 @@ -2,7 +2,7 @@ Param( [string] $Repository, [string] $BranchName="master", [string] $GdnFolder, - [string] $DncEngAccessToken, + [string] $AzureDevOpsAccessToken, [string] $PushReason ) @@ -16,8 +16,8 @@ if (Test-Path $sdlDir) { Remove-Item -Force -Recurse $sdlDir } -Write-Host "git clone https://dnceng:`$DncEngAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir" -git clone https://dnceng:$DncEngAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir +Write-Host "git clone https://dnceng:`$AzureDevOpsAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir" +git clone https://dnceng:$AzureDevOpsAccessToken@dev.azure.com/dnceng/internal/_git/sdl-tool-cfg $sdlDir if ($LASTEXITCODE -ne 0) { Write-Error "Git clone failed with exit code $LASTEXITCODE." } diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml new file mode 100644 index 0000000000..2f669fd95b --- /dev/null +++ b/eng/common/templates/job/execute-sdl.yml @@ -0,0 +1,37 @@ +parameters: + overrideParameters: '' # Optional: to override values for parameters. + additionalParameters: '' # Optional: parameters that need user specific values eg: '-SourceToolsList @("abc","def") -ArtifactToolsList @("ghi","jkl")' + continueOnError: false # optional: determines whether to continue the build if the step errors; + dependsOn: '' # Optional: dependencies of the job + +jobs: +- job: Run_SDL + dependsOn: ${{ parameters.dependsOn }} + displayName: Run SDL tool + variables: + - group: DotNet-VSTS-Bot + steps: + - checkout: self + clean: true + - task: NuGetToolInstaller@1 + displayName: 'Install NuGet.exe' + - task: NuGetCommand@2 + displayName: 'Install Guardian' + inputs: + restoreSolution: $(Build.SourcesDirectory)\eng\common\sdl\packages.config + feedsToUse: config + nugetConfigPath: $(Build.SourcesDirectory)\eng\common\sdl\NuGet.config + externalFeedCredentials: GuardianConnect + restoreDirectory: $(Build.SourcesDirectory)\.packages + - ${{ if ne(parameters.overrideParameters, '') }}: + - powershell: eng/common/sdl/execute-all-sdl-tools.ps1 ${{ parameters.overrideParameters }} + displayName: Execute SDL + continueOnError: ${{ parameters.continueOnError }} + - ${{ if eq(parameters.overrideParameters, '') }}: + - powershell: eng/common/sdl/execute-all-sdl-tools.ps1 + -GuardianPackageName Microsoft.Guardian.Cli.0.3.2 + -NugetPackageDirectory $(Build.SourcesDirectory)\.packages + -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) + ${{ parameters.additionalParameters }} + displayName: Execute SDL + continueOnError: ${{ parameters.continueOnError }} diff --git a/global.json b/global.json index 586531e486..899ac15878 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19319.1", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19320.1", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 4d15e56d5ef80f96080a2295e394fb589578f2ee Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Fri, 21 Jun 2019 22:12:38 -0700 Subject: [PATCH 113/286] update package versions for 16.1 (#6994) --- eng/Versions.props | 32 +++++++++---------- global.json | 2 +- .../LanguageService/FSharpLanguageClient.fs | 2 -- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 3fc7a08c13..35ffed669a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -109,26 +109,26 @@ 8.0.1 14.0.25420 - 16.0.467 - 16.0.467 + 16.1.89 + 16.1.89 1.1.4322 - 16.0.467 - 16.0.28727 - 16.0.28729 + 16.1.89 + 16.1.28916.169 + 16.1.28917.181 16.1.3121 - 16.0.467 - 16.0.467 - 16.0.467 + 16.1.89 + 16.1.89 + 16.1.89 8.0.50728 7.10.6071 - 16.0.28729 + 16.1.28917.181 8.0.50728 16.0.201-pre-g7d366164d0 2.3.6152103 14.3.25407 - 16.0.28729 - 16.0.28729 - 16.0.28729 + 16.1.28917.181 + 16.1.28917.181 + 16.1.28917.181 10.0.30319 11.0.50727 15.0.25123-Dev15Preview @@ -138,15 +138,15 @@ 10.0.30320 11.0.61031 12.0.30111 - 16.0.467 + 16.1.89 7.10.6071 8.0.50728 10.0.30320 12.0.30112 - 16.0.467 - 16.0.467 + 16.1.89 + 16.1.89 16.0.102 - 16.0.28729 + 16.1.28917.181 15.3.58 9.0.30729 16.0.2264 diff --git a/global.json b/global.json index 899ac15878..be4487f1e6 100644 --- a/global.json +++ b/global.json @@ -2,7 +2,7 @@ "tools": { "dotnet": "3.0.100-preview5-011568", "vs": { - "version": "16.0", + "version": "16.1", "components": [ "Microsoft.Net.Core.Component.SDK.2.1", "Microsoft.VisualStudio.Component.FSharp" diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpLanguageClient.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpLanguageClient.fs index 52f978d666..176ba2cc50 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpLanguageClient.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpLanguageClient.fs @@ -7,7 +7,6 @@ open System.Diagnostics open System.IO open System.Threading open System.Threading.Tasks -open FSharp.Compiler.LanguageServer open Microsoft.FSharp.Control open Microsoft.VisualStudio.FSharp.Editor open Microsoft.VisualStudio.FSharp.Editor.Helpers @@ -64,5 +63,4 @@ type internal FSharpLanguageClient member __.CustomMessageTarget = null member __.MiddleLayer = null member __.AttachForCustomMessageAsync(rpc: JsonRpc) = - rpc.JsonSerializer.Converters.Add(JsonOptionConverter()) // ensure we can set `'T option` values lspService.SetJsonRpc(rpc) |> Async.StartAsTask :> Task From 6633abe18074ec82451b892f5d08b57db27794d4 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 22 Jun 2019 13:57:02 -0700 Subject: [PATCH 114/286] Update dependencies from https://github.com/dotnet/arcade build 20190621.75 (#7046) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19321.75 --- eng/Version.Details.xml | 4 +-- eng/common/cross/build-rootfs.sh | 1 + eng/common/templates/job/execute-sdl.yml | 7 +++++ .../templates/job/publish-build-assets.yml | 23 +++++---------- .../templates/post-build/post-build.yml | 8 +++++ .../post-build/setup-maestro-vars.yml | 29 +++++++++---------- eng/common/tools.sh | 4 +-- global.json | 2 +- 8 files changed, 42 insertions(+), 36 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3f53c799b2..f24836c86d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - b21c24996a73aa62b7a1ee69f546b9d2eb084f29 + fcee3d5c2d6180bec19c4ae50234771c436b4b52 diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 7c4e122651..d7d5d7d5f4 100644 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -203,6 +203,7 @@ if [[ "$__LinuxCodeName" == "alpine" ]]; then -X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/main \ -X http://dl-cdn.alpinelinux.org/alpine/v$__AlpineVersion/community \ -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \ + -X http://dl-cdn.alpinelinux.org/alpine/edge/main \ -U --allow-untrusted --root $__RootfsDir --arch $__AlpineArch --initdb \ add $__AlpinePackages rm -r $__ApkToolsDir diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index 2f669fd95b..acb4c55d73 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -13,6 +13,13 @@ jobs: steps: - checkout: self clean: true + - task: DownloadBuildArtifacts@0 + displayName: Download Build Artifacts + inputs: + buildType: current + downloadType: specific files + matchingPattern: "**" + downloadPath: $(Build.SourcesDirectory)\artifacts - task: NuGetToolInstaller@1 displayName: 'Install NuGet.exe' - task: NuGetCommand@2 diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 0144221681..ff7346163f 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -60,27 +60,18 @@ jobs: condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} - task: powershell@2 - displayName: Create BARBuildId Artifact + displayName: Create ReleaseConfigs Artifact inputs: targetType: inline script: | - Add-Content -Path "$(Build.StagingDirectory)/BARBuildId.txt" -Value $(BARBuildId) - - task: powershell@2 - displayName: Create Channels Artifact - inputs: - targetType: inline - script: | - Add-Content -Path "$(Build.StagingDirectory)/Channels.txt" -Value "$(DefaultChannels)" - - task: PublishBuildArtifacts@1 - displayName: Publish BAR BuildId to VSTS - inputs: - PathtoPublish: '$(Build.StagingDirectory)/BARBuildId.txt' - PublishLocation: Container - ArtifactName: ReleaseConfigs + Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(BARBuildId) + Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value "$(DefaultChannels)" + Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(IsInternalBuild) + Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(IsStableBuild) - task: PublishBuildArtifacts@1 - displayName: Publish Channels to VSTS + displayName: Publish ReleaseConfigs Artifact inputs: - PathtoPublish: '$(Build.StagingDirectory)/Channels.txt' + PathtoPublish: '$(Build.StagingDirectory)/ReleaseConfigs.txt' PublishLocation: Container ArtifactName: ReleaseConfigs - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 6b74475a6f..2c411dd009 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -2,6 +2,9 @@ parameters: enableSourceLinkValidation: true enableSigningValidation: true enableSymbolValidation: true + SDLValidationParameters: + enable: false + params: '' stages: - stage: validate @@ -52,6 +55,11 @@ stages: -GHCommit $(Build.SourceVersion) -SourcelinkCliVersion $(SourceLinkCLIVersion) + - ${{ if eq(parameters.SDLValidationParameters.enable, 'true') }}: + - template: /eng/common/templates/job/execute-sdl.yml + parameters: + additionalParameters: ${{ parameters.SDLValidationParameters.params }} + - template: \eng\common\templates\post-build\channels\public-dev-release.yml parameters: enableSymbolValidation: ${{ parameters.enableSymbolValidation }} diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml index 9de585a94a..0eddd6cd3b 100644 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -17,22 +17,21 @@ jobs: targetType: inline script: | # This is needed to make Write-PipelineSetVariable works in this context - if ($env:BUILD_BUILDNUMBER -ne "" -and $env:BUILD_BUILDNUMBER -ne $null) { - $ci = $true + $ci = $true - . "$(Build.SourcesDirectory)/eng/common/tools.ps1" - - $BarId = Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/BARBuildId.txt" - Write-PipelineSetVariable -Name 'BARBuildId' -Value $BarId + . "$(Build.SourcesDirectory)/eng/common/tools.ps1" - Write-Host "Asked Write-PipelineSetVariable to create BARBuildId with value '$BarId'" + $Content = Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt" - $Channels = "" - Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/Channels.txt" | ForEach-Object { $Channels += "$_ ," } - Write-PipelineSetVariable -Name 'InitialChannels' -Value "$Channels" + $BarId = $Content | Select -Index 0 - Write-Host "Asked Write-PipelineSetVariable to create InitialChannels with value '$Channels'" - } - else { - Write-Host "This step can only be run in an Azure DevOps CI environment." - } + $Channels = "" + $Content | Select -Index 1 | ForEach-Object { $Channels += "$_ ," } + + $IsInternalBuild = $Content | Select -Index 2 + $IsStableBuild = $Content | Select -Index 3 + + Write-PipelineSetVariable -Name 'BARBuildId' -Value $BarId + Write-PipelineSetVariable -Name 'InitialChannels' -Value "$Channels" + Write-PipelineSetVariable -Name 'IsInternalBuild' -Value $IsInternalBuild + Write-PipelineSetVariable -Name 'IsStableBuild' -Value $IsStableBuild diff --git a/eng/common/tools.sh b/eng/common/tools.sh index f39aab57b9..70d92cf85a 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -356,11 +356,11 @@ function MSBuild-Core { } } -. "$scriptroot/pipeline-logging-functions.sh" - ResolvePath "${BASH_SOURCE[0]}" _script_dir=`dirname "$_ResolvePath"` +. "$_script_dir/pipeline-logging-functions.sh" + eng_root=`cd -P "$_script_dir/.." && pwd` repo_root=`cd -P "$_script_dir/../.." && pwd` artifacts_dir="$repo_root/artifacts" diff --git a/global.json b/global.json index be4487f1e6..5c42fa7841 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19320.1", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19321.75", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 4f6aecc3822e5331ed7790f8459c210c70991158 Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Sun, 23 Jun 2019 13:04:28 +0000 Subject: [PATCH 115/286] Update dependencies from https://github.com/dotnet/arcade build 20190622.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19322.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index f24836c86d..83e38e2b0c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - fcee3d5c2d6180bec19c4ae50234771c436b4b52 + 48aed493ffa093728bc9ffd17be0e5957f77aade diff --git a/global.json b/global.json index 5c42fa7841..1dbfc4ac6a 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19321.75", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19322.2", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 5e68e7609df416b6cdc785a8f4c8cfcd668eb3f2 Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Mon, 24 Jun 2019 13:02:05 +0000 Subject: [PATCH 116/286] Update dependencies from https://github.com/dotnet/arcade build 20190623.4 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19323.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 83e38e2b0c..309516901a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 48aed493ffa093728bc9ffd17be0e5957f77aade + 9946534da4f73e6242ca105f6798ab58119c9ab0 diff --git a/global.json b/global.json index 1dbfc4ac6a..1f44c774f6 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19322.2", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19323.4", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 0de649d2b72c304fb589c6c51643d4cfe716b959 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Tue, 25 Jun 2019 10:40:36 +0200 Subject: [PATCH 117/286] Ignore ionide (#7059) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index e6feea6dfc..6162593d1e 100644 --- a/.gitignore +++ b/.gitignore @@ -126,3 +126,4 @@ tests/fsharpqa/testenv/bin/System.ValueTuple.dll msbuild.binlog /fcs/FSharp.Compiler.Service.netstandard/*.fs /fcs/FSharp.Compiler.Service.netstandard/*.fsi +/.ionide/ From 108428b864ab71537b4984b8f47c27953b744fe8 Mon Sep 17 00:00:00 2001 From: Volker Milbrandt Date: Tue, 25 Jun 2019 11:13:01 +0200 Subject: [PATCH 118/286] Update several links (#7055) * https instead of http for http://github.com, http://fsharp.org, https://fsharp.github.io, https://contributor-covenant.org * update link to git fo windows, https instead of http, mdlint warnings * link updated * replace http://api.github.com/ by https * update some links to https, mdlint warnings * update link * PR feedback --- CODE_OF_CONDUCT.md | 6 +- DEVGUIDE.md | 32 +- README.md | 16 +- .../post-build/sourcelink-validation.ps1 | 28 +- fcs/README.md | 22 +- fcs/RELEASE_NOTES.md | 286 +++++++++--------- fcs/docsrc/content/corelib.fsx | 26 +- fcs/docsrc/content/index.md | 96 +++--- fcs/docsrc/content/interactive.fsx | 60 ++-- fcs/docsrc/content/ja/corelib.fsx | 16 +- fcs/docsrc/tools/generate.fsx | 10 +- fcs/docsrc/tools/generate.ja.fsx | 2 +- fcs/docsrc/tools/templates/ja/template.cshtml | 4 +- fcs/docsrc/tools/templates/template.cshtml | 4 +- release-notes.md | 10 +- src/buildtools/README-fslexyacc.md | 4 +- .../FSharp.Core.nuget/FSharp.Core.nuspec | 2 +- src/fsharp/service/service.fsi | 88 +++--- .../Program.fs | 4 +- .../Program.fs | 4 +- .../Program.fs | 4 +- .../Program.fs | 4 +- .../Program.fs | 4 +- .../Program.fs | 4 +- .../Script.fsx | 2 +- .../Script.fsx | 2 +- .../Script.fsx | 2 +- .../Script.fsx | 2 +- .../Script.fsx | 2 +- .../Script.fsx | 2 +- .../Script.fsx | 2 +- .../Script.fsx | 2 +- .../ProjectWithBuildErrors/Program.fs | 13 +- .../Program.fs | 4 +- .../TestProjectChanges/Program.fs | 4 +- .../projects/vs2019slow/vs2019slow/Program.fs | 4 +- .../ConsoleProject/Template/Program.fs | 4 +- .../Template/xlf/Program.fs.cs.xlf | 4 +- .../Template/xlf/Program.fs.de.xlf | 4 +- .../Template/xlf/Program.fs.es.xlf | 4 +- .../Template/xlf/Program.fs.fr.xlf | 4 +- .../Template/xlf/Program.fs.it.xlf | 4 +- .../Template/xlf/Program.fs.ja.xlf | 4 +- .../Template/xlf/Program.fs.ko.xlf | 4 +- .../Template/xlf/Program.fs.pl.xlf | 4 +- .../Template/xlf/Program.fs.pt-BR.xlf | 4 +- .../Template/xlf/Program.fs.ru.xlf | 4 +- .../Template/xlf/Program.fs.tr.xlf | 4 +- .../Template/xlf/Program.fs.zh-Hans.xlf | 4 +- .../Template/xlf/Program.fs.zh-Hant.xlf | 4 +- .../LibraryProject/Template/Script.fsx | 2 +- .../Template/xlf/Script.fsx.cs.xlf | 4 +- .../Template/xlf/Script.fsx.de.xlf | 4 +- .../Template/xlf/Script.fsx.es.xlf | 4 +- .../Template/xlf/Script.fsx.fr.xlf | 4 +- .../Template/xlf/Script.fsx.it.xlf | 4 +- .../Template/xlf/Script.fsx.ja.xlf | 4 +- .../Template/xlf/Script.fsx.ko.xlf | 4 +- .../Template/xlf/Script.fsx.pl.xlf | 4 +- .../Template/xlf/Script.fsx.pt-BR.xlf | 4 +- .../Template/xlf/Script.fsx.ru.xlf | 4 +- .../Template/xlf/Script.fsx.tr.xlf | 4 +- .../Template/xlf/Script.fsx.zh-Hans.xlf | 4 +- .../Template/xlf/Script.fsx.zh-Hant.xlf | 4 +- .../TutorialProject/Template/Tutorial.fsx | 184 +++++------ .../Utils/LanguageServiceProfiling/Program.fs | 66 ++-- .../UnitTests/IndentationServiceTests.fs | 34 +-- 67 files changed, 581 insertions(+), 590 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index a22238d717..1c658245ed 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -40,7 +40,7 @@ Project maintainers who do not follow or enforce the Code of Conduct in good fai ## Attribution -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version] -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ +[homepage]: https://contributor-covenant.org +[version]: https://contributor-covenant.org/version/1/4/ diff --git a/DEVGUIDE.md b/DEVGUIDE.md index f9ebde61e5..1ee9c227d4 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -5,7 +5,7 @@ Get the latest source code from the master branch by running this git command: git clone https://github.com/dotnet/fsharp.git - + Before running the build scripts, ensure that you have cleaned up the visualfsharp repo by running this git command: git clean -xfd @@ -104,9 +104,9 @@ Or hard crash on launch ("Unknown Error"), delete these folders: The new builds of the Visual F# IDE Tools can no longer be installed into Visual Studio 2015. -You can install Visual Studio 2019 from https://www.visualstudio.com/downloads/. +You can install Visual Studio 2019 from . -**Note:** This step will install a VSIX extension into Visual Studio "Next" that changes the Visual F# IDE Tools +**Note:** This step will install a VSIX extension into Visual Studio "Next" that changes the Visual F# IDE Tools components installed in that VS installation. You can revert this step by disabling or uninstalling the addin. For **Debug**, uninstall then reinstall: @@ -157,25 +157,25 @@ See the "Debugging The Compiler" section of this [article](https://medium.com/@w ## Notes -#### Windows: Links to Additional frameworks +### Windows: Links to Additional frameworks -- [Git for windows](http://msysgit.github.io/) -- [.NET 4.6](http://www.microsoft.com/en-us/download/details.aspx?id=48137) -- [Windows 8.1 SDK](http://msdn.microsoft.com/en-us/library/windows/desktop/bg162891.aspx) +- [Git for windows](https://gitforwindows.org/) +- [.NET 4.6](https://www.microsoft.com/en-us/download/details.aspx?id=48137) +- [Windows 8.1 SDK](https://msdn.microsoft.com/en-us/library/windows/desktop/bg162891.aspx) - [Windows 10 SDK](https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk) -#### Notes on the Windows .NET Framework build +### Notes on the Windows .NET Framework build 1. The `update.cmd` script adds required strong name validation skips and NGens the compiler and libraries. This requires admin privileges. 1. The compiler binaries produced are "private" and strong-named signed with a test key. 1. Some additional tools are required to build the compiler, notably `fslex.exe`, `fsyacc.exe`, `FSharp.PowerPack.Build.Tasks.dll`, `FsSrGen.exe`, `FSharp.SRGen.Build.Tasks.dll`, and the other tools found in the `lkg` directory. 1. The overall bootstrapping process executes as follows - - We first need an existing F# compiler. We use the one in the `lkg` directory. Let's assume this compiler has an `FSharp.Core.dll` with version X. - - We use this compiler to compile the source in this distribution, to produce a "proto" compiler, dropped to the `proto` directory. When run, this compiler still relies on `FSharp.Core.dll` with version X. - - We use the proto compiler to compile the source for `FSharp.Core.dll` in this distribution. - - We use the proto compiler to compile the source for `FSharp.Compiler.dll`, `fsc.exe`, `fsi.exe`, and other binaries found in this distribution. + - We first need an existing F# compiler. We use the one in the `lkg` directory. Let's assume this compiler has an `FSharp.Core.dll` with version X. + - We use this compiler to compile the source in this distribution, to produce a "proto" compiler, dropped to the `proto` directory. When run, this compiler still relies on `FSharp.Core.dll` with version X. + - We use the proto compiler to compile the source for `FSharp.Core.dll` in this distribution. + - We use the proto compiler to compile the source for `FSharp.Compiler.dll`, `fsc.exe`, `fsi.exe`, and other binaries found in this distribution. -#### Updating FSComp.fs, FSComp.resx and XLF +### Updating FSComp.fs, FSComp.resx and XLF If your changes involve modifying the list of language keywords in any way, (e.g. when implementing a new keyword), the XLF localization files need to be synced with the corresponding resx files. This can be done automatically by running @@ -185,7 +185,7 @@ If your changes involve modifying the list of language keywords in any way, (e.g This only works on Windows/.NETStandard framework, so changing this from any other platform requires editing and syncing all of the XLF files manually. -#### Configuring proxy server +### Configuring proxy server If you are behind a proxy server, NuGet client tool must be configured to use it: @@ -195,6 +195,6 @@ If you are behind a proxy server, NuGet client tool must be configured to use it Where you should set proper proxy address, user name and password. -#### Resources +### Resources -The primary technical guide to the core compiler code is [The F# Compiler Technical Guide](http://fsharp.github.io/2015/09/29/fsharp-compiler-guide.html). Please read and contribute to that guide. +The primary technical guide to the core compiler code is [The F# Compiler Technical Guide](https://fsharp.github.io/2015/09/29/fsharp-compiler-guide.html). Please read and contribute to that guide. diff --git a/README.md b/README.md index 2eaa73a983..b5f8b936e6 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ These are the branches in use: * `dev15.9` - Long-term servicing branch for VS 2017 update 15.9.x. We do not expect to service that release, but if we do, that's where the changes will go. - + * `dev16.x` - Latest release branch for the particular point release of Visual Studio. - Incorporates features and fixes from master up to a particular branch point, then selective cherry-picks. @@ -84,8 +84,8 @@ Evolution of the F# language and core library follows a process spanning two add The following links can help you get an overview of some technical aspects of the F# language and compiler: -* [The F# Compiler Technical Guide](http://fsharp.github.io/2015/09/29/fsharp-compiler-guide.html) -* [The F# Language Specification](http://fsharp.org/specs/language-spec/) +* [The F# Compiler Technical Guide](https://fsharp.github.io/2015/09/29/fsharp-compiler-guide.html) +* [The F# Language Specification](https://fsharp.org/specs/language-spec/) ## License @@ -93,19 +93,19 @@ This project is subject to the MIT License. A copy of this license is in [Licens ## Code of Conduct -This project has adopted the [Contributor Covenant](http://contributor-covenant.org/) code of conduct to clarify expected behavior in our community. You can read it at [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md). +This project has adopted the [Contributor Covenant](https://contributor-covenant.org/) code of conduct to clarify expected behavior in our community. You can read it at [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md). ## Get In Touch -Members of the [F# Software Foundation](http://fsharp.org) are invited to the [FSSF Slack](http://fsharp.org/guides/slack/). You can find support from other contributors in the `#compiler` and `#editor-support` channels. +Members of the [F# Software Foundation](https://fsharp.org) are invited to the [FSSF Slack](https://fsharp.org/guides/slack/). You can find support from other contributors in the `#compiler` and `#editor-support` channels. Additionally, you can use the `#fsharp` tag on Twitter if you have general F# questions, including about this repository. Chances are you'll get multiple responses. -## About F# +## About F\# If you're curious about F# itself, check out these links: * [What is F#](https://docs.microsoft.com/dotnet/fsharp/what-is-fsharp) * [Get started with F#](https://docs.microsoft.com/dotnet/fsharp/get-started/) -* [F# Software Foundation](http://fsharp.org) -* [F# Testimonials](http://fsharp.org/testimonials) +* [F# Software Foundation](https://fsharp.org) +* [F# Testimonials](https://fsharp.org/testimonials) diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 index 8abd684e9e..84c97df1fc 100644 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -11,13 +11,13 @@ Set-StrictMode -Version 2.0 . $PSScriptRoot\..\tools.ps1 -# Cache/HashMap (File -> Exist flag) used to consult whether a file exist +# Cache/HashMap (File -> Exist flag) used to consult whether a file exist # in the repository at a specific commit point. This is populated by inserting # all files present in the repo at a specific commit point. $global:RepoFiles = @{} $ValidatePackage = { - param( + param( [string] $PackagePath # Full path to a Symbols.NuGet package ) @@ -32,7 +32,7 @@ $ValidatePackage = { # Extensions for which we'll look for SourceLink information # For now we'll only care about Portable & Embedded PDBs $RelevantExtensions = @(".dll", ".exe", ".pdb") - + Write-Host -NoNewLine "Validating" ([System.IO.Path]::GetFileName($PackagePath)) "... " $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) @@ -46,13 +46,13 @@ $ValidatePackage = { try { $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) - $zip.Entries | + $zip.Entries | Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | ForEach-Object { $FileName = $_.FullName $Extension = [System.IO.Path]::GetExtension($_.Name) $FakeName = -Join((New-Guid), $Extension) - $TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName + $TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName # We ignore resource DLLs if ($FileName.EndsWith(".resources.dll")) { @@ -62,7 +62,7 @@ $ValidatePackage = { [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) $ValidateFile = { - param( + param( [string] $FullPath, # Full path to the module that has to be checked [string] $RealPath, [ref] $FailedFiles @@ -83,7 +83,7 @@ $ValidatePackage = { ForEach-Object { $Link = $_ $CommitUrl = "https://raw.githubusercontent.com/${using:GHRepoName}/${using:GHCommit}/" - + $FilePath = $Link.Replace($CommitUrl, "") $Status = 200 $Cache = $using:RepoFiles @@ -91,7 +91,7 @@ $ValidatePackage = { if ( !($Cache.ContainsKey($FilePath)) ) { try { $Uri = $Link -as [System.URI] - + # Only GitHub links are valid if ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match "github" -or $Uri.Host -match "githubusercontent")) { $Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode @@ -128,15 +128,15 @@ $ValidatePackage = { } } } - + &$ValidateFile $TargetFile $FileName ([ref]$FailedFiles) } } catch { - + } finally { - $zip.Dispose() + $zip.Dispose() } if ($FailedFiles -eq 0) { @@ -163,13 +163,13 @@ function ValidateSourceLinkLinks { ExitWithExitCode 1 } - $RepoTreeURL = -Join("http://api.github.com/repos/", $GHRepoName, "/git/trees/", $GHCommit, "?recursive=1") + $RepoTreeURL = -Join("https://api.github.com/repos/", $GHRepoName, "/git/trees/", $GHCommit, "?recursive=1") $CodeExtensions = @(".cs", ".vb", ".fs", ".fsi", ".fsx", ".fsscript") try { # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash $Data = Invoke-WebRequest $RepoTreeURL -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty tree - + foreach ($file in $Data) { $Extension = [System.IO.Path]::GetExtension($file.path) @@ -183,7 +183,7 @@ function ValidateSourceLinkLinks { Write-Host $_ ExitWithExitCode 1 } - + if (Test-Path $ExtractPath) { Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue } diff --git a/fcs/README.md b/fcs/README.md index f0126f369c..e176ffb142 100644 --- a/fcs/README.md +++ b/fcs/README.md @@ -1,5 +1,3 @@ - - # The FSharp.Compiler.Service components and NuGet package This directory contains the build, packaging, test and documentation-generation logic for the NuGet package ``FSharp.Compiler.Service``. The source for this NuGet @@ -11,7 +9,7 @@ Basically we are packaging up the compiler as a DLL and publishing it as a NuGet There are subtle differences between FSharp.Compiler.Service and FSharp.Compiler.Private (shipped with the Visual F# Tools) -- FCS has a public API +- FCS has a public API - FCS is built against **.NET 4.6.1** and **FSharp.Core NuGet 4.6.2** to give broader reach @@ -64,10 +62,9 @@ which does things like: You can push the packages if you have permissions, either automatically using ``build Release`` or manually set APIKEY=... - ..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.22.0.3.nupkg %APIKEY% -Source https://nuget.org + ..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.22.0.3.nupkg %APIKEY% -Source https://nuget.org ..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.MSBuild.v12.22.0.3.nupkg %APIKEY% -Source https://nuget.org ..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.ProjectCracker.22.0.3.nupkg %APIKEY% -Source https://nuget.org - ### Use of Paket and FAKE @@ -77,23 +74,21 @@ FAKE is only used to run build.fsx. Eventually we will likely remove this once ### Testing -Testing reuses the test files from ..\tests\service which were are also FCS tests. - +Testing reuses the test files from ..\tests\service which were are also FCS tests. ### Documentation Generation fcs\build GenerateDocs -Output is in ``docs``. In the ``FSharp.Compiler.Service`` repo this is checked in and hosted as http://fsharp.github.io/FSharp.Compiler.Service. - +Output is in ``docs``. In the ``FSharp.Compiler.Service`` repo this is checked in and hosted as . ## The two other NuGet packages -It also contains both the source, build, packaging and test logic for +It also contains both the source, build, packaging and test logic for -* ``FSharp.Compiler.Service.MSBuild.v12`` adds legacy MSBuild v12 support to an instance of FSharp.Compiler.Service, if exact compatibility for scripting references such as ``#r "Foo, Version=1.3.4"`` is required. +- ``FSharp.Compiler.Service.MSBuild.v12`` adds legacy MSBuild v12 support to an instance of FSharp.Compiler.Service, if exact compatibility for scripting references such as ``#r "Foo, Version=1.3.4"`` is required. -* ``FSharp.Compiler.Service.ProjectCracker`` is part of ``FsAutoComplete`` and Ionide and is used to crack old-style project formats using MSBuild. It used to be part of the FCS API. +- ``FSharp.Compiler.Service.ProjectCracker`` is part of ``FsAutoComplete`` and Ionide and is used to crack old-style project formats using MSBuild. It used to be part of the FCS API. Both of these components are gradually becoming obsolete @@ -102,8 +97,7 @@ Both of these components are gradually becoming obsolete FSharp.Compiler.Service is a somewhat awkward component. There are some things we can do to simplify things: 1. Remove the use of Paket and FAKE -1. Move all projects under fcs\... to new .NET SDK project file format +1. Move all projects under fcs\... to new .NET SDK project file format 1. Drop the use of ``dotnet mergenupkg`` since we should be able to use cross targeting 1. Make FCS a DLL similar ot the rest of the build and make this an official component from Microsoft (signed etc.) 1. Replace FSharp.Compiler.Private by FSharp.Compiler.Service - diff --git a/fcs/RELEASE_NOTES.md b/fcs/RELEASE_NOTES.md index d925996ddf..e1cb2f3ecb 100644 --- a/fcs/RELEASE_NOTES.md +++ b/fcs/RELEASE_NOTES.md @@ -15,23 +15,23 @@ * Use new .NET SDK project files * FSharp.Compiler.Service nuget now uses net461 and netstandard2.0 * FSharp.Compiler.Service netstandard2.0 now supports type providers - + #### 19.0.1 * Rename ``LogicalEnclosingEntity`` to ``ApparentEnclosingEntity`` for consistency int he F# codebase terminology. * Rename ``EnclosingEntity`` to ``DeclaringEntity``. In the case of extension properties, ``EnclosingEntity`` was incorrectly returning the logical enclosing entity (i.e. the type the property appears to extend), and in this case ``ApparentEnclosingEntity`` should be used instead. - + #### 18.0.1 * Integrate visualfsharp master - + #### 17.0.2 * Integrate visualfsharp master - + #### 16.0.3 * [File name deduplication not working with ParseAndCheckFileInProject](https://github.com/fsharp/FSharp.Compiler.Service/issues/819) - + #### 16.0.2 * [ProjectCracker returns *.fsi files in FSharpProjectOptions.SourceFiles array](https://github.com/fsharp/FSharp.Compiler.Service/pull/812) - + * [Fix line endings in the Nuget packages descriptions](https://github.com/fsharp/FSharp.Compiler.Service/pull/811) #### 16.0.1 @@ -49,15 +49,15 @@ #### 13.0.1 * Move docs --> docssrc - + #### 13.0.0 * Move FSharp.Compiler.Service.MSBuild.v12.dll to a separate nuget package - + #### 12.0.8 * Set bit on output executables correctly - + #### 12.0.7 - * Integrate visualfsharp master + * Integrate visualfsharp master #### 12.0.6 * [758: Fix project cracker when invalid path given](https://github.com/fsharp/FSharp.Compiler.Service/pull/758) @@ -189,54 +189,54 @@ * Expose QualifiedName and FileName of FSharpImplementationFileContents * Add FSharpErrorInfo.ErrorNumber -#### 2.0.0.1-beta +#### 2.0.0.1-beta * Fix 452 - FSharpField.IsMutable = true for BCL enum cases * Fix 414 - Add IsInstanceMemberInCompiledCode -#### 2.0.0.0-beta -* Feature #470, #478, #479 - Move ProjectCracker to separate nuget package and DLL, used ProjectCrackerTool.exe to run +#### 2.0.0.0-beta +* Feature #470, #478, #479 - Move ProjectCracker to separate nuget package and DLL, used ProjectCrackerTool.exe to run * Feature #463 - Expose slot signatures of members in object expressions -* Feature #469, #475 - Add EvalExpressionNonThrowing, EvalInteractionNonThrowing, EvalScriptNonThrowing +* Feature #469, #475 - Add EvalExpressionNonThrowing, EvalInteractionNonThrowing, EvalScriptNonThrowing * Fix #456 - FCS makes calls to kernel32.dll when running on OSX * Fix #473 - stack overflow in resolution logic * Fix #460 - Failure getting expression for a provided method call -#### 1.4.2.3 - -* Fix bug in loop optimization, apply https://github.com/Microsoft/visualfsharp/pull/756/ +#### 1.4.2.3 - +* Fix bug in loop optimization, apply https://github.com/Microsoft/visualfsharp/pull/756/ -#### 1.4.2.2 - +#### 1.4.2.2 - * #488 - Performance problems with project references -#### 1.4.2.1 - -* #450 - Correct generation of ReferencedProjects +#### 1.4.2.1 - +* #450 - Correct generation of ReferencedProjects -#### 1.4.2.0 - +#### 1.4.2.0 - * Fix bug in double lookup of cache, see https://github.com/fsharp/FSharp.Compiler.Service/pull/447 -#### 1.4.1 - +#### 1.4.1 - * Add pause before backgrounnd work starts. The FCS request queue must be empty for 1 second before work will start * Write trace information about the reactor queue to the event log * Rewrite reactor to consistently prioritize queued work * Implement cancellation for queued work if it is cancelled prior to being executed * Adjust caching to check cache correctly if there is a gap before the request is executed -#### 1.4.0.9 - +#### 1.4.0.9 - * FSharpType.Format fix * Disable maximum-memory trigger by default until use case ironed out -#### 1.4.0.8 - +#### 1.4.0.8 - * FSharpType.Format now prettifies type variables. If necessary, FSharpType.Prettify can also be called -* Add maximum-memory trigger to downsize FCS caches. Defaults to 1.7GB of allocaed memory in the system +* Add maximum-memory trigger to downsize FCS caches. Defaults to 1.7GB of allocaed memory in the system process for a 32-bit process, and 2x this for a 64-bit process -#### 1.4.0.7 - +#### 1.4.0.7 - * fix 427 - Make event information available for properties which represent first-class uses of F#-declared events * fix 410 - Symbols for C# fields (and especially enum fields) * Expose implemented abstract slots * Fix problem with obscure filenames caught by Microsoft\visualfsharp tests * Integrate with visualfsharp master -#### 1.4.0.6 - +#### 1.4.0.6 - * fix 423 - Symbols for non-standard C# events * fix 235 - XmlDocSigs for references assemblies * fix 177 - GetAllUsesOfAllSymbolsInFile returns nothing for C# nested enum @@ -244,19 +244,19 @@ * Exposing assembly attributes on FSharpAssemblySignature * clean up IncrementalFSharpBuild.frameworkTcImportsCache -#### 1.4.0.5 - -* add more entries to FSharpTokenTag +#### 1.4.0.5 - +* add more entries to FSharpTokenTag -#### 1.4.0.4 - -* add more entries to FSharpTokenTag +#### 1.4.0.4 - +* add more entries to FSharpTokenTag * add PrettyNaming.QuoteIdentifierIfNeeded and PrettyNaming.KeywordNames -#### 1.4.0.3 - +#### 1.4.0.3 - * integrate Microsoft/visualfsharp OOB cleanup via fsharp/fsharp * Make Parser and Lexer private -#### 1.4.0.2 - -* #387 - types and arrays in F# attribute contructor arguments +#### 1.4.0.2 - +* #387 - types and arrays in F# attribute contructor arguments #### 1.4.0.1 - F# 4.0 support * Use FSharp.Core 4.4.0.0 by default for scripting scenarios if not FSharp.Core referenced by host process @@ -268,164 +268,164 @@ * simplified source indexing with new SourceLink * Add noframework option in AST compiler methods -#### 0.0.90 - +#### 0.0.90 - * Add fix for #343 Use ResolveReferences task * Expose BinFolderOfDefaultFSharpCompiler to editors * Fix the registry checking on mono to avoid unnecessary exceptions being thrown -#### 0.0.89 - +#### 0.0.89 - * Fix output location of referenced projects -#### 0.0.88 - +#### 0.0.88 - * Added Fix to allow implicit PCL references to be retrieved -#### 0.0.87 - +#### 0.0.87 - * Don't report fake symbols in indexing #325 * Add EnclosingEntity for an active pattern group #327 * Add ImmediateSubExpressions #284 * integrate fsharp/fsharp master into master -#### 0.0.85 - +#### 0.0.85 - * Fix for FSharpSymbolUse for single case union type #301 * Added supprt for ReturnParameter in nested functions -#### 0.0.84 - +#### 0.0.84 - * Added curried parameter groups for nested functions -#### 0.0.83 - +#### 0.0.83 - * Add Overloads to the symbols signature so it is publicly visible * Update OnEvaluation event to have FSharpSymbolUse information available -#### 0.0.82 - +#### 0.0.82 - * Better support for Metadata of C# (and other) Assemblies. * Expose the DefaultFileSystem as a type instead of anonymous -#### 0.0.81 - +#### 0.0.81 - * Update GetDeclarationListSymbols to expose FSharpSymbolUse * Improve reporting of format specifiers -#### 0.0.80 - +#### 0.0.80 - * Update to latest F# 3.1.3 (inclunding updated FsLex/FsYacc used in build of FCS) * Report printf specifiers from Service API -* Improve Accessibility of non-F# symbols +* Improve Accessibility of non-F# symbols -#### 0.0.79 - +#### 0.0.79 - * Do not use memory mapped files when cracking a DLL to get an assembly reference * Fix for multilanguage projects in project cracker -#### 0.0.78 - +#### 0.0.78 - * Reduce background checker memory usage * add docs on FSharp.Core * docs on caches and queues -#### 0.0.77 - +#### 0.0.77 - * Update to github.com/fsharp/fsharp 05f426cee85609f2fe51b71473b07d7928bb01c8 -#### 0.0.76 - +#### 0.0.76 - * Fix #249 - Fix TryFullName when used on namespaces of provided erased type definitions * Add OnEvaluation event to FCS to allow detailed information to be exposed -#### 0.0.75 - +#### 0.0.75 - * Do not use shared cursor for IL binaries (https://github.com/fsprojects/VisualFSharpPowerTools/issues/822) -#### 0.0.74 - +#### 0.0.74 - * Extension members are returned as members of current modules -* Fix exceptions while cross-reference a type provider project +* Fix exceptions while cross-reference a type provider project -#### 0.0.73 - +#### 0.0.73 - * Add AssemblyContents and FSharpExpr to allow access to resolved, checked expression trees * Populate ReferencedProjects using ProjectFileInfo * Fix finding symbols declared in signature files * Add logging to project cracking facility -#### 0.0.72 - -* Allow project parser to be used on project file with relative paths +#### 0.0.72 - +* Allow project parser to be used on project file with relative paths * Expose attributes for non-F# symbols -#### 0.0.71 - +#### 0.0.71 - * More renamings in SourceCodeServices API for more consistent use of 'FSharp' prefix -#### 0.0.70 - +#### 0.0.70 - * Make FSharpProjectFileParser public * Fixes to project parser for Mono (.NET 4.0 component) * Renamings in SourceCodeServices API for more consistent use of 'FSharp' prefix -#### 0.0.67 - +#### 0.0.67 - * Fixes to project parser for Mono -#### 0.0.66 - +#### 0.0.66 - * Fixes to project parser for Mono * Use MSBuild v12.0 for reference resolution on .NET 4.5+ -#### 0.0.65 - +#### 0.0.65 - * Fixes to project parser -#### 0.0.64 - +#### 0.0.64 - * Add project parser, particularly GetProjectOptionsFromProjectFile -#### 0.0.63 - +#### 0.0.63 - * #221 - Normalize return types of .NET events -#### 0.0.62 - -* Integrate to latest http://github.com/fsharp/fsharp (#80f9221f811217bd890b3a670d717ebc510aeeaf) +#### 0.0.62 - +* Integrate to latest https://github.com/fsharp/fsharp (#80f9221f811217bd890b3a670d717ebc510aeeaf) -#### 0.0.61 - -* #216 - Return associated getters/setters from F# properties -* #214 - Added missing XmlDocSig for FSharpMemberOrFunctionOrValue's Events, Methods and Properties -* #213 - Retrieve information for all active pattern cases +#### 0.0.61 - +* #216 - Return associated getters/setters from F# properties +* #214 - Added missing XmlDocSig for FSharpMemberOrFunctionOrValue's Events, Methods and Properties +* #213 - Retrieve information for all active pattern cases * #188 - Fix leak in file handles when using multiple instances of FsiEvaluationSession, and add optionally collectible assemblies -#### 0.0.60 - -* #207 - Add IsLiteral/LiteralValue to FSharpField -* #205 - Add IsOptionalArg and related properties to FSharpParameter -* #210 - Check default/override members via 'IsOverrideOrExplicitMember' -* #209 - Add TryFullName to FSharpEntity +#### 0.0.60 - +* #207 - Add IsLiteral/LiteralValue to FSharpField +* #205 - Add IsOptionalArg and related properties to FSharpParameter +* #210 - Check default/override members via 'IsOverrideOrExplicitMember' +* #209 - Add TryFullName to FSharpEntity -#### 0.0.59 - -* Fix for #184 - Fix EvalScript by using verbatim string for #Load +#### 0.0.59 - +* Fix for #184 - Fix EvalScript by using verbatim string for #Load * Fix for #183 - The line no. reporting is still using 0-based indexes in errors. This is confusing. -#### 0.0.58 - +#### 0.0.58 - * Fix for #156 - The FSharp.Core should be retrieved from the hosting environment -#### 0.0.57 - +#### 0.0.57 - * Second fix for #160 - Nuget package now contains .NET 4.0 and 4.5 -#### 0.0.56 - +#### 0.0.56 - * Fix for #160 - Nuget package contains .NET 4.0 and 4.5 -#### 0.0.55 - +#### 0.0.55 - * Integrate changes for F# 3.1.x, Fix #166 -#### 0.0.54 - -* Fix for #159 - Unsubscribe from TP Invalidate events when disposing builders +#### 0.0.54 - +* Fix for #159 - Unsubscribe from TP Invalidate events when disposing builders -#### 0.0.53 - +#### 0.0.53 - * Add queue length to InteractiveChecker -#### 0.0.52 - +#### 0.0.52 - * Fix caches keeping hold of stale entries -#### 0.0.51 - +#### 0.0.51 - * Add IsAccessible to FSharpSymbol, and ProjectContext.AccessibilityRights to give the context of an access -#### 0.0.50 - -* Fix #79 - FindUsesOfSymbol returns None at definition of properties with explicit getters and setters +#### 0.0.50 - +* Fix #79 - FindUsesOfSymbol returns None at definition of properties with explicit getters and setters -#### 0.0.49 - -* Fix #138 - Fix symbol equality for provided type members +#### 0.0.49 - +* Fix #138 - Fix symbol equality for provided type members * Fix #150 - Return IsGetterMethod = true for declarations of F# properties (no separate 'property' symbol is yet returned, see #79) * Fix #132 - Add IsStaticInstantiation on FSharpEntity to allow clients to detect fake symbols arising from application of static parameters * Fix #154 - Add IsArrayType on FSharpEntity to allow clients to detect the symbols for array types * Fix #96 - Return resolutions of 'Module' and 'Type' in "Module.field" and "Type.field" -#### 0.0.48 - +#### 0.0.48 - * Allow own fsi object without referencing FSharp.Compiler.Interactive.Settings.dll (#127) -#### 0.0.47 - +#### 0.0.47 - * Adjust fix for #143 for F# types with abstract+default events -#### 0.0.46 - +#### 0.0.46 - * Fix multi-project analysis when referenced projects have changed (#141) * Fix process exit on bad arguments to FsiEvaluationSession (#126) * Deprecate FsiEvaluationSession constructor and add FsiEvaluationSession.Create static method to allow for future API that can return errors @@ -435,170 +435,170 @@ * Change IsProperty and IsEvent to only return true for the symbols for properties and events, rather than the methods associated with these * Fix value of Assembly for some symbols (e.g. property symbols) -#### 0.0.45 - +#### 0.0.45 - * Add optional project cache size parameter to InteractiveChecker * Switch to openBinariesInMemory for SimpleSourceCodeServices * Cleanup SimpleSourceCodeServices to avoid code duplication -#### 0.0.44 - -* Integrate latest changes from visualfsharp.codeplex.com via github.com/fsharp/fsharp +#### 0.0.44 - +* Integrate latest changes from visualfsharp.codeplex.com via github.com/fsharp/fsharp * Fix problem with task that generates description text of declaration * Add AllInterfaceTypes to FSharpEntity and FSharpType * Add BaseType to FSharpType to propagate instantiation -* Add Instantiate to FSharpType +* Add Instantiate to FSharpType -#### 0.0.43 - -* Fix #109 - Duplicates in GetUsesOfSymbolInFile +#### 0.0.43 - +* Fix #109 - Duplicates in GetUsesOfSymbolInFile -#### 0.0.42 - +#### 0.0.42 - * Fix #105 - Register enum symbols in patterns * Fix #107 - Return correct results for inheritance chain of .NET types * Fix #101 - Add DeclaringEntity property -#### 0.0.41 - +#### 0.0.41 - * Fixed #104 - Make all operations that may utilize the FCS reactor async * Add FSharpDisplayContext and FSharpType.Format * Replace GetSymbolAtLocationAlternate by GetSymbolUseAtLocation -#### 0.0.40 - +#### 0.0.40 - * Fixed #86 - Expose Microsoft.FSharp.Compiler.Interactive.Shell.Settings.fsi * Fixed #99 - Add IsNamespace property to FSharpEntity -#### 0.0.39 - +#### 0.0.39 - * Fixed #79 - Usage points for symbols in union patterns -#### 0.0.38 - +#### 0.0.38 - * Fixed #94 and #89 by addition of new properties to the FSharpSymbolUse type * Fixed #93 by addition of IsOpaque to FSharpEntity type * Fixed #92 - Issue with nested classes * Fixed #87 - Allow analysis of members from external assemblies -#### 0.0.37 - +#### 0.0.37 - * Obsolete HasDefaultValue - see https://github.com/fsharp/FSharp.Compiler.Service/issues/77 -#### 0.0.36 - +#### 0.0.36 - * Fix #71 - Expose static parameters and xml docs of type providers * Fix #63 - SourceCodeServices: #r ignores include paths passed as command-line flags -#### 0.0.35 - +#### 0.0.35 - * Fix #38 - FSharp.Compiler.Services should tolerate an FSharp.Core without siginfo/optdata in the search path -#### 0.0.34 - +#### 0.0.34 - * Add StaticParameters property to entities, plus FSharpStaticParameter symbol * Fix #65 -#### 0.0.33 - +#### 0.0.33 - * Add FullName and Assembly properties for symbols * Fix #76 * Add Japanese documentation -#### 0.0.32 - +#### 0.0.32 - * Make ParseFileInProject asynchronous * Add ParseAndCheckFileInProject * Use cached results in ParseAndCheckFileInProject if available -#### 0.0.31 - +#### 0.0.31 - * Fix performance problem with CheckFileInProject -#### 0.0.30 - +#### 0.0.30 - * Add initial prototype version of multi-project support, through optional ProjectReferences in ProjectOptions. Leave this empty to use DLL/file-based references to results from other projects. -#### 0.0.29 - +#### 0.0.29 - * Fix symbols for named union fields in patterns -#### 0.0.28 - +#### 0.0.28 - * Fix symbols for named union fields -* Add FSharpActivePatternCase to refine FSharpSymbol +* Add FSharpActivePatternCase to refine FSharpSymbol -#### 0.0.27 - +#### 0.0.27 - * Fix exception tag symbol reporting -#### 0.0.26 - +#### 0.0.26 - * Fix off-by-one in reporting of range for active pattern name -#### 0.0.25 - +#### 0.0.25 - * Add optional source argument to TryGetRecentTypeCheckResultsForFile to specify that source must match exactly -#### 0.0.24 - +#### 0.0.24 - * Update version number as nuget package may not have published properly -#### 0.0.23 - +#### 0.0.23 - * Move to one-based line numbering everywhere * Provide better symbol information for active patterns -#### 0.0.22 - +#### 0.0.22 - * Provide symbol location for type parameters -#### 0.0.21 - +#### 0.0.21 - * Add GetUsesOfSymbolInFile * Better symbol resolution results for type parameter symbols -#### 0.0.20 - +#### 0.0.20 - * Update version number as nuget package may not have published properly -#### 0.0.19 - +#### 0.0.19 - * Change return type of GetAllUsesOfSymbol, GetAllUsesOfAllSymbols and GetAllUsesOfAllSymbolsInFile to FSharpSymbolUse * Add symbol uses when an abstract member is implemented. -#### 0.0.18 - +#### 0.0.18 - * Add GetAllUsesOfAllSymbols and GetAllUsesOfAllSymbolsInFile -#### 0.0.17 - -* Improvements to symbol accuracy w.r.t. type abbreviations +#### 0.0.17 - +* Improvements to symbol accuracy w.r.t. type abbreviations -#### 0.0.16 - +#### 0.0.16 - * Make FSharpEntity.BaseType return an option * FsiSesion got a new "EvalScript" method which allows to evaluate .fsx files -#### 0.0.15 - +#### 0.0.15 - * Update version number as nuget package may not have published properly -#### 0.0.14 - +#### 0.0.14 - * Update version number as nuget package may not have published properly -#### 0.0.13-alpha - +#### 0.0.13-alpha - * Fix #39 - Constructor parameters are mistaken for record fields in classes -#### 0.0.12-alpha - +#### 0.0.12-alpha - * Make the parts of the lexer/parser used by 'XmlDoc' tools in F# VS Power tools public -#### 0.0.11-alpha - -* Add 'IsUnresolved' +#### 0.0.11-alpha - +* Add 'IsUnresolved' -#### 0.0.10-alpha - +#### 0.0.10-alpha - * Fix bug where 'multiple references to FSharp.Core' was given as error for scripts -#### 0.0.9-alpha - +#### 0.0.9-alpha - * Fix fsc corrupting assemblies when generating pdb files (really) * Give better error messages for missing assemblies * Report more information about symbols returned by GetSymbolAtLocation (through subtypes) * Fix typos in docs -* Return full project results from ParseAndCheckInteraction +* Return full project results from ParseAndCheckInteraction * Be more robust to missing assembly references by default. -#### 0.0.8-alpha - +#### 0.0.8-alpha - * Fix fsc corrupting assemblies when generating pdb files -#### 0.0.7-alpha - +#### 0.0.7-alpha - * Fix docs * Make symbols more robust to missing assemblies * Be robust to failures on IncrementalBuilder creation * Allow use of MSBuild resolution by IncrementalBuilder -#### 0.0.6-alpha - +#### 0.0.6-alpha - * Fix version number -#### 0.0.5-alpha - +#### 0.0.5-alpha - * Added GetUsesOfSymbol(), FSharpSymbol type, GetSymbolAtLocation(...) -#### 0.0.4-alpha - +#### 0.0.4-alpha - * Added documentation of file system API * Reporte errors correctly from ParseAndCheckProject -#### 0.0.3-alpha - +#### 0.0.3-alpha - * Integrate FSharp.PowerPack.Metadata as the FSharp* symbol API * Renamed Param --> MethodGroupItemParameter and hid record from view, made into an object * Renamed Method --> MethodGroupItem and hid record from view, made into an object @@ -615,15 +615,15 @@ * Added numerous methods to API including CheckFileInProject * Added experimental GetBackgroundCheckResultsForFileInProject, GetBackgroundParseResultsForFileInProject * Added PartialAssemblySignature to TypeCheckResults/CheckFileResults -* Added CurrentPartialAssemblySignature to FsiEvaluationSession -* Added ParseAndCheckInteraction to FsiEvaluationSession to support intellisense implementation against a script fragment +* Added CurrentPartialAssemblySignature to FsiEvaluationSession +* Added ParseAndCheckInteraction to FsiEvaluationSession to support intellisense implementation against a script fragment * Added initial testing in tests/service * Added ParseAndCheckProject to SourceCodeServices API. This will eventually return "whole project" information such as symbol tables. * Added GetDefaultConfiguration to simplify process of configuring FsiEvaluationSession * Added PartialAssemblySignatureUpdated event to FsiEvaluationSession * Added travis build -#### 0.0.2-alpha - +#### 0.0.2-alpha - * Integrate hosted FSI configuration, SimpleSourceCodeServices, cleanup to SourceCodeServices API diff --git a/fcs/docsrc/content/corelib.fsx b/fcs/docsrc/content/corelib.fsx index 4e175e95ee..a0c1e85f02 100644 --- a/fcs/docsrc/content/corelib.fsx +++ b/fcs/docsrc/content/corelib.fsx @@ -8,16 +8,16 @@ Shipping an FSharp.Core with your application --------------------------------------------- When building applications or plug-in components which use FSharp.Compiler.Service.dll, you will normally also -include a copy of FSharp.Core.dll as part of your application. +include a copy of FSharp.Core.dll as part of your application. For example, if you build a ``HostedCompiler.exe``, you will normally place an FSharp.Core.dll (say 4.3.1.0) alongside -your ``HostedCompiler.exe``. +your ``HostedCompiler.exe``. Binding redirects for your application -------------------------------------- The FSharp.Compiler.Service.dll component depends on FSharp.Core 4.4.0.0. Normally your application will target -a later version of FSharp.Core, and you may need a [binding redirect](http://msdn.microsoft.com/en-us/library/7wd6ex19(v=vs.110).aspx) to ensure +a later version of FSharp.Core, and you may need a [binding redirect](https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions) to ensure that other versions of FSharp.Core forward to the final version of FSharp.Core.dll your application uses. Binding redirect files are normally generated automatically by build tools. If not, you can use one like this (if your tool is called ``HostedCompiler.exe``, the binding redirect file is called ``HostedCompiler.exe.config``) @@ -37,7 +37,7 @@ Some other dependencies may also need to be reconciled and forwarded. - + Which FSharp.Core and .NET Framework gets referenced in compilation? @@ -51,18 +51,18 @@ To target a specific FSharp.Core and/or .NET Framework assemblies, use the ``--n and the appropriate command-line arguments: [] - let fsharpCorePath = + let fsharpCorePath = @"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.1.0\FSharp.Core.dll" - let errors2, exitCode2 = + let errors2, exitCode2 = scs.Compile( - [| "fsc.exe"; "--noframework"; - "-r"; fsharpCorePath; - "-r"; @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll"; - "-o"; fn3; + [| "fsc.exe"; "--noframework"; + "-r"; fsharpCorePath; + "-r"; @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll"; + "-o"; fn3; "-a"; fn2 |]) You will need to determine the location of these assemblies. The easiest way to locate these DLLs in a cross-platform way and -convert them to command-line arguments is to [crack an F# project file](http://fsharp.github.io/FSharp.Compiler.Service/project.html). +convert them to command-line arguments is to [crack an F# project file](https://fsharp.github.io/FSharp.Compiler.Service/project.html). Alternatively you can compute SDK paths yourself, and some helpers to do this are in [the tests for FSharp.Compiler.Service.dll](https://github.com/fsharp/FSharp.Compiler.Service/blob/8a943dd3b545648690cb3bed652a469bdb6dd869/tests/service/Common.fs#L54). @@ -73,9 +73,9 @@ If you do _not_ explicitly reference an FSharp.Core.dll from an SDK location, or using ``FsiEvaluationSession`` or ``GetCheckOptionsFromScriptRoot``, then an implicit reference to FSharp.Core will be made by the following choice: -1. The version of FSharp.Core.dll statically referenced by the host assembly returned by ``System.Reflection.Assembly.GetEntryAssembly()``. +1. The version of FSharp.Core.dll statically referenced by the host assembly returned by ``System.Reflection.Assembly.GetEntryAssembly()``. -2. If there is no static reference to FSharp.Core in the host assembly, then +2. If there is no static reference to FSharp.Core in the host assembly, then - For FSharp.Compiler.Service 1.4.0.x above (F# 4.0 series), a reference to FSharp.Core version 4.4.0.0 is added diff --git a/fcs/docsrc/content/index.md b/fcs/docsrc/content/index.md index 859348b05f..13cb0926ab 100644 --- a/fcs/docsrc/content/index.md +++ b/fcs/docsrc/content/index.md @@ -3,7 +3,7 @@ F# Compiler Services The F# compiler services package is a component derived from the F# compiler source code that exposes additional functionality for implementing F# language bindings, additional -tools based on the compiler or refactoring tools. The package also includes F# +tools based on the compiler or refactoring tools. The package also includes F# interactive service that can be used for embedding F# scripting into your applications.
@@ -23,36 +23,36 @@ Available services The project currently exposes the following services that are tested & documented on this page. The libraries contain additional public API that can be used, but is not documented here. - * [**F# Language tokenizer**](tokenizer.html) - turns any F# source code into a stream of tokens. - Useful for implementing source code colorization and basic tools. Correctly handle nested - comments, strings etc. - - * [**Processing untyped AST**](untypedtree.html) - allows accessing the untyped abstract syntax tree (AST). - This represents parsed F# syntax without type information and can be used to implement code formatting - and various simple processing tasks. - - * [**Using editor (IDE) services**](editor.html) - expose functionality for auto-completion, tool-tips, - parameter information etc. These functions are useful for implementing F# support for editors - and for getting some type information for F# code. - - * [**Working with signatures, types, and resolved symbols**](symbols.html) - many services related to type checking - return resolved symbols, representing inferred types, and the signatures of whole assemblies. - - * [**Working with resolved expressions**](typedtree.html) - services related to working with - type-checked expressions and declarations, where names have been resolved to symbols. - - * [**Working with projects and project-wide analysis**](project.html) - you can request a check of - an entire project, and ask for the results of whole-project analyses such as find-all-references. - - * [**Hosting F# interactive**](interactive.html) - allows calling F# interactive as a .NET library - from your .NET code. You can use this API to embed F# as a scripting language in your projects. - - * [**Hosting the F# compiler**](compiler.html) - allows you to embed calls to the F# compiler. - - * [**File system API**](filesystem.html) - the `FSharp.Compiler.Service` component has a global variable - representing the file system. By setting this variable you can host the compiler in situations where a file system - is not available. - +* [**F# Language tokenizer**](tokenizer.html) - turns any F# source code into a stream of tokens. + Useful for implementing source code colorization and basic tools. Correctly handle nested + comments, strings etc. + +* [**Processing untyped AST**](untypedtree.html) - allows accessing the untyped abstract syntax tree (AST). + This represents parsed F# syntax without type information and can be used to implement code formatting + and various simple processing tasks. + +* [**Using editor (IDE) services**](editor.html) - expose functionality for auto-completion, tool-tips, + parameter information etc. These functions are useful for implementing F# support for editors + and for getting some type information for F# code. + +* [**Working with signatures, types, and resolved symbols**](symbols.html) - many services related to type checking + return resolved symbols, representing inferred types, and the signatures of whole assemblies. + +* [**Working with resolved expressions**](typedtree.html) - services related to working with + type-checked expressions and declarations, where names have been resolved to symbols. + +* [**Working with projects and project-wide analysis**](project.html) - you can request a check of + an entire project, and ask for the results of whole-project analyses such as find-all-references. + +* [**Hosting F# interactive**](interactive.html) - allows calling F# interactive as a .NET library + from your .NET code. You can use this API to embed F# as a scripting language in your projects. + +* [**Hosting the F# compiler**](compiler.html) - allows you to embed calls to the F# compiler. + +* [**File system API**](filesystem.html) - the `FSharp.Compiler.Service` component has a global variable + representing the file system. By setting this variable you can host the compiler in situations where a file system + is not available. + > **NOTE:** The FSharp.Compiler.Service API is subject to change when later versions of the nuget package are published Projects using the F# Compiler Services @@ -60,24 +60,22 @@ Projects using the F# Compiler Services Some of the projects using the F# Compiler Services are: - * [**The Visual F# Power Tools**](http://fsprojects.github.io/VisualFSharpPowerTools/) - * [**The Xamarin and MonoDevelop Tools for F#**](https://github.com/mono/monodevelop/tree/master/main/external/fsharpbinding) - * [**The Emacs Plugin for F#**](https://github.com/fsharp/emacs-fsharp-mode) - * [**The Vim Plugin for F#**](https://github.com/fsharp/vim-fsharp) - * [**iFSharp**](https://github.com/BayardRock/IfSharp) - iPython-style notebook engine for F# - * [**CloudSharper**](http://cloudsharper.com/) - Online web and mobile programming with big data and charting - * [**Tsunami**](http://tsunami.io) - Tsunami enhances applications and workflows with the power of Type Safe Scripting - * [**FQuake3**](https://github.com/TIHan/FQuake3/) - integrates F# as an interactive game scripting engine - * [**FCell**](http://fcell.io) - Deliver the power of .NET from within Microsoft Excel - * [**FSharpLint**](http://fsprojects.github.io/FSharpLint/) - Lint tool for F# - * [**FsReveal**](http://fsprojects.github.io/FsReveal//) - FsReveal parses markdown and F# script file and generate reveal.js slides - * [**Elucidate**](https://github.com/rookboom/Elucidate) - Visual Studio extension for rich inlined comments using MarkDown - * [**Fable**](https://fable-compiler.github.io/) - F# to JavaScript Compiler - * [**FSharp.Formatting**](http://tpetricek.github.io/FSharp.Formatting/) - F# tools for generating documentation (Markdown processor and F# code formatter) - * [**FAKE**](http://fsharp.github.io/FAKE/) - "FAKE - F# Make" is a cross platform build automation system - * [**FsLab Journal**](https://visualstudiogallery.msdn.microsoft.com/45373b36-2a4c-4b6a-b427-93c7a8effddb) - Template that makes it easy to do interactive data analysis using F# Interactive and produce nice HTML reports of your work - - +* [**The Visual F# Power Tools**](https://fsprojects.github.io/VisualFSharpPowerTools/) +* [**The Xamarin and MonoDevelop Tools for F#**](https://github.com/mono/monodevelop/tree/master/main/external/fsharpbinding) +* [**The Emacs Plugin for F#**](https://github.com/fsharp/emacs-fsharp-mode) +* [**The Vim Plugin for F#**](https://github.com/fsharp/vim-fsharp) +* [**iFSharp**](https://github.com/BayardRock/IfSharp) - iPython-style notebook engine for F# +* [**CloudSharper**](https://cloudsharper.com/) - Online web and mobile programming with big data and charting +* [**Tsunami**](http://tsunami.io) - Tsunami enhances applications and workflows with the power of Type Safe Scripting +* [**FQuake3**](https://github.com/TIHan/FQuake3/) - integrates F# as an interactive game scripting engine +* [**FCell**](http://fcell.io) - Deliver the power of .NET from within Microsoft Excel +* [**FSharpLint**](https://fsprojects.github.io/FSharpLint/) - Lint tool for F# +* [**FsReveal**](https://fsprojects.github.io/FsReveal/) - FsReveal parses markdown and F# script file and generate reveal.js slides +* [**Elucidate**](https://github.com/rookboom/Elucidate) - Visual Studio extension for rich inlined comments using MarkDown +* [**Fable**](https://fable-compiler.github.io/) - F# to JavaScript Compiler +* [**FSharp.Formatting**](http://tpetricek.github.io/FSharp.Formatting/) - F# tools for generating documentation (Markdown processor and F# code formatter) +* [**FAKE**](https://fsharp.github.io/FAKE/) - "FAKE - F# Make" is a cross platform build automation system +* [**FsLab Journal**](https://visualstudiogallery.msdn.microsoft.com/45373b36-2a4c-4b6a-b427-93c7a8effddb) - Template that makes it easy to do interactive data analysis using F# Interactive and produce nice HTML reports of your work Contributing and copyright -------------------------- diff --git a/fcs/docsrc/content/interactive.fsx b/fcs/docsrc/content/interactive.fsx index 301f77f34e..2854d4529e 100644 --- a/fcs/docsrc/content/interactive.fsx +++ b/fcs/docsrc/content/interactive.fsx @@ -6,16 +6,16 @@ Interactive Service: Embedding F# Interactive This tutorial demonstrates how to embed F# interactive in your application. F# interactive is an interactive scripting environment that compiles F# code into highly efficient IL code -and executes it on the fly. The F# interactive service allows you to embed F# evaluation in +and executes it on the fly. The F# interactive service allows you to embed F# evaluation in your application. -> **NOTE:** There is a number of options for embedding F# Interactive. The easiest one is to use the +> **NOTE:** There is a number of options for embedding F# Interactive. The easiest one is to use the `fsi.exe` process and communicate with it using standard input and standard output. In this tutorial, we look at calling F# Interactive directly through .NET API. However, if you have no control over the input, it is a good idea to run F# interactive in a separate process. One reason is that there is no way to handle `StackOverflowException` and so a poorly written -script can terminate the host process. **Remember that while calling F# Interactive through .NET API, -` --shadowcopyreferences` option will be ignored**. For detailed discussion, please take a look at +script can terminate the host process. **Remember that while calling F# Interactive through .NET API, +` --shadowcopyreferences` option will be ignored**. For detailed discussion, please take a look at [this thread](https://github.com/fsharp/FSharp.Compiler.Service/issues/292). > **NOTE:** If `FsiEvaluationSession.Create` fails with an error saying that `FSharp.Core.dll` cannot be found, add the `FSharp.Core.sigdata` and `FSharp.Core.optdata` files. More info [here](https://fsharp.github.io/FSharp.Compiler.Service/corelib.html). @@ -55,7 +55,7 @@ let argv = [| "C:\\fsi.exe" |] let allArgs = Array.append argv [|"--noninteractive"|] let fsiConfig = FsiEvaluationSession.GetDefaultConfiguration() -let fsiSession = FsiEvaluationSession.Create(fsiConfig, allArgs, inStream, outStream, errStream) +let fsiSession = FsiEvaluationSession.Create(fsiConfig, allArgs, inStream, outStream, errStream) @@ -74,7 +74,7 @@ let evalExpression text = | None -> printfn "Got no result!" (** -This takes a string as an argument and evaluates (i.e. executes) it as F# code. +This takes a string as an argument and evaluates (i.e. executes) it as F# code. *) evalExpression "42+1" // prints '43' @@ -83,7 +83,7 @@ This can be used in a strongly typed way as follows: *) /// Evaluate expression & return the result, strongly typed -let evalExpressionTyped<'T> (text) = +let evalExpressionTyped<'T> (text) = match fsiSession.EvalExpression(text) with | Some value -> value.ReflectionValue |> unbox<'T> | None -> failwith "Got no result!" @@ -95,7 +95,7 @@ evalExpressionTyped "42+1" // gives '43' The `EvalInteraction` method can be used to evaluate side-effectful operations such as printing, declarations, or other interactions that are not valid F# expressions, but can be entered in the F# Interactive console. Such commands include `#time "on"` (and other directives), `open System` -all declarations and other top-level statements. The code +all declarations and other top-level statements. The code does not require `;;` at the end. Just enter the code that you want to execute: *) fsiSession.EvalInteraction "printfn \"bye\"" @@ -116,7 +116,7 @@ Catching errors code has type checking warnings or errors, or if evaluation fails with an exception. In these cases you can use ``EvalExpressionNonThrowing``, ``EvalInteractionNonThrowing`` and ``EvalScriptNonThrowing``. These return a tuple of a result and an array of ``FSharpErrorInfo`` values. -These represent the errors and warnings. The result part is a ``Choice<_,_>`` between an actual +These represent the errors and warnings. The result part is a ``Choice<_,_>`` between an actual result and an exception. The result part of ``EvalExpression`` and ``EvalExpressionNonThrowing`` is an optional ``FSharpValue``. @@ -129,7 +129,7 @@ File.WriteAllText("sample.fsx", "let twenty = 'a' + 10.0") let result, warnings = fsiSession.EvalScriptNonThrowing "sample.fsx" // show the result -match result with +match result with | Choice1Of2 () -> printfn "checked and executed ok" | Choice2Of2 exn -> printfn "execution exception: %s" exn.Message @@ -141,8 +141,8 @@ Gives: *) // show the errors and warnings -for w in warnings do - printfn "Warning %s at %d,%d" w.Message w.StartLineAlternate w.StartColumn +for w in warnings do + printfn "Warning %s at %d,%d" w.Message w.StartLineAlternate w.StartColumn (** Gives: @@ -156,9 +156,9 @@ For expressions: let evalExpressionTyped2<'T> text = let res, warnings = fsiSession.EvalExpressionNonThrowing(text) - for w in warnings do - printfn "Warning %s at %d,%d" w.Message w.StartLineAlternate w.StartColumn - match res with + for w in warnings do + printfn "Warning %s at %d,%d" w.Message w.StartLineAlternate w.StartColumn + match res with | Choice1Of2 (Some value) -> value.ReflectionValue |> unbox<'T> | Choice1Of2 None -> failwith "null or no result" | Choice2Of2 (exn:exn) -> failwith (sprintf "exception %s" exn.Message) @@ -175,17 +175,17 @@ By default the code passed to ``EvalExpression`` is executed immediately. To exe open System.Threading.Tasks -let sampleLongRunningExpr = +let sampleLongRunningExpr = """ -async { +async { // The code of what you want to run do System.Threading.Thread.Sleep 5000 - return 10 + return 10 } |> Async.StartAsTask""" -let task1 = evalExpressionTyped>(sampleLongRunningExpr) -let task2 = evalExpressionTyped>(sampleLongRunningExpr) +let task1 = evalExpressionTyped>(sampleLongRunningExpr) +let task2 = evalExpressionTyped>(sampleLongRunningExpr) (** Both computations have now started. You can now fetch the results: @@ -199,7 +199,7 @@ task2.Result // gives the result after completion (up to 5 seconds) Type checking in the evaluation context ------------------ -Let's assume you have a situation where you would like to typecheck code +Let's assume you have a situation where you would like to typecheck code in the context of the F# Interactive scripting session. For example, you first evaluation a declaration: *) @@ -211,17 +211,17 @@ fsiSession.EvalInteraction "let xxx = 1 + 1" Now you want to typecheck the partially complete code `xxx + xx` *) -let parseResults, checkResults, checkProjectResults = +let parseResults, checkResults, checkProjectResults = fsiSession.ParseAndCheckInteraction("xxx + xx") |> Async.RunSynchronously -(** +(** The `parseResults` and `checkResults` have types `ParseFileResults` and `CheckFileResults` explained in [Editor](editor.html). You can, for example, look at the type errors in the code: *) checkResults.Errors.Length // 1 -(** +(** The code is checked with respect to the logical type context available in the F# interactive session based on the declarations executed so far. @@ -230,10 +230,10 @@ You can also request declaration list information, tooltip text and symbol resol open FSharp.Compiler // get a tooltip -checkResults.GetToolTipText(1, 2, "xxx + xx", ["xxx"], FSharpTokenTag.IDENT) +checkResults.GetToolTipText(1, 2, "xxx + xx", ["xxx"], FSharpTokenTag.IDENT) checkResults.GetSymbolUseAtLocation(1, 2, "xxx + xx", ["xxx"]) // symbol xxx - + (** The 'fsi' object ------------------ @@ -252,16 +252,16 @@ Evaluating code in using FsiEvaluationSession generates a .NET dynamic assembly You can make generated code collectible by passing `collectible=true`. However code will only be collected if there are no outstanding object references involving types, for example `FsiValue` objects returned by `EvalExpression`, and you must have disposed the `FsiEvaluationSession`. -See also [Restrictions on Collectible Assemblies](http://msdn.microsoft.com/en-us/library/dd554932(v=vs.110).aspx#restrictions). +See also [Restrictions on Collectible Assemblies](https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/dd554932(v=vs.100)#restrictions). The example below shows the creation of 200 evaluation sessions. Note that `collectible=true` and -`use session = ...` are both used. +`use session = ...` are both used. If collectible code is working correctly, overall resource usage will not increase linearly as the evaluation progresses. *) -let collectionTest() = +let collectionTest() = for i in 1 .. 200 do let defaultArgs = [|"fsi.exe";"--noninteractive";"--nologo";"--gui-"|] @@ -271,7 +271,7 @@ let collectionTest() = let fsiConfig = FsiEvaluationSession.GetDefaultConfiguration() use session = FsiEvaluationSession.Create(fsiConfig, defaultArgs, inStream, outStream, errStream, collectible=true) - + session.EvalInteraction (sprintf "type D = { v : int }") let v = session.EvalExpression (sprintf "{ v = 42 * %d }" i) printfn "iteration %d, result = %A" i v.Value.ReflectionValue diff --git a/fcs/docsrc/content/ja/corelib.fsx b/fcs/docsrc/content/ja/corelib.fsx index 4dcd09e115..ea9ee87f8f 100644 --- a/fcs/docsrc/content/ja/corelib.fsx +++ b/fcs/docsrc/content/ja/corelib.fsx @@ -31,7 +31,7 @@ FSharp.Compiler.Service.dll コンポーネントは FSharp.Core 4.3.0.0 に依 - + どの FSharp.Core と .NET フレームワークがコンパイル時に参照される? @@ -42,17 +42,17 @@ FSharp.Combiler.Service コンポーネントは多かれ少なかれ、F#コー 特定の FSharp.Core および .NET フレームワーク アセンブリ、またはそのいずれかをターゲットにする場合、 ``--noframework`` 引数と適切なコマンドライン引数を使います: [] - let fsharpCorePath = + let fsharpCorePath = @"C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.3.1.0\FSharp.Core.dll" - let errors2, exitCode2 = + let errors2, exitCode2 = scs.Compile( - [| "fsc.exe"; "--noframework"; - "-r"; fsharpCorePath; - "-r"; @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll"; - "-o"; fn3; + [| "fsc.exe"; "--noframework"; + "-r"; fsharpCorePath; + "-r"; @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll"; + "-o"; fn3; "-a"; fn2 |]) -これらのアセンブリが配置されている場所を指定する必要があります。クロスプラットフォームに対応した方法でDLL を配置して、それらをコマンドライン引数に変換する最も簡単な方法は、[F# プロジェクトファイルをクラックする](http://fsharp.github.io/FSharp.Compiler.Service/ja/project.html)ことです。 +これらのアセンブリが配置されている場所を指定する必要があります。クロスプラットフォームに対応した方法でDLL を配置して、それらをコマンドライン引数に変換する最も簡単な方法は、[F# プロジェクトファイルをクラックする](https://fsharp.github.io/FSharp.Compiler.Service/ja/project.html)ことです。 自分で SDK のパスを処理する代わりに、[FSharp.Compiler.Service.dll 用のテスト](https://github.com/fsharp/FSharp.Compiler.Service/blob/8a943dd3b545648690cb3bed652a469bdb6dd869/tests/service/Common.fs#L54)で使用しているようなヘルパー関数も用意されています。 diff --git a/fcs/docsrc/tools/generate.fsx b/fcs/docsrc/tools/generate.fsx index 3ef4b0a1bd..617a154efb 100644 --- a/fcs/docsrc/tools/generate.fsx +++ b/fcs/docsrc/tools/generate.fsx @@ -4,7 +4,7 @@ // -------------------------------------------------------------------------------------- // Binaries that have XML documentation (in a corresponding generated XML file) -let referenceBinaries = [ "FSharp.Compiler.Service.dll" ] +let referenceBinaries = [ "FSharp.Compiler.Service.dll" ] // Web site location for the generated documentation let website = "https://fsharp.github.io/FSharp.Compiler.Service" @@ -13,7 +13,7 @@ let info = [ "project-name", "F# Compiler Services" "project-author", "Microsoft Corporation, Dave Thomas, Anh-Dung Phan, Tomas Petricek" "project-summary", "F# compiler services for creating IDE tools, language extensions and for F# embedding" - "project-github", "http://github.com/fsharp/FSharp.Compiler.Service" + "project-github", "https://github.com/fsharp/FSharp.Compiler.Service" "project-nuget", "https://www.nuget.org/packages/FSharp.Compiler.Service" ] // -------------------------------------------------------------------------------------- @@ -42,7 +42,7 @@ let docTemplate = formatting @@ "templates/docpage.cshtml" // Where to look for *.csproj templates (in this order) let layoutRoots = - [ templates; + [ templates; formatting @@ "templates" formatting @@ "templates/reference" ] @@ -50,7 +50,7 @@ let layoutRoots = let copyFiles () = CopyRecursive files output true |> Log "Copying file: " ensureDirectory (output @@ "content") - CopyRecursive (formatting @@ "styles") (output @@ "content") true + CopyRecursive (formatting @@ "styles") (output @@ "content") true |> Log "Copying styles and scripts: " let clr = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() @@ -61,7 +61,7 @@ let buildReference () = CleanDir (output @@ "reference") for lib in referenceBinaries do MetadataFormat.Generate - ( bin @@ lib, output @@ "reference", layoutRoots, + ( bin @@ lib, output @@ "reference", layoutRoots, parameters = ("root", root)::info, sourceRepo = "https://github.com/fsharp/FSharp.Compiler.Service/tree/master/src", sourceFolder = @"..\..\..\src", diff --git a/fcs/docsrc/tools/generate.ja.fsx b/fcs/docsrc/tools/generate.ja.fsx index bf9f77ce99..96049490fa 100644 --- a/fcs/docsrc/tools/generate.ja.fsx +++ b/fcs/docsrc/tools/generate.ja.fsx @@ -11,7 +11,7 @@ let info = [ "project-name", "F# Compiler Services" "project-author", "Microsoft Corporation, Dave Thomas, Anh-Dung Phan, Tomas Petricek" "project-summary", "F# compiler services for creating IDE tools, language extensions and for F# embedding" - "project-github", "http://github.com/fsharp/FSharp.Compiler.Service" + "project-github", "https://github.com/fsharp/FSharp.Compiler.Service" "project-nuget", "https://www.nuget.org/packages/FSharp.Compiler.Service" ] // -------------------------------------------------------------------------------------- diff --git a/fcs/docsrc/tools/templates/ja/template.cshtml b/fcs/docsrc/tools/templates/ja/template.cshtml index 8e8a290ab1..a37b7c8cab 100644 --- a/fcs/docsrc/tools/templates/ja/template.cshtml +++ b/fcs/docsrc/tools/templates/ja/template.cshtml @@ -24,7 +24,7 @@

@Properties["project-name"]

@@ -50,7 +50,7 @@
  • GitHub上のソースコード
  • ライセンス
  • リリースノート
  • - +
  • ホームページ
  • 開発者用メモ
  • diff --git a/fcs/docsrc/tools/templates/template.cshtml b/fcs/docsrc/tools/templates/template.cshtml index a547596abb..9bdd7d4fe2 100644 --- a/fcs/docsrc/tools/templates/template.cshtml +++ b/fcs/docsrc/tools/templates/template.cshtml @@ -24,7 +24,7 @@

    @Properties["project-name"]

    @@ -50,7 +50,7 @@
  • Source Code on GitHub
  • License
  • Release Notes
  • - +
  • Home page
  • Developer notes
  • diff --git a/release-notes.md b/release-notes.md index 790efce100..88c4c4a3e9 100644 --- a/release-notes.md +++ b/release-notes.md @@ -1,6 +1,6 @@ - Copyright (c) Microsoft Corporation. All Rights Reserved. + Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - + ## About the release notes We deliver F# and F# tools for Visual Studio and .NET Core releases. These can include bug fixes, new tooling features, new compiler features, performance improvements, infrastructure improvements, and new language versions. The most recent release of F# or any F# component will be at the top of this document. @@ -33,7 +33,7 @@ You can find all tracked VS 15.9 items in the [15.9 milestone](https://github.co ### F# OSS Build * Feature (#5027) - Set VisualFSharpFull as the default startup project, by [Robert Jeppesen](https://github.com/rojepp). - + ## Visual Studio 15.8.5 * Fix (#5504) - Internal MSBuild Error when building non-.NET SDK projects with MSBuild parallelism @@ -244,7 +244,7 @@ Includes commits up to `dd8252eb8d20aaedf7b1c7576cd2a8a82d24f587` * Other new APIs * `Option.filter`, `Option.toObj`, `Option.ofObj`, `Option.toNullable`, `Option.ofNullable` * `String.filter` - * `Checked.int8`, `Checked.uint8` + * `Checked.int8`, `Checked.uint8` * `Async.AwaitTask` (non-generic) * `WebClient.AsyncDownloadFile`, `WebClient.AsyncDownloadData` * `tryUnbox`, `isNull` @@ -427,7 +427,7 @@ Includes commits up to `3385e58aabc91368c8e1f551650ba48705aaa285` * Bugfix: Errors when attempting to add reference to .NET core library * Bugfix: Crash in `FSComp.SR.RunStartupValidation()` -[4.0.0]: http://fsharp.org +[4.0.0]: https://fsharp.org [3.1.2]: http://blogs.msdn.com/b/fsharpteam/archive/2014/08/20/announcing-the-release-of-visual-f-tools-3-1-2.aspx [3.1.1]: http://blogs.msdn.com/b/fsharpteam/archive/2014/01/22/announcing-visual-f-3-1-1-and-support-for-desktop-express.aspx diff --git a/src/buildtools/README-fslexyacc.md b/src/buildtools/README-fslexyacc.md index a498a74720..cd47b42b38 100644 --- a/src/buildtools/README-fslexyacc.md +++ b/src/buildtools/README-fslexyacc.md @@ -1,8 +1,8 @@ -# Notes on FsLex and FsYacc +# Notes on FsLex and FsYacc For better or worse the F# compiler contains three tokenizers (`*.fsl`) and three grammars (`*.fsy`) implemented using FsLex and FsYacc respectively, including the all-important F# grammar itself. -The canonical home for FsLex and FsYacc is http://github.com/fsprojects/FsLexYacc. +The canonical home for FsLex and FsYacc is https://github.com/fsprojects/FsLexYacc. FsLex and FsYacc are themselves built using earlier versions of FsLex and FsYacc. **If you would like to improve, modify, extend, test or document these diff --git a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec index b11df35fca..ee7a88b29d 100644 --- a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec +++ b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec @@ -2,7 +2,7 @@ $CommonMetadataElements$ - http://fsharp.org/img/logo.png + https://fsharp.org/img/logo.png en-US diff --git a/src/fsharp/service/service.fsi b/src/fsharp/service/service.fsi index ec368942d7..28e0e6ee6e 100755 --- a/src/fsharp/service/service.fsi +++ b/src/fsharp/service/service.fsi @@ -16,11 +16,11 @@ open FSharp.Compiler.Range open FSharp.Compiler.Text /// Unused in this API -type public UnresolvedReferencesSet +type public UnresolvedReferencesSet /// A set of information describing a project or script build configuration. -type public FSharpProjectOptions = - { +type public FSharpProjectOptions = + { // Note that this may not reduce to just the project directory, because there may be two projects in the same directory. ProjectFileName: string @@ -38,7 +38,7 @@ type public FSharpProjectOptions = ReferencedProjects: (string * FSharpProjectOptions)[] /// When true, the typechecking environment is known a priori to be incomplete, for - /// example when a .fs file is opened outside of a project. In this case, the number of error + /// example when a .fs file is opened outside of a project. In this case, the number of error /// messages reported is reduced. IsIncompleteTypeCheckEnvironment : bool @@ -64,12 +64,12 @@ type public FSharpProjectOptions = /// if and only if the stamps are equal Stamp: int64 option } - -[] + +[] /// Used to parse and check F# source code. type public FSharpChecker = /// - /// Create an instance of an FSharpChecker. + /// Create an instance of an FSharpChecker. /// /// /// The optional size of the project checking cache. @@ -131,8 +131,8 @@ type public FSharpChecker = /// the reconstructed types in the file. /// /// All files except the one being checked are read from the FileSystem API - /// Note: returns NoAntecedent if the background builder is not yet done preparing the type check context for the - /// file (e.g. loading references and parsing/checking files in the project that this file depends upon). + /// Note: returns NoAntecedent if the background builder is not yet done preparing the type check context for the + /// file (e.g. loading references and parsing/checking files in the project that this file depends upon). /// In this case, the caller can either retry, or wait for FileTypeCheckStateIsDirty to be raised for this file. /// ///
    @@ -143,8 +143,8 @@ type public FSharpChecker = /// The full source for the file. /// The options for the project or script. /// - /// An item passed back to 'hasTextChangedSinceLastTypecheck' (from some calls made on 'FSharpCheckFileResults') to help determine if - /// an approximate intellisense resolution is inaccurate because a range of text has changed. This + /// An item passed back to 'hasTextChangedSinceLastTypecheck' (from some calls made on 'FSharpCheckFileResults') to help determine if + /// an approximate intellisense resolution is inaccurate because a range of text has changed. This /// can be used to marginally increase accuracy of intellisense results in some situations. /// /// An optional string used for tracing compiler operations associated with this request. @@ -169,8 +169,8 @@ type public FSharpChecker = /// The full source for the file. /// The options for the project or script. /// - /// An item passed back to 'hasTextChangedSinceLastTypecheck' (from some calls made on 'FSharpCheckFileResults') to help determine if - /// an approximate intellisense resolution is inaccurate because a range of text has changed. This + /// An item passed back to 'hasTextChangedSinceLastTypecheck' (from some calls made on 'FSharpCheckFileResults') to help determine if + /// an approximate intellisense resolution is inaccurate because a range of text has changed. This /// can be used to marginally increase accuracy of intellisense results in some situations. /// /// An optional string used for tracing compiler operations associated with this request. @@ -178,7 +178,7 @@ type public FSharpChecker = /// /// - /// Parse and check a source code file, returning a handle to the results + /// Parse and check a source code file, returning a handle to the results /// /// /// Note: all files except the one being checked are read from the FileSystem API @@ -193,8 +193,8 @@ type public FSharpChecker = /// The full source for the file. /// The options for the project or script. /// - /// An item passed back to 'hasTextChangedSinceLastTypecheck' (from some calls made on 'FSharpCheckFileResults') to help determine if - /// an approximate intellisense resolution is inaccurate because a range of text has changed. This + /// An item passed back to 'hasTextChangedSinceLastTypecheck' (from some calls made on 'FSharpCheckFileResults') to help determine if + /// an approximate intellisense resolution is inaccurate because a range of text has changed. This /// can be used to marginally increase accuracy of intellisense results in some situations. /// /// An optional string used for tracing compiler operations associated with this request. @@ -277,13 +277,13 @@ type public FSharpChecker = member GetBackgroundCheckResultsForFileInProject : filename : string * options : FSharpProjectOptions * ?userOpName: string -> Async /// - /// Compile using the given flags. Source files names are resolved via the FileSystem API. - /// The output file must be given by a -o flag. + /// Compile using the given flags. Source files names are resolved via the FileSystem API. + /// The output file must be given by a -o flag. /// The first argument is ignored and can just be "fsc.exe". /// /// An optional string used for tracing compiler operations associated with this request. member Compile: argv:string[] * ?userOpName: string -> Async - + /// /// TypeCheck and compile provided AST /// @@ -291,15 +291,15 @@ type public FSharpChecker = member Compile: ast:ParsedInput list * assemblyName:string * outFile:string * dependencies:string list * ?pdbFile:string * ?executable:bool * ?noframework:bool * ?userOpName: string -> Async /// - /// Compiles to a dynamic assembly using the given flags. + /// Compiles to a dynamic assembly using the given flags. /// /// The first argument is ignored and can just be "fsc.exe". /// /// Any source files names are resolved via the FileSystem API. An output file name must be given by a -o flag, but this will not /// be written - instead a dynamic assembly will be created and loaded. /// - /// If the 'execute' parameter is given the entry points for the code are executed and - /// the given TextWriters are used for the stdout and stderr streams respectively. In this + /// If the 'execute' parameter is given the entry points for the code are executed and + /// the given TextWriters are used for the stdout and stderr streams respectively. In this /// case, a global setting is modified during the execution. /// /// An optional string used for tracing compiler operations associated with this request. @@ -310,7 +310,7 @@ type public FSharpChecker = /// /// An optional string used for tracing compiler operations associated with this request. member CompileToDynamicAssembly: ast:ParsedInput list * assemblyName:string * dependencies:string list * execute:(TextWriter * TextWriter) option * ?debug:bool * ?noframework:bool * ?userOpName: string -> Async - + /// /// Try to get type check results for a file. This looks up the results of recent type checks of the /// same file, regardless of contents. The version tag specified in the original check of the file is returned. @@ -324,25 +324,25 @@ type public FSharpChecker = member TryGetRecentCheckResultsForFile : filename: string * options:FSharpProjectOptions * ?sourceText: ISourceText * ?userOpName: string -> (FSharpParseFileResults * FSharpCheckFileResults * (*version*)int) option /// This function is called when the entire environment is known to have changed for reasons not encoded in the ProjectOptions of any project/compilation. - member InvalidateAll : unit -> unit - + member InvalidateAll : unit -> unit + /// This function is called when the configuration is known to have changed for reasons not encoded in the ProjectOptions. /// For example, dependent references may have been deleted or created. /// Start a background compile of the project if a project with the same name has already been seen before. /// An optional string used for tracing compiler operations associated with this request. - member InvalidateConfiguration: options: FSharpProjectOptions * ?startBackgroundCompileIfAlreadySeen: bool * ?userOpName: string -> unit + member InvalidateConfiguration: options: FSharpProjectOptions * ?startBackgroundCompileIfAlreadySeen: bool * ?userOpName: string -> unit /// Set the project to be checked in the background. Overrides any previous call to CheckProjectInBackground member CheckProjectInBackground: options: FSharpProjectOptions * ?userOpName: string -> unit /// Stop the background compile. - //[] + //[] member StopBackgroundCompile : unit -> unit /// Block until the background compile finishes. - //[] + //[] member WaitForBackgroundCompile : unit -> unit - + /// Report a statistic for testability static member GlobalForegroundParseCountStatistic : int @@ -352,8 +352,8 @@ type public FSharpChecker = /// Flush all caches and garbage collect member ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients : unit -> unit - /// Current queue length of the service, for debug purposes. - /// In addition, a single async operation or a step of a background build + /// Current queue length of the service, for debug purposes. + /// In addition, a single async operation or a step of a background build /// may be in progress - such an operation is not counted in the queue length. member CurrentQueueLength : int @@ -362,7 +362,7 @@ type public FSharpChecker = /// /// An optional string used for tracing compiler operations associated with this request. member NotifyProjectCleaned: options: FSharpProjectOptions * ?userOpName: string -> Async - + /// Notify the host that the logical type checking context for a file has now been updated internally /// and that the file has become eligible to be re-typechecked for errors. /// @@ -378,29 +378,29 @@ type public FSharpChecker = /// /// The event will be raised on a background thread. member FileChecked : IEvent - + /// Raised after the maxMB memory threshold limit is reached member MaxMemoryReached : IEvent /// A maximum number of megabytes of allocated memory. If the figure reported by System.GC.GetTotalMemory(false) goes over this limit, the FSharpChecker object will attempt to free memory and reduce cache sizes to a minimum. member MaxMemory : int with get, set - - /// Get or set a flag which controls if background work is started implicitly. + + /// Get or set a flag which controls if background work is started implicitly. /// /// If true, calls to CheckFileInProject implicitly start a background check of that project, replacing - /// any other background checks in progress. This is useful in IDE applications with spare CPU cycles as + /// any other background checks in progress. This is useful in IDE applications with spare CPU cycles as /// it prepares the project analysis results for use. The default is 'true'. member ImplicitlyStartBackgroundWork: bool with get, set - + /// Get or set the pause time in milliseconds before background work is started. member PauseBeforeBackgroundWork: int with get, set - + /// Notify the host that a project has been fully checked in the background (using file contents provided by the file system API) /// /// The event may be raised on a background thread. member ProjectChecked : IEvent - // For internal use only + // For internal use only member internal ReactorOps : IReactorOperations [] @@ -420,8 +420,8 @@ type public CompilerEnvironment = /// The default location of FSharp.Core.dll and fsc.exe based on the version of fsc.exe that is running static member BinFolderOfDefaultFSharpCompiler : ?probePoint: string -> string option -/// Information about the compilation environment -[] +/// Information about the compilation environment +[] module public CompilerEnvironment = /// These are the names of assemblies that should be referenced for .fs or .fsi files that /// are not associated with a project. @@ -436,7 +436,7 @@ module public DebuggerEnvironment = /// Return the language ID, which is the expression evaluator id that the /// debugger will use. val GetLanguageID : unit -> Guid - + /// A set of helpers related to naming of identifiers module public PrettyNaming = @@ -448,10 +448,10 @@ module public PrettyNaming = val FormatAndOtherOverloadsString : int -> string - /// A utility to help determine if an identifier needs to be quoted + /// A utility to help determine if an identifier needs to be quoted val QuoteIdentifierIfNeeded : string -> string - /// All the keywords in the F# language + /// All the keywords in the F# language val KeywordNames : string list /// A set of helpers for dealing with F# files. diff --git a/tests/projects/Sample_VS2013_FSharp_ConsoleApp_net40/Program.fs b/tests/projects/Sample_VS2013_FSharp_ConsoleApp_net40/Program.fs index 2bcf7f9899..da84161c54 100644 --- a/tests/projects/Sample_VS2013_FSharp_ConsoleApp_net40/Program.fs +++ b/tests/projects/Sample_VS2013_FSharp_ConsoleApp_net40/Program.fs @@ -1,7 +1,7 @@ -// Learn more about F# at http://fsharp.org +// Learn more about F# at https://fsharp.org // See the 'F# Tutorial' project for more help. [] -let main argv = +let main argv = printfn "%A" argv 0 // return an integer exit code diff --git a/tests/projects/Sample_VS2015_FSharp_Console_App_net40/Program.fs b/tests/projects/Sample_VS2015_FSharp_Console_App_net40/Program.fs index 2bcf7f9899..da84161c54 100644 --- a/tests/projects/Sample_VS2015_FSharp_Console_App_net40/Program.fs +++ b/tests/projects/Sample_VS2015_FSharp_Console_App_net40/Program.fs @@ -1,7 +1,7 @@ -// Learn more about F# at http://fsharp.org +// Learn more about F# at https://fsharp.org // See the 'F# Tutorial' project for more help. [] -let main argv = +let main argv = printfn "%A" argv 0 // return an integer exit code diff --git a/tests/projects/Sample_VS2015_FSharp_Console_App_net45/Program.fs b/tests/projects/Sample_VS2015_FSharp_Console_App_net45/Program.fs index 2bcf7f9899..da84161c54 100644 --- a/tests/projects/Sample_VS2015_FSharp_Console_App_net45/Program.fs +++ b/tests/projects/Sample_VS2015_FSharp_Console_App_net45/Program.fs @@ -1,7 +1,7 @@ -// Learn more about F# at http://fsharp.org +// Learn more about F# at https://fsharp.org // See the 'F# Tutorial' project for more help. [] -let main argv = +let main argv = printfn "%A" argv 0 // return an integer exit code diff --git a/tests/projects/Sample_VS2015_FSharp_Console_App_net451/Program.fs b/tests/projects/Sample_VS2015_FSharp_Console_App_net451/Program.fs index 2bcf7f9899..da84161c54 100644 --- a/tests/projects/Sample_VS2015_FSharp_Console_App_net451/Program.fs +++ b/tests/projects/Sample_VS2015_FSharp_Console_App_net451/Program.fs @@ -1,7 +1,7 @@ -// Learn more about F# at http://fsharp.org +// Learn more about F# at https://fsharp.org // See the 'F# Tutorial' project for more help. [] -let main argv = +let main argv = printfn "%A" argv 0 // return an integer exit code diff --git a/tests/projects/Sample_VS2015_FSharp_Console_App_net452/Program.fs b/tests/projects/Sample_VS2015_FSharp_Console_App_net452/Program.fs index 2bcf7f9899..da84161c54 100644 --- a/tests/projects/Sample_VS2015_FSharp_Console_App_net452/Program.fs +++ b/tests/projects/Sample_VS2015_FSharp_Console_App_net452/Program.fs @@ -1,7 +1,7 @@ -// Learn more about F# at http://fsharp.org +// Learn more about F# at https://fsharp.org // See the 'F# Tutorial' project for more help. [] -let main argv = +let main argv = printfn "%A" argv 0 // return an integer exit code diff --git a/tests/projects/Sample_VS2015_FSharp_Console_App_net46/Program.fs b/tests/projects/Sample_VS2015_FSharp_Console_App_net46/Program.fs index 2bcf7f9899..da84161c54 100644 --- a/tests/projects/Sample_VS2015_FSharp_Console_App_net46/Program.fs +++ b/tests/projects/Sample_VS2015_FSharp_Console_App_net46/Program.fs @@ -1,7 +1,7 @@ -// Learn more about F# at http://fsharp.org +// Learn more about F# at https://fsharp.org // See the 'F# Tutorial' project for more help. [] -let main argv = +let main argv = printfn "%A" argv 0 // return an integer exit code diff --git a/tests/projects/Sample_VS2015_FSharp_Library_net40/Script.fsx b/tests/projects/Sample_VS2015_FSharp_Library_net40/Script.fsx index 00ea094aa8..4dd0639ebe 100644 --- a/tests/projects/Sample_VS2015_FSharp_Library_net40/Script.fsx +++ b/tests/projects/Sample_VS2015_FSharp_Library_net40/Script.fsx @@ -1,4 +1,4 @@ -// Learn more about F# at http://fsharp.org. See the 'F# Tutorial' project +// Learn more about F# at https://fsharp.org. See the 'F# Tutorial' project // for more guidance on F# programming. #load "Library1.fs" diff --git a/tests/projects/Sample_VS2015_FSharp_Library_net45/Script.fsx b/tests/projects/Sample_VS2015_FSharp_Library_net45/Script.fsx index a3079973c8..58b6520867 100644 --- a/tests/projects/Sample_VS2015_FSharp_Library_net45/Script.fsx +++ b/tests/projects/Sample_VS2015_FSharp_Library_net45/Script.fsx @@ -1,4 +1,4 @@ -// Learn more about F# at http://fsharp.org. See the 'F# Tutorial' project +// Learn more about F# at https://fsharp.org. See the 'F# Tutorial' project // for more guidance on F# programming. #load "Library1.fs" diff --git a/tests/projects/Sample_VS2015_FSharp_Library_net45_fsharp_30/Script.fsx b/tests/projects/Sample_VS2015_FSharp_Library_net45_fsharp_30/Script.fsx index 986dbf6f75..4fb010b658 100644 --- a/tests/projects/Sample_VS2015_FSharp_Library_net45_fsharp_30/Script.fsx +++ b/tests/projects/Sample_VS2015_FSharp_Library_net45_fsharp_30/Script.fsx @@ -1,4 +1,4 @@ -// Learn more about F# at http://fsharp.org. See the 'F# Tutorial' project +// Learn more about F# at https://fsharp.org. See the 'F# Tutorial' project // for more guidance on F# programming. #load "Library1.fs" diff --git a/tests/projects/Sample_VS2015_FSharp_Library_net45_fsharp_31/Script.fsx b/tests/projects/Sample_VS2015_FSharp_Library_net45_fsharp_31/Script.fsx index be47661c53..2a30bb2dde 100644 --- a/tests/projects/Sample_VS2015_FSharp_Library_net45_fsharp_31/Script.fsx +++ b/tests/projects/Sample_VS2015_FSharp_Library_net45_fsharp_31/Script.fsx @@ -1,4 +1,4 @@ -// Learn more about F# at http://fsharp.org. See the 'F# Tutorial' project +// Learn more about F# at https://fsharp.org. See the 'F# Tutorial' project // for more guidance on F# programming. #load "Library1.fs" diff --git a/tests/projects/Sample_VS2015_FSharp_Portable259_Library/Script.fsx b/tests/projects/Sample_VS2015_FSharp_Portable259_Library/Script.fsx index e4b42ed805..aa7d556c8a 100644 --- a/tests/projects/Sample_VS2015_FSharp_Portable259_Library/Script.fsx +++ b/tests/projects/Sample_VS2015_FSharp_Portable259_Library/Script.fsx @@ -1,4 +1,4 @@ -// Learn more about F# at http://fsharp.org. See the 'F# Tutorial' project +// Learn more about F# at https://fsharp.org. See the 'F# Tutorial' project // for more guidance on F# programming. #load "PortableLibrary1.fs" diff --git a/tests/projects/Sample_VS2015_FSharp_Portable47_Library/Script.fsx b/tests/projects/Sample_VS2015_FSharp_Portable47_Library/Script.fsx index e2d17fdde7..b7004bad14 100644 --- a/tests/projects/Sample_VS2015_FSharp_Portable47_Library/Script.fsx +++ b/tests/projects/Sample_VS2015_FSharp_Portable47_Library/Script.fsx @@ -1,4 +1,4 @@ -// Learn more about F# at http://fsharp.org. See the 'F# Tutorial' project +// Learn more about F# at https://fsharp.org. See the 'F# Tutorial' project // for more guidance on F# programming. #load "PortableLibrary1.fs" diff --git a/tests/projects/Sample_VS2015_FSharp_Portable78_Library/Script.fsx b/tests/projects/Sample_VS2015_FSharp_Portable78_Library/Script.fsx index 58f632f7a6..bee838c914 100644 --- a/tests/projects/Sample_VS2015_FSharp_Portable78_Library/Script.fsx +++ b/tests/projects/Sample_VS2015_FSharp_Portable78_Library/Script.fsx @@ -1,4 +1,4 @@ -// Learn more about F# at http://fsharp.org. See the 'F# Tutorial' project +// Learn more about F# at https://fsharp.org. See the 'F# Tutorial' project // for more guidance on F# programming. #load "PortableLibrary1.fs" diff --git a/tests/projects/Sample_VS2015_FSharp_Portable7_Library/Script.fsx b/tests/projects/Sample_VS2015_FSharp_Portable7_Library/Script.fsx index 2778d43203..504af39e3a 100644 --- a/tests/projects/Sample_VS2015_FSharp_Portable7_Library/Script.fsx +++ b/tests/projects/Sample_VS2015_FSharp_Portable7_Library/Script.fsx @@ -1,4 +1,4 @@ -// Learn more about F# at http://fsharp.org. See the 'F# Tutorial' project +// Learn more about F# at https://fsharp.org. See the 'F# Tutorial' project // for more guidance on F# programming. #load "PortableLibrary1.fs" diff --git a/tests/projects/misc/ProjectWithBuildErrors/ProjectWithBuildErrors/Program.fs b/tests/projects/misc/ProjectWithBuildErrors/ProjectWithBuildErrors/Program.fs index a50a68fd4e..b9271d2552 100644 --- a/tests/projects/misc/ProjectWithBuildErrors/ProjectWithBuildErrors/Program.fs +++ b/tests/projects/misc/ProjectWithBuildErrors/ProjectWithBuildErrors/Program.fs @@ -1,4 +1,4 @@ -// Learn more about F# at http://fsharp.org +// Learn more about F# at https://fsharp.org // See the 'F# Tutorial' project for more help. @@ -6,16 +6,15 @@ let private x : int = failwith "" let inline f () = x -let f1 argv = +let f1 argv = //let x = 1 + 1.0 let y = argx // this gives a multi-line error message printfn "%A" argv 0 // return an integer exit code - + [] -let main argv = - //let x = 1 + 1.0 - //let y = argx // this gives +let main argv = + //let x = 1 + 1.0 + //let y = argx // this gives printfn "%A" argv 0 // return an integer exit code - \ No newline at end of file diff --git a/tests/projects/misc/SameFileBelongsToMultipleProjects/SameFileBelongsToMultipleProjects/Program.fs b/tests/projects/misc/SameFileBelongsToMultipleProjects/SameFileBelongsToMultipleProjects/Program.fs index 55b67799e9..9f122841b1 100644 --- a/tests/projects/misc/SameFileBelongsToMultipleProjects/SameFileBelongsToMultipleProjects/Program.fs +++ b/tests/projects/misc/SameFileBelongsToMultipleProjects/SameFileBelongsToMultipleProjects/Program.fs @@ -1,8 +1,8 @@ -// Learn more about F# at http://fsharp.org +// Learn more about F# at https://fsharp.org // See the 'F# Tutorial' project for more help. [] -let main argv = +let main argv = printfn "%A" argv let c1 = Library1.Class.PropertyAlwaysAvailable let c1 = Library2.Class.PropertyAlwaysAvailable diff --git a/tests/projects/misc/TestProjectChanges/TestProjectChanges/Program.fs b/tests/projects/misc/TestProjectChanges/TestProjectChanges/Program.fs index 97fad1e1a7..e2eeae2fb2 100644 --- a/tests/projects/misc/TestProjectChanges/TestProjectChanges/Program.fs +++ b/tests/projects/misc/TestProjectChanges/TestProjectChanges/Program.fs @@ -1,8 +1,8 @@ -// Learn more about F# at http://fsharp.org +// Learn more about F# at https://fsharp.org // See the 'F# Tutorial' project for more help. [] -let main argv = +let main argv = printfn "%A" argv let c1 = Library1AlwaysInMatchingConfiguration.Class.PropertyAlwaysAvailable let c1 = Library2AlwaysInDebugConfiguration.Class.PropertyAlwaysAvailable diff --git a/tests/projects/vs2019slow/vs2019slow/Program.fs b/tests/projects/vs2019slow/vs2019slow/Program.fs index 2bcf7f9899..da84161c54 100644 --- a/tests/projects/vs2019slow/vs2019slow/Program.fs +++ b/tests/projects/vs2019slow/vs2019slow/Program.fs @@ -1,7 +1,7 @@ -// Learn more about F# at http://fsharp.org +// Learn more about F# at https://fsharp.org // See the 'F# Tutorial' project for more help. [] -let main argv = +let main argv = printfn "%A" argv 0 // return an integer exit code diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/Program.fs b/vsintegration/ProjectTemplates/ConsoleProject/Template/Program.fs index 4ad1e90802..93b7275510 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/Program.fs +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/Program.fs @@ -1,7 +1,7 @@ -// @@@LearnMore|Learn more about F# at http://fsharp.org@@@ +// @@@LearnMore|Learn more about F# at https://fsharp.org@@@ // @@@SeeTutorial|See the 'F# Tutorial' project for more help.@@@ [] -let main argv = +let main argv = printfn "%A" argv 0 // @@@Return|return an integer exit code@@@ diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.cs.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.cs.xlf index 54f3d3c0c9..ffd1deada4 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.cs.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.cs.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Další informace o F# na http://fsharp.org + Learn more about F# at https://fsharp.org + Další informace o F# na https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.de.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.de.xlf index e3b7538200..59272645d4 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.de.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.de.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Weitere Informationen zu F# unter "http://fsharp.org". + Learn more about F# at https://fsharp.org + Weitere Informationen zu F# unter "https://fsharp.org". diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.es.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.es.xlf index 30efd4ece6..081582225e 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.es.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.es.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Más información acerca de F# en http://fsharp.org + Learn more about F# at https://fsharp.org + Más información acerca de F# en https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.fr.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.fr.xlf index 315bebbcac..c2ed6e21e3 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.fr.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.fr.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - En savoir plus sur F# sur le site http://fsharp.org + Learn more about F# at https://fsharp.org + En savoir plus sur F# sur le site https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.it.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.it.xlf index 3f1c17cb06..5b9b76eb7f 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.it.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.it.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Altre informazioni su F# all'indirizzo http://fsharp.org + Learn more about F# at https://fsharp.org + Altre informazioni su F# all'indirizzo https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ja.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ja.xlf index 00489bf797..e0935dc291 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ja.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ja.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - F# の詳細については、http://fsharp.org を参照してください + Learn more about F# at https://fsharp.org + F# の詳細については、https://fsharp.org を参照してください diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ko.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ko.xlf index 3d4586af7d..e41549ea2a 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ko.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ko.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - hF#에 대해 http://fsharp.org에서 자세히 알아보기 + Learn more about F# at https://fsharp.org + hF#에 대해 https://fsharp.org에서 자세히 알아보기 diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pl.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pl.xlf index f8a5de8d77..298af71ef0 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pl.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pl.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Dowiedz się więcej na temat języka F# pod adresem http://fsharp.org + Learn more about F# at https://fsharp.org + Dowiedz się więcej na temat języka F# pod adresem https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pt-BR.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pt-BR.xlf index 30c89d53b9..701d39192b 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pt-BR.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pt-BR.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Saiba mais sobre F# em http://fsharp.org + Learn more about F# at https://fsharp.org + Saiba mais sobre F# em https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ru.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ru.xlf index 7d66166015..57caaf2c82 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ru.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ru.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Дополнительные сведения о F# см. на http://fsharp.org + Learn more about F# at https://fsharp.org + Дополнительные сведения о F# см. на https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.tr.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.tr.xlf index caa20c452c..deaa07d46b 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.tr.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.tr.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - F# hakkında daha fazla bilgi için bkz. http://fsharp.org + Learn more about F# at https://fsharp.org + F# hakkında daha fazla bilgi için bkz. https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hans.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hans.xlf index 83e038a60e..74de5b0fe0 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hans.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hans.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - 在 http://fsharp.org 上了解有关 F# 的详细信息 + Learn more about F# at https://fsharp.org + 在 https://fsharp.org 上了解有关 F# 的详细信息 diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hant.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hant.xlf index 26ef14aae6..b0f43a7d4a 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hant.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hant.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - 請參閱 http://fsharp.org,進一步了解 F# + Learn more about F# at https://fsharp.org + 請參閱 https://fsharp.org,進一步了解 F# diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/Script.fsx b/vsintegration/ProjectTemplates/LibraryProject/Template/Script.fsx index 8eaea69e66..0caeb86ca6 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/Script.fsx +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/Script.fsx @@ -1,4 +1,4 @@ -// @@@LearnMore|Learn more about F# at http://fsharp.org@@@ +// @@@LearnMore|Learn more about F# at https://fsharp.org@@@ // @@@SeeTutorial|See the 'F# Tutorial' project for more help.@@@ #load "Library1.fs" diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.cs.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.cs.xlf index 985099ec87..fc829e7113 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.cs.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.cs.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Další informace o F# na http://fsharp.org + Learn more about F# at https://fsharp.org + Další informace o F# na https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.de.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.de.xlf index 0e507996fb..28fe2b6f40 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.de.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.de.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Weitere Informationen zu F# unter "http://fsharp.org". + Learn more about F# at https://fsharp.org + Weitere Informationen zu F# unter "https://fsharp.org". diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.es.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.es.xlf index 64e2f3bd15..507619b46b 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.es.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.es.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Más información acerca de F# en http://fsharp.org + Learn more about F# at https://fsharp.org + Más información acerca de F# en https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.fr.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.fr.xlf index 59fc3c21d0..53a859e0d5 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.fr.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.fr.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - En savoir plus sur F# sur le site http://fsharp.org + Learn more about F# at https://fsharp.org + En savoir plus sur F# sur le site https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.it.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.it.xlf index 32a62ec653..d65ce6f70c 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.it.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.it.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Altre informazioni su F# all'indirizzo http://fsharp.org + Learn more about F# at https://fsharp.org + Altre informazioni su F# all'indirizzo https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ja.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ja.xlf index 76f079d13e..45cbcbec9a 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ja.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ja.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - F# の詳細については、http://fsharp.org を参照してください + Learn more about F# at https://fsharp.org + F# の詳細については、https://fsharp.org を参照してください diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ko.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ko.xlf index b8477614c1..45d7cd9e47 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ko.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ko.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - hF#에 대해 http://fsharp.org에서 자세히 알아보기 + Learn more about F# at https://fsharp.org + hF#에 대해 https://fsharp.org에서 자세히 알아보기 diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pl.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pl.xlf index 26abdffefe..94269ce71b 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pl.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pl.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Dowiedz się więcej na temat języka F# pod adresem http://fsharp.org + Learn more about F# at https://fsharp.org + Dowiedz się więcej na temat języka F# pod adresem https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pt-BR.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pt-BR.xlf index d1e9d07a6e..f1be7744b1 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pt-BR.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pt-BR.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Saiba mais sobre F# em http://fsharp.org + Learn more about F# at https://fsharp.org + Saiba mais sobre F# em https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ru.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ru.xlf index b8dd108a58..08746c4a7f 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ru.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ru.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - Дополнительные сведения о F# см. на http://fsharp.org + Learn more about F# at https://fsharp.org + Дополнительные сведения о F# см. на https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.tr.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.tr.xlf index 2b4bb37062..564cfc2dca 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.tr.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.tr.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - F# hakkında daha fazla bilgi için bkz. http://fsharp.org + Learn more about F# at https://fsharp.org + F# hakkında daha fazla bilgi için bkz. https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hans.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hans.xlf index 332774539b..0859fdcd1a 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hans.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hans.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - 在 http://fsharp.org 上了解有关 F# 的详细信息 + Learn more about F# at https://fsharp.org + 在 https://fsharp.org 上了解有关 F# 的详细信息 diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hant.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hant.xlf index 9106b3e72c..9edde3fd88 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hant.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hant.xlf @@ -3,8 +3,8 @@ - Learn more about F# at http://fsharp.org - 請參閱 http://fsharp.org,進一步了解 F# + Learn more about F# at https://fsharp.org + 請參閱 https://fsharp.org,進一步了解 F# diff --git a/vsintegration/ProjectTemplates/TutorialProject/Template/Tutorial.fsx b/vsintegration/ProjectTemplates/TutorialProject/Template/Tutorial.fsx index c2b01ecc0e..52b6649ca3 100644 --- a/vsintegration/ProjectTemplates/TutorialProject/Template/Tutorial.fsx +++ b/vsintegration/ProjectTemplates/TutorialProject/Template/Tutorial.fsx @@ -6,17 +6,17 @@ // ******************************************************************************************************* // // @@@MoreAbout|For more about F#, see:@@@ -// http://fsharp.org +// https://fsharp.org // https://docs.microsoft.com/en-us/dotnet/articles/fsharp/ // // @@@SeeDocumentaton|To see this tutorial in documentation form, see:@@@ // https://docs.microsoft.com/en-us/dotnet/articles/fsharp/tour // // @@@LearnMoreAbout|To learn more about applied F# programming, use@@@ -// http://fsharp.org/guides/enterprise/ -// http://fsharp.org/guides/cloud/ -// http://fsharp.org/guides/web/ -// http://fsharp.org/guides/data-science/ +// https://fsharp.org/guides/enterprise/ +// https://fsharp.org/guides/cloud/ +// https://fsharp.org/guides/web/ +// https://fsharp.org/guides/data-science/ // // @@@ToInstall-Line1|To install the Visual F# Power Tools, use@@@ // @@@ToInstall-Line2|'Tools' --> 'Extensions and Updates' --> `Online` and search@@@ @@ -46,7 +46,7 @@ open System /// @@@Module-Line2|Grouping code in modules helps keep related code together and helps avoid name conflicts in your program.@@@ /// /// @@@Module-Line3|To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/modules@@@ -module IntegersAndNumbers = +module IntegersAndNumbers = /// @@@SampleInt|This is a sample integer.@@@ let sampleInteger = 176 @@ -102,7 +102,7 @@ module Immutability = /// @@@FunctionsModule-Line2|useful results.@@@ /// /// @@@FunctionsModule-Line3|To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/functions/@@@ -module BasicFunctions = +module BasicFunctions = /// @@@LetFunction-Line1|You use 'let' to define a function. This one accepts an integer argument and returns an integer.@@@ /// @@@LetFunction-Line2|Parentheses are optional for function arguments, except for when you use an explicit type annotation.@@@ @@ -125,10 +125,10 @@ module BasicFunctions = /// @@@Conditionals-Line1|Conditionals use if/then/elid/elif/else.@@@ /// /// @@@Conditionals-Line2|Note that F# uses whitespace indentation-aware syntax, similar to languages like Python.@@@ - let sampleFunction3 x = - if x < 100.0 then + let sampleFunction3 x = + if x < 100.0 then 2.0*x*x - x/5.0 + 3.0 - else + else 2.0*x*x + x/5.0 - 37.0 let result3 = sampleFunction3 (6.5 + 4.5) @@ -159,7 +159,7 @@ module Booleans = /// @@@Strings-Line1|Strings are fundamental data types in F#. Here are some examples of Strings and basic String manipulation.@@@ /// /// @@@Strings-Line2|To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/strings@@@ -module StringManipulation = +module StringManipulation = /// @@@StringQuotes|Strings use double quotes.@@@ let string1 = "Hello" @@ -173,7 +173,7 @@ module StringManipulation = let string4 = """The computer said "hello world" when I told it to!""" /// @@@StringConcatenation|String concatenation is normally done with the '+' operator.@@@ - let helloWorld = string1 + " " + string2 + let helloWorld = string1 + " " + string2 // @@@StringPrinting|This line uses '%s' to print a string value. This is type-safe.@@@ printfn "%s" helloWorld @@ -205,7 +205,7 @@ module Tuples = let tuple2 = (1, "fred", 3.1415) printfn "tuple1: %A\ttuple2: %A" tuple1 tuple2 - + /// @@@TupleTypeAnnotation-Line1|A simple tuple of integers with a type annotation.@@@ /// @@@TupleTypeAnnotation-Line2|Type annotations for tuples use the * symbol to separate elements@@@ let tuple3: int * int = (5, 9) @@ -249,20 +249,20 @@ module PipelinesAndComposition = /// @@@FilterWithoutPipes-Line1|Given a list of integers, it filters out the even numbers,@@@ /// @@@FilterWithoutPipes-Line2|squares the resulting odds, and adds 1 to the squared odds.@@@ - let squareOddValuesAndAddOne values = + let squareOddValuesAndAddOne values = let odds = List.filter isOdd values let squares = List.map square odds let result = List.map addOne squares result printfn "processing %A through 'squareOddValuesAndAddOne' produces: %A" numbers (squareOddValuesAndAddOne numbers) - + /// @@@FilterShorter-Line1|A shorter way to write 'squareOddValuesAndAddOne' is to nest each@@@ /// @@@FilterShorter-Line2|sub-result into the function calls themselves.@@@ /// /// @@@FilterShorter-Line3|This makes the function much shorter, but it's difficult to see the@@@ /// @@@FilterShorter-Line4|order in which the data is processed.@@@ - let squareOddValuesAndAddOneNested values = + let squareOddValuesAndAddOneNested values = List.map addOne (List.map square (List.filter isOdd values)) printfn "processing %A through 'squareOddValuesAndAddOneNested' produces: %A" numbers (squareOddValuesAndAddOneNested numbers) @@ -331,13 +331,13 @@ module Lists = ] /// @@@NumberList2|This is a list of integers from 1 to 1000@@@ - let numberList = [ 1 .. 1000 ] + let numberList = [ 1 .. 1000 ] /// @@@ListComputation-Line1|Lists can also be generated by computations. This is a list containing@@@ /// @@@ListComputation-Line2|all the days of the year.@@@ - let daysList = + let daysList = [ for month in 1 .. 12 do - for day in 1 .. System.DateTime.DaysInMonth(2017, month) do + for day in 1 .. System.DateTime.DaysInMonth(2017, month) do yield System.DateTime(2017, month, day) ] // @@@PrintList2|Print the first 5 elements of 'daysList' using 'List.take'.@@@ @@ -345,22 +345,22 @@ module Lists = /// @@@ListComputationConditional-Line1|Computations can include conditionals. This is a list containing the tuples@@@ /// @@@ListComputationConditional-Line2|which are the coordinates of the black squares on a chess board.@@@ - let blackSquares = + let blackSquares = [ for i in 0 .. 7 do - for j in 0 .. 7 do - if (i+j) % 2 = 1 then + for j in 0 .. 7 do + if (i+j) % 2 = 1 then yield (i, j) ] /// @@@ListMap-Line1|Lists can be transformed using 'List.map' and other functional programming combinators.@@@ /// @@@ListMap-Line2|This definition produces a new list by squaring the numbers in numberList, using the pipeline@@@ /// @@@ListMap-Line3|operator to pass an argument to List.map.@@@ - let squares = - numberList - |> List.map (fun x -> x*x) + let squares = + numberList + |> List.map (fun x -> x*x) /// @@@ListFilter-Line1|There are many other list combinations. The following computes the sum of the squares of the@@@ /// @@@ListFilter-Line2|numbers divisible by 3.@@@ - let sumOfSquares = + let sumOfSquares = numberList |> List.filter (fun x -> x % 3 = 0) |> List.sumBy (fun x -> x * x) @@ -386,19 +386,19 @@ module Arrays = let array3 = [| 1 .. 1000 |] /// @@@ArrayComputationConstruction|This is an array containing only the words "hello" and "world".@@@ - let array4 = + let array4 = [| for word in array2 do - if word.Contains("l") then + if word.Contains("l") then yield word |] /// @@@ArrayInit|This is an array initialized by index and containing the even numbers from 0 to 2000.@@@ - let evenNumbers = Array.init 1001 (fun n -> n * 2) + let evenNumbers = Array.init 1001 (fun n -> n * 2) /// @@@ArraySlicing|Sub-arrays are extracted using slicing notation.@@@ let evenNumbersSlice = evenNumbers.[0..500] /// @@@ArrayLooping|You can loop over arrays and lists using 'for' loops.@@@ - for word in array4 do + for word in array4 do printfn "word: %s" word // @@@ArrayAssignment-Line1|You can modify the contents of an an array element by using the left arrow assignment operator.@@@ @@ -408,7 +408,7 @@ module Arrays = /// @@@ArrayMap-Line1|You can transform arrays using 'Array.map' and other functional programming operations.@@@ /// @@@ArrayMap-Line2|The following calculates the sum of the lengths of the words that start with 'h'.@@@ - let sumOfLengthsOfWords = + let sumOfLengthsOfWords = array2 |> Array.filter (fun x -> x.StartsWith "h") |> Array.sumBy (fun x -> x.Length) @@ -424,7 +424,7 @@ module Arrays = /// @@@Sequences-Line4|Sequence processing functions can be applied to Lists and Arrays as well.@@@ /// /// @@@Sequences-Line5|To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/sequences@@@ -module Sequences = +module Sequences = /// @@@EmptySequence|This is the empty sequence.@@@ let seq1 = Seq.empty @@ -436,13 +436,13 @@ module Sequences = let numbersSeq = seq { 1 .. 1000 } /// @@@SequenceComposition|This is a sequence producing the words "hello" and "world"@@@ - let seq3 = + let seq3 = seq { for word in seq2 do - if word.Contains("l") then + if word.Contains("l") then yield word } /// @@@SequenceInit|This sequence producing the even numbers up to 2000.@@@ - let evenNumbers = Seq.init 1001 (fun n -> n * 2) + let evenNumbers = Seq.init 1001 (fun n -> n * 2) let rnd = System.Random() @@ -453,8 +453,8 @@ module Sequences = yield! randomWalk (x + rnd.NextDouble() - 0.5) } /// @@@Sequence100Elements|This example shows the first 100 elements of the random walk.@@@ - let first100ValuesOfRandomWalk = - randomWalk 5.0 + let first100ValuesOfRandomWalk = + randomWalk 5.0 |> Seq.truncate 100 |> Seq.toList @@ -467,11 +467,11 @@ module Sequences = /// @@@RecursiveFunctions-Line3|Recursion is the preferred way to process sequences or collections in F#.@@@ /// /// @@@RecursiveFunctions-Line4|To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/functions/index#recursive-functions@@@ -module RecursiveFunctions = - +module RecursiveFunctions = + /// @@@RecFunDef-Line1|This example shows a recursive function that computes the factorial of an@@@ /// @@@RecRunDef-Line2|integer. It uses 'let rec' to define a recursive function.@@@ - let rec factorial n = + let rec factorial n = if n = 0 then 1 else n * factorial (n-1) printfn "Factorial of 6 is: %d" (factorial 6) @@ -499,7 +499,7 @@ module RecursiveFunctions = match xs with | [] -> accumulator | y::ys -> sumListTailRecHelper (accumulator+y) ys - + /// @@@RecSumListTailInvoke-Line1|This invokes the tail recursive helper function, providing '0' as a seed accumulator.@@@ /// @@@RecSumListTailInvoke-Line2|An approach like this is common in F#.@@@ let sumListTailRecursive xs = sumListTailRecHelper 0 xs @@ -513,18 +513,18 @@ module RecursiveFunctions = /// @@@Records-Line2|They are immutable and have structural equality semantics.@@@ /// /// @@@Records-Line3|To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/records@@@ -module RecordTypes = +module RecordTypes = /// @@@RecordDefinition|This example shows how to define a new record type.@@@ - type ContactCard = + type ContactCard = { Name : string Phone : string Verified : bool } - + /// @@@RecordInstantiation1|This example shows how to instantiate a record type.@@@ - let contact1 = - { Name = "Alf" - Phone = "(206) 555-0157" + let contact1 = + { Name = "Alf" + Phone = "(206) 555-0157" Verified = false } /// @@@RecordInstantiation2|You can also do this on the same line with ';' separators.@@@ @@ -535,14 +535,14 @@ module RecordTypes = /// @@@UpdateRecord-Line3|the 'Phone' and 'Verified' fields.@@@ /// /// @@@UpdateRecord-Line4|To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/copy-and-update-record-expressions@@@ - let contact2 = - { contact1 with + let contact2 = + { contact1 with Phone = "(206) 555-0112" Verified = true } /// @@@ProcessRecord-Line1|This example shows how to write a function that processes a record value.@@@ /// @@@ProcessRecord-Line2|It converts a 'ContactCard' object to a string.@@@ - let showContactCard (c: ContactCard) = + let showContactCard (c: ContactCard) = c.Name + " Phone: " + c.Phone + (if not c.Verified then " (unverified)" else "") printfn "Alf's Contact Card: %s" (showContactCard contact1) @@ -558,12 +558,12 @@ module RecordTypes = member this.PrintedContactCard = this.Name + " Phone: " + this.Phone + (if not this.Verified then " (unverified)" else "") + this.Address - let contactAlternate = - { Name = "Alf" - Phone = "(206) 555-0157" - Verified = false + let contactAlternate = + { Name = "Alf" + Phone = "(206) 555-0157" + Verified = false Address = "111 Alf Street" } - + // @@@RecordAccess|Members are accessed via the '.' operator on an instantiated type.@@@ printfn "Alf's alternate contact card is %s" contactAlternate.PrintedContactCard @@ -571,7 +571,7 @@ module RecordTypes = /// @@@RecordStruct-Line2|This is helpful in situations where the performance of structs outweighs@@@ /// @@@RecordStruct-Line3|the flexibility of reference types.@@@ [] - type ContactCardStruct = + type ContactCardStruct = { Name : string Phone : string Verified : bool } @@ -581,17 +581,17 @@ module RecordTypes = /// @@@DiscriminatedUnions-Line2|Data stored in DUs can be one of several distinct values.@@@ /// /// @@@DiscriminatedUnions-Line3|To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/discriminated-unions@@@ -module DiscriminatedUnions = +module DiscriminatedUnions = /// @@@CardSuit|The following represents the suit of a playing card.@@@ - type Suit = - | Hearts - | Clubs - | Diamonds + type Suit = + | Hearts + | Clubs + | Diamonds | Spades /// @@@CardRank|A Disciminated Union can also be used to represent the rank of a playing card.@@@ - type Rank = + type Rank = /// @@@CardRankValue|Represents the rank of cards 2 .. 10@@@ | Value of int | Ace @@ -600,34 +600,34 @@ module DiscriminatedUnions = | Jack /// @@@CardMember|Discriminated Unions can also implement object-oriented members.@@@ - static member GetAllRanks() = + static member GetAllRanks() = [ yield Ace for i in 2 .. 10 do yield Value i yield Jack yield Queen yield King ] - + /// @@@CardType-Line1|This is a record type that combines a Suit and a Rank.@@@ /// @@@CardType-Line2|It's common to use both Records and Disciminated Unions when representing data.@@@ type Card = { Suit: Suit; Rank: Rank } - + /// @@@ComputeFullDeck|This computes a list representing all the cards in the deck.@@@ - let fullDeck = + let fullDeck = [ for suit in [ Hearts; Diamonds; Clubs; Spades] do - for rank in Rank.GetAllRanks() do + for rank in Rank.GetAllRanks() do yield { Suit=suit; Rank=rank } ] /// @@@CardToString|This example converts a 'Card' object to a string.@@@ - let showPlayingCard (c: Card) = - let rankString = - match c.Rank with + let showPlayingCard (c: Card) = + let rankString = + match c.Rank with | Ace -> "Ace" | King -> "King" | Queen -> "Queen" | Jack -> "Jack" | Value n -> string n - let suitString = - match c.Suit with + let suitString = + match c.Suit with | Clubs -> "clubs" | Diamonds -> "diamonds" | Spades -> "spades" @@ -635,8 +635,8 @@ module DiscriminatedUnions = rankString + " of " + suitString /// @@@PrintAllCards|This example prints all the cards in a playing deck.@@@ - let printAllCards() = - for card in fullDeck do + let printAllCards() = + for card in fullDeck do printfn "%s" (showPlayingCard card) // @@@SingleCaseDu-Line1|Single-case DUs are often used for domain modeling. This can buy you extra type safety@@@ @@ -795,7 +795,7 @@ module PatternMatching = /// @@@Option-Line3|languages would use null references.@@@ /// /// @@@Option-Line4|To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/options@@@ -module OptionValues = +module OptionValues = /// @@@ZipCode|First, define a zipcode defined via Single-case Discriminated Union.@@@ type ZipCode = ZipCode of string @@ -813,8 +813,8 @@ module OptionValues = /// @@@CalcShippingZone-Line2|This uses combinators in the Option module to allow a functional pipeline for@@@ /// @@@CalcShippingZone-Line3|transforming data with Optionals.@@@ let CustomerShippingZone (calculator: ShippingCalculator, customer: Customer) = - customer.ZipCode - |> Option.bind calculator.GetState + customer.ZipCode + |> Option.bind calculator.GetState |> Option.map calculator.GetShippingZone @@ -822,7 +822,7 @@ module OptionValues = /// @@@UnitsOfMeasure-Line2|You can then perform type-safe arithmetic on these values.@@@ /// /// @@@UnitsOfMeasure-Line3|To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/units-of-measure@@@ -module UnitsOfMeasure = +module UnitsOfMeasure = /// @@@CommonUnits|First, open a collection of common unit names@@@ open Microsoft.FSharp.Data.UnitSystems.SI.UnitNames @@ -852,7 +852,7 @@ module UnitsOfMeasure = /// @@@Classes-Line3|To learn more about Classes, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/classes@@@ /// /// @@@Classes-Line4|To learn more about Members, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/members@@@ -module DefiningClasses = +module DefiningClasses = /// @@@Vector-Line1|A simple two-dimensional Vector class.@@@ /// @@ -874,7 +874,7 @@ module DefiningClasses = /// @@@MemberMethod|This member is a method. The previous members were properties.@@@ member this.Scale(k) = Vector2D(k * this.DX, k * this.DY) - + /// @@@InstantiateClass|This is how you instantiate the Vector2D class.@@@ let vector1 = Vector2D(3.0, 4.0) @@ -888,15 +888,15 @@ module DefiningClasses = /// @@@GenericClasses-Line2|In the following, 'T is the type parameter for the class.@@@ /// /// @@@GenericClasses-Line3|To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/generics/@@@ -module DefiningGenericClasses = +module DefiningGenericClasses = - type StateTracker<'T>(initialElement: 'T) = + type StateTracker<'T>(initialElement: 'T) = /// @@@InternalField|This internal field store the states in a list.@@@ let mutable states = [ initialElement ] /// @@@AddElement|Add a new element to the list of states.@@@ - member this.UpdateState newState = + member this.UpdateState newState = states <- newState :: states // @@@MutableAssignment|use the '<-' operator to mutate the value.@@@ /// @@@History|Get the entire list of historical states.@@@ @@ -943,18 +943,18 @@ module ImplementingInterfaces = /// /// @@@Parallel-Line3|To learn more, see: https://msdn.microsoft.com/en-us/visualfsharpdocs/conceptual/array.parallel-module-%5Bfsharp%5D@@@ module ParallelArrayProgramming = - + /// @@@InputArray|First, an array of inputs.@@@ let oneBigArray = [| 0 .. 100000 |] - + // @@@ExpensiveFunction|Next, define a functions that does some CPU intensive computation.@@@ - let rec computeSomeFunction x = - if x <= 2 then 1 + let rec computeSomeFunction x = + if x <= 2 then 1 else computeSomeFunction (x - 1) + computeSomeFunction (x - 2) - + // @@@ParallelMap|Next, do a parallel map over a large input array.@@@ - let computeResults() = - oneBigArray + let computeResults() = + oneBigArray |> Array.Parallel.map (fun x -> computeSomeFunction (x % 20)) // @@@PrintParallel|Next, print the results.@@@ @@ -968,7 +968,7 @@ module ParallelArrayProgramming = module Events = /// @@@SimpleEvent|First, create instance of Event object that consists of subscription point (event.Publish) and event trigger (event.Trigger).@@@ - let simpleEvent = new Event() + let simpleEvent = new Event() // @@@AddEventHandler1|Next, add handler to the event.@@@ simpleEvent.Publish.Add( @@ -990,7 +990,7 @@ module Events = #if COMPILED -module BoilerPlateForForm = +module BoilerPlateForForm = [] do () do System.Windows.Forms.Application.Run() diff --git a/vsintegration/Utils/LanguageServiceProfiling/Program.fs b/vsintegration/Utils/LanguageServiceProfiling/Program.fs index 521c3b9020..fc33ebc7d2 100644 --- a/vsintegration/Utils/LanguageServiceProfiling/Program.fs +++ b/vsintegration/Utils/LanguageServiceProfiling/Program.fs @@ -2,19 +2,19 @@ Background check a project "CXGSCGS" (Check, Flush, GC, Stats, Check, GC, Stats) - .\Release\net40\bin\LanguageServiceProfiling.exe ..\FSharp.Compiler.Service CXGSCGS + .\Release\net40\bin\LanguageServiceProfiling.exe ..\FSharp.Compiler.Service CXGSCGS Foreground check new versions of multiple files in an already-checked project and keep intellisense info "CGSFGS" (Check, GC, Stats, File, GC, Stats) - .\Release\net40\bin\LanguageServiceProfiling.exe ..\FSharp.Compiler.Service CGSFGS + .\Release\net40\bin\LanguageServiceProfiling.exe ..\FSharp.Compiler.Service CGSFGS Use the following to collect memory usage stats, appending to the existing stats files: - git clone http://github.com/fsharp/FSharp.Compiler.Service tests\scripts\tmp\FSharp.Compiler.Service + git clone https://github.com/fsharp/FSharp.Compiler.Service tests\scripts\tmp\FSharp.Compiler.Service pushd tests\scripts\tmp\FSharp.Compiler.Service - git checkout 2d51df21ca1d86d4d6676ead3b1fb125b2a0d1ba + git checkout 2d51df21ca1d86d4d6676ead3b1fb125b2a0d1ba .\build Build.NetFx popd @@ -59,7 +59,7 @@ let internal getQuickInfoText (FSharpToolTipText.FSharpToolTipText elements) : s elements |> List.map (parseElement) |> String.concat "\n" |> normalizeLineEnds [] -let main argv = +let main argv = let rootDir = argv.[0] let scriptOpt = if argv.Length >= 2 then Some argv.[1] else None let msgOpt = if argv.Length >= 3 then Some argv.[2] else None @@ -72,7 +72,7 @@ let main argv = eprintfn "Found options for %s." options.Options.ProjectFileName let checker = FSharpChecker.Create(projectCacheSize = 200, keepAllBackgroundResolutions = false) let waste = new ResizeArray() - + let checkProject() : Async = async { eprintfn "ParseAndCheckProject(%s)..." (Path.GetFileName options.Options.ProjectFileName) @@ -81,7 +81,7 @@ let main argv = if result.HasCriticalErrors then eprintfn "Finished with ERRORS: %+A" result.Errors return None - else + else eprintfn "Finished successfully in %O" sw.Elapsed return Some result } @@ -99,29 +99,29 @@ let main argv = if results.Errors |> Array.exists (fun x -> x.Severity = FSharpErrorSeverity.Error) then eprintfn "Finished with ERRORS in %O: %+A" sw.Elapsed results.Errors return None - else + else eprintfn "Finished successfully in %O" sw.Elapsed return Some results } - + let checkFiles (fileVersion: int) = async { - eprintfn "multiple ParseAndCheckFileInProject(...)..." + eprintfn "multiple ParseAndCheckFileInProject(...)..." let sw = Stopwatch.StartNew() - let answers = - options.FilesToCheck |> List.map (fun file -> + let answers = + options.FilesToCheck |> List.map (fun file -> eprintfn "doing %s" file checker.ParseAndCheckFileInProject(file, fileVersion, SourceText.ofString (File.ReadAllText file), options.Options) |> Async.RunSynchronously) - for _,answer in answers do + for _,answer in answers do match answer with | FSharpCheckFileAnswer.Aborted -> - eprintfn "Aborted!" + eprintfn "Aborted!" | FSharpCheckFileAnswer.Succeeded results -> if results.Errors |> Array.exists (fun x -> x.Severity = FSharpErrorSeverity.Error) then eprintfn "Finished with ERRORS: %+A" results.Errors eprintfn "Finished in %O" sw.Elapsed } - + let findAllReferences (fileVersion: int) : Async = async { eprintfn "Find all references (symbol = '%s', file = '%s')" options.SymbolText options.FileToCheck @@ -139,13 +139,13 @@ let main argv = let! symbolUses = projectResults.GetUsesOfSymbol(symbolUse.Symbol) eprintfn "Found %d symbol uses in %O" symbolUses.Length sw.Elapsed return symbolUses - | None -> + | None -> eprintfn "Symbol '%s' was not found at (%d, %d) in %s" options.SymbolText options.SymbolPos.Line options.SymbolPos.Column options.FileToCheck return [||] - | None -> + | None -> eprintfn "No file check results for %s" options.FileToCheck return [||] - | None -> + | None -> eprintfn "No project results for %s" options.Options.ProjectFileName return [||] } @@ -158,7 +158,7 @@ let main argv = match fileResults with | Some fileResults -> let parsingOptions, _ = checker.GetParsingOptionsFromProjectOptions(options.Options) - let! parseResult = checker.ParseFile(options.FileToCheck, SourceText.ofString (getFileText()), parsingOptions) + let! parseResult = checker.ParseFile(options.FileToCheck, SourceText.ofString (getFileText()), parsingOptions) for completion in options.CompletionPositions do eprintfn "querying %A %s" completion.QualifyingNames completion.PartialName let! listInfo = @@ -171,18 +171,18 @@ let main argv = EndColumn = completion.Position.Column - 1 LastDotPos = None }, fun() -> []) - + for i in listInfo.Items do eprintfn "%s" (getQuickInfoText i.DescriptionText) | None -> eprintfn "no declarations" | None -> eprintfn "no declarations" } - + let wasteMemory () = waste.Add(Array.zeroCreate (1024 * 1024 * 25)) - if useConsole then + if useConsole then eprintfn """Press: for check the project @@ -197,7 +197,7 @@ let main argv = for exit.""" let mutable tPrev = None - let stats() = + let stats() = // Note that timing calls are relatively expensive on the startup path so we don't // make this call unless showTimes has been turned on. let uproc = System.Diagnostics.Process.GetCurrentProcess() @@ -209,9 +209,9 @@ let main argv = match tPrev with | Some (timePrev, gcPrev:int[], wsPrev)-> let spanGC = [| for i in 0 .. maxGen -> System.GC.CollectionCount(i) - gcPrev.[i] |] - printfn "%s TimeDelta: %4.2f MemDelta: %4d G0: %4d G1: %4d G2: %4d" + printfn "%s TimeDelta: %4.2f MemDelta: %4d G0: %4d G1: %4d G2: %4d" (match msgOpt with Some msg -> msg | None -> "statistics:") - (timeNow - timePrev) + (timeNow - timePrev) (wsNow - wsPrev) spanGC.[min 0 maxGen] spanGC.[min 1 maxGen] spanGC.[min 2 maxGen] @@ -219,11 +219,11 @@ let main argv = tPrev <- Some (timeNow, gcNow, wsNow) let processCmd (fileVersion: int) c = - match c with - | 'C' -> + match c with + | 'C' -> checkProject() |> Async.RunSynchronously |> ignore fileVersion - | 'G' -> + | 'G' -> eprintfn "GC is running..." let sw = Stopwatch.StartNew() GC.Collect 2 @@ -248,7 +248,7 @@ let main argv = stats() fileVersion | 'X' -> - checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() + checker.ClearLanguageServiceRootCachesAndCollectAndFinalizeAllTransients() fileVersion | 'P' -> eprintfn "pausing (press any key)..."; @@ -256,24 +256,24 @@ let main argv = fileVersion | _ -> fileVersion - let rec console fileVersion = + let rec console fileVersion = match Console.ReadKey().Key with | ConsoleKey.C -> processCmd fileVersion 'C' |> console | ConsoleKey.G -> processCmd fileVersion 'G' |> console | ConsoleKey.F -> processCmd fileVersion 'F' |> console | ConsoleKey.R -> processCmd fileVersion 'R' |> console | ConsoleKey.L -> processCmd fileVersion 'L' |> console - | ConsoleKey.W -> processCmd fileVersion 'W' |> console + | ConsoleKey.W -> processCmd fileVersion 'W' |> console | ConsoleKey.M -> processCmd fileVersion 'M' |> console | ConsoleKey.X -> processCmd fileVersion 'X' |> console | ConsoleKey.P -> processCmd fileVersion 'P' |> console | ConsoleKey.Enter -> () | _ -> console fileVersion - let runScript (script:string) = + let runScript (script:string) = (0,script) ||> Seq.fold processCmd |> ignore - match scriptOpt with + match scriptOpt with | None -> console 0 | Some s -> runScript s 0 \ No newline at end of file diff --git a/vsintegration/tests/UnitTests/IndentationServiceTests.fs b/vsintegration/tests/UnitTests/IndentationServiceTests.fs index 7c1689119e..d16c48ddab 100644 --- a/vsintegration/tests/UnitTests/IndentationServiceTests.fs +++ b/vsintegration/tests/UnitTests/IndentationServiceTests.fs @@ -19,7 +19,7 @@ open UnitTests.TestLib.LanguageService [][] type IndentationServiceTests() = let filePath = "C:\\test.fs" - let projectOptions: FSharpProjectOptions = { + let projectOptions: FSharpProjectOptions = { ProjectFileName = "C:\\test.fsproj" ProjectId = None SourceFiles = [| filePath |] @@ -37,22 +37,22 @@ type IndentationServiceTests() = let documentId = DocumentId.CreateNewId(ProjectId.CreateNewId()) let tabSize = 4 let indentStyle = FormattingOptions.IndentStyle.Smart - + let indentComment = System.Text.RegularExpressions.Regex(@"\$\s*Indent:\s*(\d+)\s*\$") let consoleProjectTemplate = " -// Learn more about F# at http://fsharp.org +// Learn more about F# at https://fsharp.org // See the 'F# Tutorial' project for more help. [] -let main argv = +let main argv = printfn \"%A\" argv 0 // return an integer exit code" let libraryProjectTemplate = " namespace ProjectNamespace -type Class1() = +type Class1() = member this.X = \"F#\"" let nestedTypesTemplate = " @@ -67,12 +67,12 @@ let plus x y = x + y // $Indent: 4$ let mutable x = 0 -x <- +x <- 10 * 2 // $Indent: 4$ match some 10 with | None -> 0 -| Some x -> +| Some x -> x + 1 // $Indent: 4$ try @@ -132,7 +132,7 @@ while true do // Even if the line before only had comment like this // The follwing line should inherit that indentation too $Indent: 4$ " - + let testCases = [| ( None, 0, consoleProjectTemplate ) ( None, 1, consoleProjectTemplate ) @@ -143,14 +143,14 @@ while true do ( Some(4), 6, consoleProjectTemplate ) ( Some(4), 7, consoleProjectTemplate ) ( Some(4), 8, consoleProjectTemplate ) - + ( None, 0, libraryProjectTemplate ) ( None, 1, libraryProjectTemplate ) ( Some(0), 2, libraryProjectTemplate ) ( Some(0), 3, libraryProjectTemplate ) ( Some(4), 4, libraryProjectTemplate ) ( Some(4), 5, libraryProjectTemplate ) - + ( None, 0, nestedTypesTemplate ) ( None, 1, nestedTypesTemplate ) ( Some(0), 2, nestedTypesTemplate ) @@ -171,8 +171,8 @@ while true do ( Some(expectedIndentation), lineNumber, autoIndentTemplate )) [] - member this.TestIndentation() = - for (expectedIndentation, lineNumber, template) in testCases do + member this.TestIndentation() = + for (expectedIndentation, lineNumber, template) in testCases do let sourceText = SourceText.From(template) let parsingOptions, _ = checker.GetParsingOptionsFromProjectOptions projectOptions @@ -181,13 +181,13 @@ while true do | None -> Assert.IsTrue(actualIndentation.IsNone, "No indentation was expected at line {0}", lineNumber) | Some indentation -> Assert.AreEqual(expectedIndentation.Value, actualIndentation.Value, "Indentation on line {0} doesn't match", lineNumber) - [] - member this.TestAutoIndentation() = - for (expectedIndentation, lineNumber, template) in autoIndentTestCases do + [] + member this.TestAutoIndentation() = + for (expectedIndentation, lineNumber, template) in autoIndentTestCases do + - let sourceText = SourceText.From(template) - + let parsingOptions, _ = checker.GetParsingOptionsFromProjectOptions projectOptions let actualIndentation = FSharpIndentationService.GetDesiredIndentation(documentId, sourceText, filePath, lineNumber, tabSize, indentStyle, Some (parsingOptions, projectOptions)) match expectedIndentation with From 6d699222deacc3820a1ec4f3516ce6612c95a80b Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Thu, 27 Jun 2019 05:36:16 +0200 Subject: [PATCH 119/286] Remove dead code (#7068) --- src/fsharp/CompileOps.fs | 3 --- src/fsharp/FSStrings.resx | 3 --- src/fsharp/xlf/FSStrings.cs.xlf | 5 ----- src/fsharp/xlf/FSStrings.de.xlf | 5 ----- src/fsharp/xlf/FSStrings.es.xlf | 5 ----- src/fsharp/xlf/FSStrings.fr.xlf | 5 ----- src/fsharp/xlf/FSStrings.it.xlf | 5 ----- src/fsharp/xlf/FSStrings.ja.xlf | 5 ----- src/fsharp/xlf/FSStrings.ko.xlf | 5 ----- src/fsharp/xlf/FSStrings.pl.xlf | 5 ----- src/fsharp/xlf/FSStrings.pt-BR.xlf | 5 ----- src/fsharp/xlf/FSStrings.ru.xlf | 5 ----- src/fsharp/xlf/FSStrings.tr.xlf | 5 ----- src/fsharp/xlf/FSStrings.zh-Hans.xlf | 5 ----- src/fsharp/xlf/FSStrings.zh-Hant.xlf | 5 ----- 15 files changed, 71 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 491a753b9d..f40b700a5f 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -769,9 +769,6 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (suggestNames os.Append(PossibleOverloadE().Format minfo (buf.ToString())) |> ignore - //| PossibleBestOverload(_, minfo, m) -> - // Printf.bprintf os "\n\nPossible best overload: '%s'." minfo - | FunctionExpected _ -> os.Append(FunctionExpectedE().Format) |> ignore diff --git a/src/fsharp/FSStrings.resx b/src/fsharp/FSStrings.resx index 05cd75cc66..9794e8fb4d 100644 --- a/src/fsharp/FSStrings.resx +++ b/src/fsharp/FSStrings.resx @@ -162,9 +162,6 @@ Possible overload: '{0}'. {1}. - - \n\nPossible best overload: '{0}'. - This function takes too many arguments, or is used in a context where a function is not expected diff --git a/src/fsharp/xlf/FSStrings.cs.xlf b/src/fsharp/xlf/FSStrings.cs.xlf index 91a4ac37be..5e4388a386 100644 --- a/src/fsharp/xlf/FSStrings.cs.xlf +++ b/src/fsharp/xlf/FSStrings.cs.xlf @@ -77,11 +77,6 @@ Možné přetížení: {0}. {1}. - - \n\nPossible best overload: '{0}'. - \n\nNejlepší možné přetížení: {0}. - - This function takes too many arguments, or is used in a context where a function is not expected Tato funkce přebírá příliš mnoho argumentů, nebo se používá v kontextu, ve kterém se funkce neočekává. diff --git a/src/fsharp/xlf/FSStrings.de.xlf b/src/fsharp/xlf/FSStrings.de.xlf index 7e39e99b0a..60734cae52 100644 --- a/src/fsharp/xlf/FSStrings.de.xlf +++ b/src/fsharp/xlf/FSStrings.de.xlf @@ -77,11 +77,6 @@ Mögliche Überladung: '{0}'. {1}. - - \n\nPossible best overload: '{0}'. - \n\nMögliche beste Überladung: "{0}". - - This function takes too many arguments, or is used in a context where a function is not expected Diese Funktion akzeptiert zu viele Argumente oder wird in einem Kontext verwendet, in dem keine Funktion erwartet wird. diff --git a/src/fsharp/xlf/FSStrings.es.xlf b/src/fsharp/xlf/FSStrings.es.xlf index a23054dec2..238c6db503 100644 --- a/src/fsharp/xlf/FSStrings.es.xlf +++ b/src/fsharp/xlf/FSStrings.es.xlf @@ -77,11 +77,6 @@ Sobrecarga posible: '{0}'. {1}. - - \n\nPossible best overload: '{0}'. - \n\nMejor sobrecarga posible: '{0}'. - - This function takes too many arguments, or is used in a context where a function is not expected Esta función toma demasiados argumentos o se usa en un contexto donde no se espera una función. diff --git a/src/fsharp/xlf/FSStrings.fr.xlf b/src/fsharp/xlf/FSStrings.fr.xlf index b17a66de85..104d9221cd 100644 --- a/src/fsharp/xlf/FSStrings.fr.xlf +++ b/src/fsharp/xlf/FSStrings.fr.xlf @@ -77,11 +77,6 @@ Surcharge possible : '{0}'. {1}. - - \n\nPossible best overload: '{0}'. - \n\nMeilleure surcharge possible : '{0}'. - - This function takes too many arguments, or is used in a context where a function is not expected Cette fonction accepte trop d'arguments ou est utilisée dans un contexte où aucune fonction n'est attendue diff --git a/src/fsharp/xlf/FSStrings.it.xlf b/src/fsharp/xlf/FSStrings.it.xlf index a1ead8b3ad..6ec47804c8 100644 --- a/src/fsharp/xlf/FSStrings.it.xlf +++ b/src/fsharp/xlf/FSStrings.it.xlf @@ -77,11 +77,6 @@ Possibile overload: '{0}'. {1}. - - \n\nPossible best overload: '{0}'. - \n\nPossibile overload migliore: '{0}'. - - This function takes too many arguments, or is used in a context where a function is not expected Questa funzione utilizza troppi argomenti oppure è utilizzata in un contesto in cui non è prevista una funzione diff --git a/src/fsharp/xlf/FSStrings.ja.xlf b/src/fsharp/xlf/FSStrings.ja.xlf index eb91f5fb4f..a53a982545 100644 --- a/src/fsharp/xlf/FSStrings.ja.xlf +++ b/src/fsharp/xlf/FSStrings.ja.xlf @@ -77,11 +77,6 @@ 使用できるオーバーロードは '{0}' です。{1}。 - - \n\nPossible best overload: '{0}'. - \n\n使用できる中で最適なオーバーロードは '{0}' です。 - - This function takes too many arguments, or is used in a context where a function is not expected この関数の引数が多すぎるか、関数を使用できない場所で関数が使用されています diff --git a/src/fsharp/xlf/FSStrings.ko.xlf b/src/fsharp/xlf/FSStrings.ko.xlf index 8242499042..dd4fc36394 100644 --- a/src/fsharp/xlf/FSStrings.ko.xlf +++ b/src/fsharp/xlf/FSStrings.ko.xlf @@ -77,11 +77,6 @@ 가능한 오버로드: '{0}'. {1}. - - \n\nPossible best overload: '{0}'. - \n\n가능한 최적의 오버로드: '{0}' - - This function takes too many arguments, or is used in a context where a function is not expected 이 함수는 너무 많은 인수를 사용하거나 함수가 필요하지 않은 컨텍스트에서 사용되었습니다. diff --git a/src/fsharp/xlf/FSStrings.pl.xlf b/src/fsharp/xlf/FSStrings.pl.xlf index 354f7aec8d..d48940e6a3 100644 --- a/src/fsharp/xlf/FSStrings.pl.xlf +++ b/src/fsharp/xlf/FSStrings.pl.xlf @@ -77,11 +77,6 @@ Możliwe przeciążenie: „{0}”. {1}. - - \n\nPossible best overload: '{0}'. - \n\nNajlepsze możliwe przeciążenie: „{0}”. - - This function takes too many arguments, or is used in a context where a function is not expected Ta funkcja akceptuje za dużo argumentów lub jest używana w kontekście, w którym funkcja nie jest oczekiwana diff --git a/src/fsharp/xlf/FSStrings.pt-BR.xlf b/src/fsharp/xlf/FSStrings.pt-BR.xlf index 3c2a5f2296..502ee57c81 100644 --- a/src/fsharp/xlf/FSStrings.pt-BR.xlf +++ b/src/fsharp/xlf/FSStrings.pt-BR.xlf @@ -77,11 +77,6 @@ Sobrecarga possível: '{0}'. {1}. - - \n\nPossible best overload: '{0}'. - \n\nMelhor sobrecarga possível: '{0}'. - - This function takes too many arguments, or is used in a context where a function is not expected Esta função obtém muitos argumentos, ou é usada em um contexto onde uma função não é esperada diff --git a/src/fsharp/xlf/FSStrings.ru.xlf b/src/fsharp/xlf/FSStrings.ru.xlf index cd7d4e5e29..68ee12a770 100644 --- a/src/fsharp/xlf/FSStrings.ru.xlf +++ b/src/fsharp/xlf/FSStrings.ru.xlf @@ -77,11 +77,6 @@ Возможная перегрузка: "{0}". {1}. - - \n\nPossible best overload: '{0}'. - \n\nВозможная наилучшая перегрузка: '{0}'. - - This function takes too many arguments, or is used in a context where a function is not expected Эта функция принимает слишком много аргументов либо используется в контексте, где функции не допускаются diff --git a/src/fsharp/xlf/FSStrings.tr.xlf b/src/fsharp/xlf/FSStrings.tr.xlf index 1d5eca8822..24c9175d5d 100644 --- a/src/fsharp/xlf/FSStrings.tr.xlf +++ b/src/fsharp/xlf/FSStrings.tr.xlf @@ -77,11 +77,6 @@ Olası aşırı yükleme: '{0}'. {1}. - - \n\nPossible best overload: '{0}'. - \n\nOlası en iyi aşırı yükleme: '{0}'. - - This function takes too many arguments, or is used in a context where a function is not expected Bu işlev çok fazla bağımsız değişken alıyor veya bir işlev beklenmeyen bağlamda kullanılıyor diff --git a/src/fsharp/xlf/FSStrings.zh-Hans.xlf b/src/fsharp/xlf/FSStrings.zh-Hans.xlf index 16e798e089..374effcde5 100644 --- a/src/fsharp/xlf/FSStrings.zh-Hans.xlf +++ b/src/fsharp/xlf/FSStrings.zh-Hans.xlf @@ -77,11 +77,6 @@ 可能的重载:“{0}”。{1}。 - - \n\nPossible best overload: '{0}'. - \n\n可能的最佳重载:“{0}”。 - - This function takes too many arguments, or is used in a context where a function is not expected 此函数采用的参数过多,或者用于不需要函数的上下文中 diff --git a/src/fsharp/xlf/FSStrings.zh-Hant.xlf b/src/fsharp/xlf/FSStrings.zh-Hant.xlf index c895858a67..47e8ce91a6 100644 --- a/src/fsharp/xlf/FSStrings.zh-Hant.xlf +++ b/src/fsharp/xlf/FSStrings.zh-Hant.xlf @@ -77,11 +77,6 @@ 可能的多載: '{0}'。{1}。 - - \n\nPossible best overload: '{0}'. - \n\n可能的最佳多載: '{0}'。 - - This function takes too many arguments, or is used in a context where a function is not expected 這個函式接受太多引數,或是用在不需要函式的內容中 From 86f8b1788c7ac996fafec1f1e6cf8a0eff39bd70 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Thu, 27 Jun 2019 05:38:17 +0200 Subject: [PATCH 120/286] Avoid allocating in IsOperatorName (#7061) * Avoid allocating in IsOperatorName * bring back Ordinal * flip bool --- src/fsharp/ErrorResolutionHints.fs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/fsharp/ErrorResolutionHints.fs b/src/fsharp/ErrorResolutionHints.fs index fc136a8bed..02ebc1e1b6 100644 --- a/src/fsharp/ErrorResolutionHints.fs +++ b/src/fsharp/ErrorResolutionHints.fs @@ -36,11 +36,16 @@ let FilterPredictions (suggestionF:ErrorLogger.Suggestions) (idText:string) = /// Returns `true` if given string is an operator display name, e.g. ( |>> ) let IsOperatorName (name: string) = - if not (name.StartsWithOrdinal("( ") && name.EndsWithOrdinal(" )")) then + if isNull name || not (name.StartsWithOrdinal("( ") && name.EndsWithOrdinal(" )")) then false else - let name = name.[2..name.Length - 3] - name |> Seq.forall (fun c -> c <> ' ') + let mutable i = 2 + let mutable isOperator = true + while isOperator && i < name.Length - 3 do + if name.[i] = ' ' then + isOperator <- false + i <- i + 1 + isOperator if allSuggestions.Contains idText then [] else // some other parsing error occurred let dotIdText = "." + idText From c3b6dffa8c68f8a6abb1182494d49d64abf9b247 Mon Sep 17 00:00:00 2001 From: Volker Milbrandt Date: Thu, 27 Jun 2019 05:40:01 +0200 Subject: [PATCH 121/286] Fix build GenerateDocs (#7054) * if file does not exist but folder an error is reported Signed-off-by: Volker Milbrandt * `fcs\build GenerateDocs` didn't run for FAKE 4.64.6 didn't do the full migration yet https://fake.build/fake-migrate-to-fake-5.html --- fcs/download-paket.ps1 | 8 +++++--- fcs/download-paket.sh | 6 ++++-- fcs/paket.dependencies | 2 +- fcs/paket.lock | 23 ++++++++++++++++------- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/fcs/download-paket.ps1 b/fcs/download-paket.ps1 index 1c781b0bd1..7aa8c5ef6f 100644 --- a/fcs/download-paket.ps1 +++ b/fcs/download-paket.ps1 @@ -1,4 +1,4 @@ -$paketurl="https://github.com/fsprojects/Paket/releases/download/5.201.1/paket.exe" +$paketurl="https://github.com/fsprojects/Paket/releases/download/5.210.1/paket.exe" $paketdir = Join-Path $PSScriptRoot ".paket" $paketpath = Join-Path $paketdir "paket.exe" @@ -6,8 +6,10 @@ $paketpath = Join-Path $paketdir "paket.exe" [Net.ServicePointManager]::SecurityProtocol = ` [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Tls11; - + if (-not (Test-Path "$paketpath")) { - mkdir "$paketdir" + if (-not (Test-Path "$paketdir")) { + mkdir "$paketdir" + } Invoke-WebRequest -Uri $paketurl -OutFile "$paketpath" } diff --git a/fcs/download-paket.sh b/fcs/download-paket.sh index dc475174a7..d2bf8524a8 100755 --- a/fcs/download-paket.sh +++ b/fcs/download-paket.sh @@ -12,10 +12,12 @@ while [[ -h "$source" ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -paketurl=https://github.com/fsprojects/Paket/releases/download/5.201.1/paket.exe +paketurl=https://github.com/fsprojects/Paket/releases/download/5.210.1/paket.exe paketdir=$scriptroot/.paket paketpath=$paketdir/paket.exe if [ ! -e "$paketpath" ]; then - mkdir "$paketdir" + if [ ! -e "$paketdir" ]; then + mkdir "$paketdir" + fi curl -o "$paketpath" -L $paketurl fi diff --git a/fcs/paket.dependencies b/fcs/paket.dependencies index 284a402166..d23e0010e7 100644 --- a/fcs/paket.dependencies +++ b/fcs/paket.dependencies @@ -2,5 +2,5 @@ framework: net461 source https://www.nuget.org/api/v2/ -nuget FAKE 4.64.6 +nuget FAKE 5.8.4 nuget FSharp.Formatting diff --git a/fcs/paket.lock b/fcs/paket.lock index 908c7de8d1..85f5ff5efe 100644 --- a/fcs/paket.lock +++ b/fcs/paket.lock @@ -1,10 +1,19 @@ RESTRICTION: == net461 NUGET remote: https://www.nuget.org/api/v2 - FAKE (4.64.6) - FSharp.Compiler.Service (2.0.0.6) - FSharp.Formatting (2.14.4) - FSharp.Compiler.Service (2.0.0.6) - FSharpVSPowerTools.Core (>= 2.3 < 2.4) - FSharpVSPowerTools.Core (2.3) - FSharp.Compiler.Service (>= 2.0.0.3) + FAKE (5.8.4) + FSharp.Compiler.Service (27.0.1) + FSharp.Core (>= 4.5.2) + System.Collections.Immutable (>= 1.5) + System.Reflection.Metadata (>= 1.6) + System.ValueTuple (>= 4.4) + FSharp.Core (4.6.2) + FSharp.Formatting (3.1) + FSharp.Compiler.Service (>= 27.0.1 < 28.0) + Microsoft.AspNet.Razor (>= 3.2.7 < 4.0) + System.ValueTuple (>= 4.5 < 5.0) + Microsoft.AspNet.Razor (3.2.7) + System.Collections.Immutable (1.5) + System.Reflection.Metadata (1.6) + System.Collections.Immutable (>= 1.5) + System.ValueTuple (4.5) From 6af64a7bc09c6fd3c166376557d1fc6a256f2fdd Mon Sep 17 00:00:00 2001 From: Patrick McDonald Date: Thu, 27 Jun 2019 21:56:39 +0100 Subject: [PATCH 122/286] List.transpose should throw error when given jagged array (#6908) (#6989) * List.transpose should throw error when given jagged array (#6908) * transpose does not throw when one of the elements is empty * Add additional test cases --- src/fsharp/FSharp.Core/local.fs | 15 +++++++++------ .../Microsoft.FSharp.Collections/ListModule2.fs | 3 +++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/fsharp/FSharp.Core/local.fs b/src/fsharp/FSharp.Core/local.fs index 0f5c69160d..75dc2bb090 100644 --- a/src/fsharp/FSharp.Core/local.fs +++ b/src/fsharp/FSharp.Core/local.fs @@ -717,25 +717,28 @@ module internal List = invalidArgDifferentListLength "list.[0]" (System.String.Format("list.[{0}]", j)) t.Length [], [], 0 | h :: t -> + let mutable j = 0 + for t' in tail do + j <- j + 1 + if t'.IsEmpty then + invalidArgDifferentListLength (System.String.Format("list.[{0}]", j)) "list.[0]" (t.Length + 1) let headsCons = freshConsNoTail h let tailsCons = freshConsNoTail t let headCount = transposeGetHeadsFreshConsTail headsCons tailsCons tail 1 headsCons, tailsCons, headCount /// Append the next element to the transposed list - let rec transposeToFreshConsTail cons list expectedCount = + let rec transposeToFreshConsTail cons list = match list with | [] -> setFreshConsTail cons [] | _ -> match transposeGetHeads list with | [], _, _ -> setFreshConsTail cons [] - | heads, tails, headCount -> - if headCount < expectedCount then - invalidArgDifferentListLength (System.String.Format("list.[{0}]", headCount)) "list.[0]" <| tails.[0].Length + 1 + | heads, tails, _ -> let cons2 = freshConsNoTail heads setFreshConsTail cons cons2 - transposeToFreshConsTail cons2 tails expectedCount + transposeToFreshConsTail cons2 tails /// Build the transposed list let transpose (list: 'T list list) = @@ -746,7 +749,7 @@ module internal List = let heads, tails, headCount = transposeGetHeads list if headCount = 0 then [] else let cons = freshConsNoTail heads - transposeToFreshConsTail cons tails headCount + transposeToFreshConsTail cons tails cons let rec truncateToFreshConsTail cons count list = diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs index 342d5678bf..1f049fbad8 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Collections/ListModule2.fs @@ -842,6 +842,9 @@ type ListModule02() = // jagged lists CheckThrowsArgumentException (fun () -> List.transpose [[1; 2]; [3]] |> ignore) CheckThrowsArgumentException (fun () -> List.transpose [[1]; [2; 3]] |> ignore) + CheckThrowsArgumentException (fun () -> List.transpose [[]; [1; 2]; [3; 4]] |> ignore) + CheckThrowsArgumentException (fun () -> List.transpose [[1; 2]; []; [3; 4]] |> ignore) + CheckThrowsArgumentException (fun () -> List.transpose [[1; 2]; [3; 4]; []] |> ignore) [] member this.Truncate() = From 010bd0009a98bc941b80d89fb552d143512c5b58 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 27 Jun 2019 18:16:04 -0700 Subject: [PATCH 123/286] Added -noVisualStudio flag for build.cmd. (#7071) * Added -compiler flag for build. Does not require VS to build. * Renamed -compiler to -noVisualStudio * Minor fix * Trying to fix unix builds * Update DEVGUIDE.md --- DEVGUIDE.md | 4 ++ eng/Build.ps1 | 70 ++++++++++++++++++--- eng/build-utils.ps1 | 4 +- proto.proj | 3 - src/fsharp/FSharp.Build/FSharp.Build.fsproj | 3 +- src/fsharp/fsc/fsc.fsproj | 3 +- src/fsharp/fsi/fsi.fsproj | 3 +- 7 files changed, 72 insertions(+), 18 deletions(-) diff --git a/DEVGUIDE.md b/DEVGUIDE.md index 1ee9c227d4..e944b07313 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -52,6 +52,10 @@ After you build the first time you can open and use this solution: If you are just developing the core compiler and library then building ``FSharp.sln`` will be enough. +If you do not have Visual Studio installed and want to simply build the compiler as a .NET Core application, use this: + + Build.cmd -noVisualStudio + ### Developing the F# Compiler (Linux/macOS) For Linux/Mac: diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 54e6ff5e2b..f329cba02a 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -53,6 +53,7 @@ param ( [switch]$testVs, [switch]$testAll, [string]$officialSkipTests = "false", + [switch]$noVisualStudio, [parameter(ValueFromRemainingArguments=$true)][string[]]$properties) @@ -96,6 +97,7 @@ function Print-Usage() { Write-Host " -procdump Monitor test runs with procdump" Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build" Write-Host " -useGlobalNuGetCache Use global NuGet cache." + Write-Host " -noVisualStudio Only build fsc and fsi as .NET Core applications. No Visual Studio required. '-configuration', '-verbosity', '-norestore', '-rebuild' are supported." Write-Host "" Write-Host "Command line arguments starting with '/p:' are passed through to MSBuild." } @@ -145,8 +147,19 @@ function Process-Arguments() { } function Update-Arguments() { - if (-Not (Test-Path "$ArtifactsDir\Bootstrap\fsc\fsc.exe")) { - $script:bootstrap = $True + if ($script:noVisualStudio) { + $script:bootstrapTfm = "netcoreapp2.1" + $script:msbuildEngine = "dotnet" + } + + if ($bootstrapTfm -eq "netcoreapp2.1") { + if (-Not (Test-Path "$ArtifactsDir\Bootstrap\fsc\fsc.runtimeconfig.json")) { + $script:bootstrap = $True + } + } else { + if (-Not (Test-Path "$ArtifactsDir\Bootstrap\fsc\fsc.exe") -or (Test-Path "$ArtifactsDir\Bootstrap\fsc\fsc.runtimeconfig.json")) { + $script:bootstrap = $True + } } } @@ -227,10 +240,37 @@ function TestUsingNUnit([string] $testProject, [string] $targetFramework) { $projectName = [System.IO.Path]::GetFileNameWithoutExtension($testProject) $testLogPath = "$ArtifactsDir\TestResults\$configuration\${projectName}_$targetFramework.xml" $testBinLogPath = "$LogDir\${projectName}_$targetFramework.binlog" - $args = "test $testProject --no-restore --no-build -c $configuration -f $targetFramework -v n --test-adapter-path . --logger ""nunit;LogFilePath=$testLogPath"" /bl:$testBinLogPath" + $args = "test $testProject -c $configuration -f $targetFramework -v n --test-adapter-path . --logger ""nunit;LogFilePath=$testLogPath"" /bl:$testBinLogPath" + + if (-not $noVisualStudio -or $norestore) { + $args += " --no-restore" + } + + if (-not $noVisualStudio) { + $args += " --no-build" + } + Exec-Console $dotnetExe $args } +function BuildCompiler() { + if ($bootstrapTfm -eq "netcoreapp2.1") { + $dotnetPath = InitializeDotNetCli + $dotnetExe = Join-Path $dotnetPath "dotnet.exe" + $fscProject = "$RepoRoot\src\fsharp\fsc\fsc.fsproj" + $fsiProject = "$RepoRoot\src\fsharp\fsi\fsi.fsproj" + + $argNoRestore = if ($norestore) { " --no-restore" } else { "" } + $argNoIncremental = if ($rebuild) { " --no-incremental" } else { "" } + + $args = "build $fscProject -c $configuration -v $verbosity -f netcoreapp2.1" + $argNoRestore + $argNoIncremental + Exec-Console $dotnetExe $args + + $args = "build $fsiProject -c $configuration -v $verbosity -f netcoreapp2.1" + $argNoRestore + $argNoIncremental + Exec-Console $dotnetExe $args + } +} + function Prepare-TempDir() { Copy-Item (Join-Path $RepoRoot "tests\Resources\Directory.Build.props") $TempDir Copy-Item (Join-Path $RepoRoot "tests\Resources\Directory.Build.targets") $TempDir @@ -259,7 +299,11 @@ try { } if ($restore -or $build -or $rebuild -or $pack -or $sign -or $publish) { - BuildSolution + if ($noVisualStudio) { + BuildCompiler + } else { + BuildSolution + } } if ($build) { @@ -269,7 +313,7 @@ try { $desktopTargetFramework = "net472" $coreclrTargetFramework = "netcoreapp2.1" - if ($testDesktop) { + if ($testDesktop -and -not $noVisualStudio) { TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $desktopTargetFramework TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.LanguageServer.UnitTests\FSharp.Compiler.LanguageServer.UnitTests.fsproj" -targetFramework $desktopTargetFramework TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $desktopTargetFramework @@ -285,7 +329,7 @@ try { TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $coreclrTargetFramework } - if ($testFSharpQA) { + if ($testFSharpQA -and -not $noVisualStudio) { Push-Location "$RepoRoot\tests\fsharpqa\source" $resultsRoot = "$ArtifactsDir\TestResults\$configuration" $resultsLog = "test-net40-fsharpqa-results.log" @@ -304,21 +348,27 @@ try { } if ($testFSharpCore) { - TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $desktopTargetFramework + if (-not $noVisualStudio) { + TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $desktopTargetFramework + } TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $coreclrTargetFramework } if ($testCompiler) { - TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $desktopTargetFramework + if (-not $noVisualStudio) { + TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $desktopTargetFramework + } TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $coreclrTargetFramework } if ($testCambridge) { - TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $desktopTargetFramework + if (-not $noVisualStudio) { + TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $desktopTargetFramework + } TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $coreclrTargetFramework } - if ($testVs) { + if ($testVs -and -not $noVisualStudio) { TestUsingNUnit -testProject "$RepoRoot\vsintegration\tests\GetTypesVS.UnitTests\GetTypesVS.UnitTests.fsproj" -targetFramework $desktopTargetFramework TestUsingNUnit -testProject "$RepoRoot\vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" -targetFramework $desktopTargetFramework } diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index 335379b2f7..fcda1a58e2 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -230,7 +230,7 @@ function Run-MSBuild([string]$projectFilePath, [string]$buildArgs = "", [string] # Important to not set $script:bootstrapDir here yet as we're actually in the process of # building the bootstrap. function Make-BootstrapBuild() { - Write-Host "Building bootstrap compiler" + Write-Host "Building bootstrap '$bootstrapTfm' compiler" $dir = Join-Path $ArtifactsDir "Bootstrap" Remove-Item -re $dir -ErrorAction SilentlyContinue @@ -243,7 +243,7 @@ function Make-BootstrapBuild() { # prepare compiler $projectPath = "$RepoRoot\proto.proj" - Run-MSBuild $projectPath "/restore /t:Publish" -logFileName "Bootstrap" -configuration $bootstrapConfiguration + Run-MSBuild $projectPath "/restore /t:Publish /p:TargetFramework=$bootstrapTfm;ProtoTargetFramework=$bootstrapTfm" -logFileName "Bootstrap" -configuration $bootstrapConfiguration Copy-Item "$ArtifactsDir\bin\fsc\$bootstrapConfiguration\$bootstrapTfm\publish" -Destination "$dir\fsc" -Force -Recurse Copy-Item "$ArtifactsDir\bin\fsi\$bootstrapConfiguration\$bootstrapTfm\publish" -Destination "$dir\fsi" -Force -Recurse diff --git a/proto.proj b/proto.proj index b0ee288977..23d7525d13 100644 --- a/proto.proj +++ b/proto.proj @@ -7,15 +7,12 @@ - TargetFramework=net472 TargetFramework=netcoreapp2.1 - TargetFramework=net472 TargetFramework=netcoreapp2.1 - TargetFramework=net472 TargetFramework=netcoreapp2.1 diff --git a/src/fsharp/FSharp.Build/FSharp.Build.fsproj b/src/fsharp/FSharp.Build/FSharp.Build.fsproj index 0bf32ed19a..e22c879701 100644 --- a/src/fsharp/FSharp.Build/FSharp.Build.fsproj +++ b/src/fsharp/FSharp.Build/FSharp.Build.fsproj @@ -4,7 +4,8 @@ Library - net472;netcoreapp2.1 + $(ProtoTargetFramework) + net472;netcoreapp2.1 netcoreapp2.1 FSharp.Build $(NoWarn);45;55;62;75;1204 diff --git a/src/fsharp/fsc/fsc.fsproj b/src/fsharp/fsc/fsc.fsproj index 370664ee6a..7bddcb9dfd 100644 --- a/src/fsharp/fsc/fsc.fsproj +++ b/src/fsharp/fsc/fsc.fsproj @@ -4,7 +4,8 @@ Exe - net472;netcoreapp2.1 + $(ProtoTargetFramework) + net472;netcoreapp2.1 netcoreapp2.1 .exe $(NoWarn);45;55;62;75;1204 diff --git a/src/fsharp/fsi/fsi.fsproj b/src/fsharp/fsi/fsi.fsproj index fb55d4d898..5b4978679b 100644 --- a/src/fsharp/fsi/fsi.fsproj +++ b/src/fsharp/fsi/fsi.fsproj @@ -4,7 +4,8 @@ Exe - net472;netcoreapp2.1 + $(ProtoTargetFramework) + net472;netcoreapp2.1 netcoreapp2.1 .exe $(NoWarn);45;55;62;75;1204 From 5a8f454a10f675fc3788b78f90fdc1acedeab606 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Fri, 28 Jun 2019 21:31:12 +0200 Subject: [PATCH 124/286] Use a MaxBuffer for Suggestions (#7060) * Use MaxBuffer for Suggestions * Extract SuggestNames function * Rename Parameter * Apply feedback for formatting --- src/fsharp/CompileOps.fs | 42 ++- src/fsharp/ConstraintSolver.fs | 9 +- src/fsharp/ErrorLogger.fs | 4 +- src/fsharp/ErrorResolutionHints.fs | 133 ++++--- src/fsharp/NameResolution.fs | 342 +++++++----------- src/fsharp/TypeChecker.fs | 33 +- .../service/ServiceErrorResolutionHints.fs | 14 +- .../service/ServiceErrorResolutionHints.fsi | 2 +- .../FSharp.Compiler.UnitTests/EditDistance.fs | 2 - .../FSharp.Compiler.UnitTests.fsproj | 1 + .../SuggestionBuffer.fs | 103 ++++++ tests/fsharp/typecheck/sigs/neg01.bsl | 8 +- tests/fsharp/typecheck/sigs/neg14.bsl | 8 +- tests/fsharp/typecheck/sigs/neg20.bsl | 8 +- tests/fsharp/typecheck/sigs/neg32.bsl | 24 +- tests/fsharp/typecheck/sigs/neg59.bsl | 4 +- tests/fsharp/typecheck/sigs/neg86.vsbsl | 4 +- tests/fsharp/typecheck/sigs/neg96.bsl | 8 +- tests/fsharp/typecheck/sigs/neg97.bsl | 4 +- tests/fsharp/typecheck/sigs/neg97.vsbsl | 4 +- .../CodeFix/ReplaceWithSuggestion.fs | 32 +- 21 files changed, 402 insertions(+), 387 deletions(-) create mode 100644 tests/FSharp.Compiler.UnitTests/SuggestionBuffer.fs diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index f40b700a5f..85728909cf 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -600,7 +600,20 @@ let getErrorString key = SR.GetString key let (|InvalidArgument|_|) (exn: exn) = match exn with :? ArgumentException as e -> Some e.Message | _ -> None -let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (suggestNames: bool) = +let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (canSuggestNames: bool) = + + let suggestNames suggestionsF idText = + if canSuggestNames then + let buffer = ErrorResolutionHints.SuggestionBuffer idText + if not buffer.Disabled then + suggestionsF buffer.Add + if not buffer.IsEmpty then + os.Append " " |> ignore + os.Append(FSComp.SR.undefinedNameSuggestionsIntro()) |> ignore + for value in buffer do + os.AppendLine() |> ignore + os.Append " " |> ignore + os.Append(DecompileOpName value) |> ignore let rec OutputExceptionR (os: StringBuilder) error = @@ -822,14 +835,10 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (suggestNames | UndefinedName(_, k, id, suggestionsF) -> os.Append(k (DecompileOpName id.idText)) |> ignore - if suggestNames then - let filtered = ErrorResolutionHints.FilterPredictions suggestionsF id.idText - if List.isEmpty filtered |> not then - os.Append(ErrorResolutionHints.FormatPredictions DecompileOpName filtered) |> ignore - + suggestNames suggestionsF id.idText | InternalUndefinedItemRef(f, smr, ccuName, s) -> - let _, errs = f(smr, ccuName, s) + let _, errs = f(smr, ccuName, s) os.Append errs |> ignore | FieldNotMutable _ -> @@ -1363,10 +1372,7 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (suggestNames | ErrorWithSuggestions ((_, s), _, idText, suggestionF) -> os.Append(DecompileOpName s) |> ignore - if suggestNames then - let filtered = ErrorResolutionHints.FilterPredictions suggestionF idText - if List.isEmpty filtered |> not then - os.Append(ErrorResolutionHints.FormatPredictions DecompileOpName filtered) |> ignore + suggestNames suggestionF idText | NumberedError ((_, s), _) -> os.Append s |> ignore @@ -1582,10 +1588,10 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (suggestNames // remove any newlines and tabs -let OutputPhasedDiagnostic (os: System.Text.StringBuilder) (err: PhasedDiagnostic) (flattenErrors: bool) (suggestNames: bool) = +let OutputPhasedDiagnostic (os: System.Text.StringBuilder) (err: PhasedDiagnostic) (flattenErrors: bool) (canSuggestNames: bool) = let buf = new System.Text.StringBuilder() - OutputPhasedErrorR buf err suggestNames + OutputPhasedErrorR buf err canSuggestNames let s = if flattenErrors then ErrorLogger.NormalizeErrorString (buf.ToString()) else buf.ToString() os.Append s |> ignore @@ -1635,7 +1641,7 @@ type Diagnostic = | Long of bool * DiagnosticDetailedInfo /// returns sequence that contains Diagnostic for the given error + Diagnostic for all related errors -let CollectDiagnostic (implicitIncludeDir, showFullPaths, flattenErrors, errorStyle, isError, err: PhasedDiagnostic, suggestNames: bool) = +let CollectDiagnostic (implicitIncludeDir, showFullPaths, flattenErrors, errorStyle, isError, err: PhasedDiagnostic, canSuggestNames: bool) = let outputWhere (showFullPaths, errorStyle) m: DiagnosticLocation = if Range.equals m rangeStartup || Range.equals m rangeCmdArgs then { Range = m; TextRepresentation = ""; IsEmpty = true; File = "" } @@ -1708,7 +1714,7 @@ let CollectDiagnostic (implicitIncludeDir, showFullPaths, flattenErrors, errorSt let canonical = OutputCanonicalInformation(err.Subcategory(), GetDiagnosticNumber mainError) let message = let os = System.Text.StringBuilder() - OutputPhasedDiagnostic os mainError flattenErrors suggestNames + OutputPhasedDiagnostic os mainError flattenErrors canSuggestNames os.ToString() let entry: DiagnosticDetailedInfo = { Location = where; Canonical = canonical; Message = message } @@ -1723,7 +1729,7 @@ let CollectDiagnostic (implicitIncludeDir, showFullPaths, flattenErrors, errorSt let relCanonical = OutputCanonicalInformation(err.Subcategory(), GetDiagnosticNumber mainError) // Use main error for code let relMessage = let os = System.Text.StringBuilder() - OutputPhasedDiagnostic os err flattenErrors suggestNames + OutputPhasedDiagnostic os err flattenErrors canSuggestNames os.ToString() let entry: DiagnosticDetailedInfo = { Location = relWhere; Canonical = relCanonical; Message = relMessage} @@ -1731,7 +1737,7 @@ let CollectDiagnostic (implicitIncludeDir, showFullPaths, flattenErrors, errorSt | _ -> let os = System.Text.StringBuilder() - OutputPhasedDiagnostic os err flattenErrors suggestNames + OutputPhasedDiagnostic os err flattenErrors canSuggestNames errors.Add( Diagnostic.Short(isError, os.ToString()) ) relatedErrors |> List.iter OutputRelatedError @@ -1752,7 +1758,7 @@ let CollectDiagnostic (implicitIncludeDir, showFullPaths, flattenErrors, errorSt /// prints error and related errors to the specified StringBuilder let rec OutputDiagnostic (implicitIncludeDir, showFullPaths, flattenErrors, errorStyle, isError) os (err: PhasedDiagnostic) = - // 'true' for "suggestNames" is passed last here because we want to report suggestions in fsc.exe and fsi.exe, just not in regular IDE usage. + // 'true' for "canSuggestNames" is passed last here because we want to report suggestions in fsc.exe and fsi.exe, just not in regular IDE usage. let errors = CollectDiagnostic (implicitIncludeDir, showFullPaths, flattenErrors, errorStyle, isError, err, true) for e in errors do Printf.bprintf os "\n" diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index 74036e1687..586b91c41b 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -2193,12 +2193,11 @@ and ReportNoCandidatesError (csenv: ConstraintSolverEnv) (nUnnamedCallerArgs, nN match cmeth.UnassignedNamedArgs with | CallerNamedArg(id, _) :: _ -> if minfo.IsConstructor then - let predictFields() = - minfo.DeclaringTyconRef.AllInstanceFieldsAsList - |> List.map (fun p -> p.Name.Replace("@", "")) - |> System.Collections.Generic.HashSet + let suggestFields (addToBuffer: string -> unit) = + for p in minfo.DeclaringTyconRef.AllInstanceFieldsAsList do + addToBuffer(p.Name.Replace("@", "")) - ErrorWithSuggestions((msgNum, FSComp.SR.csCtorHasNoArgumentOrReturnProperty(methodName, id.idText, msgText)), id.idRange, id.idText, predictFields) + ErrorWithSuggestions((msgNum, FSComp.SR.csCtorHasNoArgumentOrReturnProperty(methodName, id.idText, msgText)), id.idRange, id.idText, suggestFields) else Error((msgNum, FSComp.SR.csMemberHasNoArgumentOrReturnProperty(methodName, id.idText, msgText)), id.idRange) | [] -> Error((msgNum, msgText), m) diff --git a/src/fsharp/ErrorLogger.fs b/src/fsharp/ErrorLogger.fs index e84b5c69e4..2f9c07173b 100755 --- a/src/fsharp/ErrorLogger.fs +++ b/src/fsharp/ErrorLogger.fs @@ -46,9 +46,9 @@ let rec findOriginalException err = | WrappedError(err, _) -> findOriginalException err | _ -> err -type Suggestions = unit -> Collections.Generic.HashSet +type Suggestions = (string -> unit) -> unit -let NoSuggestions : Suggestions = fun () -> Collections.Generic.HashSet() +let NoSuggestions : Suggestions = ignore /// Thrown when we stop processing the F# Interactive entry or #load. exception StopProcessingExn of exn option with diff --git a/src/fsharp/ErrorResolutionHints.fs b/src/fsharp/ErrorResolutionHints.fs index 02ebc1e1b6..ee80985935 100644 --- a/src/fsharp/ErrorResolutionHints.fs +++ b/src/fsharp/ErrorResolutionHints.fs @@ -5,11 +5,13 @@ module internal FSharp.Compiler.ErrorResolutionHints open Internal.Utilities open FSharp.Compiler.AbstractIL.Internal.Library +open System.Collections +open System.Collections.Generic let maxSuggestions = 5 let minThresholdForSuggestions = 0.7 let highConfidenceThreshold = 0.85 -let minStringLengthForThreshold = 3 +let minStringLengthForSuggestion = 3 /// We report a candidate if its edit distance is <= the threshold. /// The threshold is set to about a quarter of the number of characters. @@ -23,65 +25,82 @@ let IsInEditDistanceProximity idText suggestion = editDistance <= threshold -/// Filters predictions based on edit distance to the given unknown identifier. -let FilterPredictions (suggestionF:ErrorLogger.Suggestions) (idText:string) = +/// Demangles a suggestion +let DemangleOperator (nm: string) = + if nm.StartsWithOrdinal("( ") && nm.EndsWithOrdinal(" )") then + nm.[2..nm.Length - 3] + else + nm + +type SuggestionBufferEnumerator(tail: int, data: KeyValuePair []) = + let mutable current = data.Length + interface IEnumerator with + member __.Current + with get () = + let kvpr = &data.[current] + kvpr.Value + interface System.Collections.IEnumerator with + member __.Current with get () = box data.[current].Value + member __.MoveNext() = + current <- current - 1 + current > tail || (current = tail && data.[current] <> Unchecked.defaultof<_>) + member __.Reset () = current <- data.Length + interface System.IDisposable with + member __.Dispose () = () + +type SuggestionBuffer(idText: string) = + let data = Array.zeroCreate>(maxSuggestions) + let mutable tail = maxSuggestions - 1 let uppercaseText = idText.ToUpperInvariant() - let allSuggestions = suggestionF() + let dotIdText = "." + idText + let mutable disableSuggestions = idText.Length < minStringLengthForSuggestion - let demangle (nm:string) = - if nm.StartsWithOrdinal("( ") && nm.EndsWithOrdinal(" )") then - let cleanName = nm.[2..nm.Length - 3] - cleanName - else nm + let insert (k,v) = + let mutable pos = tail + while pos < maxSuggestions && (let kv = &data.[pos] in kv.Key < k) do + pos <- pos + 1 - /// Returns `true` if given string is an operator display name, e.g. ( |>> ) - let IsOperatorName (name: string) = - if isNull name || not (name.StartsWithOrdinal("( ") && name.EndsWithOrdinal(" )")) then - false - else - let mutable i = 2 - let mutable isOperator = true - while isOperator && i < name.Length - 3 do - if name.[i] = ' ' then - isOperator <- false - i <- i + 1 - isOperator + if pos > 0 then + if pos >= maxSuggestions || (let kv = &data.[pos] in k <> kv.Key || v <> kv.Value) then + if tail < pos - 1 then + for i = tail to pos - 2 do + data.[i] <- data.[i + 1] + data.[pos - 1] <- KeyValuePair(k,v) + if tail > 0 then tail <- tail - 1 - if allSuggestions.Contains idText then [] else // some other parsing error occurred - let dotIdText = "." + idText - allSuggestions - |> Seq.choose (fun suggestion -> - // Because beginning a name with _ is used both to indicate an unused - // value as well as to formally squelch the associated compiler - // error/warning (FS1182), we remove such names from the suggestions, - // both to prevent accidental usages as well as to encourage good taste - if IsOperatorName suggestion || suggestion.StartsWithOrdinal("_") then None else - let suggestion:string = demangle suggestion - let suggestedText = suggestion.ToUpperInvariant() - let similarity = EditDistance.JaroWinklerDistance uppercaseText suggestedText - if similarity >= highConfidenceThreshold || suggestion.EndsWithOrdinal(dotIdText) then - Some(similarity, suggestion) - elif similarity < minThresholdForSuggestions && suggestedText.Length > minStringLengthForThreshold then - None - elif IsInEditDistanceProximity uppercaseText suggestedText then - Some(similarity, suggestion) - else - None) - |> Seq.sortByDescending fst - |> Seq.mapi (fun i x -> i, x) - |> Seq.takeWhile (fun (i, _) -> i < maxSuggestions) - |> Seq.map snd - |> Seq.toList + member __.Add (suggestion: string) = + if not disableSuggestions then + if suggestion = idText then // some other parse error happened + disableSuggestions <- true + + // Because beginning a name with _ is used both to indicate an unused + // value as well as to formally squelch the associated compiler + // error/warning (FS1182), we remove such names from the suggestions, + // both to prevent accidental usages as well as to encourage good taste + if suggestion.Length >= minStringLengthForSuggestion && not (suggestion.StartsWithOrdinal "_") then + let suggestion:string = DemangleOperator suggestion + let suggestedText = suggestion.ToUpperInvariant() + let similarity = EditDistance.JaroWinklerDistance uppercaseText suggestedText + if similarity >= highConfidenceThreshold || + suggestion.EndsWithOrdinal dotIdText || + (similarity >= minThresholdForSuggestions && IsInEditDistanceProximity uppercaseText suggestedText) + then + insert(similarity, suggestion) |> ignore + + member __.Disabled with get () = disableSuggestions + + member __.IsEmpty with get () = disableSuggestions || (tail = maxSuggestions - 1) -/// Formats the given predictions according to the error style. -let FormatPredictions normalizeF (predictions: (float * string) list) = - match predictions with - | [] -> System.String.Empty - | _ -> - let suggestions = - predictions - |> List.map (snd >> normalizeF) - |> List.map (sprintf "%s %s" System.Environment.NewLine) - |> String.concat "" + interface IEnumerable with + member this.GetEnumerator () = + if this.IsEmpty then + Seq.empty.GetEnumerator() + else + new SuggestionBufferEnumerator(tail, data) :> IEnumerator - " " + FSComp.SR.undefinedNameSuggestionsIntro() + suggestions + interface IEnumerable with + member this.GetEnumerator () = + if this.IsEmpty then + Seq.empty.GetEnumerator() :> IEnumerator + else + new SuggestionBufferEnumerator(tail, data) :> IEnumerator diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index 1809fdaf3b..6f03bbc1d4 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -899,9 +899,7 @@ let AddResults res1 res2 = | Result x, Exception _ -> Result x // If we have error messages for the same symbol, then we can merge suggestions. | Exception (UndefinedName(n1, f, id1, suggestions1)), Exception (UndefinedName(n2, _, id2, suggestions2)) when n1 = n2 && id1.idText = id2.idText && Range.equals id1.idRange id2.idRange -> - let suggestions = HashSet(suggestions1()) - suggestions.UnionWith(suggestions2()) - Exception(UndefinedName(n1, f, id1, fun () -> suggestions)) + Exception(UndefinedName(n1, f, id1, fun addToBuffer -> suggestions1 addToBuffer; suggestions2 addToBuffer)) // This prefers error messages coming from deeper failing long identifier paths | Exception (UndefinedName(n1, _, _, _) as e1), Exception (UndefinedName(n2, _, _, _) as e2) -> if n1 < n2 then Exception e2 else Exception e1 @@ -1840,12 +1838,12 @@ let rec ResolveLongIndentAsModuleOrNamespace sink atMostOne amap m first fullyQu else let moduleOrNamespaces = nenv.ModulesAndNamespaces fullyQualified let namespaceNotFound = lazy( - let suggestModulesAndNamespaces() = - moduleOrNamespaces - |> Seq.collect (fun kv -> kv.Value) - |> Seq.filter (fun modref -> IsEntityAccessible amap m ad modref) - |> Seq.collect (fun e -> [e.DisplayName; e.DemangledModuleOrNamespaceName]) - |> HashSet + let suggestModulesAndNamespaces (addToBuffer: string -> unit) = + for kv in moduleOrNamespaces do + for modref in kv.Value do + if IsEntityAccessible amap m ad modref then + addToBuffer modref.DisplayName + addToBuffer modref.DemangledModuleOrNamespaceName UndefinedName(0, FSComp.SR.undefinedNameNamespaceOrModule, id, suggestModulesAndNamespaces)) @@ -1854,11 +1852,11 @@ let rec ResolveLongIndentAsModuleOrNamespace sink atMostOne amap m first fullyQu match moduleNotFoundErrorCache with | Some (oldId, error) when Range.equals oldId id.idRange -> error | _ -> - let suggestNames() = - mty.ModulesAndNamespacesByDemangledName - |> Seq.filter (fun kv -> IsEntityAccessible amap m ad (modref.NestedTyconRef kv.Value)) - |> Seq.collect (fun e -> [e.Value.DisplayName; e.Value.DemangledModuleOrNamespaceName]) - |> HashSet + let suggestNames (addToBuffer: string -> unit) = + for kv in mty.ModulesAndNamespacesByDemangledName do + if IsEntityAccessible amap m ad (modref.NestedTyconRef kv.Value) then + addToBuffer kv.Value.DisplayName + addToBuffer kv.Value.DemangledModuleOrNamespaceName let error = raze (UndefinedName(depth, FSComp.SR.undefinedNameNamespace, id, suggestNames)) moduleNotFoundErrorCache <- Some(id.idRange, error) @@ -2229,44 +2227,30 @@ let rec ResolveLongIdentInTypePrim (ncenv: NameResolver) nenv lookupKind (resInf match nestedSearchAccessible with | Result res when not (isNil res) -> nestedSearchAccessible | _ -> - let suggestMembers() = - let suggestions1 = - ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv None ad m ty - |> List.map (fun p -> p.PropertyName) - - let suggestions2 = - ExtensionMethInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv None m ty - |> List.map (fun m -> m.DisplayName) + let suggestMembers (addToBuffer: string -> unit) = + for p in ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv None ad m ty do + addToBuffer p.PropertyName - let suggestions3 = - GetIntrinsicPropInfosOfType ncenv.InfoReader None ad AllowMultiIntfInstantiations.No findFlag m ty - |> List.map (fun p -> p.PropertyName) + for m in ExtensionMethInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv None m ty do + addToBuffer m.DisplayName - let suggestions4 = - GetIntrinsicMethInfosOfType ncenv.InfoReader None ad AllowMultiIntfInstantiations.No findFlag m ty - |> List.filter (fun m -> not m.IsClassConstructor && not m.IsConstructor) - |> List.map (fun m -> m.DisplayName) + for p in GetIntrinsicPropInfosOfType ncenv.InfoReader None ad AllowMultiIntfInstantiations.No findFlag m ty do + addToBuffer p.PropertyName - let suggestions5 = GetRecordLabelsForType g nenv ty + for m in GetIntrinsicMethInfosOfType ncenv.InfoReader None ad AllowMultiIntfInstantiations.No findFlag m ty do + if not m.IsClassConstructor && not m.IsConstructor then + addToBuffer m.DisplayName - let suggestions6 = - match lookupKind with - | LookupKind.Expr | LookupKind.Pattern -> - if isAppTy g ty then - let tcref = tcrefOfAppTy g ty - tcref.UnionCasesArray - |> Array.map (fun uc -> uc.DisplayName) - else - [||] - | _ -> [||] + for l in GetRecordLabelsForType g nenv ty do + addToBuffer l - [ yield! suggestions1 - yield! suggestions2 - yield! suggestions3 - yield! suggestions4 - yield! suggestions5 - yield! suggestions6 ] - |> HashSet + match lookupKind with + | LookupKind.Expr | LookupKind.Pattern -> + if isAppTy g ty then + let tcref = tcrefOfAppTy g ty + for uc in tcref.UnionCasesArray do + addToBuffer uc.DisplayName + | _ -> () raze (UndefinedName (depth, FSComp.SR.undefinedNameFieldConstructorOrMember, id, suggestMembers)) @@ -2380,43 +2364,28 @@ let rec ResolveExprLongIdentInModuleOrNamespace (ncenv: NameResolver) nenv (type match tyconSearch +++ moduleSearch +++ (fun _ -> unionSearch) with | Result [] -> - let suggestPossibleTypesAndNames() = - let types = - modref.ModuleOrNamespaceType.AllEntities - |> Seq.filter (fun e -> IsEntityAccessible ncenv.amap m ad (modref.NestedTyconRef e)) - |> Seq.map (fun e -> e.DisplayName) - - let submodules = - mty.ModulesAndNamespacesByDemangledName - |> Seq.filter (fun kv -> IsEntityAccessible ncenv.amap m ad (modref.NestedTyconRef kv.Value)) - |> Seq.map (fun e -> e.Value.DisplayName) - - let unions = - modref.ModuleOrNamespaceType.AllEntities - |> Seq.collect (fun tycon -> - let hasRequireQualifiedAccessAttribute = HasFSharpAttribute ncenv.g ncenv.g.attrib_RequireQualifiedAccessAttribute tycon.Attribs - if hasRequireQualifiedAccessAttribute then - [||] - else - tycon.UnionCasesArray) - |> Seq.map (fun uc -> uc.DisplayName) - - let vals = - modref.ModuleOrNamespaceType.AllValsByLogicalName - |> Seq.filter (fun e -> IsValAccessible ad (mkNestedValRef modref e.Value)) - |> Seq.map (fun e -> e.Value.DisplayName) - - let exns = - modref.ModuleOrNamespaceType.ExceptionDefinitionsByDemangledName - |> Seq.filter (fun e -> IsTyconReprAccessible ncenv.amap m ad (modref.NestedTyconRef e.Value)) - |> Seq.map (fun e -> e.Value.DisplayName) - - [ yield! types - yield! submodules - yield! unions - yield! vals - yield! exns ] - |> HashSet + let suggestPossibleTypesAndNames (addToBuffer: string -> unit) = + for e in modref.ModuleOrNamespaceType.AllEntities do + if IsEntityAccessible ncenv.amap m ad (modref.NestedTyconRef e) then + addToBuffer e.DisplayName + + if e.IsUnionTycon then + let hasRequireQualifiedAccessAttribute = HasFSharpAttribute ncenv.g ncenv.g.attrib_RequireQualifiedAccessAttribute e.Attribs + if not hasRequireQualifiedAccessAttribute then + for uc in e.UnionCasesArray do + addToBuffer uc.DisplayName + + for kv in mty.ModulesAndNamespacesByDemangledName do + if IsEntityAccessible ncenv.amap m ad (modref.NestedTyconRef kv.Value) then + addToBuffer kv.Value.DisplayName + + for e in modref.ModuleOrNamespaceType.AllValsByLogicalName do + if IsValAccessible ad (mkNestedValRef modref e.Value) then + addToBuffer e.Value.DisplayName + + for e in modref.ModuleOrNamespaceType.ExceptionDefinitionsByDemangledName do + if IsTyconReprAccessible ncenv.amap m ad (modref.NestedTyconRef e.Value) then + addToBuffer e.Value.DisplayName raze (UndefinedName(depth, FSComp.SR.undefinedNameValueConstructorNamespaceOrType, id, suggestPossibleTypesAndNames)) | results -> AtMostOneResult id.idRange results @@ -2504,41 +2473,26 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified match !typeError with | Some e -> raze e | _ -> - let suggestNamesAndTypes() = - let suggestedNames = - nenv.eUnqualifiedItems - |> Seq.map (fun e -> e.Value.DisplayName) - - let suggestedTypes = - nenv.TyconsByDemangledNameAndArity fullyQualified - |> Seq.filter (fun e -> IsEntityAccessible ncenv.amap m ad e.Value) - |> Seq.map (fun e -> e.Value.DisplayName) - - let suggestedModulesAndNamespaces = - nenv.ModulesAndNamespaces fullyQualified - |> Seq.collect (fun kv -> kv.Value) - |> Seq.filter (fun modref -> IsEntityAccessible ncenv.amap m ad modref) - |> Seq.collect (fun e -> [e.DisplayName; e.DemangledModuleOrNamespaceName]) - - let unions = - // check if the user forgot to use qualified access - nenv.eTyconsByDemangledNameAndArity - |> Seq.choose (fun e -> - let hasRequireQualifiedAccessAttribute = HasFSharpAttribute ncenv.g ncenv.g.attrib_RequireQualifiedAccessAttribute e.Value.Attribs - if not hasRequireQualifiedAccessAttribute then - None - else - if e.Value.IsUnionTycon && e.Value.UnionCasesArray |> Array.exists (fun c -> c.DisplayName = id.idText) then - Some e.Value - else - None) - |> Seq.map (fun t -> t.DisplayName + "." + id.idText) - - [ yield! suggestedNames - yield! suggestedTypes - yield! suggestedModulesAndNamespaces - yield! unions ] - |> HashSet + let suggestNamesAndTypes (addToBuffer: string -> unit) = + for e in nenv.eUnqualifiedItems do + addToBuffer e.Value.DisplayName + + for e in nenv.TyconsByDemangledNameAndArity fullyQualified do + if IsEntityAccessible ncenv.amap m ad e.Value then + addToBuffer e.Value.DisplayName + + for kv in nenv.ModulesAndNamespaces fullyQualified do + for modref in kv.Value do + if IsEntityAccessible ncenv.amap m ad modref then + addToBuffer modref.DisplayName + addToBuffer modref.DemangledModuleOrNamespaceName + + // check if the user forgot to use qualified access + for e in nenv.eTyconsByDemangledNameAndArity do + let hasRequireQualifiedAccessAttribute = HasFSharpAttribute ncenv.g ncenv.g.attrib_RequireQualifiedAccessAttribute e.Value.Attribs + if hasRequireQualifiedAccessAttribute then + if e.Value.IsUnionTycon && e.Value.UnionCasesArray |> Array.exists (fun c -> c.DisplayName = id.idText) then + addToBuffer (e.Value.DisplayName + "." + id.idText) raze (UndefinedName(0, FSComp.SR.undefinedNameValueOfConstructor, id, suggestNamesAndTypes)) ForceRaise failingCase @@ -2605,29 +2559,25 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified | _ -> let innerSearch = search +++ (moduleSearch AccessibleFromSomeFSharpCode) +++ (tyconSearch AccessibleFromSomeFSharpCode) - let suggestEverythingInScope() = - seq { yield! - nenv.ModulesAndNamespaces fullyQualified - |> Seq.collect (fun kv -> kv.Value) - |> Seq.filter (fun modref -> IsEntityAccessible ncenv.amap m ad modref) - |> Seq.collect (fun e -> [e.DisplayName; e.DemangledModuleOrNamespaceName]) + let suggestEverythingInScope (addToBuffer: string -> unit) = + for kv in nenv.ModulesAndNamespaces fullyQualified do + for modref in kv.Value do + if IsEntityAccessible ncenv.amap m ad modref then + addToBuffer modref.DisplayName + addToBuffer modref.DemangledModuleOrNamespaceName - yield! - nenv.TyconsByDemangledNameAndArity fullyQualified - |> Seq.filter (fun e -> IsEntityAccessible ncenv.amap m ad e.Value) - |> Seq.map (fun e -> e.Value.DisplayName) + for e in nenv.TyconsByDemangledNameAndArity fullyQualified do + if IsEntityAccessible ncenv.amap m ad e.Value then + addToBuffer e.Value.DisplayName - yield! - nenv.eUnqualifiedItems - |> Seq.map (fun e -> e.Value.DisplayName) - } |> HashSet + for e in nenv.eUnqualifiedItems do + addToBuffer e.Value.DisplayName match innerSearch with | Exception (UndefinedName(0, _, id1, suggestionsF)) when Range.equals id.idRange id1.idRange -> - let mergeSuggestions() = - let res = suggestEverythingInScope() - res.UnionWith(suggestionsF()) - res + let mergeSuggestions addToBuffer = + suggestionsF addToBuffer + suggestEverythingInScope addToBuffer let failingCase = raze (UndefinedName(0, FSComp.SR.undefinedNameValueNamespaceTypeOrModule, id, mergeSuggestions)) ForceRaise failingCase @@ -2709,20 +2659,15 @@ let rec ResolvePatternLongIdentInModuleOrNamespace (ncenv: NameResolver) nenv nu match tyconSearch +++ ctorSearch +++ moduleSearch with | Result [] -> - let suggestPossibleTypes() = - let submodules = - mty.ModulesAndNamespacesByDemangledName - |> Seq.filter (fun kv -> IsEntityAccessible ncenv.amap m ad (modref.NestedTyconRef kv.Value)) - |> Seq.collect (fun e -> [e.Value.DisplayName; e.Value.DemangledModuleOrNamespaceName]) - - let suggestedTypes = - nenv.TyconsByDemangledNameAndArity FullyQualifiedFlag.OpenQualified - |> Seq.filter (fun e -> IsEntityAccessible ncenv.amap m ad e.Value) - |> Seq.map (fun e -> e.Value.DisplayName) + let suggestPossibleTypes (addToBuffer: string -> unit) = + for kv in mty.ModulesAndNamespacesByDemangledName do + if IsEntityAccessible ncenv.amap m ad (modref.NestedTyconRef kv.Value) then + addToBuffer kv.Value.DisplayName + addToBuffer kv.Value.DemangledModuleOrNamespaceName - [ yield! submodules - yield! suggestedTypes ] - |> HashSet + for e in nenv.TyconsByDemangledNameAndArity FullyQualifiedFlag.OpenQualified do + if IsEntityAccessible ncenv.amap m ad e.Value then + addToBuffer e.Value.DisplayName raze (UndefinedName(depth, FSComp.SR.undefinedNameConstructorModuleOrNamespace, id, suggestPossibleTypes)) | results -> AtMostOneResult id.idRange results @@ -2828,10 +2773,9 @@ let rec ResolveTypeLongIdentInTyconRefPrim (ncenv: NameResolver) (typeNameResInf match tcrefs with | tcref :: _ -> success tcref | [] -> - let suggestTypes() = - tcref.ModuleOrNamespaceType.TypesByDemangledNameAndArity id.idRange - |> Seq.map (fun e -> e.Value.DisplayName) - |> HashSet + let suggestTypes (addToBuffer: string -> unit) = + for e in tcref.ModuleOrNamespaceType.TypesByDemangledNameAndArity id.idRange do + addToBuffer e.Value.DisplayName raze (UndefinedName(depth, FSComp.SR.undefinedNameType, id, suggestTypes)) | id2 :: rest2 -> @@ -2849,10 +2793,9 @@ let rec ResolveTypeLongIdentInTyconRefPrim (ncenv: NameResolver) (typeNameResInf match tcrefs with | _ :: _ -> tcrefs |> CollectAtMostOneResult (fun (resInfo, tcref) -> ResolveTypeLongIdentInTyconRefPrim ncenv typeNameResInfo ad resInfo genOk (depth+1) m tcref id2 rest2) | [] -> - let suggestTypes() = - tcref.ModuleOrNamespaceType.TypesByDemangledNameAndArity id.idRange - |> Seq.map (fun e -> e.Value.DisplayName) - |> HashSet + let suggestTypes (addToBuffer: string -> unit) = + for e in tcref.ModuleOrNamespaceType.TypesByDemangledNameAndArity id.idRange do + addToBuffer e.Value.DisplayName raze (UndefinedName(depth, FSComp.SR.undefinedNameType, id, suggestTypes)) @@ -2873,11 +2816,11 @@ let ResolveTypeLongIdentInTyconRef sink (ncenv: NameResolver) nenv typeNameResIn /// Create an UndefinedName error with details let SuggestTypeLongIdentInModuleOrNamespace depth (modref: ModuleOrNamespaceRef) amap ad m (id: Ident) = - let suggestPossibleTypes() = - modref.ModuleOrNamespaceType.AllEntities - |> Seq.filter (fun e -> IsEntityAccessible amap m ad (modref.NestedTyconRef e)) - |> Seq.collect (fun e -> [e.DisplayName; e.DemangledModuleOrNamespaceName]) - |> HashSet + let suggestPossibleTypes (addToBuffer: string -> unit) = + for e in modref.ModuleOrNamespaceType.AllEntities do + if IsEntityAccessible amap m ad (modref.NestedTyconRef e) then + addToBuffer e.DisplayName + addToBuffer e.DemangledModuleOrNamespaceName let errorTextF s = FSComp.SR.undefinedNameTypeIn(s, fullDisplayTextOfModRef modref) UndefinedName(depth, errorTextF, id, suggestPossibleTypes) @@ -2901,11 +2844,12 @@ let rec private ResolveTypeLongIdentInModuleOrNamespace sink nenv (ncenv: NameRe let resInfo = resInfo.AddEntity(id.idRange, submodref) ResolveTypeLongIdentInModuleOrNamespace sink nenv ncenv typeNameResInfo ad genOk resInfo (depth+1) m submodref submodref.ModuleOrNamespaceType id2 rest2 | _ -> - let suggestPossibleModules() = - modref.ModuleOrNamespaceType.ModulesAndNamespacesByDemangledName - |> Seq.filter (fun kv -> IsEntityAccessible ncenv.amap m ad (modref.NestedTyconRef kv.Value)) - |> Seq.collect (fun e -> [e.Value.DisplayName; e.Value.DemangledModuleOrNamespaceName]) - |> HashSet + let suggestPossibleModules (addToBuffer: string -> unit) = + for kv in modref.ModuleOrNamespaceType.ModulesAndNamespacesByDemangledName do + if IsEntityAccessible ncenv.amap m ad (modref.NestedTyconRef kv.Value) then + addToBuffer kv.Value.DisplayName + addToBuffer kv.Value.DemangledModuleOrNamespaceName + raze (UndefinedName(depth, FSComp.SR.undefinedNameNamespaceOrModule, id, suggestPossibleModules)) let tyconSearch = @@ -2913,10 +2857,9 @@ let rec private ResolveTypeLongIdentInModuleOrNamespace sink nenv (ncenv: NameRe match tcrefs with | _ :: _ -> tcrefs |> CollectResults (fun tcref -> ResolveTypeLongIdentInTyconRefPrim ncenv typeNameResInfo ad resInfo genOk (depth+1) m tcref id2 rest2) | [] -> - let suggestTypes() = - modref.ModuleOrNamespaceType.TypesByDemangledNameAndArity id.idRange - |> Seq.map (fun e -> e.Value.DisplayName) - |> HashSet + let suggestTypes (addToBuffer: string -> unit) = + for e in modref.ModuleOrNamespaceType.TypesByDemangledNameAndArity id.idRange do + addToBuffer e.Value.DisplayName raze (UndefinedName(depth, FSComp.SR.undefinedNameType, id, suggestTypes)) @@ -2948,18 +2891,16 @@ let rec ResolveTypeLongIdentPrim sink (ncenv: NameResolver) occurence first full //CheckForTypeLegitimacyAndMultipleGenericTypeAmbiguities tcref rest typeNameResInfo m success(ResolutionInfo.Empty, tcref) | [] -> - let suggestPossibleTypes() = - nenv.TyconsByDemangledNameAndArity fullyQualified - |> Seq.filter (fun kv -> IsEntityAccessible ncenv.amap m ad kv.Value) - |> Seq.collect (fun e -> - match occurence with - | ItemOccurence.UseInAttribute -> - [yield e.Value.DisplayName - yield e.Value.DemangledModuleOrNamespaceName - if e.Value.DisplayName.EndsWithOrdinal("Attribute") then - yield e.Value.DisplayName.Replace("Attribute", "")] - | _ -> [e.Value.DisplayName; e.Value.DemangledModuleOrNamespaceName]) - |> HashSet + let suggestPossibleTypes (addToBuffer: string -> unit) = + for kv in nenv.TyconsByDemangledNameAndArity fullyQualified do + if IsEntityAccessible ncenv.amap m ad kv.Value then + addToBuffer kv.Value.DisplayName + addToBuffer kv.Value.DemangledModuleOrNamespaceName + match occurence with + | ItemOccurence.UseInAttribute -> + if kv.Value.DisplayName.EndsWithOrdinal("Attribute") then + addToBuffer (kv.Value.DisplayName.Replace("Attribute", "")) + | _ -> () raze (UndefinedName(0, FSComp.SR.undefinedNameType, id, suggestPossibleTypes)) | id2 :: rest2 -> @@ -3084,9 +3025,9 @@ let SuggestOtherLabelsOfSameRecordType g (nenv: NameResolutionEnv) ty (id: Ident labelsOfPossibleRecord let SuggestLabelsOfRelatedRecords g (nenv: NameResolutionEnv) (id: Ident) (allFields: Ident list) = - let suggestLabels() = + let suggestLabels (addToBuffer: string -> unit) = let givenFields = allFields |> List.map (fun fld -> fld.idText) |> List.filter ((<>) id.idText) |> HashSet - let fullyQualfied = + let fullyQualified = if givenFields.Count = 0 then // return labels from all records let result = NameMap.domainL nenv.eFieldLabels |> HashSet @@ -3116,21 +3057,15 @@ let SuggestLabelsOfRelatedRecords g (nenv: NameResolutionEnv) (id: Ident) (allFi labelsOfPossibleRecords.ExceptWith givenFields labelsOfPossibleRecords - if fullyQualfied.Count > 0 then fullyQualfied else - - // check if the user forgot to use qualified access - nenv.eTyconsByDemangledNameAndArity - |> Seq.choose (fun e -> - let hasRequireQualifiedAccessAttribute = HasFSharpAttribute g g.attrib_RequireQualifiedAccessAttribute e.Value.Attribs - if not hasRequireQualifiedAccessAttribute then - None - else - if e.Value.IsRecordTycon && e.Value.AllFieldsArray |> Seq.exists (fun x -> x.Name = id.idText) then - Some e.Value - else - None) - |> Seq.map (fun t -> t.DisplayName + "." + id.idText) - |> HashSet + if fullyQualified.Count > 0 then + fullyQualified |> Seq.iter addToBuffer + else + // check if the user forgot to use qualified access + for e in nenv.eTyconsByDemangledNameAndArity do + let hasRequireQualifiedAccessAttribute = HasFSharpAttribute g g.attrib_RequireQualifiedAccessAttribute e.Value.Attribs + if hasRequireQualifiedAccessAttribute then + if e.Value.IsRecordTycon && e.Value.AllFieldsArray |> Seq.exists (fun x -> x.Name = id.idText) then + addToBuffer (e.Value.DisplayName + "." + id.idText) UndefinedName(0, FSComp.SR.undefinedNameRecordLabel, id, suggestLabels) @@ -3159,7 +3094,10 @@ let ResolveFieldPrim sink (ncenv: NameResolver) nenv ad ty (mp, id: Ident) allFi | _ -> if isRecdTy g ty then // record label doesn't belong to record type -> suggest other labels of same record - let suggestLabels() = SuggestOtherLabelsOfSameRecordType g nenv ty id allFields + let suggestLabels (addToBuffer: string -> unit) = + for label in SuggestOtherLabelsOfSameRecordType g nenv ty id allFields do + addToBuffer label + let typeName = NicePrint.minimalStringOfType nenv.eDisplayEnv ty let errorText = FSComp.SR.nrRecordDoesNotContainSuchLabel(typeName, id.idText) error(ErrorWithSuggestions(errorText, m, id.idText, suggestLabels)) diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 824cb2ac20..ae464f1575 100644 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -4544,23 +4544,17 @@ and TcTyparOrMeasurePar optKind cenv (env: TcEnv) newOk tpenv (Typar(id, _, _) a | Some res -> checkRes res | None -> if newOk = NoNewTypars then - let predictTypeParameters() = - let predictions1 = - env.eNameResEnv.eTypars - |> Seq.map (fun p -> "'" + p.Key) - - let predictions2 = - match tpenv with - | UnscopedTyparEnv elements -> - elements - |> Seq.map (fun p -> "'" + p.Key) - - [ yield! predictions1 - yield! predictions2 ] - |> HashSet - + let suggestTypeParameters (addToBuffer: string -> unit) = + for p in env.eNameResEnv.eTypars do + addToBuffer ("'" + p.Key) + + match tpenv with + | UnscopedTyparEnv elements -> + for p in elements do + addToBuffer ("'" + p.Key) + let reportedId = Ident("'" + id.idText, id.idRange) - error (UndefinedName(0, FSComp.SR.undefinedNameTypeParameter, reportedId, predictTypeParameters)) + error (UndefinedName(0, FSComp.SR.undefinedNameTypeParameter, reportedId, suggestTypeParameters)) // OK, this is an implicit declaration of a type parameter // The kind defaults to Type @@ -6548,10 +6542,9 @@ and FreshenObjExprAbstractSlot cenv (env: TcEnv) (implty: TType) virtNameAndArit tcref.MembersOfFSharpTyconByName |> Seq.exists (fun kv -> kv.Value |> List.exists (fun valRef -> valRef.DisplayName = bindName)) - let suggestVirtualMembers() = - virtNameAndArityPairs - |> List.map (fst >> fst) - |> HashSet + let suggestVirtualMembers (addToBuffer: string -> unit) = + for ((x,_),_) in virtNameAndArityPairs do + addToBuffer x if containsNonAbstractMemberWithSameName then errorR(ErrorWithSuggestions(FSComp.SR.tcMemberFoundIsNotAbstractOrVirtual(tcref.DisplayName, bindName), mBinding, bindName, suggestVirtualMembers)) diff --git a/src/fsharp/service/ServiceErrorResolutionHints.fs b/src/fsharp/service/ServiceErrorResolutionHints.fs index 37fbc2ea52..5059c2a897 100644 --- a/src/fsharp/service/ServiceErrorResolutionHints.fs +++ b/src/fsharp/service/ServiceErrorResolutionHints.fs @@ -2,13 +2,13 @@ namespace FSharp.Compiler.SourceCodeServices -open System.Collections.Generic - open FSharp.Compiler.ErrorResolutionHints module ErrorResolutionHints = - let getSuggestedNames (namesToCheck: string[]) (unresolvedIdentifier: string) = - let res = FilterPredictions (fun () -> HashSet(namesToCheck)) unresolvedIdentifier |> List.map snd - match res with - | [] -> None - | _ -> Some res \ No newline at end of file + let getSuggestedNames (suggestionsF: FSharp.Compiler.ErrorLogger.Suggestions) (unresolvedIdentifier: string) = + let buffer = SuggestionBuffer(unresolvedIdentifier) + if buffer.Disabled then + Seq.empty + else + suggestionsF buffer.Add + buffer :> seq \ No newline at end of file diff --git a/src/fsharp/service/ServiceErrorResolutionHints.fsi b/src/fsharp/service/ServiceErrorResolutionHints.fsi index 3677ecd042..77617a0916 100644 --- a/src/fsharp/service/ServiceErrorResolutionHints.fsi +++ b/src/fsharp/service/ServiceErrorResolutionHints.fsi @@ -6,4 +6,4 @@ namespace FSharp.Compiler.SourceCodeServices module ErrorResolutionHints = /// Given a set of names, uses and a string representing an unresolved identifier, /// returns a list of suggested names if there are any feasible candidates. - val getSuggestedNames: symbolUses: string[] -> unresolvedIdentifier: string -> string list option \ No newline at end of file + val getSuggestedNames: suggestionsF: ((string -> unit) -> unit) -> unresolvedIdentifier: string -> seq diff --git a/tests/FSharp.Compiler.UnitTests/EditDistance.fs b/tests/FSharp.Compiler.UnitTests/EditDistance.fs index fa1f9a4293..ffcac4bc77 100644 --- a/tests/FSharp.Compiler.UnitTests/EditDistance.fs +++ b/tests/FSharp.Compiler.UnitTests/EditDistance.fs @@ -3,9 +3,7 @@ namespace FSharp.Compiler.UnitTests open System open System.Globalization -open System.Text open NUnit.Framework -open FSharp.Compiler [] module EditDistance = diff --git a/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj b/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj index b5b30d9067..27bf5b2d07 100644 --- a/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj +++ b/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj @@ -17,6 +17,7 @@ +
    diff --git a/tests/FSharp.Compiler.UnitTests/SuggestionBuffer.fs b/tests/FSharp.Compiler.UnitTests/SuggestionBuffer.fs new file mode 100644 index 0000000000..0a0584088c --- /dev/null +++ b/tests/FSharp.Compiler.UnitTests/SuggestionBuffer.fs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework + +[] +module SuggestionBuffer = + open FSharp.Compiler.ErrorResolutionHints + + [] + let NewBufferShouldBeEmpty() = + let buffer = SuggestionBuffer("abdef") + + Assert.IsFalse buffer.Disabled + Assert.IsEmpty buffer + + [] + let BufferShouldOnlyAcceptSimilarElements() = + let buffer = SuggestionBuffer("abcd") + buffer.Add("abce") + buffer.Add("somethingcompletelyunrelated") + + let results = Array.ofSeq buffer + + Assert.areEqual [| "abce" |] results + + [] + let SmallIdentifierShouldBeIgnored() = + let buffer = SuggestionBuffer("ab") + + Assert.IsTrue buffer.Disabled + + buffer.Add("abce") + buffer.Add("somethingcompletelyunrelated") + buffer.Add("abcg") + buffer.Add("abch") + buffer.Add("abcde") + buffer.Add("abci") + buffer.Add("abcj") + + let results = Array.ofSeq buffer + + Assert.IsTrue buffer.Disabled + Assert.areEqual [||] results + + [] + let BufferShouldOnlyTakeTop5Elements() = + let buffer = SuggestionBuffer("abcd") + buffer.Add("abce") + buffer.Add("somethingcompletelyunrelated") + buffer.Add("abcg") + buffer.Add("abch") + buffer.Add("abcde") + buffer.Add("abci") + buffer.Add("abcj") + + let results = Array.ofSeq buffer + + Assert.areEqual [| "abce"; "abcg"; "abch"; "abci"; "abcj"|] results + + [] + let BufferShouldUseEarlierElementsIfTheyHaveSameScore() = + let buffer = SuggestionBuffer("abcd") + buffer.Add("abce") + buffer.Add("abcf") + buffer.Add("abcg") + buffer.Add("abch") + buffer.Add("abci") + buffer.Add("abcj") + + let results = Array.ofSeq buffer + + Assert.areEqual [| "abce"; "abcf"; "abcg"; "abch"; "abci"|] results + + + [] + let BufferShouldDisableItselfIfItSeesTheOriginalIdentifier() = + let buffer = SuggestionBuffer("abcd") + buffer.Add("abce") + buffer.Add("abcf") + buffer.Add("abcg") + buffer.Add("abch") + + Assert.IsFalse buffer.Disabled + Assert.IsNotEmpty buffer + + buffer.Add("abcd") // original Ident + buffer.Add("abcj") + + Assert.IsTrue buffer.Disabled + Assert.IsEmpty buffer + + [] + let BufferShouldIgnoreSmallIdentifiers() = + let buffer = SuggestionBuffer("abd") + buffer.Add("abce") + buffer.Add("abc") + buffer.Add("ab") + buffer.Add("ad") + + let results = Array.ofSeq buffer + + Assert.areEqual [| "abc"; "abce" |] results \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/neg01.bsl b/tests/fsharp/typecheck/sigs/neg01.bsl index e2a7c05659..80b8b22daf 100644 --- a/tests/fsharp/typecheck/sigs/neg01.bsl +++ b/tests/fsharp/typecheck/sigs/neg01.bsl @@ -3,10 +3,4 @@ neg01a.fsi(24,8,25,7): typecheck error FS0913: Types cannot contain nested type neg01a.fs(22,8,23,7): typecheck error FS0913: Types cannot contain nested type definitions -neg01b.fs(2,13,2,14): typecheck error FS0039: The value, constructor, namespace or type 'X' is not defined. Maybe you want one of the following: - - z - - A - - B +neg01b.fs(2,13,2,14): typecheck error FS0039: The value, constructor, namespace or type 'X' is not defined. diff --git a/tests/fsharp/typecheck/sigs/neg14.bsl b/tests/fsharp/typecheck/sigs/neg14.bsl index f10030ee52..28f4763d71 100644 --- a/tests/fsharp/typecheck/sigs/neg14.bsl +++ b/tests/fsharp/typecheck/sigs/neg14.bsl @@ -1,10 +1,4 @@ neg14a.fs(9,6,9,33): typecheck error FS0343: The type 'missingInterfaceInSignature' implements 'System.IComparable' explicitly but provides no corresponding override for 'Object.Equals'. An implementation of 'Object.Equals' has been automatically provided, implemented via 'System.IComparable'. Consider implementing the override 'Object.Equals' explicitly -neg14b.fs(2,13,2,14): typecheck error FS0039: The value, constructor, namespace or type 'X' is not defined. Maybe you want one of the following: - - z - - A - - B +neg14b.fs(2,13,2,14): typecheck error FS0039: The value, constructor, namespace or type 'X' is not defined. diff --git a/tests/fsharp/typecheck/sigs/neg20.bsl b/tests/fsharp/typecheck/sigs/neg20.bsl index f9ec690978..ae9600cdae 100644 --- a/tests/fsharp/typecheck/sigs/neg20.bsl +++ b/tests/fsharp/typecheck/sigs/neg20.bsl @@ -407,14 +407,10 @@ neg20.fs(373,22,373,41): typecheck error FS1124: Multiple types exist called 'Ov neg20.fs(382,19,382,40): typecheck error FS1124: Multiple types exist called 'OverloadedClassName', taking different numbers of generic parameters. Provide a type instantiation to disambiguate the type resolution, e.g. 'OverloadedClassName<_>'. -neg20.fs(383,39,383,41): typecheck error FS0039: The field, constructor or member 'S2' is not defined. Maybe you want one of the following: - - S +neg20.fs(383,39,383,41): typecheck error FS0039: The field, constructor or member 'S2' is not defined. neg20.fs(428,19,428,38): typecheck error FS1133: No constructors are available for the type 'OverloadedClassName<'a,'b>' neg20.fs(430,22,430,41): typecheck error FS1133: No constructors are available for the type 'OverloadedClassName<'a,'b>' -neg20.fs(444,39,444,41): typecheck error FS0039: The field, constructor or member 'S2' is not defined. Maybe you want one of the following: - - S +neg20.fs(444,39,444,41): typecheck error FS0039: The field, constructor or member 'S2' is not defined. diff --git a/tests/fsharp/typecheck/sigs/neg32.bsl b/tests/fsharp/typecheck/sigs/neg32.bsl index 858ed7330c..bb84996139 100644 --- a/tests/fsharp/typecheck/sigs/neg32.bsl +++ b/tests/fsharp/typecheck/sigs/neg32.bsl @@ -7,17 +7,11 @@ neg32.fs(39,17,39,19): typecheck error FS0039: The type parameter 'T is not defi neg32.fs(40,4,40,23): typecheck error FS0671: A property cannot have explicit type parameters. Consider using a method instead. -neg32.fs(40,21,40,23): typecheck error FS0039: The type parameter 'U is not defined. Maybe you want one of the following: +neg32.fs(40,21,40,23): typecheck error FS0039: The type parameter 'U is not defined. - 'T +neg32.fs(41,21,41,23): typecheck error FS0039: The type parameter 'U is not defined. -neg32.fs(41,21,41,23): typecheck error FS0039: The type parameter 'U is not defined. Maybe you want one of the following: - - 'T - -neg32.fs(41,27,41,29): typecheck error FS0039: The type parameter 'U is not defined. Maybe you want one of the following: - - 'T +neg32.fs(41,27,41,29): typecheck error FS0039: The type parameter 'U is not defined. neg32.fs(42,18,42,20): typecheck error FS0039: The type parameter 'U is not defined. @@ -27,17 +21,11 @@ neg32.fs(46,17,46,19): typecheck error FS0039: The type parameter 'T is not defi neg32.fs(47,4,47,23): typecheck error FS0671: A property cannot have explicit type parameters. Consider using a method instead. -neg32.fs(47,21,47,23): typecheck error FS0039: The type parameter 'U is not defined. Maybe you want one of the following: - - 'T - -neg32.fs(48,21,48,23): typecheck error FS0039: The type parameter 'U is not defined. Maybe you want one of the following: - - 'T +neg32.fs(47,21,47,23): typecheck error FS0039: The type parameter 'U is not defined. -neg32.fs(48,27,48,29): typecheck error FS0039: The type parameter 'U is not defined. Maybe you want one of the following: +neg32.fs(48,21,48,23): typecheck error FS0039: The type parameter 'U is not defined. - 'T +neg32.fs(48,27,48,29): typecheck error FS0039: The type parameter 'U is not defined. neg32.fs(49,18,49,20): typecheck error FS0039: The type parameter 'U is not defined. diff --git a/tests/fsharp/typecheck/sigs/neg59.bsl b/tests/fsharp/typecheck/sigs/neg59.bsl index 32b9363a07..c4f55d1e06 100644 --- a/tests/fsharp/typecheck/sigs/neg59.bsl +++ b/tests/fsharp/typecheck/sigs/neg59.bsl @@ -3,9 +3,7 @@ neg59.fs(9,13,9,17): typecheck error FS3096: 'join' must be followed by a variab neg59.fs(9,39,9,40): typecheck error FS0039: The value or constructor 'j' is not defined. -neg59.fs(10,24,10,25): typecheck error FS0039: The value or constructor 'j' is not defined. Maybe you want one of the following: - - i +neg59.fs(10,24,10,25): typecheck error FS0039: The value or constructor 'j' is not defined. neg59.fs(15,13,15,22): typecheck error FS3096: 'groupJoin' must be followed by a variable name. Usage: groupJoin var in collection on (outerKey = innerKey) into group. Note that parentheses are required after 'on'. diff --git a/tests/fsharp/typecheck/sigs/neg86.vsbsl b/tests/fsharp/typecheck/sigs/neg86.vsbsl index 1e189ddee0..638377e4bf 100644 --- a/tests/fsharp/typecheck/sigs/neg86.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg86.vsbsl @@ -9,9 +9,7 @@ neg86.fsx(8,13,8,17): typecheck error FS3096: 'join' must be followed by a varia neg86.fsx(8,13,8,17): typecheck error FS3167: 'join' must be followed by 'in'. Usage: join var in collection on (outerKey = innerKey). Note that parentheses are required after 'on'. -neg86.fsx(9,21,9,22): typecheck error FS0039: The value or constructor 'e' is not defined. Maybe you want one of the following: - - c +neg86.fsx(9,21,9,22): typecheck error FS0039: The value or constructor 'e' is not defined. neg86.fsx(23,13,23,17): typecheck error FS3097: Incorrect syntax for 'join'. Usage: join var in collection on (outerKey = innerKey). Note that parentheses are required after 'on'. diff --git a/tests/fsharp/typecheck/sigs/neg96.bsl b/tests/fsharp/typecheck/sigs/neg96.bsl index f443fbe6e6..cd87ec8144 100644 --- a/tests/fsharp/typecheck/sigs/neg96.bsl +++ b/tests/fsharp/typecheck/sigs/neg96.bsl @@ -1,10 +1,6 @@ neg96.fs(11,9,11,21): typecheck error FS1133: No constructors are available for the type 'StructRecord' -neg96.fs(18,10,18,11): typecheck error FS0039: The type 'X' is not defined. Maybe you want one of the following: +neg96.fs(18,10,18,11): typecheck error FS0039: The type 'X' is not defined. - T - -neg96.fs(18,10,18,11): typecheck error FS0039: The type 'X' is not defined. Maybe you want one of the following: - - T +neg96.fs(18,10,18,11): typecheck error FS0039: The type 'X' is not defined. diff --git a/tests/fsharp/typecheck/sigs/neg97.bsl b/tests/fsharp/typecheck/sigs/neg97.bsl index 1e882f98b6..1a4d97f87d 100644 --- a/tests/fsharp/typecheck/sigs/neg97.bsl +++ b/tests/fsharp/typecheck/sigs/neg97.bsl @@ -23,6 +23,4 @@ neg97.fs(36,20,36,32): typecheck error FS0064: This construct causes code to be neg97.fs(36,12,36,14): typecheck error FS0663: This type parameter has been used in a way that constrains it to always be 'string' -neg97.fs(42,20,42,22): typecheck error FS0039: The type parameter 'T is not defined. Maybe you want one of the following: - - 'U +neg97.fs(42,20,42,22): typecheck error FS0039: The type parameter 'T is not defined. diff --git a/tests/fsharp/typecheck/sigs/neg97.vsbsl b/tests/fsharp/typecheck/sigs/neg97.vsbsl index 1e882f98b6..1a4d97f87d 100644 --- a/tests/fsharp/typecheck/sigs/neg97.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg97.vsbsl @@ -23,6 +23,4 @@ neg97.fs(36,20,36,32): typecheck error FS0064: This construct causes code to be neg97.fs(36,12,36,14): typecheck error FS0663: This type parameter has been used in a way that constrains it to always be 'string' -neg97.fs(42,20,42,22): typecheck error FS0039: The type parameter 'T is not defined. Maybe you want one of the following: - - 'U +neg97.fs(42,20,42,22): typecheck error FS0039: The type parameter 'T is not defined. diff --git a/vsintegration/src/FSharp.Editor/CodeFix/ReplaceWithSuggestion.fs b/vsintegration/src/FSharp.Editor/CodeFix/ReplaceWithSuggestion.fs index b3f80dc232..969cfb55a1 100644 --- a/vsintegration/src/FSharp.Editor/CodeFix/ReplaceWithSuggestion.fs +++ b/vsintegration/src/FSharp.Editor/CodeFix/ReplaceWithSuggestion.fs @@ -46,26 +46,24 @@ type internal FSharpReplaceWithSuggestionCodeFixProvider let partialName = QuickParse.GetPartialLongNameEx(caretLine.ToString(), caretLinePos.Character - 1) let! declInfo = checkFileResults.GetDeclarationListInfo(Some parseFileResults, fcsCaretLineNumber, caretLine.ToString(), partialName, userOpName=userOpName) |> liftAsync - let namesToCheck = declInfo.Items |> Array.map (fun item -> item.Name) + let addNames (addToBuffer:string -> unit) = + for item in declInfo.Items do + addToBuffer item.Name - let suggestedNames = ErrorResolutionHints.getSuggestedNames namesToCheck unresolvedIdentifierText - match suggestedNames with - | None -> () - | Some suggestions -> - let diagnostics = - context.Diagnostics - |> Seq.filter (fun x -> fixableDiagnosticIds |> Set.contains x.Id) - |> Seq.toImmutableArray + let diagnostics = + context.Diagnostics + |> Seq.filter (fun x -> fixableDiagnosticIds |> Set.contains x.Id) + |> Seq.toImmutableArray - for suggestion in suggestions do - let replacement = Keywords.QuoteIdentifierIfNeeded suggestion - let codeFix = - CodeFixHelpers.createTextChangeCodeFix( - CompilerDiagnostics.getErrorMessage (ReplaceWithSuggestion suggestion), - context, - (fun () -> asyncMaybe.Return [| TextChange(context.Span, replacement) |])) + for suggestion in ErrorResolutionHints.getSuggestedNames addNames unresolvedIdentifierText do + let replacement = Keywords.QuoteIdentifierIfNeeded suggestion + let codeFix = + CodeFixHelpers.createTextChangeCodeFix( + CompilerDiagnostics.getErrorMessage (ReplaceWithSuggestion suggestion), + context, + (fun () -> asyncMaybe.Return [| TextChange(context.Span, replacement) |])) - context.RegisterCodeFix(codeFix, diagnostics) + context.RegisterCodeFix(codeFix, diagnostics) } |> Async.Ignore |> RoslynHelpers.StartAsyncUnitAsTask(context.CancellationToken) From 5306722f47aff504245f5304ece49ca8c592b69a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2019 12:57:11 -0700 Subject: [PATCH 125/286] Update dependencies from https://github.com/dotnet/arcade build 20190630.1 (#7088) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19330.1 --- NuGet.config | 2 +- eng/Version.Details.xml | 4 +- eng/common/post-build/nuget-validation.ps1 | 28 +++ eng/common/post-build/promote-build.ps1 | 53 ++++++ .../post-build/sourcelink-validation.ps1 | 28 +-- .../post-build/trigger-subscriptions.ps1 | 69 +++++++ eng/common/sdl/extract-artifact-packages.ps1 | 70 ++++++++ eng/common/sdl/packages.config | 2 +- eng/common/templates/job/execute-sdl.yml | 12 +- .../templates/job/publish-build-assets.yml | 1 - .../channels/internal-servicing.yml | 170 ++++++++++++++++++ .../channels/public-dev-release.yml | 59 ++++-- .../post-build/channels/public-release.yml | 170 ++++++++++++++++++ .../channels/public-validation-release.yml | 52 ++++-- .../templates/post-build/common-variables.yml | 9 + .../templates/post-build/post-build.yml | 24 +++ .../templates/post-build/promote-build.yml | 12 +- .../post-build/setup-maestro-vars.yml | 4 +- .../post-build/trigger-subscription.yml | 11 ++ global.json | 4 +- 20 files changed, 720 insertions(+), 64 deletions(-) create mode 100644 eng/common/post-build/nuget-validation.ps1 create mode 100644 eng/common/post-build/promote-build.ps1 create mode 100644 eng/common/post-build/trigger-subscriptions.ps1 create mode 100644 eng/common/sdl/extract-artifact-packages.ps1 create mode 100644 eng/common/templates/post-build/channels/internal-servicing.yml create mode 100644 eng/common/templates/post-build/channels/public-release.yml create mode 100644 eng/common/templates/post-build/trigger-subscription.yml diff --git a/NuGet.config b/NuGet.config index fdf6d3eda4..8f21de1b15 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,4 +1,4 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 309516901a..b7f5189a27 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 9946534da4f73e6242ca105f6798ab58119c9ab0 + 89fab80685c91024c8f9e21f1c37f62580f648f8 diff --git a/eng/common/post-build/nuget-validation.ps1 b/eng/common/post-build/nuget-validation.ps1 new file mode 100644 index 0000000000..1bdced1e30 --- /dev/null +++ b/eng/common/post-build/nuget-validation.ps1 @@ -0,0 +1,28 @@ +# This script validates NuGet package metadata information using this +# tool: https://github.com/NuGet/NuGetGallery/tree/jver-verify/src/VerifyMicrosoftPackage + +param( + [Parameter(Mandatory=$true)][string] $PackagesPath, # Path to where the packages to be validated are + [Parameter(Mandatory=$true)][string] $ToolDestinationPath # Where the validation tool should be downloaded to +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 + +. $PSScriptRoot\..\tools.ps1 + +try { + $url = "https://raw.githubusercontent.com/NuGet/NuGetGallery/jver-verify/src/VerifyMicrosoftPackage/verify.ps1" + + New-Item -ItemType "directory" -Path ${ToolDestinationPath} -Force + + Invoke-WebRequest $url -OutFile ${ToolDestinationPath}\verify.ps1 + + & ${ToolDestinationPath}\verify.ps1 ${PackagesPath}\*.nupkg +} +catch { + Write-PipelineTaskError "NuGet package validation failed. Please check error logs." + Write-Host $_ + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/promote-build.ps1 b/eng/common/post-build/promote-build.ps1 new file mode 100644 index 0000000000..84a608fa56 --- /dev/null +++ b/eng/common/post-build/promote-build.ps1 @@ -0,0 +1,53 @@ +param( + [Parameter(Mandatory=$true)][int] $BuildId, + [Parameter(Mandatory=$true)][int] $ChannelId, + [Parameter(Mandatory=$true)][string] $BarToken, + [string] $MaestroEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com", + [string] $ApiVersion = "2019-01-16" +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 + +. $PSScriptRoot\..\tools.ps1 + +function Get-Headers([string]$accept, [string]$barToken) { + $headers = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' + $headers.Add('Accept',$accept) + $headers.Add('Authorization',"Bearer $barToken") + return $headers +} + +try { + $maestroHeaders = Get-Headers 'application/json' $BarToken + + # Get info about which channels the build has already been promoted to + $getBuildApiEndpoint = "$MaestroEndpoint/api/builds/${BuildId}?api-version=$ApiVersion" + $buildInfo = Invoke-WebRequest -Method Get -Uri $getBuildApiEndpoint -Headers $maestroHeaders | ConvertFrom-Json + + if (!$buildInfo) { + Write-Host "Build with BAR ID $BuildId was not found in BAR!" + ExitWithExitCode 1 + } + + # Find whether the build is already assigned to the channel or not + if ($buildInfo.channels) { + foreach ($channel in $buildInfo.channels) { + if ($channel.Id -eq $ChannelId) { + Write-Host "The build with BAR ID $BuildId is already on channel $ChannelId!" + ExitWithExitCode 0 + } + } + } + + Write-Host "Build not present in channel $ChannelId. Promoting build ... " + + $promoteBuildApiEndpoint = "$maestroEndpoint/api/channels/${ChannelId}/builds/${BuildId}?api-version=$ApiVersion" + Invoke-WebRequest -Method Post -Uri $promoteBuildApiEndpoint -Headers $maestroHeaders + Write-Host "done." +} +catch { + Write-Host "There was an error while trying to promote build '$BuildId' to channel '$ChannelId'" + Write-Host $_ + Write-Host $_.ScriptStackTrace +} diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 index 84c97df1fc..8abd684e9e 100644 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -11,13 +11,13 @@ Set-StrictMode -Version 2.0 . $PSScriptRoot\..\tools.ps1 -# Cache/HashMap (File -> Exist flag) used to consult whether a file exist +# Cache/HashMap (File -> Exist flag) used to consult whether a file exist # in the repository at a specific commit point. This is populated by inserting # all files present in the repo at a specific commit point. $global:RepoFiles = @{} $ValidatePackage = { - param( + param( [string] $PackagePath # Full path to a Symbols.NuGet package ) @@ -32,7 +32,7 @@ $ValidatePackage = { # Extensions for which we'll look for SourceLink information # For now we'll only care about Portable & Embedded PDBs $RelevantExtensions = @(".dll", ".exe", ".pdb") - + Write-Host -NoNewLine "Validating" ([System.IO.Path]::GetFileName($PackagePath)) "... " $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) @@ -46,13 +46,13 @@ $ValidatePackage = { try { $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) - $zip.Entries | + $zip.Entries | Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | ForEach-Object { $FileName = $_.FullName $Extension = [System.IO.Path]::GetExtension($_.Name) $FakeName = -Join((New-Guid), $Extension) - $TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName + $TargetFile = Join-Path -Path $ExtractPath -ChildPath $FakeName # We ignore resource DLLs if ($FileName.EndsWith(".resources.dll")) { @@ -62,7 +62,7 @@ $ValidatePackage = { [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) $ValidateFile = { - param( + param( [string] $FullPath, # Full path to the module that has to be checked [string] $RealPath, [ref] $FailedFiles @@ -83,7 +83,7 @@ $ValidatePackage = { ForEach-Object { $Link = $_ $CommitUrl = "https://raw.githubusercontent.com/${using:GHRepoName}/${using:GHCommit}/" - + $FilePath = $Link.Replace($CommitUrl, "") $Status = 200 $Cache = $using:RepoFiles @@ -91,7 +91,7 @@ $ValidatePackage = { if ( !($Cache.ContainsKey($FilePath)) ) { try { $Uri = $Link -as [System.URI] - + # Only GitHub links are valid if ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match "github" -or $Uri.Host -match "githubusercontent")) { $Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode @@ -128,15 +128,15 @@ $ValidatePackage = { } } } - + &$ValidateFile $TargetFile $FileName ([ref]$FailedFiles) } } catch { - + } finally { - $zip.Dispose() + $zip.Dispose() } if ($FailedFiles -eq 0) { @@ -163,13 +163,13 @@ function ValidateSourceLinkLinks { ExitWithExitCode 1 } - $RepoTreeURL = -Join("https://api.github.com/repos/", $GHRepoName, "/git/trees/", $GHCommit, "?recursive=1") + $RepoTreeURL = -Join("http://api.github.com/repos/", $GHRepoName, "/git/trees/", $GHCommit, "?recursive=1") $CodeExtensions = @(".cs", ".vb", ".fs", ".fsi", ".fsx", ".fsscript") try { # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash $Data = Invoke-WebRequest $RepoTreeURL -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty tree - + foreach ($file in $Data) { $Extension = [System.IO.Path]::GetExtension($file.path) @@ -183,7 +183,7 @@ function ValidateSourceLinkLinks { Write-Host $_ ExitWithExitCode 1 } - + if (Test-Path $ExtractPath) { Remove-Item $ExtractPath -Force -Recurse -ErrorAction SilentlyContinue } diff --git a/eng/common/post-build/trigger-subscriptions.ps1 b/eng/common/post-build/trigger-subscriptions.ps1 new file mode 100644 index 0000000000..db8a839457 --- /dev/null +++ b/eng/common/post-build/trigger-subscriptions.ps1 @@ -0,0 +1,69 @@ +param( + [Parameter(Mandatory=$true)][string] $SourceRepo, + [Parameter(Mandatory=$true)][int] $ChannelId, + [string] $MaestroEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com", + [string] $BarToken, + [string] $ApiVersion = "2019-01-16" +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 + +. $PSScriptRoot\..\tools.ps1 + +function Get-Headers([string]$accept, [string]$barToken) { + $headers = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' + $headers.Add('Accept',$accept) + $headers.Add('Authorization',"Bearer $barToken") + return $headers +} + +# Get all the $SourceRepo subscriptions +$normalizedSurceRepo = $SourceRepo.Replace('dnceng@', '') +$getSubscriptionsApiEndpoint = "$maestroEndpoint/api/subscriptions?sourceRepository=$normalizedSurceRepo&api-version=$apiVersion" +$headers = Get-Headers 'application/json' $barToken + +$subscriptions = Invoke-WebRequest -Uri $getSubscriptionsApiEndpoint -Headers $headers | ConvertFrom-Json + +if (!$subscriptions) { + Write-Host "No subscriptions found for source repo '$normalizedSurceRepo' in channel '$ChannelId'" + return +} + +$subscriptionsToTrigger = New-Object System.Collections.Generic.List[string] +$failedTriggeredSubscription = $false + +# Get all enabled subscriptions that need dependency flow on 'everyBuild' +foreach ($subscription in $subscriptions) { + if ($subscription.enabled -and $subscription.policy.updateFrequency -like 'everyBuild' -and $subscription.channel.id -eq $ChannelId) { + Write-Host "$subscription.id" + [void]$subscriptionsToTrigger.Add($subscription.id) + } +} + +foreach ($subscriptionToTrigger in $subscriptionsToTrigger) { + try { + $triggerSubscriptionApiEndpoint = "$maestroEndpoint/api/subscriptions/$subscriptionToTrigger/trigger?api-version=$apiVersion" + $headers = Get-Headers 'application/json' $BarToken + + Write-Host "Triggering subscription '$subscriptionToTrigger'..." + + Invoke-WebRequest -Uri $triggerSubscriptionApiEndpoint -Headers $headers -Method Post + + Write-Host "Subscription '$subscriptionToTrigger' triggered!" + } + catch + { + Write-Host "There was an error while triggering subscription '$subscriptionToTrigger'" + Write-Host $_ + Write-Host $_.ScriptStackTrace + $failedTriggeredSubscription = $true + } +} + +if ($failedTriggeredSubscription) { + Write-Host "At least one subscription failed to be triggered..." + ExitWithExitCode 1 +} + +Write-Host "All subscriptions were triggered successfully!" diff --git a/eng/common/sdl/extract-artifact-packages.ps1 b/eng/common/sdl/extract-artifact-packages.ps1 new file mode 100644 index 0000000000..1fdbb14329 --- /dev/null +++ b/eng/common/sdl/extract-artifact-packages.ps1 @@ -0,0 +1,70 @@ +param( + [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where artifact packages are stored + [Parameter(Mandatory=$true)][string] $ExtractPath # Full path to directory where the packages will be extracted +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 +$ExtractPackage = { + param( + [string] $PackagePath # Full path to a NuGet package + ) + + if (!(Test-Path $PackagePath)) { + Write-PipelineTaskError "Input file does not exist: $PackagePath" + ExitWithExitCode 1 + } + + $RelevantExtensions = @(".dll", ".exe", ".pdb") + Write-Host -NoNewLine "Extracting" ([System.IO.Path]::GetFileName($PackagePath)) "... " + + $PackageId = [System.IO.Path]::GetFileNameWithoutExtension($PackagePath) + $ExtractPath = Join-Path -Path $using:ExtractPath -ChildPath $PackageId + + Add-Type -AssemblyName System.IO.Compression.FileSystem + + [System.IO.Directory]::CreateDirectory($ExtractPath); + + try { + $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) + + $zip.Entries | + Where-Object {$RelevantExtensions -contains [System.IO.Path]::GetExtension($_.Name)} | + ForEach-Object { + $TargetFile = Join-Path -Path $ExtractPath -ChildPath $_.Name + + [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true) + } + } + catch { + + } + finally { + $zip.Dispose() + } + } + function ExtractArtifacts { + if (!(Test-Path $InputPath)) { + Write-Host "Input Path does not exist: $InputPath" + ExitWithExitCode 0 + } + $Jobs = @() + Get-ChildItem "$InputPath\*.nupkg" | + ForEach-Object { + $Jobs += Start-Job -ScriptBlock $ExtractPackage -ArgumentList $_.FullName + } + + foreach ($Job in $Jobs) { + Wait-Job -Id $Job.Id | Receive-Job + } +} + +try { + Measure-Command { ExtractArtifacts } +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config index b054737df1..fb9b712863 100644 --- a/eng/common/sdl/packages.config +++ b/eng/common/sdl/packages.config @@ -1,4 +1,4 @@  - + diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index acb4c55d73..5837f3d56d 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -20,6 +20,16 @@ jobs: downloadType: specific files matchingPattern: "**" downloadPath: $(Build.SourcesDirectory)\artifacts + - powershell: eng/common/sdl/extract-artifact-packages.ps1 + -InputPath $(Build.SourcesDirectory)\artifacts\BlobArtifacts + -ExtractPath $(Build.SourcesDirectory)\artifacts\BlobArtifacts + displayName: Extract Blob Artifacts + continueOnError: ${{ parameters.continueOnError }} + - powershell: eng/common/sdl/extract-artifact-packages.ps1 + -InputPath $(Build.SourcesDirectory)\artifacts\PackageArtifacts + -ExtractPath $(Build.SourcesDirectory)\artifacts\PackageArtifacts + displayName: Extract Package Artifacts + continueOnError: ${{ parameters.continueOnError }} - task: NuGetToolInstaller@1 displayName: 'Install NuGet.exe' - task: NuGetCommand@2 @@ -36,7 +46,7 @@ jobs: continueOnError: ${{ parameters.continueOnError }} - ${{ if eq(parameters.overrideParameters, '') }}: - powershell: eng/common/sdl/execute-all-sdl-tools.ps1 - -GuardianPackageName Microsoft.Guardian.Cli.0.3.2 + -GuardianPackageName Microsoft.Guardian.Cli.0.6.0 -NugetPackageDirectory $(Build.SourcesDirectory)\.packages -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) ${{ parameters.additionalParameters }} diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index ff7346163f..9e77ef1b54 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -66,7 +66,6 @@ jobs: script: | Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(BARBuildId) Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value "$(DefaultChannels)" - Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(IsInternalBuild) Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(IsStableBuild) - task: PublishBuildArtifacts@1 displayName: Publish ReleaseConfigs Artifact diff --git a/eng/common/templates/post-build/channels/internal-servicing.yml b/eng/common/templates/post-build/channels/internal-servicing.yml new file mode 100644 index 0000000000..808d46b17f --- /dev/null +++ b/eng/common/templates/post-build/channels/internal-servicing.yml @@ -0,0 +1,170 @@ +parameters: + enableSymbolValidation: true + +stages: +- stage: IS_Publish + dependsOn: validate + variables: + - template: ../common-variables.yml + displayName: Internal Servicing + jobs: + - template: ../setup-maestro-vars.yml + + - job: + displayName: Symbol Publishing + dependsOn: setupMaestroVars + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.InternalServicing_30_Channel_Id) + variables: + - group: DotNet-Symbol-Server-Pats + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Artifacts + inputs: + downloadType: specific files + matchingPattern: "*Artifacts*" + + - task: PowerShell@2 + displayName: Publish + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:Configuration=Release + + - job: publish_assets + displayName: Publish Assets + dependsOn: setupMaestroVars + variables: + - group: DotNet-Blob-Feed + - group: Publish-Build-Assets + - group: AzureDevOps-Artifact-Feeds-Pats + - name: BARBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + - name: IsStableBuild + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.InternalServicing_30_Channel_Id) + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: current + artifactName: PackageArtifacts + + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: current + artifactName: BlobArtifacts + + - task: DownloadBuildArtifacts@0 + displayName: Download Asset Manifests + inputs: + buildType: current + artifactName: AssetManifests + + - task: PowerShell@2 + displayName: Add Assets Location + env: + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + /p:ChannelId=$(InternalServicing_30_Channel_Id) + /p:IsStableBuild=$(IsStableBuild) + /p:IsInternalBuild=$(IsInternalBuild) + /p:RepositoryName=$(Build.Repository.Name) + /p:CommitSha=$(Build.SourceVersion) + /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' + /p:BuildAssetRegistryToken='$(MaestroAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' + /p:Configuration=Release + + - task: NuGetCommand@2 + displayName: Publish Packages to AzDO Feed + condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') + inputs: + command: push + vstsFeed: $(AzDoFeedName) + packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg + publishVstsFeed: $(AzDoFeedName) + + - task: PowerShell@2 + displayName: Publish Blobs to AzDO Feed + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 + arguments: -FeedName $(AzDoFeedName) + -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) + enabled: false + + - template: ../trigger-subscription.yml + parameters: + ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} + +- stage: IS_PublishValidation + displayName: Publish Validation + variables: + - template: ../common-variables.yml + jobs: + - template: ../setup-maestro-vars.yml + + - ${{ if eq(parameters.enableSymbolValidation, 'true') }}: + - job: + displayName: Symbol Availability + dependsOn: setupMaestroVars + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.InternalServicing_30_Channel_Id) + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: current + artifactName: PackageArtifacts + + - task: PowerShell@2 + displayName: Check Symbol Availability + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) + + - job: + displayName: Gather Drop + dependsOn: setupMaestroVars + variables: + BARBuildId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.InternalServicing_30_Channel_Id) + pool: + vmImage: 'windows-2019' + steps: + - task: PowerShell@2 + displayName: Setup Darc CLI + inputs: + targetType: filePath + filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1' + + - task: PowerShell@2 + displayName: Run Darc gather-drop + inputs: + targetType: inline + script: | + darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) --latest-location + enabled: false + + - template: ../promote-build.yml + parameters: + ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} \ No newline at end of file diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml index c61eaa927d..79c6822db7 100644 --- a/eng/common/templates/post-build/channels/public-dev-release.yml +++ b/eng/common/templates/post-build/channels/public-dev-release.yml @@ -20,17 +20,10 @@ stages: vmImage: 'windows-2019' steps: - task: DownloadBuildArtifacts@0 - displayName: Download PDB Artifacts + displayName: Download Artifacts inputs: - buildType: current - artifactName: PDBArtifacts - continueOnError: true - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: current - artifactName: BlobArtifacts + downloadType: specific files + matchingPattern: "*Artifacts*" - task: PowerShell@2 displayName: Publish @@ -44,13 +37,16 @@ stages: /p:Configuration=Release - job: - displayName: Publish to Static Feed + displayName: Publish Assets dependsOn: setupMaestroVars variables: - group: DotNet-Blob-Feed - group: Publish-Build-Assets + - group: AzureDevOps-Artifact-Feeds-Pats - name: BARBuildId value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + - name: IsStableBuild + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicDevRelease_30_Channel_Id) pool: vmImage: 'windows-2019' @@ -74,22 +70,47 @@ stages: artifactName: AssetManifests - task: PowerShell@2 - displayName: Publish + displayName: Add Assets Location + env: + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishToPackageFeed -restore -msbuildEngine dotnet - /p:AccountKeyToStaticFeed='$(dotnetfeed-storage-access-key-1)' + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + /p:ChannelId=$(PublicDevRelease_30_Channel_Id) + /p:IsStableBuild=$(IsStableBuild) + /p:IsInternalBuild=$(IsInternalBuild) + /p:RepositoryName=$(Build.Repository.Name) + /p:CommitSha=$(Build.SourceVersion) + /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' /p:BARBuildId=$(BARBuildId) /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' /p:BuildAssetRegistryToken='$(MaestroAccessToken)' /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:ArtifactsCategory='$(_DotNetArtifactsCategory)' - /p:OverrideAssetsWithSameName=true - /p:PassIfExistingItemIdentical=true /p:Configuration=Release + - task: NuGetCommand@2 + displayName: Publish Packages to AzDO Feed + condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') + inputs: + command: push + vstsFeed: $(AzDoFeedName) + packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg + publishVstsFeed: $(AzDoFeedName) + + - task: PowerShell@2 + displayName: Publish Blobs to AzDO Feed + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 + arguments: -FeedName $(AzDoFeedName) + -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) + enabled: false + - stage: PublishValidation displayName: Publish Validation @@ -140,6 +161,6 @@ stages: script: | darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) --latest-location - - template: ../promote-build.yml - parameters: + - template: ../promote-build.yml + parameters: ChannelId: ${{ variables.PublicDevRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/public-release.yml b/eng/common/templates/post-build/channels/public-release.yml new file mode 100644 index 0000000000..25923020df --- /dev/null +++ b/eng/common/templates/post-build/channels/public-release.yml @@ -0,0 +1,170 @@ +parameters: + enableSymbolValidation: true + +stages: +- stage: PubRel_Publish + dependsOn: validate + variables: + - template: ../common-variables.yml + displayName: Public Release + jobs: + - template: ../setup-maestro-vars.yml + + - job: + displayName: Symbol Publishing + dependsOn: setupMaestroVars + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicRelease_30_Channel_Id) + variables: + - group: DotNet-Symbol-Server-Pats + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Artifacts + inputs: + downloadType: specific files + matchingPattern: "*Artifacts*" + + - task: PowerShell@2 + displayName: Publish + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:Configuration=Release + + - job: publish_assets + displayName: Publish Assets + dependsOn: setupMaestroVars + variables: + - group: DotNet-Blob-Feed + - group: Publish-Build-Assets + - group: AzureDevOps-Artifact-Feeds-Pats + - name: BARBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + - name: IsStableBuild + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicRelease_30_Channel_Id) + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: current + artifactName: PackageArtifacts + + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: current + artifactName: BlobArtifacts + + - task: DownloadBuildArtifacts@0 + displayName: Download Asset Manifests + inputs: + buildType: current + artifactName: AssetManifests + + - task: PowerShell@2 + displayName: Publish + env: + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + /p:ChannelId=$(PublicRelease_30_Channel_Id) + /p:IsStableBuild=$(IsStableBuild) + /p:IsInternalBuild=$(IsInternalBuild) + /p:RepositoryName=$(Build.Repository.Name) + /p:CommitSha=$(Build.SourceVersion) + /p:NugetPath=$(Agent.BuildDirectory)/Nuget/NuGet.exe + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' + /p:BuildAssetRegistryToken='$(MaestroAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' + /p:Configuration=Release + + - task: NuGetCommand@2 + displayName: Publish Packages to AzDO Feed + condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') + inputs: + command: push + vstsFeed: $(AzDoFeedName) + packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg + publishVstsFeed: $(AzDoFeedName) + + - task: PowerShell@2 + displayName: Publish Blobs to AzDO Feed + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 + arguments: -FeedName $(AzDoFeedName) + -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) + enabled: false + + - template: ../trigger-subscription.yml + parameters: + ChannelId: ${{ variables.PublicRelease_30_Channel_Id }} + +- stage: PubRel_PublishValidation + displayName: Publish Validation + variables: + - template: ../common-variables.yml + jobs: + - template: ../setup-maestro-vars.yml + + - ${{ if eq(parameters.enableSymbolValidation, 'true') }}: + - job: + displayName: Symbol Availability + dependsOn: setupMaestroVars + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicRelease_30_Channel_Id) + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: current + artifactName: PackageArtifacts + + - task: PowerShell@2 + displayName: Check Symbol Availability + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) + + - job: + displayName: Gather Drop + dependsOn: setupMaestroVars + variables: + BARBuildId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicRelease_30_Channel_Id) + pool: + vmImage: 'windows-2019' + steps: + - task: PowerShell@2 + displayName: Setup Darc CLI + inputs: + targetType: filePath + filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1' + + - task: PowerShell@2 + displayName: Run Darc gather-drop + inputs: + targetType: inline + script: | + darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) --latest-location + enabled: false + + - template: ../promote-build.yml + parameters: + ChannelId: ${{ variables.PublicRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index 23725c6d62..114477d3ad 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -8,14 +8,17 @@ stages: - template: ../setup-maestro-vars.yml - job: - displayName: Publish to Static Feed + displayName: Publish Assets dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicValidationRelease_30_Channel_Id) variables: - group: DotNet-Blob-Feed - group: Publish-Build-Assets + - group: AzureDevOps-Artifact-Feeds-Pats - name: BARBuildId value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + - name: IsStableBuild + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicValidationRelease_30_Channel_Id) pool: vmImage: 'windows-2019' steps: @@ -38,21 +41,46 @@ stages: artifactName: AssetManifests - task: PowerShell@2 - displayName: Publish + displayName: Add Assets Location + env: + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishToPackageFeed -restore -msbuildEngine dotnet - /p:AccountKeyToStaticFeed='$(dotnetfeed-storage-access-key-1)' + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + /p:ChannelId=$(PublicValidationRelease_30_Channel_Id) + /p:IsStableBuild=$(IsStableBuild) + /p:IsInternalBuild=$(IsInternalBuild) + /p:RepositoryName=$(Build.Repository.Name) + /p:CommitSha=$(Build.SourceVersion) + /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' /p:BARBuildId=$(BARBuildId) /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' /p:BuildAssetRegistryToken='$(MaestroAccessToken)' /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:ArtifactsCategory='$(_DotNetArtifactsCategory)' - /p:OverrideAssetsWithSameName=true - /p:PassIfExistingItemIdentical=true + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' /p:Configuration=Release + + - task: NuGetCommand@2 + displayName: Publish Packages to AzDO Feed + condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') + inputs: + command: push + vstsFeed: $(AzDoFeedName) + packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg + publishVstsFeed: $(AzDoFeedName) + + - task: PowerShell@2 + displayName: Publish Blobs to AzDO Feed + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 + arguments: -FeedName $(AzDoFeedName) + -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) + enabled: false - stage: PVR_PublishValidation @@ -86,6 +114,6 @@ stages: script: | darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com --password $(MaestroAccessToken) --latest-location - - template: ../promote-build.yml - parameters: + - template: ../promote-build.yml + parameters: ChannelId: ${{ variables.PublicValidationRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index 97b48d97fe..8283467352 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -5,5 +5,14 @@ variables: # .NET Tools - Validation PublicValidationRelease_30_Channel_Id: 9 + # .NET Core 3.0 Internal Servicing + InternalServicing_30_Channel_Id: 184 + + # .NET Core 3.0 Release + PublicRelease_30_Channel_Id: 19 + + # Whether the build is internal or not + IsInternalBuild: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} + SourceLinkCLIVersion: 3.0.0 SymbolToolVersion: 1.0.1 diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 2c411dd009..daa799259c 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -2,6 +2,7 @@ parameters: enableSourceLinkValidation: true enableSigningValidation: true enableSymbolValidation: true + enableNugetValidation: true SDLValidationParameters: enable: false params: '' @@ -11,6 +12,25 @@ stages: dependsOn: build displayName: Validate jobs: + - ${{ if eq(parameters.enableNugetValidation, 'true') }}: + - job: + displayName: NuGet Validation + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: current + artifactName: PackageArtifacts + + - task: PowerShell@2 + displayName: Validate + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/nuget-validation.ps1 + arguments: -PackagesPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ + -ToolDestinationPath $(Agent.BuildDirectory)/Extract/ + - ${{ if eq(parameters.enableSigningValidation, 'true') }}: - job: displayName: Signing Validation @@ -65,3 +85,7 @@ stages: enableSymbolValidation: ${{ parameters.enableSymbolValidation }} - template: \eng\common\templates\post-build\channels\public-validation-release.yml + +- template: \eng\common\templates\post-build\channels\public-release.yml + +- template: \eng\common\templates\post-build\channels\internal-servicing.yml diff --git a/eng/common/templates/post-build/promote-build.yml b/eng/common/templates/post-build/promote-build.yml index d00317003b..af48b0b339 100644 --- a/eng/common/templates/post-build/promote-build.yml +++ b/eng/common/templates/post-build/promote-build.yml @@ -18,11 +18,7 @@ jobs: - task: PowerShell@2 displayName: Add Build to Channel inputs: - targetType: inline - script: | - $headers = @{ - "Accept" = "application/json" - "Authorization" = "Bearer $(MaestroAccessToken)" - } - Invoke-RestMethod -Method Post -Headers $headers -Uri https://maestro-prod.westus2.cloudapp.azure.com/api/channels/$(ChannelId)/builds/$(BARBuildId)?api-version=2019-01-16 - enabled: false + filePath: $(Build.SourcesDirectory)/eng/common/post-build/promote-build.ps1 + arguments: -BuildId $(BARBuildId) + -ChannelId $(ChannelId) + -BarToken $(MaestroAccessToken) diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml index 0eddd6cd3b..f6120dc1e1 100644 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -28,10 +28,8 @@ jobs: $Channels = "" $Content | Select -Index 1 | ForEach-Object { $Channels += "$_ ," } - $IsInternalBuild = $Content | Select -Index 2 - $IsStableBuild = $Content | Select -Index 3 + $IsStableBuild = $Content | Select -Index 2 Write-PipelineSetVariable -Name 'BARBuildId' -Value $BarId Write-PipelineSetVariable -Name 'InitialChannels' -Value "$Channels" - Write-PipelineSetVariable -Name 'IsInternalBuild' -Value $IsInternalBuild Write-PipelineSetVariable -Name 'IsStableBuild' -Value $IsStableBuild diff --git a/eng/common/templates/post-build/trigger-subscription.yml b/eng/common/templates/post-build/trigger-subscription.yml new file mode 100644 index 0000000000..65259d4e68 --- /dev/null +++ b/eng/common/templates/post-build/trigger-subscription.yml @@ -0,0 +1,11 @@ +parameters: + ChannelId: 0 + +steps: +- task: PowerShell@2 + displayName: Triggering subscriptions + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/trigger-subscriptions.ps1 + arguments: -SourceRepo $(Build.Repository.Uri) + -ChannelId ${{ parameters.ChannelId }} + -BarToken $(MaestroAccessTokenInt) \ No newline at end of file diff --git a/global.json b/global.json index 1f44c774f6..7623ed03b7 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "3.0.100-preview5-011568", + "dotnet": "3.0.100-preview6-012264", "vs": { "version": "16.1", "components": [ @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19323.4", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19330.1", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 6bdbe9d35c2979c342ae18873f05d22ac36bc311 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Mon, 1 Jul 2019 17:16:00 -0700 Subject: [PATCH 126/286] Fix fsharp47 (#7091) * Fix langversion switch fsi test * versions --- eng/Versions.props | 35 +++++++++---------- src/fsharp/xlf/FSComp.txt.es.xlf | 2 +- .../CompilerOptions/fsc/langversion/env.lst | 2 +- .../fsi/langversion/comparer.fsx | 32 ----------------- .../CompilerOptions/fsi/langversion/env.lst | 2 +- ...osoft.VisualStudio.Editors.Designer.cs.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.de.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.es.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.fr.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.it.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.ja.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.ko.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.pl.xlf | 3 +- ...ft.VisualStudio.Editors.Designer.pt-BR.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.ru.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.tr.xlf | 3 +- ....VisualStudio.Editors.Designer.zh-Hans.xlf | 3 +- ....VisualStudio.Editors.Designer.zh-Hant.xlf | 3 +- 18 files changed, 46 insertions(+), 66 deletions(-) delete mode 100644 tests/fsharpqa/Source/CompilerOptions/fsi/langversion/comparer.fsx diff --git a/eng/Versions.props b/eng/Versions.props index 6288375b66..185e201fba 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -30,7 +30,7 @@ 16 - 3 + 1 $(VSMajorVersion).0 $(VSMajorVersion).$(VSMinorVersion).0 $(VSAssemblyVersionPrefix).0 @@ -55,7 +55,6 @@ https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json; https://api.nuget.org/v3/index.json; https://dotnet.myget.org/F/roslyn/api/v3/index.json; - https://dotnet.myget.org/F/roslyn-analyzers/api/v3/index.json; https://dotnet.myget.org/F/symreader-converter/api/v3/index.json; https://dotnet.myget.org/F/interactive-window/api/v3/index.json; https://myget.org/F/vs-devcore/api/v3/index.json; @@ -110,26 +109,26 @@ 8.0.1 14.0.25420 - 16.0.467 - 16.0.467 + 16.1.89 + 16.1.89 1.1.4322 - 16.0.467 - 16.0.28727 - 16.0.28729 + 16.1.89 + 16.1.28916.169 + 16.1.28917.181 16.1.3121 - 16.0.467 - 16.0.467 - 16.0.467 + 16.1.89 + 16.1.89 + 16.1.89 8.0.50728 7.10.6071 - 16.0.28729 + 16.1.28917.181 8.0.50728 16.0.201-pre-g7d366164d0 2.3.6152103 14.3.25407 - 16.0.28729 - 16.0.28729 - 16.0.28729 + 16.1.28917.181 + 16.1.28917.181 + 16.1.28917.181 10.0.30319 11.0.50727 15.0.25123-Dev15Preview @@ -139,15 +138,15 @@ 10.0.30320 11.0.61031 12.0.30111 - 16.0.467 + 16.1.89 7.10.6071 8.0.50728 10.0.30320 12.0.30112 - 16.0.467 - 16.0.467 + 16.1.89 + 16.1.89 16.0.102 - 16.0.28729 + 16.1.28917.181 15.3.58 9.0.30729 16.0.2264 diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index f8f734b015..73a099a9ad 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -134,7 +134,7 @@ All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. - Todas las ramas de una expresión de coincidencia de patrón deben devolver valores del mismo tipo. La primera rama devolvió un valor de tipo "{0}", pero esta rama devolvió un valor de tipo "\{1 \}". + All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst index 3b89b6742d..bba306f616 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/env.lst @@ -1,4 +1,4 @@ # ReqENU means that the test is non-localized -ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >langversionhelp.txt --langversion:? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\..\\comparer.fsx langversionhelp.txt langversionhelp.437.1033.bsl" # --langversion:? +ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 PRECMD="\$FSC_PIPE >langversionhelp.txt --langversion:? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx langversionhelp.txt langversionhelp.437.1033.bsl" # --langversion:? ReqENU SOURCE=badlangversion.fsx SCFLAGS=" --langversion:4.5" # --langversion:4.5 diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/comparer.fsx b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/comparer.fsx deleted file mode 100644 index 38adec6afd..0000000000 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/comparer.fsx +++ /dev/null @@ -1,32 +0,0 @@ -// #NoMT #CompilerOptions #RequiresENU -#light - -let arg0 = System.Environment.GetCommandLineArgs().[0] -let path = System.Environment.GetEnvironmentVariable("PATH") -let fn1 = fsi.CommandLineArgs.[1] -let fn2 = fsi.CommandLineArgs.[2] - -// Read file into an array -let File2List (filename:string) = System.IO.File.ReadAllLines(filename) - -let f1 = File2List fn1 -let f2 = File2List fn2 - -let mutable i = 0 -let compare (f1:string[]) (f2:string[]) = - if f1.Length <> f2.Length then failwithf "Help text did not match. f1.Length = %d, f2.Length = %d. Check you have fsc on path, arg0 = %s, PATH=%s" f1.Length f2.Length arg0 path - (f1, f2) ||> Array.forall2 (fun (a:string) (b:string) -> - let aa = System.Text.RegularExpressions.Regex.Replace(a, @"F# Compiler version .+", "F# Compiler") - let bb = System.Text.RegularExpressions.Regex.Replace(b, @"F# Compiler version .+", "F# Compiler") - i <- i+1 - if (aa = bb) then - true - else - printfn "Files differ at line %d:" i - printfn "\t>> %s" a - printfn "\t<< %s" b - false - ) - -exit (if compare f1 f2 then 0 else 1) - diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst index c776cbedee..fa31a7b0e4 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/env.lst @@ -1,4 +1,4 @@ # ReqENU means that the test is non-localized -ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE >c:\\temp\\langversionhelp.txt --langversion:? 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx c:\\temp\\langversionhelp.txt langversionhelp.437.1033.bsl" # --langversion:? +ReqENU SOURCE=dummy.fsx COMPILE_ONLY=1 SCFLAGS="--nologo" FSIMODE=EXEC PRECMD="\$FSI_PIPE --langversion:? >langversionhelp.txt 2>&1" POSTCMD="\$FSI_PIPE --nologo --quiet --exec ..\\..\\..\\comparer.fsx langversionhelp.txt langversionhelp.437.1033.bsl" # --langversion:? ReqENU SOURCE=badlangversion.fsx SCFLAGS=" --langversion:4.5" # --langversion:4.5 diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf index a678a4bcfe..860555f344 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom
    {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf index 662133483e..65b4328fdc 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom
    {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf index 41dbc88f0b..1153755c3d 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom
    {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf index 0f1e16e95f..cd60e9f07e 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom
    {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf index 8902030751..dd58cb9a11 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom
    {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf index a39e49dfa0..bdb896a5c8 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom
    {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf index e7191ac3c4..6f540b5425 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom
    {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf index d0675bd2fc..73bef853b9 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom
    {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf index acfade8884..3e8a169348 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom
    {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf index 355d363084..2b5303d91d 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom
    {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf index 86ac32f4b3..73a72b806a 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom
    {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf index 0537632d5f..474f99a3dc 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom
    {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf index 17c64ffefb..16b7339b2a 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom
    {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" From 4d724f2b4da783451b335b8a2651906214b0f9f3 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Mon, 1 Jul 2019 20:36:26 -0700 Subject: [PATCH 127/286] Reorder and clarify devguide (#7082) Some outdated info removed and it's reorganized a bit. --- DEVGUIDE.md | 223 ++++++++++++++++++++++------------------------------ 1 file changed, 93 insertions(+), 130 deletions(-) diff --git a/DEVGUIDE.md b/DEVGUIDE.md index e944b07313..862ac8c58e 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -1,62 +1,72 @@ # Development Guide -## Get the Latest F# Compiler Source Code +This document details more advanced options for developing in this codebase. It is not quite necessary to follow it, but it is likely that you'll find something you'll need from here. -Get the latest source code from the master branch by running this git command: +## Recommended workflow - git clone https://github.com/dotnet/fsharp.git +We recommend the following overall workflow when developing for this repository: -Before running the build scripts, ensure that you have cleaned up the visualfsharp repo by running this git command: +* Fork this repository +* Always work in your fork +* Always keep your fork up to date - git clean -xfd +This will make management of multiple forks and your own work easier over time. -This will remove any files that are not under version control. This is necessary only if you have already attempted to build the solution or have made other changes that might prevent it from building. +## Updating your fork -## Installing Dependencies and Building +We recommend the following commands to update your fork: -Follow the instructions below to build and develop the F# Compiler, Core Library and tools on Windows, macOS and Linux. +``` +git checkout master +git clean -xdf +git fetch upstream +git rebase upstream/master +git push +``` -- [Developing the F# Compiler (Windows)](#developing-the-f-compiler-windows) -- [Developing the F# Compiler (Linux/macOS)](#developing-the-f-compiler-linuxmacos) -- [Developing the Visual F# IDE Tools (Windows Only)](#developing-the-visual-f-ide-tools-windows-only) -- [Notes and Resources](#notes) +Or more succinctly: -### Developing the F# Compiler (Windows) +``` +git checkout master && git clean -xdf && git fetch upstream && git rebase upstream/master && git push +``` -Install +This will update your fork with the latest from `dotnet/fsharp` on your machine and push those updates to your remote fork. -- [.NET Framework 4.7.2](https://dotnet.microsoft.com/download/dotnet-framework/net472) -- [.NET Core 3 SDK](https://dotnet.microsoft.com/download/dotnet-core/3.0) +## Developing on Windows -**NOTE on Windows:** +Install the latest released [Visual Studio](https://www.visualstudio.com/downloads/), as that is what the `master` branch's tools are synced with. Select the following workloads: -1. It is recommended to run `build.cmd` in a command prompt with path set to have the location of MSBuild. If you have Visual Studio, we can run using `Developer Command Prompt for Visual Studio 20xx` (depends on Visual Studio version). This developer command prompt is easier to use than normal command prompt, because it already has the correct path of Visual Studio and .NET's tooling set for us to use (including MSBuild). +* .NET desktop development (also check F# desktop support, as this will install some legacy templates) +* Visual Studio extension development -2. The command prompt must have Administrator rights (`Run as Administrator`). +Building is simple: -On Windows you can build the F# compiler and tools as follows: - - Build.cmd + build.cmd Desktop tests can be run with: - Build.cmd -test + build.cmd -test -Additional options are available via: +After you build the first time you can open and use this solution in Visual Studio: - Build.cmd /? + .\VisualFSharp.sln + +If you don't have everything installed yet, you'll get prompted by Visual Studio to install a few more things. This is because we use a `.vsconfig` file that specifies all our dependencies. -After you build the first time you can open and use this solution: +## Developing on Windows - No Visual Studio - .\VisualFSharp.sln +We recommend installing the latest released Visual Studio and using that if you are on Windows. However, if you prefer not to do that, you will need to install the following: -If you are just developing the core compiler and library then building ``FSharp.sln`` will be enough. +* [.NET Framework 4.7.2](https://dotnet.microsoft.com/download/dotnet-framework/net472) +* [.NET Core 3 SDK](https://dotnet.microsoft.com/download/dotnet-core/3.0) -If you do not have Visual Studio installed and want to simply build the compiler as a .NET Core application, use this: +You'll need to pass an additional flag to the build script: - Build.cmd -noVisualStudio + build.cmd -noVisualStudio + +You can open `FSharp.sln` in your editor of choice. -### Developing the F# Compiler (Linux/macOS) +## Developing on Linux or macOS For Linux/Mac: @@ -65,140 +75,93 @@ For Linux/Mac: Running tests: ./build.sh --test + +You can then open `FSharp.sln` in your editor of choice. -### Developing the Visual F# IDE Tools (Windows Only) - -To build and test Visual F# IDE Tools, install these requirements: - -- Download [Visual Studio 2019](https://www.visualstudio.com/downloads/) -- Launch the Visual Studio Installer - - Under the **"Windows"** workload, select **".NET desktop development"** - - Select the optional component **"F# desktop language support"** - - Under the **"Other Toolsets"** workload, select **"Visual Studio extension development"** +## Testing from the command line -Steps to build: +You can find all test options as separate flags. For example: - Build.cmd -- build all F# components under the default configuration (Debug) - Build.cmd -configuration Release -- build all F# components as Release - Build.cmd -testDesktop -- build and test all net472 tests +``` +build -testDesktop -- test all net472 target frameworks +build -testCoreClr -- test all netstandard and netcoreapp target frameworks +build -testFSharpQA -- test all F# Cambridge tests +build -testVs -- test all VS integration points +build -testFcs -- test F# compiler service components +build -testAll -- all of the above +``` -All test options: +Running any of the above will build the latest changes and run tests against them. - -testDesktop -- test all net472 target frameworks - -testCoreClr -- test all netstandard and netcoreapp target frameworks - -testFSharpQA -- test all F# Cambridge tests - -testVs -- test all VS integration points - -testFcs -- test F# compiler service components - -testAll -- all of the above +## Updating FSComp.fs, FSComp.resx and XLF -Use ``VisualFSharp.sln`` if you're building the Visual F# IDE Tools. - -Note on Debug vs Release: ``Release`` Configuration has a degraded debugging experience, so if you want to test a change locally, it is recommended to do it in the ``Debug`` configuration. For more information see issues [#2771](https://github.com/Microsoft/visualfsharp/issues/2771) and [#2773](https://github.com/Microsoft/visualfsharp/pull/2773). - -Note ([#2351](https://github.com/Microsoft/visualfsharp/issues/2351)): if you face this error: - -> error VSSDK1077: Unable to locate the extensions directory. "ExternalSettingsManager::GetScopePaths failed to initialize PkgDefManager for C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe". - -Or hard crash on launch ("Unknown Error"), delete these folders: - -- `%localappdata%\Microsoft\VisualStudio\16.0_(some number here)RoslynDev` -- `%localappdata%\Microsoft\VisualStudio\16.0_(some number here)` - -#### [Optional] Install the Visual F# IDE Tools (Windows Only) - -The new builds of the Visual F# IDE Tools can no longer be installed into Visual Studio 2015. +If your changes involve modifying the list of language keywords in any way, (e.g. when implementing a new keyword), the XLF localization files need to be synced with the corresponding resx files. This can be done automatically by running -You can install Visual Studio 2019 from . + pushd src\fsharp\FSharp.Compiler.Private + msbuild FSharp.Compiler.Private.fsproj /t:UpdateXlf + popd -**Note:** This step will install a VSIX extension into Visual Studio "Next" that changes the Visual F# IDE Tools -components installed in that VS installation. You can revert this step by disabling or uninstalling the addin. +This only works on Windows/.NETStandard framework, so changing this from any other platform requires editing and syncing all of the XLF files manually. -For **Debug**, uninstall then reinstall: +## Developing the F# tools for Visual Studio - VSIXInstaller.exe /u:"VisualFSharp" - VSIXInstaller.exe artifacts\VSSetup\Debug\VisualFSharpFull.vsix +As you would expect, doing this requires both Windows and Visual Studio are installed. -For **Release**, uninstall then reinstall: +See (DEVGUIDE.md#Developing on Windows) for instructions to install what is needed; it's the same prerequisites. - VSIXInstaller.exe /u:"VisualFSharp" - VSIXInstaller.exe artifacts\VSSetup\Release\VisualFSharpFull.vsix +### Quickly see your changes locally -Restart Visual Studio, it should now be running your freshly-built Visual F# IDE Tools with updated F# Interactive. +First, ensure that `VisualFSharpFull` is the startup project. -#### [Optional] F5 testing of local changes +Then, use the **f5** or **ctrl+f5** keyboard shortcuts to test your tooling changes. The former will debug a new instance of Visual Studio. The latter will launch a new instance of Visual Studio, but with your changes installed. -To test your changes locally _without_ overwriting your default installed Visual F# tools, set the `VisualFSharp\Vsix\VisualFSharpFull` -project as the startup project. When you hit F5 a new instance of Visual Studio will be started in the `RoslynDev` hive with your -changes, but the root (default) hive will remain untouched. You can also start this hive automatically using +Alternatively, you can do this entirely via the command line if you prefer that: devenv.exe /rootsuffix RoslynDev -Because this uses the "RoslynDev" hive you can simultaneously test changes to an appropriate build of Roslyn binaries. - -#### [Optional] Rapid deployment of incremental changes to Visual F# IDE Tools components - -For the brave, you can rapidly deploy incrementally updated versions of Visual F# IDE Tool components such as ``FSharp.Editor.dll`` by copying them directly into the extension directory in your user AppData folder: - - xcopy /y debug\net40\bin\FSharp.* "%USERPROFILE%\AppData\Local\Microsoft\VisualStudio\16.0_7c5620b7FSharpDev\Extensions\Microsoft.VisualFSharpTools\Visual F# Tools\16.4.1.9055" +### Install your changes into a current Visual Studio installation -This gives a much tighter inner development loop than uninstalling/reinstalling the VSIX, as you do not have to restart VIsual Studio. Caveat emptor. +If you'd like to "run with your changes", you can produce a VSIX and install it into your current Visual Studio instance: -#### [Optional] Clobber the F# SDK on the machine +``` +VSIXInstaller.exe /u:"VisualFSharp" +VSIXInstaller.exe artifacts\VSSetup\Release\VisualFSharpFull.vsix +``` -**Note:** The step below will try to clobber the machine-wide installed F# SDK on your machine. This replaces the ``fsc.exe`` used by the standard install location or ``Microsoft.FSharp.Targets``. **Repairing Visual Studio 16 is currently the only way to revert this step.** +It's important to use `Release` if you want to see if your changes have had a noticable performance impact. -For **Debug**: +### Performance and debugging - vsintegration\update-vsintegration.cmd debug +Use the `Debug` configuration to test your changes locally. It is the default. Do not use the `Release` configuration! Local development and testing of Visual Studio tooling is not designed for the `Release` configuration. -For **Release**: +### Troubleshooting a failed build of the tools - vsintegration\update-vsintegration.cmd release +You may run into an issue with a somewhat difficult or cryptic error message, like: -## Debugging the F# Compiler - -See the "Debugging The Compiler" section of this [article](https://medium.com/@willie.tetlow/f-mentorship-week-1-36f51d3812d4) - -## Notes - -### Windows: Links to Additional frameworks +> error VSSDK1077: Unable to locate the extensions directory. "ExternalSettingsManager::GetScopePaths failed to initialize PkgDefManager for C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe". -- [Git for windows](https://gitforwindows.org/) -- [.NET 4.6](https://www.microsoft.com/en-us/download/details.aspx?id=48137) -- [Windows 8.1 SDK](https://msdn.microsoft.com/en-us/library/windows/desktop/bg162891.aspx) -- [Windows 10 SDK](https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk) +Or hard crash on launch ("Unknown Error"). -### Notes on the Windows .NET Framework build +To fix this, delete these folders: -1. The `update.cmd` script adds required strong name validation skips and NGens the compiler and libraries. This requires admin privileges. -1. The compiler binaries produced are "private" and strong-named signed with a test key. -1. Some additional tools are required to build the compiler, notably `fslex.exe`, `fsyacc.exe`, `FSharp.PowerPack.Build.Tasks.dll`, `FsSrGen.exe`, `FSharp.SRGen.Build.Tasks.dll`, and the other tools found in the `lkg` directory. -1. The overall bootstrapping process executes as follows - - We first need an existing F# compiler. We use the one in the `lkg` directory. Let's assume this compiler has an `FSharp.Core.dll` with version X. - - We use this compiler to compile the source in this distribution, to produce a "proto" compiler, dropped to the `proto` directory. When run, this compiler still relies on `FSharp.Core.dll` with version X. - - We use the proto compiler to compile the source for `FSharp.Core.dll` in this distribution. - - We use the proto compiler to compile the source for `FSharp.Compiler.dll`, `fsc.exe`, `fsi.exe`, and other binaries found in this distribution. +- `%localappdata%\Microsoft\VisualStudio\_(some number here)RoslynDev` +- `%localappdata%\Microsoft\VisualStudio\_(some number here)` -### Updating FSComp.fs, FSComp.resx and XLF +Where `` corresponds to the latest Visual Studio version on your machine. -If your changes involve modifying the list of language keywords in any way, (e.g. when implementing a new keyword), the XLF localization files need to be synced with the corresponding resx files. This can be done automatically by running +## Additional resources - pushd src\fsharp\FSharp.Compiler.Private - msbuild FSharp.Compiler.Private.fsproj /t:UpdateXlf - popd +The primary technical guide to the core compiler code is [The F# Compiler Technical Guide](https://fsharp.github.io/2015/09/29/fsharp-compiler-guide.html). Please read and contribute to that guide. -This only works on Windows/.NETStandard framework, so changing this from any other platform requires editing and syncing all of the XLF files manually. +See the "Debugging The Compiler" section of this [article](https://medium.com/@willie.tetlow/f-mentorship-week-1-36f51d3812d4) for some examples. -### Configuring proxy server +## Addendum: configuring a proxy server If you are behind a proxy server, NuGet client tool must be configured to use it: - .nuget\nuget.exe config -set http_proxy=proxy.domain.com:8080 -ConfigFile NuGet.Config - .nuget\nuget.exe config -set http_proxy.user=user_name -ConfigFile NuGet.Config - .nuget\nuget.exe config -set http_proxy.password=user_password -ConfigFile NuGet.Config - +``` +.nuget\nuget.exe config -set http_proxy=proxy.domain.com:8080 -ConfigFile NuGet.Config +.nuget\nuget.exe config -set http_proxy.user=user_name -ConfigFile NuGet.Config +.nuget\nuget.exe config -set http_proxy.password=user_password -ConfigFile NuGet.Config +``` Where you should set proper proxy address, user name and password. - -### Resources - -The primary technical guide to the core compiler code is [The F# Compiler Technical Guide](https://fsharp.github.io/2015/09/29/fsharp-compiler-guide.html). Please read and contribute to that guide. From f878da69b9c3c776106a84b8da8d0e61bb875439 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2019 09:02:19 -0700 Subject: [PATCH 128/286] Update dependencies from https://github.com/dotnet/arcade build 20190701.4 (#7098) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19351.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b7f5189a27..a9bfa2cb00 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 89fab80685c91024c8f9e21f1c37f62580f648f8 + 1fb1e240c889cd7f6e10cb1eacd129efa3ddb4b4 diff --git a/global.json b/global.json index 7623ed03b7..e225ab15dd 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19330.1", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19351.4", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 8b66074dfc74d12623d4858cbfcbde9b087c31bb Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Wed, 3 Jul 2019 12:00:36 -0700 Subject: [PATCH 129/286] Improve diagnostics and disable flakey test (#7113) --- FSharpTests.Directory.Build.props | 4 ++++ .../Microsoft.FSharp.Control/AsyncModule.fs | 16 +++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index 8a7a832a43..37da8b1593 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -16,6 +16,10 @@ + + ($(DefineConstants);TESTING_ON_LINUX + + true diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs index 9154bd875d..b525469322 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs @@ -168,8 +168,8 @@ type AsyncModule() = let dispose(d : #IDisposable) = d.Dispose() - let testErrorAndCancelRace computation = - for _ in 1..20 do + let testErrorAndCancelRace testCaseName computation = + for i in 1..20 do let cts = new System.Threading.CancellationTokenSource() use barrier = new System.Threading.ManualResetEvent(false) async { cts.Cancel() } @@ -180,7 +180,7 @@ type AsyncModule() = Async.StartWithContinuations( computation, - (fun _ -> failwith "success not expected"), + (fun _ -> failwith (sprintf "Testcase: %s --- success not expected iterations 1 .. 20 - failed on iteration %d" testCaseName i)), (fun _ -> incr()), (fun _ -> incr()), cts.Token @@ -427,12 +427,11 @@ type AsyncModule() = member this.``RaceBetweenCancellationAndError.AwaitWaitHandle``() = let disposedEvent = new System.Threading.ManualResetEvent(false) dispose disposedEvent - - testErrorAndCancelRace(Async.AwaitWaitHandle disposedEvent) + testErrorAndCancelRace "RaceBetweenCancellationAndError.AwaitWaitHandle" (Async.AwaitWaitHandle disposedEvent) [] member this.``RaceBetweenCancellationAndError.Sleep``() = - testErrorAndCancelRace (Async.Sleep (-5)) + testErrorAndCancelRace "RaceBetweenCancellationAndError.Sleep" (Async.Sleep (-5)) #if EXPENSIVE #if NET46 @@ -663,11 +662,14 @@ type AsyncModule() = Assert.AreEqual("maxDegreeOfParallelism", exc.ParamName) Assert.True(exc.Message.Contains("maxDegreeOfParallelism must be positive, was -1")) +// This has been failing very regularly on LINUX --- issue : https://github.com/dotnet/fsharp/issues/7112 +#if !TESTING_ON_LINUX [] member this.``RaceBetweenCancellationAndError.Parallel``() = [| for i in 1 .. 1000 -> async { return i } |] |> fun cs -> Async.Parallel(cs, 1) - |> testErrorAndCancelRace + |> testErrorAndCancelRace "RaceBetweenCancellationAndError.Parallel" +#endif [] member this.``error on one workflow should cancel all others with maxDegreeOfParallelism``() = From ab2e8fac8c9cda73a07cfe0384fd036d37d06038 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2019 12:01:24 -0700 Subject: [PATCH 130/286] Update dependencies from https://github.com/dotnet/arcade build 20190702.7 (#7107) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19352.7 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a9bfa2cb00..810004aa4d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 1fb1e240c889cd7f6e10cb1eacd129efa3ddb4b4 + b8c190d95371e658d95a5731f4778bd3da2fa42d diff --git a/global.json b/global.json index e225ab15dd..53d05811a7 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19351.4", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19352.7", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From be8273640250d6b09b8ab2301d89629e5bf1b521 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Wed, 3 Jul 2019 22:27:09 +0200 Subject: [PATCH 131/286] Allow to set PreferredUILang from tests (#7102) --- src/fsharp/service/Reactor.fs | 13 ++++++++++++- src/fsharp/service/Reactor.fsi | 3 +++ src/fsharp/service/service.fs | 2 ++ tests/fsharp/Compiler/CompilerAssert.fs | 4 ++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/fsharp/service/Reactor.fs b/src/fsharp/service/Reactor.fs index bae570d0c5..cc2a6af844 100755 --- a/src/fsharp/service/Reactor.fs +++ b/src/fsharp/service/Reactor.fs @@ -35,7 +35,7 @@ type Reactor() = // We need to store the culture for the VS thread that is executing now, // so that when the reactor picks up a thread from the threadpool we can set the culture - let culture = new CultureInfo(CultureInfo.CurrentUICulture.Name) + let mutable culture = CultureInfo(CultureInfo.CurrentUICulture.Name) let mutable bgOpCts = new CancellationTokenSource() /// Mailbox dispatch function. @@ -135,6 +135,17 @@ type Reactor() = Debug.Assert(false, String.Format("unexpected failure in reactor loop {0}, restarting", e)) } + member __.SetPreferredUILang(preferredUiLang: string option) = + match preferredUiLang with + | Some s -> + culture <- CultureInfo s +#if FX_RESHAPED_GLOBALIZATION + CultureInfo.CurrentUICulture <- culture +#else + Thread.CurrentThread.CurrentUICulture <- culture +#endif + | None -> () + // [Foreground Mailbox Accessors] ----------------------------------------------------------- member r.SetBackgroundOp(bgOpOpt) = Trace.TraceInformation("Reactor: {0:n3} enqueue start background, length {1}", DateTime.Now.TimeOfDay.TotalSeconds, builder.CurrentQueueLength) diff --git a/src/fsharp/service/Reactor.fsi b/src/fsharp/service/Reactor.fsi index 5ea9572f48..3040ca65ee 100755 --- a/src/fsharp/service/Reactor.fsi +++ b/src/fsharp/service/Reactor.fsi @@ -23,6 +23,9 @@ type internal IReactorOperations = [] type internal Reactor = + /// Allows to specify the language for error messages + member SetPreferredUILang : string option -> unit + /// Set the background building function, which is called repeatedly /// until it returns 'false'. If None then no background operation is used. member SetBackgroundOp : ( (* userOpName:*) string * (* opName: *) string * (* opArg: *) string * (CompilationThreadToken -> CancellationToken -> bool)) option -> unit diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index cc7d11b9f9..5c4bce54d3 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -518,6 +518,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC keepAssemblyContents, suggestNamesForErrors) let parsingOptions = FSharpParsingOptions.FromTcConfig(tcPrior.TcConfig, Array.ofList builder.SourceFiles, options.UseScriptResolutionRules) + reactor.SetPreferredUILang tcPrior.TcConfig.preferredUiLang bc.RecordTypeCheckFileInProjectResults(fileName, options, parsingOptions, parseResults, fileVersion, tcPrior.TimeStamp, Some checkAnswer, sourceText.GetHashCode()) return checkAnswer finally @@ -635,6 +636,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC // Do the parsing. let parsingOptions = FSharpParsingOptions.FromTcConfig(builder.TcConfig, Array.ofList (builder.SourceFiles), options.UseScriptResolutionRules) + reactor.SetPreferredUILang tcPrior.TcConfig.preferredUiLang let parseErrors, parseTreeOpt, anyErrors = ParseAndCheckFile.parseFile (sourceText, filename, parsingOptions, userOpName, suggestNamesForErrors) let parseResults = FSharpParseFileResults(parseErrors, parseTreeOpt, anyErrors, builder.AllDependenciesDeprecated) let! checkResults = bc.CheckOneFileImpl(parseResults, sourceText, filename, options, textSnapshotInfo, fileVersion, builder, tcPrior, creationErrors, userOpName) diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index 37946c4087..6a43e562ea 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -25,7 +25,7 @@ module CompilerAssert = ProjectId = None SourceFiles = [|"test.fs"|] #if !NETCOREAPP - OtherOptions = [||] + OtherOptions = [|"--preferreduilang:en-US";|] #else OtherOptions = // Hack: Currently a hack to get the runtime assemblies for netcore in order to compile. @@ -36,7 +36,7 @@ module CompilerAssert = |> Seq.toArray |> Array.filter (fun x -> x.ToLowerInvariant().Contains("system.")) |> Array.map (fun x -> sprintf "-r:%s" x) - Array.append [|"--targetprofile:netcore"; "--noframework"|] assemblies + Array.append [|"--preferreduilang:en-US"; "--targetprofile:netcore"; "--noframework"|] assemblies #endif ReferencedProjects = [||] IsIncompleteTypeCheckEnvironment = false From 1b6cf9f3175701e7e69bee55288c955d4def57a2 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Wed, 3 Jul 2019 15:05:14 -0700 Subject: [PATCH 132/286] Apparently the unit test dll's don't use fsharptest.directory.props (#7115) --- FSharpBuild.Directory.Build.props | 4 ++++ FSharpTests.Directory.Build.props | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index 515de9bbdc..f342ca6fe6 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -93,6 +93,10 @@ true + + $(DefineConstants);TESTING_ON_LINUX + + $(ProtoOutputPath)\fsc\Microsoft.FSharp.Targets diff --git a/FSharpTests.Directory.Build.props b/FSharpTests.Directory.Build.props index 37da8b1593..8a7a832a43 100644 --- a/FSharpTests.Directory.Build.props +++ b/FSharpTests.Directory.Build.props @@ -16,10 +16,6 @@ - - ($(DefineConstants);TESTING_ON_LINUX - - true From 383d316c0e80a59ee71140f0faa08b06502d0f6e Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Wed, 3 Jul 2019 13:13:07 -0700 Subject: [PATCH 133/286] versioning tests --- .../FSharp.Core.UnitTests.fsproj | 1 - .../Microsoft.FSharp.Core/NameOfTests.fs | 295 ---------------- tests/fsharp/core/nameof/testcases.fsx | 332 ++++++++++++++++++ tests/fsharp/core/nameof/version46/test.fsx | 77 ++++ tests/fsharp/core/nameof/version47/test.fsx | 26 ++ tests/fsharp/tests.fs | 17 + 6 files changed, 452 insertions(+), 296 deletions(-) delete mode 100644 tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs create mode 100644 tests/fsharp/core/nameof/testcases.fsx create mode 100644 tests/fsharp/core/nameof/version46/test.fsx create mode 100644 tests/fsharp/core/nameof/version47/test.fsx diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj index 2fd3442f3f..1b67bfe2e6 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj +++ b/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj @@ -66,7 +66,6 @@ - diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs deleted file mode 100644 index 32decc4910..0000000000 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Core/NameOfTests.fs +++ /dev/null @@ -1,295 +0,0 @@ -// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace FSharp.Core.Unittests -open System -open NUnit.Framework - -exception ABC - -type BasicNameOfTests() = - let localConstant = 23 - member this.MemberMethod() = 0 - member this.MemberProperty = this.MemberMethod() - static member StaticMethod() = 0 - static member StaticProperty = BasicNameOfTests.StaticMethod() - - [] - member this.``local variable name lookup`` () = - let a = 0 - let result = nameof a - Assert.AreEqual("a",result) - Assert.AreEqual("result",nameof result) - - [] - member this.``local int function name`` () = - let myFunction x = 0 * x - let b = nameof myFunction - Assert.AreEqual("myFunction",b) - - [] - member this.``local curried function name`` () = - let curriedFunction x y = x * y - let b = nameof curriedFunction - Assert.AreEqual("curriedFunction",b) - - [] - member this.``local tupled function name`` () = - let tupledFunction(x,y) = x * y - let b = nameof tupledFunction - Assert.AreEqual("tupledFunction",b) - - [] - member this.``local unit function name`` () = - let myFunction() = 1 - let b = nameof(myFunction) - Assert.AreEqual("myFunction",b) - - [] - member this.``local function parameter name`` () = - let myFunction parameter1 = nameof parameter1 - - Assert.AreEqual("parameter1",myFunction "x") - - [] - member this.``can get name from inside a local function (needs to be let rec)`` () = - let rec myLocalFunction x = - let z = 2 * x - nameof myLocalFunction + " " + z.ToString() - - Assert.AreEqual("myLocalFunction 46",myLocalFunction 23) - Assert.AreEqual("myLocalFunction 50",myLocalFunction 25) - - [] - member this.CanGetNameFromInsideAMember () = - let b = nameof(this.CanGetNameFromInsideAMember) - Assert.AreEqual("CanGetNameFromInsideAMember",b) - - [] - member this.``member function name`` () = - let b = nameof(this.MemberMethod) - Assert.AreEqual("MemberMethod",b) - - [] - member this.``namespace name`` () = - let b = nameof(FSharp.Core) - Assert.AreEqual("Core",b) - - [] - member this.``module name`` () = - let b = nameof(FSharp.Core.Operators) - Assert.AreEqual("Operators",b) - - [] - member this.``exception name`` () = - let b = nameof(ABC) - Assert.AreEqual("ABC",b) - - [] - member this.``nested type name 1`` () = - let b = nameof(System.Collections.Generic.List.Enumerator<_>) - Assert.AreEqual("Enumerator",b) - - [] - member this.``type name 2`` () = - let b = nameof(System.Action<_>) - Assert.AreEqual("Action",b) - - [] - member this.``member function which is defined below`` () = - let b = nameof(this.MemberMethodDefinedBelow) - Assert.AreEqual("MemberMethodDefinedBelow",b) - - member this.MemberMethodDefinedBelow(x,y) = x * y - - [] - member this.``static member function name`` () = - let b = nameof(BasicNameOfTests.StaticMethod) - Assert.AreEqual("StaticMethod",b) - - [] - member this.``class member lookup`` () = - let b = nameof(localConstant) - Assert.AreEqual("localConstant",b) - - [] - member this.``member property name`` () = - let b = nameof(this.MemberProperty) - Assert.AreEqual("MemberProperty",b) - - [] - member this.``static property name`` () = - let b = nameof(BasicNameOfTests.StaticProperty) - Assert.AreEqual("StaticProperty",b) - - member this.get_XYZ() = 1 - - [] - member this.``member method starting with get_`` () = - let b = nameof(this.get_XYZ) - Assert.AreEqual("get_XYZ",b) - - static member get_SXYZ() = 1 - - [] - member this.``static method starting with get_`` () = - let b = nameof(BasicNameOfTests.get_SXYZ) - Assert.AreEqual("get_SXYZ",b) - - [] - member this.``nameof local property with encapsulated name`` () = - let ``local property with encapsulated name and %.f`` = 0 - let b = nameof(``local property with encapsulated name and %.f``) - Assert.AreEqual("local property with encapsulated name and %.f",b) - -[] -type MethodGroupNameOfTests() = - member this.MethodGroup() = () - member this.MethodGroup(i:int) = () - - member this.MethodGroup1(i:int, f:float, s:string) = 0 - member this.MethodGroup1(f:float, l:int64) = "foo" - member this.MethodGroup1(u:unit -> unit -> int, h: unit) : unit = () - - [] - member this.``single argument method group name lookup`` () = - let b = nameof(this.MethodGroup) - Assert.AreEqual("MethodGroup",b) - - [] - member this.``multiple argument method group name lookup`` () = - let b = nameof(this.MethodGroup1 : (float * int64 -> _)) - Assert.AreEqual("MethodGroup1",b) - -[] -type FrameworkMethodTests() = - [] - member this.``library function name`` () = - let b = nameof(List.map) - Assert.AreEqual("map",b) - - [] - member this.``static class function name`` () = - let b = nameof(System.Tuple.Create) - Assert.AreEqual("Create",b) - -type CustomUnionType = - | OptionA - | OptionB of int * string - -type CustomRecordType = - { X: int; Y: int } - -[] type Milliquacks - -[] -type UnionAndRecordNameOfTests() = - - [] - member this.``measure 1`` () = - let b = nameof(Milliquacks) - Assert.AreEqual("Milliquacks",b) - - [] - member this.``record case 1`` () = - let sample = Unchecked.defaultof - let b = nameof(sample.X) - Assert.AreEqual("X",b) - let b = nameof(sample.Y) - Assert.AreEqual("Y",b) - - [] - member this.``union case 1`` () = - let b = nameof(OptionA) - Assert.AreEqual("OptionA",b) - - [] - member this.``union case 2`` () = - let b = nameof(OptionB) - Assert.AreEqual("OptionB",b) - -[] -type AttributeNameOfTests() = - - [] - member this.``ok in attribute`` () = - let t = typeof.GetMethod("ok in attribute") - let attrs = t.GetCustomAttributes(typeof, false) - let attr = attrs.[0] :?> ObsoleteAttribute - Assert.AreEqual(attr.Message, "test string") - -[] -type OperatorNameOfTests() = - - [] - member this.``lookup name of typeof operator`` () = - let b = nameof(typeof) - Assert.AreEqual("typeof",b) - - [] - member this.``lookup name of + operator`` () = - let b = nameof(+) - Assert.AreEqual("op_Addition",b) - - [] - member this.``lookup name of |> operator`` () = - let a = nameof(|>) - Assert.AreEqual("op_PipeRight",a) - let b = nameof(op_PipeRight) - Assert.AreEqual("op_PipeRight",b) - - [] - member this.``lookup name of nameof operator`` () = - let b = nameof(nameof) - Assert.AreEqual("nameof",b) - -[] -type PatternMatchingOfOperatorNameTests() = - member this.Method1(i:int) = () - - [] - member this.``use it as a match case guard`` () = - match "Method1" with - | x when x = nameof(this.Method1) -> () - | _ -> Assert.Fail("not expected") - -[] -type NameOfOperatorInQuotations() = - [] - member this.``use it in a quotation`` () = - let q = - <@ - let f(x:int) = nameof x - f 20 - @> - () - -[] -type NameOfOperatorForGenerics() = - [] - member this.``use it in a generic function`` () = - let fullyGeneric x = x - let b = nameof(fullyGeneric) - Assert.AreEqual("fullyGeneric",b) - - [] - member this.``lookup name of a generic class`` () = - let b = nameof System.Collections.Generic.List - Assert.AreEqual("List",b) - -[] -type UserDefinedNameOfTests() = - [] - member this.``userdefined nameof should shadow the operator`` () = - let nameof x = "test" + x.ToString() - - let y = nameof 1 - Assert.AreEqual("test1",y) - -type Person = - { Name : string - Age : int } - member __.Update(fld : string, value : obj) = - match fld with - | x when x = nameof __.Name -> { __ with Name = string value } - | x when x = nameof __.Age -> { __ with Age = value :?> int } - | _ -> __ diff --git a/tests/fsharp/core/nameof/testcases.fsx b/tests/fsharp/core/nameof/testcases.fsx new file mode 100644 index 0000000000..62f9a0d2a0 --- /dev/null +++ b/tests/fsharp/core/nameof/testcases.fsx @@ -0,0 +1,332 @@ +module TestSuite_FSharpCore_nameof + +#nowarn "44" + +open System + +exception ABC + +type Assert = + static member AreEqual (a, b) = a=b + static member Fail = raise (Exception("Fail")) + +let failures = ref [] + +let report_failure (s : string) = + failures := !failures @ [s] + +let test (s : string) b = + if b then stderr.Write " Success " + else + stderr.Write " Failed " + report_failure (s) + stderr.WriteLine(s) + +let check s b1 b2 = test s (b1 = b2) + +type BasicNameOfTests() = + + static let staticConstant = 23 + let localConstant = 23 + + member this.MemberMethod() = 0 + member this.MemberProperty = this.MemberMethod() + + member this.``member method``() = 0 + member this.``member property`` = this.``member method``() + + static member StaticMethod() = 0 + static member StaticProperty = BasicNameOfTests.StaticMethod() + + static member ``static method``() = 0 + static member ``static property`` = BasicNameOfTests.``static method``() + + static member ``local variable name lookup`` () = + let a = 0 + let b = nameof a + let result = Assert.AreEqual("a", b) + let c = nameof b + result || Assert.AreEqual("b", c) + + static member ``local int function name`` () = + let myFunction x = 0 * x + let result = nameof myFunction + Assert.AreEqual("myFunction", result) + + static member ``local curried function name`` () = + let curriedFunction x y = x * y + let result = nameof curriedFunction + Assert.AreEqual("curriedFunction", result) + + static member ``local tupled function name`` () = + let tupledFunction(x,y) = x * y + let result = nameof tupledFunction + Assert.AreEqual("tupledFunction", result) + + static member ``local unit function name`` () = + let myFunction() = 1 + let result = nameof(myFunction) + Assert.AreEqual("myFunction", result) + + static member ``local function parameter name`` () = + let myFunction parameter1 = nameof parameter1 + let result = myFunction "x" + Assert.AreEqual("parameter1", result) + + static member ``can get name from inside a local function (needs to be let rec)`` () = + let rec myLocalFunction x = + let z = 2 * x + nameof myLocalFunction + " " + z.ToString() + + let a = myLocalFunction 23 + let result = Assert.AreEqual("myLocalFunction 46", a) + + let b = myLocalFunction 25 + result || Assert.AreEqual("myLocalFunction 50", b) + + static member ``can get name from inside static member`` () = + let b = nameof(BasicNameOfTests.``can get name from inside static member``) + Assert.AreEqual("can get name from inside static member", b) + + member this.``can get name from inside instance member`` () = + let b = nameof(this.``can get name from inside instance member``) + Assert.AreEqual("can get name from inside instance member", b) + + static member ``can get name of static member`` () = + let b = nameof(BasicNameOfTests.``can get name of static member``) + Assert.AreEqual("can get name of static member", b) + + member this.``can get name of instance member`` () = + let b = nameof(this.MemberMethod) + Assert.AreEqual("MemberMethod", b) + + static member ``namespace name`` () = + let b = nameof(FSharp.Core) + Assert.AreEqual("Core",b) + + static member ``module name`` () = + let b = nameof(FSharp.Core.Operators) + Assert.AreEqual("Operators",b) + + static member ``exception name`` () = + let b = nameof(ABC) + Assert.AreEqual("ABC",b) + + static member ``nested type name 1`` () = + let b = nameof(System.Collections.Generic.List.Enumerator<_>) + Assert.AreEqual("Enumerator",b) + + static member ``type name 2`` () = + let b = nameof(System.Action<_>) + Assert.AreEqual("Action",b) + + static member ``member function which is defined below`` () = + let x = BasicNameOfTests() + let b = nameof(x.MemberMethodDefinedBelow) + Assert.AreEqual("MemberMethodDefinedBelow",b) + + member this.MemberMethodDefinedBelow(x,y) = x * y + + static member ``static member function name`` () = + let b = nameof(BasicNameOfTests.StaticMethod) + Assert.AreEqual("StaticMethod",b) + + member this.``class member lookup`` () = + let b = nameof(localConstant) + Assert.AreEqual("localConstant",b) + + static member ``static property name`` () = + let b = nameof(BasicNameOfTests.StaticProperty) + Assert.AreEqual("StaticProperty",b) + + member this.get_XYZ() = 1 + + static member ``member method starting with get_`` () = + let x = BasicNameOfTests() + let b = nameof(x.get_XYZ) + Assert.AreEqual("get_XYZ",b) + + static member get_SXYZ() = 1 + + static member ``static method starting with get_`` () = + let b = nameof(BasicNameOfTests.get_SXYZ) + Assert.AreEqual("get_SXYZ",b) + + static member ``nameof local property with encapsulated name`` () = + let ``local property with encapsulated name and %.f`` = 0 + let b = nameof(``local property with encapsulated name and %.f``) + Assert.AreEqual("local property with encapsulated name and %.f",b) + +type MethodGroupNameOfTests() = + member this.MethodGroup() = () + member this.MethodGroup(i:int) = () + + member this.MethodGroup1(i:int, f:float, s:string) = 0 + member this.MethodGroup1(f:float, l:int64) = "foo" + member this.MethodGroup1(u:unit -> unit -> int, h: unit) : unit = () + + member this.``single argument method group name lookup`` () = + let b = nameof(this.MethodGroup) + Assert.AreEqual("MethodGroup",b) + + member this.``multiple argument method group name lookup`` () = + let b = nameof(this.MethodGroup1 : (float * int64 -> _)) + Assert.AreEqual("MethodGroup1",b) + +type FrameworkMethodTests() = + member this.``library function name`` () = + let b = nameof(List.map) + Assert.AreEqual("map",b) + + member this.``static class function name`` () = + let b = nameof(System.Tuple.Create) + Assert.AreEqual("Create",b) + +type CustomUnionType = + | OptionA + | OptionB of int * string + +type CustomRecordType = + { X: int; Y: int } + +[] type Milliquacks + +type UnionAndRecordNameOfTests() = + + member this.``measure 1`` () = + let b = nameof(Milliquacks) + Assert.AreEqual("Milliquacks",b) + + member this.``record case 1`` () = + let sample = Unchecked.defaultof + let b = nameof(sample.X) + let result = Assert.AreEqual("X",b) + let b = nameof(sample.Y) + result || Assert.AreEqual("Y",b) + + member this.``union case 1`` () = + let b = nameof(OptionA) + Assert.AreEqual("OptionA",b) + + member this.``union case 2`` () = + let b = nameof(OptionB) + Assert.AreEqual("OptionB",b) + +type AttributeNameOfTests() = + + [] + member this.``ok in attribute`` () = + let t = typeof.GetMethod("ok in attribute") + let attrs = t.GetCustomAttributes(typeof, false) + let attr = attrs.[0] :?> ObsoleteAttribute + Assert.AreEqual(attr.Message, "test string") + +type OperatorNameOfTests() = + + member this.``lookup name of typeof operator`` () = + let b = nameof(typeof) + Assert.AreEqual("typeof",b) + + member this.``lookup name of + operator`` () = + let b = nameof(+) + Assert.AreEqual("op_Addition",b) + + member this.``lookup name of |> operator`` () = + let a = nameof(|>) + let result = Assert.AreEqual("op_PipeRight",a) + let b = nameof(op_PipeRight) + result || Assert.AreEqual("op_PipeRight",b) + + member this.``lookup name of nameof operator`` () = + let b = nameof(nameof) + Assert.AreEqual("nameof",b) + +type PatternMatchingOfOperatorNameTests() = + member this.Method1(i:int) = () + + member this.``use it as a match case guard`` () = + match "Method1" with + | x when x = nameof(this.Method1) -> true + | _ -> false + +type NameOfOperatorInQuotations() = + member this.``use it in a quotation`` () = + let q = + <@ + let f(x:int) = nameof x + f 20 + @> + true + +type NameOfOperatorForGenerics() = + member this.``use it in a generic function`` () = + let fullyGeneric x = x + let b = nameof(fullyGeneric) + Assert.AreEqual("fullyGeneric",b) + + member this.``lookup name of a generic class`` () = + let b = nameof System.Collections.Generic.List + Assert.AreEqual("List",b) + +type UserDefinedNameOfTests() = + static member ``user defined nameof should shadow the operator`` () = + let nameof x = "test" + x.ToString() + let y = nameof 1 + Assert.AreEqual("test1",y) + +type Person = + { Name : string + Age : int } + member __.Update(fld : string, value : obj) = + match fld with + | x when x = nameof __.Name -> { __ with Name = string value } + | x when x = nameof __.Age -> { __ with Age = value :?> int } + | _ -> __ + +do test "local variable name lookup" (BasicNameOfTests.``local variable name lookup`` ()) +do test "local int function name" (BasicNameOfTests.``local int function name`` ()) +do test "local curried function name" (BasicNameOfTests.``local curried function name`` ()) +do test "local tupled function name" (BasicNameOfTests.``local tupled function name`` ()) +do test "local unit function name" (BasicNameOfTests.``local unit function name`` ()) +do test "local function parameter name" (BasicNameOfTests.``local function parameter name`` ()) +do test "can get name from inside a local function (needs to be let rec)" + (BasicNameOfTests.``can get name from inside a local function (needs to be let rec)`` ()) +do test "can get name from inside static member" (BasicNameOfTests.``can get name from inside static member`` ()) +do test "can get name from inside instance member" ((BasicNameOfTests()).``can get name from inside instance member`` ()) +do test "can get name of instance member" ((BasicNameOfTests()).``can get name of instance member`` ()) +do test "namespace name" (BasicNameOfTests.``namespace name`` ()) +do test "module name" (BasicNameOfTests.``module name`` ()) +do test "exception name" (BasicNameOfTests.``exception name`` ()) +do test "nested type name 1" (BasicNameOfTests.``nested type name 1`` ()) +do test "type name 2" (BasicNameOfTests.``type name 2`` ()) +do test "member function which is defined below" (BasicNameOfTests.``member function which is defined below`` ()) +do test "class member lookup" ((BasicNameOfTests()).``class member lookup`` ()) +do test "static member function name" (BasicNameOfTests.``static member function name`` ()) +do test "static property name" (BasicNameOfTests.``static property name`` ()) +do test "member method starting with get_" (BasicNameOfTests.``member method starting with get_`` ()) +do test "static method starting with get_" (BasicNameOfTests.``static method starting with get_`` ()) +do test "nameof local property with encapsulated name" (BasicNameOfTests.``nameof local property with encapsulated name`` ()) + +do test "single argument method group name lookup" ((MethodGroupNameOfTests()).``single argument method group name lookup`` ()) +do test "multiple argument method group name lookup" ((MethodGroupNameOfTests()).``multiple argument method group name lookup`` ()) + +do test "measure 1" ((UnionAndRecordNameOfTests()).``measure 1`` ()) +do test "record case 1" ((UnionAndRecordNameOfTests()).``record case 1`` ()) +do test "union case 1" ((UnionAndRecordNameOfTests()).``union case 1`` ()) +do test "union case 2" ((UnionAndRecordNameOfTests()).``union case 2`` ()) + +do test "ok in attribute" ((AttributeNameOfTests()).``ok in attribute`` ()) + +do test "lookup name of typeof operator" ((OperatorNameOfTests()).``lookup name of typeof operator`` ()) +do test "lookup name of + operator" ((OperatorNameOfTests()).``lookup name of + operator`` ()) +do test "lookup name of |> operator" ((OperatorNameOfTests()).``lookup name of |> operator`` ()) +do test "lookup name of nameof operator" ((OperatorNameOfTests()).``lookup name of nameof operator`` ()) + +do test "use it as a match case guard" ((PatternMatchingOfOperatorNameTests()).``use it as a match case guard`` ()) + +do test "se it in a quotation" ((NameOfOperatorInQuotations()).``use it in a quotation`` ()) + +do test "use it in a generic function" ((NameOfOperatorForGenerics()).``use it in a generic function`` ()) +do test "lookup name of a generic class" ((NameOfOperatorForGenerics()).``lookup name of a generic class`` ()) + +do test "user defined nameof should shadow the operator"(UserDefinedNameOfTests.``user defined nameof should shadow the operator`` ()) diff --git a/tests/fsharp/core/nameof/version46/test.fsx b/tests/fsharp/core/nameof/version46/test.fsx new file mode 100644 index 0000000000..eed31c2c75 --- /dev/null +++ b/tests/fsharp/core/nameof/version46/test.fsx @@ -0,0 +1,77 @@ +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//This is not a valid constant expression or custom attribute value +//This is not a valid constant expression or custom attribute value +//The value or constructor 'nameof' is not defined. +//This is not a valid constant expression or custom attribute value +//This is not a valid constant expression or custom attribute value +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +#if TESTS_AS_APP +module TestSuite_FSharpCore_nameof_46 +#endif + +// +#load @"..\testcases.fsx" +open TestSuite_FSharpCore_nameof + +#if TESTS_AS_APP +let RUN() = + match !failures with + | [] -> stdout.WriteLine "Test Passed" + | _ -> stdout.WriteLine "Test Failed" +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif + diff --git a/tests/fsharp/core/nameof/version47/test.fsx b/tests/fsharp/core/nameof/version47/test.fsx new file mode 100644 index 0000000000..ab93ec255c --- /dev/null +++ b/tests/fsharp/core/nameof/version47/test.fsx @@ -0,0 +1,26 @@ +// +#if TESTS_AS_APP +module TestSuite_FSharpCore_nameof_47 +#endif + +// +#load @"..\testcases.fsx" +open TestSuite_FSharpCore_nameof + +#if TESTS_AS_APP +let RUN() = + match !failures with + | [] -> stdout.WriteLine "Test Passed" + | _ -> stdout.WriteLine "Test Failed" +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif + diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index cd9a7c8b68..a38a8eeb15 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -29,6 +29,7 @@ let FSI_BASIC = FSI_FILE #endif // ^^^^^^^^^^^^ To run these tests in F# Interactive , 'build net40', then send this chunk, then evaluate body of a test ^^^^^^^^^^^^ +#if KEVIN //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ module CoreTests = // These tests are enabled for .NET Framework and .NET Core [] @@ -1803,6 +1804,7 @@ module CoreTests = peverifyWithArgs cfg "/nologo" "xmlverify.exe" #endif +#endif //@@@@@@@@@@@@@@@@@ module VersionTests = [] @@ -1817,6 +1819,20 @@ module VersionTests = [] let ``indent-version4.7``() = singleTestBuildAndRunVersion "core/indent/version47" FSC_BUILDONLY "preview" + [] + let ``nameof-version4.6``() = singleTestBuildAndRunVersion "core/nameof/version46" FSC_BUILDONLY "4.6" + + [] + let ``nameof-version4.7``() = singleTestBuildAndRunVersion "core/nameof/version47" FSC_BUILDONLY "preview" + + [] + let ``nameof-execute``() = singleTestBuildAndRunVersion "core/nameof/version47" FSC_BASIC "preview" + + [] + let ``nameof-fsi``() = singleTestBuildAndRunVersion "core/nameof/version47" FSI_BASIC "preview" + +#if KEVIN //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS module ToolsTests = @@ -2881,3 +2897,4 @@ module OverloadResolution = let [] ``Conformance\InferenceProcedures\WellFormednessChecking (E_Clashing_Values_in_AbstractClass03.fs) `` () = singleNegTest (testConfig "conformance/wellformedness") "E_Clashing_Values_in_AbstractClass03" let [] ``Conformance\InferenceProcedures\WellFormednessChecking (E_Clashing_Values_in_AbstractClass04.fs) `` () = singleNegTest (testConfig "conformance/wellformedness") "E_Clashing_Values_in_AbstractClass04" #endif +#endif //@@@@@@@@@@@@@@@@@@@@ \ No newline at end of file From 98e4893cab1581ad9cf0c4de95937ebf51d39d82 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Thu, 4 Jul 2019 00:05:32 -0700 Subject: [PATCH 134/286] Add langversion support for nameof --- src/fsharp/CompileOps.fs | 2 +- src/fsharp/LanguageFeatures.fs | 4 ++-- src/fsharp/LanguageFeatures.fsi | 1 + src/fsharp/NameResolution.fs | 11 ++++++++++- src/fsharp/TastOps.fs | 9 +++++---- src/fsharp/TcGlobals.fs | 8 +++++--- src/fsharp/TypeChecker.fs | 5 +++-- 7 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 5d6e97782c..0a00f2a6d9 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -4726,7 +4726,7 @@ and [] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse let tcGlobals = TcGlobals(tcConfig.compilingFslib, ilGlobals, fslibCcu, tcConfig.implicitIncludeDir, tcConfig.mlCompatibility, tcConfig.isInteractive, tryFindSysTypeCcu, tcConfig.emitDebugInfoInQuotations, - tcConfig.noDebugData, tcConfig.pathMap) + tcConfig.noDebugData, tcConfig.pathMap, tcConfig.langVersion) #if DEBUG // the global_g reference cell is used only for debug printing diff --git a/src/fsharp/LanguageFeatures.fs b/src/fsharp/LanguageFeatures.fs index 4257cbca9a..c8c67a4ddf 100644 --- a/src/fsharp/LanguageFeatures.fs +++ b/src/fsharp/LanguageFeatures.fs @@ -24,6 +24,7 @@ type LanguageFeature = | SingleUnderscorePattern = 2 | WildCardInForLoop = 3 | RelaxWhitespace = 4 + | NameOf = 5 /// LanguageVersion management type LanguageVersion (specifiedVersion) = @@ -47,8 +48,7 @@ type LanguageVersion (specifiedVersion) = LanguageFeature.SingleUnderscorePattern, previewVersion LanguageFeature.WildCardInForLoop, previewVersion LanguageFeature.RelaxWhitespace, previewVersion - - // Add new LanguageFeatures here ... + LanguageFeature.NameOf, previewVersion |] let specified = diff --git a/src/fsharp/LanguageFeatures.fsi b/src/fsharp/LanguageFeatures.fsi index 9d1690c7d8..fef3df9ba8 100644 --- a/src/fsharp/LanguageFeatures.fsi +++ b/src/fsharp/LanguageFeatures.fsi @@ -11,6 +11,7 @@ type LanguageFeature = | SingleUnderscorePattern = 2 | WildCardInForLoop = 3 | RelaxWhitespace = 4 + | NameOf = 5 /// LanguageVersion management type LanguageVersion = diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index fd883868cc..17417f2538 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -24,6 +24,7 @@ open FSharp.Compiler.AttributeChecking open FSharp.Compiler.InfoReader open FSharp.Compiler.PrettyNaming open FSharp.Compiler.Text +open FSharp.Compiler.Features open System.Collections.Generic #if !NO_EXTENSIONTYPING @@ -2475,7 +2476,15 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified | Exception e -> typeError := Some e; None | true, res -> - Some (FreshenUnqualifiedItem ncenv m res, []) + let fresh = FreshenUnqualifiedItem ncenv m res, [] + match fresh |> fst with + | Item.Value value -> + let isNameOfOperator = valRefEq ncenv.g ncenv.g.nameof_vref value + if isNameOfOperator && not (ncenv.g.langVersion.SupportsFeature LanguageFeature.NameOf) then + None + else + Some fresh + | _ -> Some fresh | _ -> None diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 55436c9184..8943ebd912 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -22,6 +22,7 @@ open FSharp.Compiler.TcGlobals open FSharp.Compiler.Layout open FSharp.Compiler.Layout.TaggedTextOps open FSharp.Compiler.PrettyNaming +open FSharp.Compiler.Features #if !NO_EXTENSIONTYPING open FSharp.Compiler.ExtensionTyping #endif @@ -3206,10 +3207,10 @@ let isSizeOfValRef g vref = // There is an internal version of typeof defined in prim-types.fs that needs to be detected || (g.compilingFslib && vref.LogicalName = "sizeof") -let isNameOfValRef g vref = - valRefEq g vref g.nameof_vref +let isNameOfValRef g vref = + valRefEq g vref g.nameof_vref // There is an internal version of nameof defined in prim-types.fs that needs to be detected - || (g.compilingFslib && vref.LogicalName = "nameof") + || (g.compilingFslib && vref.LogicalName = "nameof") let isTypeDefOfValRef g vref = valRefEq g vref g.typedefof_vref @@ -8569,7 +8570,7 @@ let IsSimpleSyntacticConstantExpr g inputExpr = | UncheckedDefaultOfExpr g _ | SizeOfExpr g _ | TypeOfExpr g _ - | NameOfExpr g _ -> true + | NameOfExpr g _ when g.langVersion.SupportsFeature LanguageFeature.NameOf -> true // All others are not simple constant expressions | _ -> false diff --git a/src/fsharp/TcGlobals.fs b/src/fsharp/TcGlobals.fs index 7952804ccd..38b1e7d1d6 100755 --- a/src/fsharp/TcGlobals.fs +++ b/src/fsharp/TcGlobals.fs @@ -22,6 +22,7 @@ open FSharp.Compiler.Range open FSharp.Compiler.Ast open FSharp.Compiler.Lib open FSharp.Compiler.PrettyNaming +open FSharp.Compiler.Features open Internal.Utilities @@ -180,8 +181,8 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d // The helper to find system types amongst referenced DLLs tryFindSysTypeCcu, emitDebugInfoInQuotations: bool, noDebugData: bool, - pathMap: PathMap) = - + pathMap: PathMap, langVersion: LanguageVersion) = + let vara = NewRigidTypar "a" envRange let varb = NewRigidTypar "b" envRange let varc = NewRigidTypar "c" envRange @@ -239,7 +240,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d // Search for a type. If it is not found, leave a dangling CCU reference with some useful diagnostic information should // the type actually be dereferenced let findSysTypeCcu path typeName = - match tryFindSysTypeCcu path typeName with + match tryFindSysTypeCcu path typeName with | None -> CcuThunk.CreateDelayed(dummyAssemblyNameCarryingUsefulErrorInformation path typeName) | Some ccu -> ccu @@ -904,6 +905,7 @@ type public TcGlobals(compilingFslib: bool, ilg:ILGlobals, fslibCcu: CcuThunk, d member __.emitDebugInfoInQuotations = emitDebugInfoInQuotations member __.directoryToResolveRelativePaths= directoryToResolveRelativePaths member __.pathMap = pathMap + member __.langVersion = langVersion member __.unionCaseRefEq x y = primUnionCaseRefEq compilingFslib fslibCcu x y member __.valRefEq x y = primValRefEq compilingFslib fslibCcu x y member __.fslibCcu = fslibCcu diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 044e0f8ed8..13c5dfd0f1 100644 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -36,6 +36,7 @@ open FSharp.Compiler.ConstraintSolver open FSharp.Compiler.NameResolution open FSharp.Compiler.PrettyNaming open FSharp.Compiler.InfoReader +open FSharp.Compiler.Features #if !NO_EXTENSIONTYPING open FSharp.Compiler.ExtensionTyping @@ -8769,9 +8770,9 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( // If the type of 'synArg' unifies as a function type, then this is a function application, otherwise // it is an error or a computation expression match UnifyFunctionTypeUndoIfFailed cenv denv mFunExpr exprty with - | ValueSome (domainTy, resultTy) -> + | ValueSome (domainTy, resultTy) -> match expr with - | ApplicableExpr(_, NameOfExpr cenv.g _, _) -> + | ApplicableExpr(_, NameOfExpr cenv.g _, _) when cenv.g.langVersion.SupportsFeature LanguageFeature.NameOf -> let replacementExpr = TcNameOfExpr cenv env tpenv synArg TcDelayed cenv overallTy env tpenv mExprAndArg (ApplicableExpr(cenv, replacementExpr, true)) cenv.g.string_ty ExprAtomicFlag.Atomic delayed | _ -> From 267a971efa101e11c120c10de0fb8888d8f0d4ac Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Thu, 4 Jul 2019 01:35:38 -0700 Subject: [PATCH 135/286] fsi, correct error messages --- FSharpTests.Directory.Build.targets | 1 + src/fsharp/FSharp.Build/Fsi.fs | 6 + tests/fsharp/core/nameof/testcases.fsx | 332 --------------- tests/fsharp/core/nameof/version46/test.fsx | 431 +++++++++++++++++--- tests/fsharp/core/nameof/version47/test.fsx | 333 ++++++++++++++- tests/fsharp/tests.fs | 5 - 6 files changed, 716 insertions(+), 392 deletions(-) delete mode 100644 tests/fsharp/core/nameof/testcases.fsx diff --git a/FSharpTests.Directory.Build.targets b/FSharpTests.Directory.Build.targets index fe916bf2df..8ae8c56255 100644 --- a/FSharpTests.Directory.Build.targets +++ b/FSharpTests.Directory.Build.targets @@ -13,6 +13,7 @@ DisabledWarnings="$(NoWarn)" DotnetFsiCompilerPath="$(DotnetFsiCompilerPath)" FsiExec="@(FsiExec)" + LangVersion="$(LangVersion)" LCID="$(LCID)" LoadSources="@(LoadSource)" NoFramework="false" diff --git a/src/fsharp/FSharp.Build/Fsi.fs b/src/fsharp/FSharp.Build/Fsi.fs index 93d8fc6659..ed1aae5e13 100644 --- a/src/fsharp/FSharp.Build/Fsi.fs +++ b/src/fsharp/FSharp.Build/Fsi.fs @@ -29,6 +29,7 @@ type public Fsi () as this = let mutable disabledWarnings : string = null let mutable dotnetFsiCompilerPath : string = null let mutable fsiExec = false + let mutable langVersion : string = null let mutable noFramework = false let mutable optimize = true let mutable otherFlags : string = null @@ -67,6 +68,7 @@ type public Fsi () as this = builder.AppendSwitchIfNotNull("--codepage:", codePage) + builder.AppendSwitchIfNotNull("--langversion:", langVersion) if noFramework then builder.AppendSwitch("--noframework") if defineConstants <> null then @@ -167,6 +169,10 @@ type public Fsi () as this = with get() = vslcid and set(p) = vslcid <- p + member fsc.LangVersion + with get() = langVersion + and set(s) = langVersion <- s + // --noframework member fsi.NoFramework with get() = noFramework diff --git a/tests/fsharp/core/nameof/testcases.fsx b/tests/fsharp/core/nameof/testcases.fsx deleted file mode 100644 index 62f9a0d2a0..0000000000 --- a/tests/fsharp/core/nameof/testcases.fsx +++ /dev/null @@ -1,332 +0,0 @@ -module TestSuite_FSharpCore_nameof - -#nowarn "44" - -open System - -exception ABC - -type Assert = - static member AreEqual (a, b) = a=b - static member Fail = raise (Exception("Fail")) - -let failures = ref [] - -let report_failure (s : string) = - failures := !failures @ [s] - -let test (s : string) b = - if b then stderr.Write " Success " - else - stderr.Write " Failed " - report_failure (s) - stderr.WriteLine(s) - -let check s b1 b2 = test s (b1 = b2) - -type BasicNameOfTests() = - - static let staticConstant = 23 - let localConstant = 23 - - member this.MemberMethod() = 0 - member this.MemberProperty = this.MemberMethod() - - member this.``member method``() = 0 - member this.``member property`` = this.``member method``() - - static member StaticMethod() = 0 - static member StaticProperty = BasicNameOfTests.StaticMethod() - - static member ``static method``() = 0 - static member ``static property`` = BasicNameOfTests.``static method``() - - static member ``local variable name lookup`` () = - let a = 0 - let b = nameof a - let result = Assert.AreEqual("a", b) - let c = nameof b - result || Assert.AreEqual("b", c) - - static member ``local int function name`` () = - let myFunction x = 0 * x - let result = nameof myFunction - Assert.AreEqual("myFunction", result) - - static member ``local curried function name`` () = - let curriedFunction x y = x * y - let result = nameof curriedFunction - Assert.AreEqual("curriedFunction", result) - - static member ``local tupled function name`` () = - let tupledFunction(x,y) = x * y - let result = nameof tupledFunction - Assert.AreEqual("tupledFunction", result) - - static member ``local unit function name`` () = - let myFunction() = 1 - let result = nameof(myFunction) - Assert.AreEqual("myFunction", result) - - static member ``local function parameter name`` () = - let myFunction parameter1 = nameof parameter1 - let result = myFunction "x" - Assert.AreEqual("parameter1", result) - - static member ``can get name from inside a local function (needs to be let rec)`` () = - let rec myLocalFunction x = - let z = 2 * x - nameof myLocalFunction + " " + z.ToString() - - let a = myLocalFunction 23 - let result = Assert.AreEqual("myLocalFunction 46", a) - - let b = myLocalFunction 25 - result || Assert.AreEqual("myLocalFunction 50", b) - - static member ``can get name from inside static member`` () = - let b = nameof(BasicNameOfTests.``can get name from inside static member``) - Assert.AreEqual("can get name from inside static member", b) - - member this.``can get name from inside instance member`` () = - let b = nameof(this.``can get name from inside instance member``) - Assert.AreEqual("can get name from inside instance member", b) - - static member ``can get name of static member`` () = - let b = nameof(BasicNameOfTests.``can get name of static member``) - Assert.AreEqual("can get name of static member", b) - - member this.``can get name of instance member`` () = - let b = nameof(this.MemberMethod) - Assert.AreEqual("MemberMethod", b) - - static member ``namespace name`` () = - let b = nameof(FSharp.Core) - Assert.AreEqual("Core",b) - - static member ``module name`` () = - let b = nameof(FSharp.Core.Operators) - Assert.AreEqual("Operators",b) - - static member ``exception name`` () = - let b = nameof(ABC) - Assert.AreEqual("ABC",b) - - static member ``nested type name 1`` () = - let b = nameof(System.Collections.Generic.List.Enumerator<_>) - Assert.AreEqual("Enumerator",b) - - static member ``type name 2`` () = - let b = nameof(System.Action<_>) - Assert.AreEqual("Action",b) - - static member ``member function which is defined below`` () = - let x = BasicNameOfTests() - let b = nameof(x.MemberMethodDefinedBelow) - Assert.AreEqual("MemberMethodDefinedBelow",b) - - member this.MemberMethodDefinedBelow(x,y) = x * y - - static member ``static member function name`` () = - let b = nameof(BasicNameOfTests.StaticMethod) - Assert.AreEqual("StaticMethod",b) - - member this.``class member lookup`` () = - let b = nameof(localConstant) - Assert.AreEqual("localConstant",b) - - static member ``static property name`` () = - let b = nameof(BasicNameOfTests.StaticProperty) - Assert.AreEqual("StaticProperty",b) - - member this.get_XYZ() = 1 - - static member ``member method starting with get_`` () = - let x = BasicNameOfTests() - let b = nameof(x.get_XYZ) - Assert.AreEqual("get_XYZ",b) - - static member get_SXYZ() = 1 - - static member ``static method starting with get_`` () = - let b = nameof(BasicNameOfTests.get_SXYZ) - Assert.AreEqual("get_SXYZ",b) - - static member ``nameof local property with encapsulated name`` () = - let ``local property with encapsulated name and %.f`` = 0 - let b = nameof(``local property with encapsulated name and %.f``) - Assert.AreEqual("local property with encapsulated name and %.f",b) - -type MethodGroupNameOfTests() = - member this.MethodGroup() = () - member this.MethodGroup(i:int) = () - - member this.MethodGroup1(i:int, f:float, s:string) = 0 - member this.MethodGroup1(f:float, l:int64) = "foo" - member this.MethodGroup1(u:unit -> unit -> int, h: unit) : unit = () - - member this.``single argument method group name lookup`` () = - let b = nameof(this.MethodGroup) - Assert.AreEqual("MethodGroup",b) - - member this.``multiple argument method group name lookup`` () = - let b = nameof(this.MethodGroup1 : (float * int64 -> _)) - Assert.AreEqual("MethodGroup1",b) - -type FrameworkMethodTests() = - member this.``library function name`` () = - let b = nameof(List.map) - Assert.AreEqual("map",b) - - member this.``static class function name`` () = - let b = nameof(System.Tuple.Create) - Assert.AreEqual("Create",b) - -type CustomUnionType = - | OptionA - | OptionB of int * string - -type CustomRecordType = - { X: int; Y: int } - -[] type Milliquacks - -type UnionAndRecordNameOfTests() = - - member this.``measure 1`` () = - let b = nameof(Milliquacks) - Assert.AreEqual("Milliquacks",b) - - member this.``record case 1`` () = - let sample = Unchecked.defaultof - let b = nameof(sample.X) - let result = Assert.AreEqual("X",b) - let b = nameof(sample.Y) - result || Assert.AreEqual("Y",b) - - member this.``union case 1`` () = - let b = nameof(OptionA) - Assert.AreEqual("OptionA",b) - - member this.``union case 2`` () = - let b = nameof(OptionB) - Assert.AreEqual("OptionB",b) - -type AttributeNameOfTests() = - - [] - member this.``ok in attribute`` () = - let t = typeof.GetMethod("ok in attribute") - let attrs = t.GetCustomAttributes(typeof, false) - let attr = attrs.[0] :?> ObsoleteAttribute - Assert.AreEqual(attr.Message, "test string") - -type OperatorNameOfTests() = - - member this.``lookup name of typeof operator`` () = - let b = nameof(typeof) - Assert.AreEqual("typeof",b) - - member this.``lookup name of + operator`` () = - let b = nameof(+) - Assert.AreEqual("op_Addition",b) - - member this.``lookup name of |> operator`` () = - let a = nameof(|>) - let result = Assert.AreEqual("op_PipeRight",a) - let b = nameof(op_PipeRight) - result || Assert.AreEqual("op_PipeRight",b) - - member this.``lookup name of nameof operator`` () = - let b = nameof(nameof) - Assert.AreEqual("nameof",b) - -type PatternMatchingOfOperatorNameTests() = - member this.Method1(i:int) = () - - member this.``use it as a match case guard`` () = - match "Method1" with - | x when x = nameof(this.Method1) -> true - | _ -> false - -type NameOfOperatorInQuotations() = - member this.``use it in a quotation`` () = - let q = - <@ - let f(x:int) = nameof x - f 20 - @> - true - -type NameOfOperatorForGenerics() = - member this.``use it in a generic function`` () = - let fullyGeneric x = x - let b = nameof(fullyGeneric) - Assert.AreEqual("fullyGeneric",b) - - member this.``lookup name of a generic class`` () = - let b = nameof System.Collections.Generic.List - Assert.AreEqual("List",b) - -type UserDefinedNameOfTests() = - static member ``user defined nameof should shadow the operator`` () = - let nameof x = "test" + x.ToString() - let y = nameof 1 - Assert.AreEqual("test1",y) - -type Person = - { Name : string - Age : int } - member __.Update(fld : string, value : obj) = - match fld with - | x when x = nameof __.Name -> { __ with Name = string value } - | x when x = nameof __.Age -> { __ with Age = value :?> int } - | _ -> __ - -do test "local variable name lookup" (BasicNameOfTests.``local variable name lookup`` ()) -do test "local int function name" (BasicNameOfTests.``local int function name`` ()) -do test "local curried function name" (BasicNameOfTests.``local curried function name`` ()) -do test "local tupled function name" (BasicNameOfTests.``local tupled function name`` ()) -do test "local unit function name" (BasicNameOfTests.``local unit function name`` ()) -do test "local function parameter name" (BasicNameOfTests.``local function parameter name`` ()) -do test "can get name from inside a local function (needs to be let rec)" - (BasicNameOfTests.``can get name from inside a local function (needs to be let rec)`` ()) -do test "can get name from inside static member" (BasicNameOfTests.``can get name from inside static member`` ()) -do test "can get name from inside instance member" ((BasicNameOfTests()).``can get name from inside instance member`` ()) -do test "can get name of instance member" ((BasicNameOfTests()).``can get name of instance member`` ()) -do test "namespace name" (BasicNameOfTests.``namespace name`` ()) -do test "module name" (BasicNameOfTests.``module name`` ()) -do test "exception name" (BasicNameOfTests.``exception name`` ()) -do test "nested type name 1" (BasicNameOfTests.``nested type name 1`` ()) -do test "type name 2" (BasicNameOfTests.``type name 2`` ()) -do test "member function which is defined below" (BasicNameOfTests.``member function which is defined below`` ()) -do test "class member lookup" ((BasicNameOfTests()).``class member lookup`` ()) -do test "static member function name" (BasicNameOfTests.``static member function name`` ()) -do test "static property name" (BasicNameOfTests.``static property name`` ()) -do test "member method starting with get_" (BasicNameOfTests.``member method starting with get_`` ()) -do test "static method starting with get_" (BasicNameOfTests.``static method starting with get_`` ()) -do test "nameof local property with encapsulated name" (BasicNameOfTests.``nameof local property with encapsulated name`` ()) - -do test "single argument method group name lookup" ((MethodGroupNameOfTests()).``single argument method group name lookup`` ()) -do test "multiple argument method group name lookup" ((MethodGroupNameOfTests()).``multiple argument method group name lookup`` ()) - -do test "measure 1" ((UnionAndRecordNameOfTests()).``measure 1`` ()) -do test "record case 1" ((UnionAndRecordNameOfTests()).``record case 1`` ()) -do test "union case 1" ((UnionAndRecordNameOfTests()).``union case 1`` ()) -do test "union case 2" ((UnionAndRecordNameOfTests()).``union case 2`` ()) - -do test "ok in attribute" ((AttributeNameOfTests()).``ok in attribute`` ()) - -do test "lookup name of typeof operator" ((OperatorNameOfTests()).``lookup name of typeof operator`` ()) -do test "lookup name of + operator" ((OperatorNameOfTests()).``lookup name of + operator`` ()) -do test "lookup name of |> operator" ((OperatorNameOfTests()).``lookup name of |> operator`` ()) -do test "lookup name of nameof operator" ((OperatorNameOfTests()).``lookup name of nameof operator`` ()) - -do test "use it as a match case guard" ((PatternMatchingOfOperatorNameTests()).``use it as a match case guard`` ()) - -do test "se it in a quotation" ((NameOfOperatorInQuotations()).``use it in a quotation`` ()) - -do test "use it in a generic function" ((NameOfOperatorForGenerics()).``use it in a generic function`` ()) -do test "lookup name of a generic class" ((NameOfOperatorForGenerics()).``lookup name of a generic class`` ()) - -do test "user defined nameof should shadow the operator"(UserDefinedNameOfTests.``user defined nameof should shadow the operator`` ()) diff --git a/tests/fsharp/core/nameof/version46/test.fsx b/tests/fsharp/core/nameof/version46/test.fsx index eed31c2c75..273427d2d7 100644 --- a/tests/fsharp/core/nameof/version46/test.fsx +++ b/tests/fsharp/core/nameof/version46/test.fsx @@ -1,62 +1,389 @@ -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. //The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. //The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//This is not a valid constant expression or custom attribute value -//This is not a valid constant expression or custom attribute value -//The value or constructor 'nameof' is not defined. -//This is not a valid constant expression or custom attribute value -//This is not a valid constant expression or custom attribute value +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. //The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. -//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//This is not a valid constant expression or custom attribute value +//This is not a valid constant expression or custom attribute value +//The value or constructor 'nameof' is not defined. +//This is not a valid constant expression or custom attribute value +//This is not a valid constant expression or custom attribute value +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. +//The value or constructor 'nameof' is not defined. + + #if TESTS_AS_APP module TestSuite_FSharpCore_nameof_46 #endif -// -#load @"..\testcases.fsx" -open TestSuite_FSharpCore_nameof + +#nowarn "44" + +open System + +exception ABC + +type Assert = + static member AreEqual (a, b) = a=b + static member Fail = raise (Exception("Fail")) + +let failures = ref [] + +let report_failure (s : string) = + failures := !failures @ [s] + +let test (s : string) b = + if b then stderr.Write " Success " + else + stderr.Write " Failed " + report_failure (s) + stderr.WriteLine(s) + +let check s b1 b2 = test s (b1 = b2) + +type BasicNameOfTests() = + + static let staticConstant = 23 + let localConstant = 23 + + member this.MemberMethod() = 0 + member this.MemberProperty = this.MemberMethod() + + member this.``member method``() = 0 + member this.``member property`` = this.``member method``() + + static member StaticMethod() = 0 + static member StaticProperty = BasicNameOfTests.StaticMethod() + + static member ``static method``() = 0 + static member ``static property`` = BasicNameOfTests.``static method``() + + static member ``local variable name lookup`` () = + let a = 0 + let b = nameof a + let result = Assert.AreEqual("a", b) + let c = nameof b + result || Assert.AreEqual("b", c) + + static member ``local int function name`` () = + let myFunction x = 0 * x + let result = nameof myFunction + Assert.AreEqual("myFunction", result) + + static member ``local curried function name`` () = + let curriedFunction x y = x * y + let result = nameof curriedFunction + Assert.AreEqual("curriedFunction", result) + + static member ``local tupled function name`` () = + let tupledFunction(x,y) = x * y + let result = nameof tupledFunction + Assert.AreEqual("tupledFunction", result) + + static member ``local unit function name`` () = + let myFunction() = 1 + let result = nameof(myFunction) + Assert.AreEqual("myFunction", result) + + static member ``local function parameter name`` () = + let myFunction parameter1 = nameof parameter1 + let result = myFunction "x" + Assert.AreEqual("parameter1", result) + + static member ``can get name from inside a local function (needs to be let rec)`` () = + let rec myLocalFunction x = + let z = 2 * x + nameof myLocalFunction + " " + z.ToString() + + let a = myLocalFunction 23 + let result = Assert.AreEqual("myLocalFunction 46", a) + + let b = myLocalFunction 25 + result || Assert.AreEqual("myLocalFunction 50", b) + + static member ``can get name from inside static member`` () = + let b = nameof(BasicNameOfTests.``can get name from inside static member``) + Assert.AreEqual("can get name from inside static member", b) + + member this.``can get name from inside instance member`` () = + let b = nameof(this.``can get name from inside instance member``) + Assert.AreEqual("can get name from inside instance member", b) + + static member ``can get name of static member`` () = + let b = nameof(BasicNameOfTests.``can get name of static member``) + Assert.AreEqual("can get name of static member", b) + + member this.``can get name of instance member`` () = + let b = nameof(this.MemberMethod) + Assert.AreEqual("MemberMethod", b) + + static member ``namespace name`` () = + let b = nameof(FSharp.Core) + Assert.AreEqual("Core",b) + + static member ``module name`` () = + let b = nameof(FSharp.Core.Operators) + Assert.AreEqual("Operators",b) + + static member ``exception name`` () = + let b = nameof(ABC) + Assert.AreEqual("ABC",b) + + static member ``nested type name 1`` () = + let b = nameof(System.Collections.Generic.List.Enumerator<_>) + Assert.AreEqual("Enumerator",b) + + static member ``type name 2`` () = + let b = nameof(System.Action<_>) + Assert.AreEqual("Action",b) + + static member ``member function which is defined below`` () = + let x = BasicNameOfTests() + let b = nameof(x.MemberMethodDefinedBelow) + Assert.AreEqual("MemberMethodDefinedBelow",b) + + member this.MemberMethodDefinedBelow(x,y) = x * y + + static member ``static member function name`` () = + let b = nameof(BasicNameOfTests.StaticMethod) + Assert.AreEqual("StaticMethod",b) + + member this.``class member lookup`` () = + let b = nameof(localConstant) + Assert.AreEqual("localConstant",b) + + static member ``static property name`` () = + let b = nameof(BasicNameOfTests.StaticProperty) + Assert.AreEqual("StaticProperty",b) + + member this.get_XYZ() = 1 + + static member ``member method starting with get_`` () = + let x = BasicNameOfTests() + let b = nameof(x.get_XYZ) + Assert.AreEqual("get_XYZ",b) + + static member get_SXYZ() = 1 + + static member ``static method starting with get_`` () = + let b = nameof(BasicNameOfTests.get_SXYZ) + Assert.AreEqual("get_SXYZ",b) + + static member ``nameof local property with encapsulated name`` () = + let ``local property with encapsulated name and %.f`` = 0 + let b = nameof(``local property with encapsulated name and %.f``) + Assert.AreEqual("local property with encapsulated name and %.f",b) + +type MethodGroupNameOfTests() = + member this.MethodGroup() = () + member this.MethodGroup(i:int) = () + + member this.MethodGroup1(i:int, f:float, s:string) = 0 + member this.MethodGroup1(f:float, l:int64) = "foo" + member this.MethodGroup1(u:unit -> unit -> int, h: unit) : unit = () + + member this.``single argument method group name lookup`` () = + let b = nameof(this.MethodGroup) + Assert.AreEqual("MethodGroup",b) + + member this.``multiple argument method group name lookup`` () = + let b = nameof(this.MethodGroup1 : (float * int64 -> _)) + Assert.AreEqual("MethodGroup1",b) + +type FrameworkMethodTests() = + member this.``library function name`` () = + let b = nameof(List.map) + Assert.AreEqual("map",b) + + member this.``static class function name`` () = + let b = nameof(System.Tuple.Create) + Assert.AreEqual("Create",b) + +type CustomUnionType = + | OptionA + | OptionB of int * string + +type CustomRecordType = + { X: int; Y: int } + +[] type Milliquacks + +type UnionAndRecordNameOfTests() = + + member this.``measure 1`` () = + let b = nameof(Milliquacks) + Assert.AreEqual("Milliquacks",b) + + member this.``record case 1`` () = + let sample = Unchecked.defaultof + let b = nameof(sample.X) + let result = Assert.AreEqual("X",b) + let b = nameof(sample.Y) + result || Assert.AreEqual("Y",b) + + member this.``union case 1`` () = + let b = nameof(OptionA) + Assert.AreEqual("OptionA",b) + + member this.``union case 2`` () = + let b = nameof(OptionB) + Assert.AreEqual("OptionB",b) + +type AttributeNameOfTests() = + + [] + member this.``ok in attribute`` () = + let t = typeof.GetMethod("ok in attribute") + let attrs = t.GetCustomAttributes(typeof, false) + let attr = attrs.[0] :?> ObsoleteAttribute + Assert.AreEqual(attr.Message, "test string") + +type OperatorNameOfTests() = + + member this.``lookup name of typeof operator`` () = + let b = nameof(typeof) + Assert.AreEqual("typeof",b) + + member this.``lookup name of + operator`` () = + let b = nameof(+) + Assert.AreEqual("op_Addition",b) + + member this.``lookup name of |> operator`` () = + let a = nameof(|>) + let result = Assert.AreEqual("op_PipeRight",a) + let b = nameof(op_PipeRight) + result || Assert.AreEqual("op_PipeRight",b) + + member this.``lookup name of nameof operator`` () = + let b = nameof(nameof) + Assert.AreEqual("nameof",b) + +type PatternMatchingOfOperatorNameTests() = + member this.Method1(i:int) = () + + member this.``use it as a match case guard`` () = + match "Method1" with + | x when x = nameof(this.Method1) -> true + | _ -> false + +type NameOfOperatorInQuotations() = + member this.``use it in a quotation`` () = + let q = + <@ + let f(x:int) = nameof x + f 20 + @> + true + +type NameOfOperatorForGenerics() = + member this.``use it in a generic function`` () = + let fullyGeneric x = x + let b = nameof(fullyGeneric) + Assert.AreEqual("fullyGeneric",b) + + member this.``lookup name of a generic class`` () = + let b = nameof System.Collections.Generic.List + Assert.AreEqual("List",b) + +type UserDefinedNameOfTests() = + static member ``user defined nameof should shadow the operator`` () = + let nameof x = "test" + x.ToString() + let y = nameof 1 + Assert.AreEqual("test1",y) + +type Person = + { Name : string + Age : int } + member __.Update(fld : string, value : obj) = + match fld with + | x when x = nameof __.Name -> { __ with Name = string value } + | x when x = nameof __.Age -> { __ with Age = value :?> int } + | _ -> __ + +do test "local variable name lookup" (BasicNameOfTests.``local variable name lookup`` ()) +do test "local int function name" (BasicNameOfTests.``local int function name`` ()) +do test "local curried function name" (BasicNameOfTests.``local curried function name`` ()) +do test "local tupled function name" (BasicNameOfTests.``local tupled function name`` ()) +do test "local unit function name" (BasicNameOfTests.``local unit function name`` ()) +do test "local function parameter name" (BasicNameOfTests.``local function parameter name`` ()) +do test "can get name from inside a local function (needs to be let rec)" + (BasicNameOfTests.``can get name from inside a local function (needs to be let rec)`` ()) +do test "can get name from inside static member" (BasicNameOfTests.``can get name from inside static member`` ()) +do test "can get name from inside instance member" ((BasicNameOfTests()).``can get name from inside instance member`` ()) +do test "can get name of instance member" ((BasicNameOfTests()).``can get name of instance member`` ()) +do test "namespace name" (BasicNameOfTests.``namespace name`` ()) +do test "module name" (BasicNameOfTests.``module name`` ()) +do test "exception name" (BasicNameOfTests.``exception name`` ()) +do test "nested type name 1" (BasicNameOfTests.``nested type name 1`` ()) +do test "type name 2" (BasicNameOfTests.``type name 2`` ()) +do test "member function which is defined below" (BasicNameOfTests.``member function which is defined below`` ()) +do test "class member lookup" ((BasicNameOfTests()).``class member lookup`` ()) +do test "static member function name" (BasicNameOfTests.``static member function name`` ()) +do test "static property name" (BasicNameOfTests.``static property name`` ()) +do test "member method starting with get_" (BasicNameOfTests.``member method starting with get_`` ()) +do test "static method starting with get_" (BasicNameOfTests.``static method starting with get_`` ()) +do test "nameof local property with encapsulated name" (BasicNameOfTests.``nameof local property with encapsulated name`` ()) + +do test "single argument method group name lookup" ((MethodGroupNameOfTests()).``single argument method group name lookup`` ()) +do test "multiple argument method group name lookup" ((MethodGroupNameOfTests()).``multiple argument method group name lookup`` ()) + +do test "measure 1" ((UnionAndRecordNameOfTests()).``measure 1`` ()) +do test "record case 1" ((UnionAndRecordNameOfTests()).``record case 1`` ()) +do test "union case 1" ((UnionAndRecordNameOfTests()).``union case 1`` ()) +do test "union case 2" ((UnionAndRecordNameOfTests()).``union case 2`` ()) + +do test "ok in attribute" ((AttributeNameOfTests()).``ok in attribute`` ()) + +do test "lookup name of typeof operator" ((OperatorNameOfTests()).``lookup name of typeof operator`` ()) +do test "lookup name of + operator" ((OperatorNameOfTests()).``lookup name of + operator`` ()) +do test "lookup name of |> operator" ((OperatorNameOfTests()).``lookup name of |> operator`` ()) +do test "lookup name of nameof operator" ((OperatorNameOfTests()).``lookup name of nameof operator`` ()) + +do test "use it as a match case guard" ((PatternMatchingOfOperatorNameTests()).``use it as a match case guard`` ()) + +do test "se it in a quotation" ((NameOfOperatorInQuotations()).``use it in a quotation`` ()) + +do test "use it in a generic function" ((NameOfOperatorForGenerics()).``use it in a generic function`` ()) +do test "lookup name of a generic class" ((NameOfOperatorForGenerics()).``lookup name of a generic class`` ()) + +do test "user defined nameof should shadow the operator"(UserDefinedNameOfTests.``user defined nameof should shadow the operator`` ()) #if TESTS_AS_APP let RUN() = diff --git a/tests/fsharp/core/nameof/version47/test.fsx b/tests/fsharp/core/nameof/version47/test.fsx index ab93ec255c..bbad8d142a 100644 --- a/tests/fsharp/core/nameof/version47/test.fsx +++ b/tests/fsharp/core/nameof/version47/test.fsx @@ -3,9 +3,336 @@ module TestSuite_FSharpCore_nameof_47 #endif -// -#load @"..\testcases.fsx" -open TestSuite_FSharpCore_nameof +#nowarn "44" + +open System + +exception ABC + +type Assert = + static member AreEqual (a, b) = a=b + static member Fail = raise (Exception("Fail")) + +let failures = ref [] + +let report_failure (s : string) = + failures := !failures @ [s] + +let test (s : string) b = + if b then stderr.Write " Success " + else + stderr.Write " Failed " + report_failure (s) + stderr.WriteLine(s) + +let check s b1 b2 = test s (b1 = b2) + +type BasicNameOfTests() = + + static let staticConstant = 23 + let localConstant = 23 + + member this.MemberMethod() = 0 + member this.MemberProperty = this.MemberMethod() + + member this.``member method``() = 0 + member this.``member property`` = this.``member method``() + + static member StaticMethod() = 0 + static member StaticProperty = BasicNameOfTests.StaticMethod() + + static member ``static method``() = 0 + static member ``static property`` = BasicNameOfTests.``static method``() + + static member ``local variable name lookup`` () = + let a = 0 + let b = nameof a + let result = Assert.AreEqual("a", b) + let c = nameof b + result || Assert.AreEqual("b", c) + + static member ``local int function name`` () = + let myFunction x = 0 * x + let result = nameof myFunction + Assert.AreEqual("myFunction", result) + + static member ``local curried function name`` () = + let curriedFunction x y = x * y + let result = nameof curriedFunction + Assert.AreEqual("curriedFunction", result) + + static member ``local tupled function name`` () = + let tupledFunction(x,y) = x * y + let result = nameof tupledFunction + Assert.AreEqual("tupledFunction", result) + + static member ``local unit function name`` () = + let myFunction() = 1 + let result = nameof(myFunction) + Assert.AreEqual("myFunction", result) + + static member ``local function parameter name`` () = + let myFunction parameter1 = nameof parameter1 + let result = myFunction "x" + Assert.AreEqual("parameter1", result) + + static member ``can get name from inside a local function (needs to be let rec)`` () = + let rec myLocalFunction x = + let z = 2 * x + nameof myLocalFunction + " " + z.ToString() + + let a = myLocalFunction 23 + let result = Assert.AreEqual("myLocalFunction 46", a) + + let b = myLocalFunction 25 + result || Assert.AreEqual("myLocalFunction 50", b) + + static member ``can get name from inside static member`` () = + let b = nameof(BasicNameOfTests.``can get name from inside static member``) + Assert.AreEqual("can get name from inside static member", b) + + member this.``can get name from inside instance member`` () = + let b = nameof(this.``can get name from inside instance member``) + Assert.AreEqual("can get name from inside instance member", b) + + static member ``can get name of static member`` () = + let b = nameof(BasicNameOfTests.``can get name of static member``) + Assert.AreEqual("can get name of static member", b) + + member this.``can get name of instance member`` () = + let b = nameof(this.MemberMethod) + Assert.AreEqual("MemberMethod", b) + + static member ``namespace name`` () = + let b = nameof(FSharp.Core) + Assert.AreEqual("Core",b) + + static member ``module name`` () = + let b = nameof(FSharp.Core.Operators) + Assert.AreEqual("Operators",b) + + static member ``exception name`` () = + let b = nameof(ABC) + Assert.AreEqual("ABC",b) + + static member ``nested type name 1`` () = + let b = nameof(System.Collections.Generic.List.Enumerator<_>) + Assert.AreEqual("Enumerator",b) + + static member ``type name 2`` () = + let b = nameof(System.Action<_>) + Assert.AreEqual("Action",b) + + static member ``member function which is defined below`` () = + let x = BasicNameOfTests() + let b = nameof(x.MemberMethodDefinedBelow) + Assert.AreEqual("MemberMethodDefinedBelow",b) + + member this.MemberMethodDefinedBelow(x,y) = x * y + + static member ``static member function name`` () = + let b = nameof(BasicNameOfTests.StaticMethod) + Assert.AreEqual("StaticMethod",b) + + member this.``class member lookup`` () = + let b = nameof(localConstant) + Assert.AreEqual("localConstant",b) + + static member ``static property name`` () = + let b = nameof(BasicNameOfTests.StaticProperty) + Assert.AreEqual("StaticProperty",b) + + member this.get_XYZ() = 1 + + static member ``member method starting with get_`` () = + let x = BasicNameOfTests() + let b = nameof(x.get_XYZ) + Assert.AreEqual("get_XYZ",b) + + static member get_SXYZ() = 1 + + static member ``static method starting with get_`` () = + let b = nameof(BasicNameOfTests.get_SXYZ) + Assert.AreEqual("get_SXYZ",b) + + static member ``nameof local property with encapsulated name`` () = + let ``local property with encapsulated name and %.f`` = 0 + let b = nameof(``local property with encapsulated name and %.f``) + Assert.AreEqual("local property with encapsulated name and %.f",b) + +type MethodGroupNameOfTests() = + member this.MethodGroup() = () + member this.MethodGroup(i:int) = () + + member this.MethodGroup1(i:int, f:float, s:string) = 0 + member this.MethodGroup1(f:float, l:int64) = "foo" + member this.MethodGroup1(u:unit -> unit -> int, h: unit) : unit = () + + member this.``single argument method group name lookup`` () = + let b = nameof(this.MethodGroup) + Assert.AreEqual("MethodGroup",b) + + member this.``multiple argument method group name lookup`` () = + let b = nameof(this.MethodGroup1 : (float * int64 -> _)) + Assert.AreEqual("MethodGroup1",b) + +type FrameworkMethodTests() = + member this.``library function name`` () = + let b = nameof(List.map) + Assert.AreEqual("map",b) + + member this.``static class function name`` () = + let b = nameof(System.Tuple.Create) + Assert.AreEqual("Create",b) + +type CustomUnionType = + | OptionA + | OptionB of int * string + +type CustomRecordType = + { X: int; Y: int } + +[] type Milliquacks + +type UnionAndRecordNameOfTests() = + + member this.``measure 1`` () = + let b = nameof(Milliquacks) + Assert.AreEqual("Milliquacks",b) + + member this.``record case 1`` () = + let sample = Unchecked.defaultof + let b = nameof(sample.X) + let result = Assert.AreEqual("X",b) + let b = nameof(sample.Y) + result || Assert.AreEqual("Y",b) + + member this.``union case 1`` () = + let b = nameof(OptionA) + Assert.AreEqual("OptionA",b) + + member this.``union case 2`` () = + let b = nameof(OptionB) + Assert.AreEqual("OptionB",b) + +type AttributeNameOfTests() = + + [] + member this.``ok in attribute`` () = + let t = typeof.GetMethod("ok in attribute") + let attrs = t.GetCustomAttributes(typeof, false) + let attr = attrs.[0] :?> ObsoleteAttribute + Assert.AreEqual(attr.Message, "test string") + +type OperatorNameOfTests() = + + member this.``lookup name of typeof operator`` () = + let b = nameof(typeof) + Assert.AreEqual("typeof",b) + + member this.``lookup name of + operator`` () = + let b = nameof(+) + Assert.AreEqual("op_Addition",b) + + member this.``lookup name of |> operator`` () = + let a = nameof(|>) + let result = Assert.AreEqual("op_PipeRight",a) + let b = nameof(op_PipeRight) + result || Assert.AreEqual("op_PipeRight",b) + + member this.``lookup name of nameof operator`` () = + let b = nameof(nameof) + Assert.AreEqual("nameof",b) + +type PatternMatchingOfOperatorNameTests() = + member this.Method1(i:int) = () + + member this.``use it as a match case guard`` () = + match "Method1" with + | x when x = nameof(this.Method1) -> true + | _ -> false + +type NameOfOperatorInQuotations() = + member this.``use it in a quotation`` () = + let q = + <@ + let f(x:int) = nameof x + f 20 + @> + true + +type NameOfOperatorForGenerics() = + member this.``use it in a generic function`` () = + let fullyGeneric x = x + let b = nameof(fullyGeneric) + Assert.AreEqual("fullyGeneric",b) + + member this.``lookup name of a generic class`` () = + let b = nameof System.Collections.Generic.List + Assert.AreEqual("List",b) + +type UserDefinedNameOfTests() = + static member ``user defined nameof should shadow the operator`` () = + let nameof x = "test" + x.ToString() + let y = nameof 1 + Assert.AreEqual("test1",y) + +type Person = + { Name : string + Age : int } + member __.Update(fld : string, value : obj) = + match fld with + | x when x = nameof __.Name -> { __ with Name = string value } + | x when x = nameof __.Age -> { __ with Age = value :?> int } + | _ -> __ + +do test "local variable name lookup" (BasicNameOfTests.``local variable name lookup`` ()) +do test "local int function name" (BasicNameOfTests.``local int function name`` ()) +do test "local curried function name" (BasicNameOfTests.``local curried function name`` ()) +do test "local tupled function name" (BasicNameOfTests.``local tupled function name`` ()) +do test "local unit function name" (BasicNameOfTests.``local unit function name`` ()) +do test "local function parameter name" (BasicNameOfTests.``local function parameter name`` ()) +do test "can get name from inside a local function (needs to be let rec)" + (BasicNameOfTests.``can get name from inside a local function (needs to be let rec)`` ()) +do test "can get name from inside static member" (BasicNameOfTests.``can get name from inside static member`` ()) +do test "can get name from inside instance member" ((BasicNameOfTests()).``can get name from inside instance member`` ()) +do test "can get name of instance member" ((BasicNameOfTests()).``can get name of instance member`` ()) +do test "namespace name" (BasicNameOfTests.``namespace name`` ()) +do test "module name" (BasicNameOfTests.``module name`` ()) +do test "exception name" (BasicNameOfTests.``exception name`` ()) +do test "nested type name 1" (BasicNameOfTests.``nested type name 1`` ()) +do test "type name 2" (BasicNameOfTests.``type name 2`` ()) +do test "member function which is defined below" (BasicNameOfTests.``member function which is defined below`` ()) +do test "class member lookup" ((BasicNameOfTests()).``class member lookup`` ()) +do test "static member function name" (BasicNameOfTests.``static member function name`` ()) +do test "static property name" (BasicNameOfTests.``static property name`` ()) +do test "member method starting with get_" (BasicNameOfTests.``member method starting with get_`` ()) +do test "static method starting with get_" (BasicNameOfTests.``static method starting with get_`` ()) +do test "nameof local property with encapsulated name" (BasicNameOfTests.``nameof local property with encapsulated name`` ()) + +do test "single argument method group name lookup" ((MethodGroupNameOfTests()).``single argument method group name lookup`` ()) +do test "multiple argument method group name lookup" ((MethodGroupNameOfTests()).``multiple argument method group name lookup`` ()) + +do test "measure 1" ((UnionAndRecordNameOfTests()).``measure 1`` ()) +do test "record case 1" ((UnionAndRecordNameOfTests()).``record case 1`` ()) +do test "union case 1" ((UnionAndRecordNameOfTests()).``union case 1`` ()) +do test "union case 2" ((UnionAndRecordNameOfTests()).``union case 2`` ()) + +do test "ok in attribute" ((AttributeNameOfTests()).``ok in attribute`` ()) + +do test "lookup name of typeof operator" ((OperatorNameOfTests()).``lookup name of typeof operator`` ()) +do test "lookup name of + operator" ((OperatorNameOfTests()).``lookup name of + operator`` ()) +do test "lookup name of |> operator" ((OperatorNameOfTests()).``lookup name of |> operator`` ()) +do test "lookup name of nameof operator" ((OperatorNameOfTests()).``lookup name of nameof operator`` ()) + +do test "use it as a match case guard" ((PatternMatchingOfOperatorNameTests()).``use it as a match case guard`` ()) + +do test "se it in a quotation" ((NameOfOperatorInQuotations()).``use it in a quotation`` ()) + +do test "use it in a generic function" ((NameOfOperatorForGenerics()).``use it in a generic function`` ()) +do test "lookup name of a generic class" ((NameOfOperatorForGenerics()).``lookup name of a generic class`` ()) + +do test "user defined nameof should shadow the operator"(UserDefinedNameOfTests.``user defined nameof should shadow the operator`` ()) #if TESTS_AS_APP let RUN() = diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index a38a8eeb15..dd911df60a 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -29,7 +29,6 @@ let FSI_BASIC = FSI_FILE #endif // ^^^^^^^^^^^^ To run these tests in F# Interactive , 'build net40', then send this chunk, then evaluate body of a test ^^^^^^^^^^^^ -#if KEVIN //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ module CoreTests = // These tests are enabled for .NET Framework and .NET Core [] @@ -1804,7 +1803,6 @@ module CoreTests = peverifyWithArgs cfg "/nologo" "xmlverify.exe" #endif -#endif //@@@@@@@@@@@@@@@@@ module VersionTests = [] @@ -1831,8 +1829,6 @@ module VersionTests = [] let ``nameof-fsi``() = singleTestBuildAndRunVersion "core/nameof/version47" FSI_BASIC "preview" -#if KEVIN //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS module ToolsTests = @@ -2897,4 +2893,3 @@ module OverloadResolution = let [] ``Conformance\InferenceProcedures\WellFormednessChecking (E_Clashing_Values_in_AbstractClass03.fs) `` () = singleNegTest (testConfig "conformance/wellformedness") "E_Clashing_Values_in_AbstractClass03" let [] ``Conformance\InferenceProcedures\WellFormednessChecking (E_Clashing_Values_in_AbstractClass04.fs) `` () = singleNegTest (testConfig "conformance/wellformedness") "E_Clashing_Values_in_AbstractClass04" #endif -#endif //@@@@@@@@@@@@@@@@@@@@ \ No newline at end of file From 20690cabeb7dbafc8a21c5cc4f7f7dd1d93bc967 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Thu, 4 Jul 2019 10:44:34 +0200 Subject: [PATCH 136/286] Use latest Paket (#7124) --- fcs/download-paket.ps1 | 2 +- fcs/download-paket.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fcs/download-paket.ps1 b/fcs/download-paket.ps1 index 7aa8c5ef6f..4541168012 100644 --- a/fcs/download-paket.ps1 +++ b/fcs/download-paket.ps1 @@ -1,4 +1,4 @@ -$paketurl="https://github.com/fsprojects/Paket/releases/download/5.210.1/paket.exe" +$paketurl="https://github.com/fsprojects/Paket/releases/download/5.215.0/paket.exe" $paketdir = Join-Path $PSScriptRoot ".paket" $paketpath = Join-Path $paketdir "paket.exe" diff --git a/fcs/download-paket.sh b/fcs/download-paket.sh index d2bf8524a8..2825ac4d5a 100755 --- a/fcs/download-paket.sh +++ b/fcs/download-paket.sh @@ -12,7 +12,7 @@ while [[ -h "$source" ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -paketurl=https://github.com/fsprojects/Paket/releases/download/5.210.1/paket.exe +paketurl=https://github.com/fsprojects/Paket/releases/download/5.215.0/paket.exe paketdir=$scriptroot/.paket paketpath=$paketdir/paket.exe if [ ! -e "$paketpath" ]; then From 274ffb16a3d80d4d5c58af239e4698afe6d6fa0f Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Thu, 4 Jul 2019 10:47:56 +0200 Subject: [PATCH 137/286] Use more specific assertions in CompilerAssert (#7122) --- tests/fsharp/Compiler/CompilerAssert.fs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index 6a43e562ea..029d9cf72d 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -54,25 +54,26 @@ module CompilerAssert = lock lockObj <| fun () -> let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, defaultProjectOptions) |> Async.RunSynchronously - Assert.True(parseResults.Errors.Length = 0, sprintf "Parse errors: %A" parseResults.Errors) + Assert.IsEmpty(parseResults.Errors, sprintf "Parse errors: %A" parseResults.Errors) match fileAnswer with | FSharpCheckFileAnswer.Aborted _ -> Assert.Fail("Type Checker Aborted") | FSharpCheckFileAnswer.Succeeded(typeCheckResults) -> - Assert.True(typeCheckResults.Errors.Length = 0, sprintf "Type Check errors: %A" typeCheckResults.Errors) + Assert.IsEmpty(typeCheckResults.Errors, sprintf "Type Check errors: %A" typeCheckResults.Errors) + let TypeCheckSingleError (source: string) (expectedErrorNumber: int) (expectedErrorRange: int * int * int * int) (expectedErrorMsg: string) = lock lockObj <| fun () -> let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, defaultProjectOptions) |> Async.RunSynchronously - Assert.True(parseResults.Errors.Length = 0, sprintf "Parse errors: %A" parseResults.Errors) + Assert.IsEmpty(parseResults.Errors, sprintf "Parse errors: %A" parseResults.Errors) match fileAnswer with | FSharpCheckFileAnswer.Aborted _ -> Assert.Fail("Type Checker Aborted") | FSharpCheckFileAnswer.Succeeded(typeCheckResults) -> - Assert.True(typeCheckResults.Errors.Length = 1, sprintf "Expected one type check error: %A" typeCheckResults.Errors) + Assert.AreEqual(1, typeCheckResults.Errors.Length, sprintf "Expected one type check error: %A" typeCheckResults.Errors) typeCheckResults.Errors |> Array.iter (fun info -> Assert.AreEqual(FSharpErrorSeverity.Error, info.Severity) From 681d9d5520aa50e5de99cd089e4646f2f024f2cb Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Thu, 4 Jul 2019 04:27:34 -0700 Subject: [PATCH 138/286] Use --langversion:preview for conformance tests --- .../DataExpressions/NameOf/env.lst | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst index 7e08cf92ea..60368829aa 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst @@ -1,11 +1,11 @@ - SOURCE=E_NameOfIntConst.fs # E_NameOfIntConst.fs - SOURCE=E_NameOfStringConst.fs # E_NameOfStringConst.fs - SOURCE=E_NameOfAppliedFunction.fs # E_NameOfAppliedFunction.fs - SOURCE=E_NameOfIntegerAppliedFunction.fs # E_NameOfIntegerAppliedFunction.fs - SOURCE=E_NameOfPartiallyAppliedFunction.fs # E_NameOfPartiallyAppliedFunction.fs - SOURCE=E_NameOfDictLookup.fs # E_NameOfDictLookup.fs - SOURCE=E_NameOfAdditionExpr.fs # E_NameOfAdditionExpr.fs - SOURCE=E_NameOfParameterAppliedFunction.fs # E_NameOfParameterAppliedFunction.fs - SOURCE=E_NameOfAsAFunction.fs # E_NameOfAsAFunction.fs - SOURCE=E_NameOfWithPipe.fs # E_NameOfWithPipe.fs - SOURCE=E_NameOfUnresolvableName.fs # E_NameOfUnresolvableName.fs + SOURCE=E_NameOfIntConst.fs SCFLAGS="--langversion:preview" # E_NameOfIntConst.fs + SOURCE=E_NameOfStringConst.fs SCFLAGS="--langversion:preview" # E_NameOfStringConst.fs + SOURCE=E_NameOfAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfAppliedFunction.fs + SOURCE=E_NameOfIntegerAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfIntegerAppliedFunction.fs + SOURCE=E_NameOfPartiallyAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfPartiallyAppliedFunction.fs + SOURCE=E_NameOfDictLookup.fs SCFLAGS="--langversion:preview" # E_NameOfDictLookup.fs + SOURCE=E_NameOfAdditionExpr.fs SCFLAGS="--langversion:preview" # E_NameOfAdditionExpr.fs + SOURCE=E_NameOfParameterAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfParameterAppliedFunction.fs + SOURCE=E_NameOfAsAFunction.fs SCFLAGS="--langversion:preview" # E_NameOfAsAFunction.fs + SOURCE=E_NameOfWithPipe.fs SCFLAGS="--langversion:preview" # E_NameOfWithPipe.fs + SOURCE=E_NameOfUnresolvableName.fs SCFLAGS="--langversion:preview" # E_NameOfUnresolvableName.fs From 2d8eb0e157560af03d46bcc486b72408dcf7f892 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 4 Jul 2019 13:36:33 +0100 Subject: [PATCH 139/286] fix matching mistake --- src/fsharp/TastOps.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 8943ebd912..cdf9aef3d5 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -8569,7 +8569,7 @@ let IsSimpleSyntacticConstantExpr g inputExpr = | Expr.Op (TOp.UnionCase _, _, [], _) // Nullary union cases | UncheckedDefaultOfExpr g _ | SizeOfExpr g _ - | TypeOfExpr g _ + | TypeOfExpr g _ -> true | NameOfExpr g _ when g.langVersion.SupportsFeature LanguageFeature.NameOf -> true // All others are not simple constant expressions | _ -> false From 26342bcd5746fdd81048053dfc08ee8c74c32568 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 4 Jul 2019 13:38:37 +0100 Subject: [PATCH 140/286] Update NameResolution.fs --- src/fsharp/NameResolution.fs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index 17417f2538..44ea476b3c 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -2476,15 +2476,16 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified | Exception e -> typeError := Some e; None | true, res -> - let fresh = FreshenUnqualifiedItem ncenv m res, [] - match fresh |> fst with + let fresh = FreshenUnqualifiedItem ncenv m res + match fresh with | Item.Value value -> let isNameOfOperator = valRefEq ncenv.g ncenv.g.nameof_vref value if isNameOfOperator && not (ncenv.g.langVersion.SupportsFeature LanguageFeature.NameOf) then + // Do not resolve `nameof` if the feature is unsupported, even if it is FSharp.Core None else - Some fresh - | _ -> Some fresh + Some (fresh, []) + | _ -> Some (fresh, []) | _ -> None From 277b0fd74588f42918bb78733f4992aec770ef44 Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Thu, 4 Jul 2019 13:02:01 +0000 Subject: [PATCH 141/286] Update dependencies from https://github.com/dotnet/arcade build 20190703.19 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19353.19 --- eng/Version.Details.xml | 4 ++-- eng/common/sdl/execute-all-sdl-tools.ps1 | 8 +++++--- eng/common/sdl/run-sdl.ps1 | 12 +++++++----- global.json | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 810004aa4d..daf1a40ab3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - b8c190d95371e658d95a5731f4778bd3da2fa42d + 733f8297b68dd824044a77d955e62305b9dc43d5 diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 index 0635f26fb6..aab7589f2c 100644 --- a/eng/common/sdl/execute-all-sdl-tools.ps1 +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -22,7 +22,9 @@ Param( [string] $TsaCodebaseAdmin, # Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs. [string] $TsaBugAreaPath, # Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. [string] $TsaIterationPath, # Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. - [string] $GuardianLoggerLevel="Standard" # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error + [string] $GuardianLoggerLevel="Standard", # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error + [string[]] $CrScanAdditionalRunConfigParams, # Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1") + [string[]] $PoliCheckAdditionalRunConfigParams # Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1") ) $ErrorActionPreference = "Stop" @@ -69,10 +71,10 @@ if ($TsaOnboard) { } if ($ArtifactToolsList -and $ArtifactToolsList.Count -gt 0) { - & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $ArtifactsDirectory -GdnFolder $gdnFolder -ToolsList $ArtifactToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel + & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $ArtifactsDirectory -GdnFolder $gdnFolder -ToolsList $ArtifactToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams } if ($SourceToolsList -and $SourceToolsList.Count -gt 0) { - & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $SourceDirectory -GdnFolder $gdnFolder -ToolsList $SourceToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel + & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $SourceDirectory -GdnFolder $gdnFolder -ToolsList $SourceToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams } if ($UpdateBaseline) { diff --git a/eng/common/sdl/run-sdl.ps1 b/eng/common/sdl/run-sdl.ps1 index e6a86d03a2..d7b8564458 100644 --- a/eng/common/sdl/run-sdl.ps1 +++ b/eng/common/sdl/run-sdl.ps1 @@ -5,7 +5,9 @@ Param( [string] $GdnFolder, [string[]] $ToolsList, [string] $UpdateBaseline, - [string] $GuardianLoggerLevel="Standard" + [string] $GuardianLoggerLevel="Standard", + [string[]] $CrScanAdditionalRunConfigParams, + [string[]] $PoliCheckAdditionalRunConfigParams ) $ErrorActionPreference = "Stop" @@ -29,8 +31,8 @@ foreach ($tool in $ToolsList) { Write-Host $tool # We have to manually configure tools that run on source to look at the source directory only if ($tool -eq "credscan") { - Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory : $TargetDirectory `"" - & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory : $TargetDirectory " + Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory : $TargetDirectory `" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams})" + & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory : $TargetDirectory " $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams}) if ($LASTEXITCODE -ne 0) { Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." exit $LASTEXITCODE @@ -38,8 +40,8 @@ foreach ($tool in $ToolsList) { $config = $True } if ($tool -eq "policheck") { - Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target : $TargetDirectory `"" - & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target : $TargetDirectory " + Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target : $TargetDirectory `" $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams})" + & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target : $TargetDirectory " $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams}) if ($LASTEXITCODE -ne 0) { Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." exit $LASTEXITCODE diff --git a/global.json b/global.json index 53d05811a7..4fd944a3f1 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19352.7", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19353.19", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From cfb414fe8ca65b074aefd1172b75276dce941cc5 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Thu, 4 Jul 2019 18:26:44 +0100 Subject: [PATCH 142/286] [RFC FS-1069] Implicit yields (allow dropping yield in list, array, sequence and computation expressions) (#6806) * allow dropping yield in sequence expressions * update tests * update xlf * fix test * update baseline * implicit yield for computation expressions * fix tests, merge diag4 * fix test * update tests * fix tests * fix test * fix build * address PR * fix test * review feedback * make it match fsharp47 --- src/fsharp/ConstraintSolver.fs | 17 ++ src/fsharp/ConstraintSolver.fsi | 1 + src/fsharp/FSComp.txt | 1 - src/fsharp/TypeChecker.fs | 249 +++++++++------ src/fsharp/ast.fs | 130 +------- src/fsharp/service/ServiceParseTreeWalk.fs | 1 + src/fsharp/service/ServiceUntypedParse.fs | 1 + src/fsharp/xlf/FSComp.txt.cs.xlf | 5 - src/fsharp/xlf/FSComp.txt.de.xlf | 5 - src/fsharp/xlf/FSComp.txt.es.xlf | 5 - src/fsharp/xlf/FSComp.txt.fr.xlf | 5 - src/fsharp/xlf/FSComp.txt.it.xlf | 5 - src/fsharp/xlf/FSComp.txt.ja.xlf | 5 - src/fsharp/xlf/FSComp.txt.ko.xlf | 5 - src/fsharp/xlf/FSComp.txt.pl.xlf | 5 - src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 5 - src/fsharp/xlf/FSComp.txt.ru.xlf | 5 - src/fsharp/xlf/FSComp.txt.tr.xlf | 5 - src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 5 - src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 5 - tests/fsharp/tests.fs | 6 +- tests/fsharp/typecheck/sigs/neg24.bsl | 44 ++- tests/fsharp/typecheck/sigs/neg24.fs | 286 +++++++++++++++++- .../SequenceExpressions/W_IfThenElse01.fs | 12 +- .../SequenceExpressions/W_IfThenElse02.fs | 16 +- .../SequenceExpressions/W_IfThenElse03.fs | 16 +- .../Source/Warnings/WarnIfDiscardedInList.fs | 4 +- .../Source/Warnings/WarnIfDiscardedInList2.fs | 7 +- .../Source/Warnings/WarnIfDiscardedInList3.fs | 4 +- 29 files changed, 524 insertions(+), 336 deletions(-) diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index 586b91c41b..1176c8dea8 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -2677,9 +2677,26 @@ let UndoIfFailed f = ReportWarnings warns true +let UndoIfFailedOrWarnings f = + let trace = Trace.New() + let res = + try + f trace + |> CheckNoErrorsAndGetWarnings + with e -> None + match res with + | Some [] -> + true + | _ -> + trace.Undo() + false + let AddCxTypeEqualsTypeUndoIfFailed denv css m ty1 ty2 = UndoIfFailed (fun trace -> SolveTypeEqualsTypeKeepAbbrevs (MakeConstraintSolverEnv ContextInfo.NoContext css m denv) 0 m (WithTrace trace) ty1 ty2) +let AddCxTypeEqualsTypeUndoIfFailedOrWarnings denv css m ty1 ty2 = + UndoIfFailedOrWarnings (fun trace -> SolveTypeEqualsTypeKeepAbbrevs (MakeConstraintSolverEnv ContextInfo.NoContext css m denv) 0 m (WithTrace trace) ty1 ty2) + let AddCxTypeEqualsTypeMatchingOnlyUndoIfFailed denv css m ty1 ty2 = let csenv = { MakeConstraintSolverEnv ContextInfo.NoContext css m denv with MatchingOnly = true } UndoIfFailed (fun trace -> SolveTypeEqualsTypeKeepAbbrevs csenv 0 m (WithTrace trace) ty1 ty2) diff --git a/src/fsharp/ConstraintSolver.fsi b/src/fsharp/ConstraintSolver.fsi index 59c271b126..1fce009f61 100644 --- a/src/fsharp/ConstraintSolver.fsi +++ b/src/fsharp/ConstraintSolver.fsi @@ -126,6 +126,7 @@ val CheckDeclaredTypars : DisplayEnv -> ConstraintSolverSt val AddConstraint : ConstraintSolverEnv -> int -> Range.range -> OptionalTrace -> Typar -> TyparConstraint -> OperationResult val AddCxTypeEqualsType : ContextInfo -> DisplayEnv -> ConstraintSolverState -> range -> TType -> TType -> unit val AddCxTypeEqualsTypeUndoIfFailed : DisplayEnv -> ConstraintSolverState -> range -> TType -> TType -> bool +val AddCxTypeEqualsTypeUndoIfFailedOrWarnings : DisplayEnv -> ConstraintSolverState -> range -> TType -> TType -> bool val AddCxTypeEqualsTypeMatchingOnlyUndoIfFailed : DisplayEnv -> ConstraintSolverState -> range -> TType -> TType -> bool val AddCxTypeMustSubsumeType : ContextInfo -> DisplayEnv -> ConstraintSolverState -> range -> OptionalTrace -> TType -> TType -> unit val AddCxTypeMustSubsumeTypeUndoIfFailed : DisplayEnv -> ConstraintSolverState -> range -> TType -> TType -> bool diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 4b5f756f06..27d6bfd4b4 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -574,7 +574,6 @@ tcUseWhenPatternGuard,"Character range matches have been removed in F#. Consider 736,tcExprUndelayed,"TcExprUndelayed: delayed" 737,tcExpressionRequiresSequence,"This expression form may only be used in sequence and computation expressions" 738,tcInvalidObjectExpressionSyntaxForm,"Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces." -739,tcInvalidObjectSequenceOrRecordExpression,"Invalid object, sequence or record expression" 740,tcInvalidSequenceExpressionSyntaxForm,"Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'" tcExpressionWithIfRequiresParenthesis,"This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression" 741,tcUnableToParseFormatString,"Unable to parse format string '%s'" diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 8ded1e8053..0364200cca 100644 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -847,6 +847,10 @@ let UnifyUnitType cenv (env: TcEnv) m ty expr = false +let TryUnifyUnitTypeWithoutWarning cenv (env:TcEnv) m ty = + let denv = env.DisplayEnv + AddCxTypeEqualsTypeUndoIfFailedOrWarnings denv cenv.css m ty cenv.g.unit_ty + // Logically extends System.AttributeTargets module AttributeTargets = let FieldDecl = AttributeTargets.Field ||| AttributeTargets.Property @@ -3516,32 +3520,11 @@ let (|ExprAsPat|_|) (f: SynExpr) = /// Determine if a syntactic expression inside 'seq { ... }' or '[...]' counts as a "simple sequence /// of semicolon separated values". For example [1;2;3]. -/// 'acceptDeprecated' is true for the '[ ... ]' case, where we allow the syntax '[ if g then t else e ]' but ask it to be parenthesized /// -let (|SimpleSemicolonSequence|_|) acceptDeprecated c = - - let rec YieldFree expr = - match expr with - | SynExpr.Sequential (_, _, e1, e2, _) -> YieldFree e1 && YieldFree e2 - | SynExpr.IfThenElse (_, e2, e3opt, _, _, _, _) -> YieldFree e2 && Option.forall YieldFree e3opt - | SynExpr.TryWith (e1, _, clauses, _, _, _, _) -> YieldFree e1 && clauses |> List.forall (fun (Clause(_, _, e, _, _)) -> YieldFree e) - | (SynExpr.Match (_, _, clauses, _) | SynExpr.MatchBang (_, _, clauses, _)) -> - clauses |> List.forall (fun (Clause(_, _, e, _, _)) -> YieldFree e) - | SynExpr.For (_, _, _, _, _, body, _) - | SynExpr.TryFinally (body, _, _, _, _) - | SynExpr.LetOrUse (_, _, _, body, _) - | SynExpr.While (_, _, body, _) - | SynExpr.ForEach (_, _, _, _, _, body, _) -> YieldFree body - | SynExpr.YieldOrReturnFrom _ - | SynExpr.YieldOrReturn _ - | SynExpr.LetOrUseBang _ - | SynExpr.ImplicitZero _ - | SynExpr.Do _ -> false - | _ -> true +let (|SimpleSemicolonSequence|_|) cexpr = - let rec IsSimpleSemicolonSequenceElement expr = + let IsSimpleSemicolonSequenceElement expr = match expr with - | SynExpr.IfThenElse _ when acceptDeprecated && YieldFree expr -> true | SynExpr.IfThenElse _ | SynExpr.TryWith _ | SynExpr.Match _ @@ -3554,15 +3537,14 @@ let (|SimpleSemicolonSequence|_|) acceptDeprecated c = | SynExpr.Do _ | SynExpr.MatchBang _ | SynExpr.LetOrUseBang _ - | SynExpr.ImplicitZero _ | SynExpr.While _ -> false | _ -> true - let rec GetSimpleSemicolonSequenceOfComprehension expr acc = + let rec TryGetSimpleSemicolonSequenceOfComprehension expr acc = match expr with | SynExpr.Sequential (_, true, e1, e2, _) -> if IsSimpleSemicolonSequenceElement e1 then - GetSimpleSemicolonSequenceOfComprehension e2 (e1 :: acc) + TryGetSimpleSemicolonSequenceOfComprehension e2 (e1 :: acc) else None | e -> @@ -3571,10 +3553,7 @@ let (|SimpleSemicolonSequence|_|) acceptDeprecated c = else None - if YieldFree c then - GetSimpleSemicolonSequenceOfComprehension c [] - else - None + TryGetSimpleSemicolonSequenceOfComprehension cexpr [] //------------------------------------------------------------------------- // Mutually recursive shapes @@ -5681,6 +5660,12 @@ and TcStmt cenv env tpenv synExpr = else mkCompGenSequential m expr (mkUnit cenv.g m), tpenv +and TryTcStmt cenv env tpenv synExpr = + let expr, ty, tpenv = TcExprOfUnknownType cenv env tpenv synExpr + let m = synExpr.Range + let hasTypeUnit = TryUnifyUnitTypeWithoutWarning cenv env m ty + hasTypeUnit, expr, tpenv + /// During checking of expressions of the form (x(y)).z(w1, w2) /// keep a stack of things on the right. This lets us recognize /// method applications and other item-based syntax. @@ -5947,25 +5932,18 @@ and TcExprUndelayed cenv overallTy env tpenv (synExpr: SynExpr) = match comp with | SynExpr.New _ -> errorR(Error(FSComp.SR.tcInvalidObjectExpressionSyntaxForm(), m)) - | SimpleSemicolonSequence false _ -> - errorR(Error(FSComp.SR.tcInvalidObjectSequenceOrRecordExpression(), m)) | _ -> () if not !isNotNakedRefCell && not cenv.g.compilingFslib then error(Error(FSComp.SR.tcInvalidSequenceExpressionSyntaxForm(), m)) - TcComputationOrSequenceExpression cenv env overallTy m None tpenv comp + TcSequenceExpression cenv env tpenv comp overallTy m | SynExpr.ArrayOrListOfSeqExpr (isArray, comp, m) -> CallExprHasTypeSink cenv.tcSink (m, env.NameEnv, overallTy, env.DisplayEnv, env.eAccessRights) match comp with - | SynExpr.CompExpr (_, _, (SimpleSemicolonSequence true elems as body), _) -> - match body with - | SimpleSemicolonSequence false _ -> - () - | _ -> - errorR(Deprecated(FSComp.SR.tcExpressionWithIfRequiresParenthesis(), m)) + | SynExpr.CompExpr (_, _, SimpleSemicolonSequence elems, _) -> let replacementExpr = if isArray then @@ -6064,6 +6042,19 @@ and TcExprUndelayed cenv overallTy env tpenv (synExpr: SynExpr) = let expr2, tpenv = TcStmtThatCantBeCtorBody cenv env tpenv synExpr2 Expr.Sequential (expr1, expr2, ThenDoSeq, sp, m), tpenv + // Used to implement the type-directed 'implicit yield' rule for computation expressions + | SynExpr.SequentialOrImplicitYield (sp, synExpr1, synExpr2, otherExpr, m) -> + let isStmt, expr1, tpenv = TryTcStmt cenv env tpenv synExpr1 + if isStmt then + let env = ShrinkContext env m synExpr2.Range + let expr2, tpenv = TcExprThatCanBeCtorBody cenv overallTy env tpenv synExpr2 + Expr.Sequential(expr1, expr2, NormalSeq, sp, m), tpenv + else + // The first expression wasn't unit-typed, so proceed to the alternative interpretation + // Note a copy of the first expression is embedded in 'otherExpr' and thus + // this will type-check the first expression over again. + TcExpr cenv overallTy env tpenv otherExpr + | SynExpr.Do (synInnerExpr, m) -> UnifyTypes cenv env m overallTy cenv.g.unit_ty TcStmtThatCantBeCtorBody cenv env tpenv synInnerExpr @@ -7337,24 +7328,38 @@ and TcQuotationExpr cenv overallTy env tpenv (_oper, raw, ast, isFromQueryExpres // We serialize the quoted expression to bytes in IlxGen after type inference etc. is complete. expr, tpenv -//------------------------------------------------------------------------- -// TcComputationOrSequenceExpression -//------------------------------------------------------------------------- - -and TcComputationOrSequenceExpression cenv (env: TcEnv) overallTy m interpValOpt tpenv comp = - match interpValOpt with - | Some (interpExpr: Expr, builderTy) -> - TcComputationExpression cenv env overallTy m interpExpr builderTy tpenv comp - | None -> - TcSequenceExpression cenv env tpenv comp overallTy m - /// Ignores an attribute and IgnoreAttribute _ = None -// Used for all computation expressions except sequence expressions -and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv comp = +/// Check if a computation or sequence expression is syntactically free of 'yield' (though not yield!) +and YieldFree expr = + match expr with + | SynExpr.Sequential (_, _, e1, e2, _) -> YieldFree e1 && YieldFree e2 + | SynExpr.IfThenElse (_, e2, e3opt, _, _, _, _) -> YieldFree e2 && Option.forall YieldFree e3opt + | SynExpr.TryWith (e1, _, clauses, _, _, _, _) -> + YieldFree e1 && clauses |> List.forall (fun (Clause(_, _, e, _, _)) -> YieldFree e) + | (SynExpr.Match (_, _, clauses, _) | SynExpr.MatchBang (_, _, clauses, _)) -> + clauses |> List.forall (fun (Clause(_, _, e, _, _)) -> YieldFree e) + | SynExpr.For (_, _, _, _, _, body, _) + | SynExpr.TryFinally (body, _, _, _, _) + | SynExpr.LetOrUse (_, _, _, body, _) + | SynExpr.LetOrUseBang(_, _, _, _, _, body, _) + | SynExpr.LetOrUse (_, _, _, body, _) + | SynExpr.While (_, _, body, _) + | SynExpr.ForEach (_, _, _, _, _, body, _) -> + YieldFree body + + // 'yield!' in expressions doesn't trigger the 'yield free' rule + //| SynExpr.YieldOrReturnFrom _ + | SynExpr.YieldOrReturn((true, _), _, _) -> + false + + | _ -> true - //dprintfn "TcComputationOrSequenceExpression, comp = \n%A\n-------------------\n" comp +/// Used for all computation expressions except sequence expressions +and TcComputationExpression cenv env overallTy mWhole (interpExpr: Expr) builderTy tpenv (comp: SynExpr) = + + //dprintfn "TcComputationExpression, comp = \n%A\n-------------------\n" comp let ad = env.eAccessRights let mkSynDelay2 (e: SynExpr) = mkSynDelay (e.Range.MakeSynthetic()) e @@ -7383,19 +7388,18 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv let builderVal = mkSynIdGet m builderValName mkSynApp1 (SynExpr.DotGet (builderVal, range0, LongIdentWithDots([mkSynId m nm], []), m)) args m - let sourceMethInfo = TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad "Source" builderTy + let hasMethInfo nm = TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad nm builderTy |> isNil |> not + + let sourceMethInfo = TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad "Source" builderTy + // Optionally wrap sources of "let!", "yield!", "use!" in "query.Source" let mkSourceExpr callExpr = match sourceMethInfo with | [] -> callExpr | _ -> mkSynCall "Source" callExpr.Range [callExpr] - /// Decide if the builder is an auto-quote builder - let isAutoQuote = - match TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad "Quote" builderTy with - | [] -> false - | _ -> true + let isAutoQuote = hasMethInfo "Quote" let customOperationMethods = AllMethInfosOfTypeInScope ResultCollectionSettings.AllResults cenv.infoReader env.NameEnv None ad IgnoreOverrides mBuilderVal builderTy @@ -7553,7 +7557,6 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv let (_, argInfo) = List.item i argInfos HasFSharpAttribute cenv.g cenv.g.attrib_ProjectionParameterAttribute argInfo.Attribs - let (|ForEachThen|_|) e = match e with | SynExpr.ForEach (_spBind, SeqExprOnly false, isFromSource, pat1, expr1, SynExpr.Sequential (_, true, clause, rest, _), _) -> Some (isFromSource, pat1, expr1, clause, rest) @@ -7706,7 +7709,6 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv | _ -> None - let (|StripApps|) e = let rec strip e = match e with @@ -7765,6 +7767,20 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv | SynExpr.Sequential (_sp, true, dataComp1, dataComp2, _) -> (dataComp1, Some dataComp2) | _ -> (e, None) + // "cexpr; cexpr" is treated as builder.Combine(cexpr1, cexpr1) + // This is not pretty - we have to decide which range markers we use for the calls to Combine and Delay + // NOTE: we should probably suppress these sequence points altogether + let rangeForCombine innerComp1 = + match innerComp1 with + | SynExpr.IfThenElse (_, _, _, _, _, mIfToThen, _m) -> mIfToThen + | SynExpr.Match (SequencePointAtBinding mMatch, _, _, _) -> mMatch + | SynExpr.TryWith (_, _, _, _, _, SequencePointAtTry mTry, _) -> mTry + | SynExpr.TryFinally (_, _, _, SequencePointAtTry mTry, _) -> mTry + | SynExpr.For (SequencePointAtForLoop mBind, _, _, _, _, _, _) -> mBind + | SynExpr.ForEach (SequencePointAtForLoop mBind, _, _, _, _, _, _) -> mBind + | SynExpr.While (SequencePointAtWhileLoop mWhile, _, _, _) -> mWhile + | _ -> innerComp1.Range + // Check for 'where x > y', 'select x, y' and other mis-applications of infix operators, give a good error message, and return a flag let checkForBinaryApp comp = match comp with @@ -7795,6 +7811,11 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv let emptyVarSpace = LazyWithContext.NotLazy ([], env) + // If there are no 'yield' in the computation expression, and the builder supports 'Yield', + // then allow the type-directed rule interpreting non-unit-typed expressions in statement + // positions as 'yield'. 'yield!' may be present in the computation expression. + let enableImplicitYield = hasMethInfo "Yield" && hasMethInfo "Combine" && hasMethInfo "Delay" && YieldFree comp + // q - a flag indicating if custom operators are allowed. They are not allowed inside try/with, try/finally, if/then/else etc. // varSpace - a lazy data structure indicating the variables bound so far in the overall computation // comp - the computation expression being analyzed @@ -8161,16 +8182,7 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv // "cexpr; cexpr" is treated as builder.Combine(cexpr1, cexpr1) // This is not pretty - we have to decide which range markers we use for the calls to Combine and Delay // NOTE: we should probably suppress these sequence points altogether - let m1 = - match innerComp1 with - | SynExpr.IfThenElse (_, _, _, _, _, mIfToThen, _m) -> mIfToThen - | SynExpr.Match (SequencePointAtBinding mMatch, _, _, _) -> mMatch - | SynExpr.TryWith (_, _, _, _, _, SequencePointAtTry mTry, _) -> mTry - | SynExpr.TryFinally (_, _, _, SequencePointAtTry mTry, _) -> mTry - | SynExpr.For (SequencePointAtForLoop mBind, _, _, _, _, _, _) -> mBind - | SynExpr.ForEach (SequencePointAtForLoop mBind, _, _, _, _, _, _) -> mBind - | SynExpr.While (SequencePointAtWhileLoop mWhile, _, _, _) -> mWhile - | _ -> innerComp1.Range + let m1 = rangeForCombine innerComp1 if isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env m ad "Combine" builderTy) then error(Error(FSComp.SR.tcRequireBuilderMethod("Combine"), m)) if isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env m ad "Delay" builderTy) then error(Error(FSComp.SR.tcRequireBuilderMethod("Delay"), m)) Some (translatedCtxt (mkSynCall "Combine" m1 [c; mkSynCall "Delay" m1 [mkSynDelay innerComp2.Range (transNoQueryOps innerComp2)]])) @@ -8186,7 +8198,21 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv Some(trans true q varSpace (SynExpr.LetOrUseBang (sp, false, true, SynPat.Const(SynConst.Unit, rhsExpr.Range), rhsExpr, innerComp2, m)) translatedCtxt) // "expr; cexpr" is treated as sequential execution | _ -> - Some (trans true q varSpace innerComp2 (fun holeFill -> translatedCtxt (SynExpr.Sequential (sp, true, innerComp1, holeFill, m)))) + Some (trans true q varSpace innerComp2 (fun holeFill -> + let fillExpr = + if enableImplicitYield then + + // When implicit yields are enabled, then if the 'innerComp1' checks as type + // 'unit' we interpret the expression as a sequential, and when it doesn't + // have type 'unit' we interpret it as a 'Yield + Combine'. + let combineExpr = + let m1 = rangeForCombine innerComp1 + let implicitYieldExpr = mkSynCall "Yield" comp.Range [innerComp1] + mkSynCall "Combine" m1 [implicitYieldExpr; mkSynCall "Delay" m1 [mkSynDelay holeFill.Range holeFill]] + SynExpr.SequentialOrImplicitYield(sp, innerComp1, holeFill, combineExpr, m) + else + SynExpr.Sequential(sp, true, innerComp1, holeFill, m) + translatedCtxt fillExpr)) | SynExpr.IfThenElse (guardExpr, thenComp, elseCompOpt, spIfToThen, isRecovery, mIfToThen, mIfToEndOfElseBranch) -> match elseCompOpt with @@ -8315,7 +8341,6 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv Some (translatedCtxt yieldExpr) else Some (translatedCtxt (mkSynCall "ReturnFrom" m [yieldExpr])) - | SynExpr.YieldOrReturn ((isYield, _), yieldExpr, m) -> let methName = (if isYield then "Yield" else "Return") @@ -8325,7 +8350,9 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv | _ -> None - and transNoQueryOps comp = trans true false emptyVarSpace comp id + and transNoQueryOps comp = + trans true false emptyVarSpace comp id + and trans firstTry q varSpace comp translatedCtxt = match tryTrans firstTry q varSpace comp translatedCtxt with | Some e -> e @@ -8341,8 +8368,9 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv if isNil (TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env m ad "Return" builderTy) then SynExpr.ImplicitZero m else - SynExpr.YieldOrReturn ((false, true), SynExpr.Const (SynConst.Unit, m), m) - trans true q varSpace (SynExpr.LetOrUseBang (NoSequencePointAtDoBinding, false, false, SynPat.Const(SynConst.Unit, mUnit), rhsExpr, bodyExpr, m)) translatedCtxt + SynExpr.YieldOrReturn((false, true), SynExpr.Const (SynConst.Unit, m), m) + trans true q varSpace (SynExpr.LetOrUseBang(NoSequencePointAtDoBinding, false, false, SynPat.Const(SynConst.Unit, mUnit), rhsExpr, bodyExpr, m)) translatedCtxt + // "expr;" in final position is treated as { expr; zero } // Suppress the sequence point on the "zero" | _ -> @@ -8354,21 +8382,27 @@ and TcComputationExpression cenv env overallTy mWhole interpExpr builderTy tpenv match comp with | SynExpr.JoinIn _ -> () // an error will be reported later when we process innerComp1 as a sequential | _ -> errorR(Error(FSComp.SR.tcUnrecognizedQueryOperator(), comp.RangeOfFirstPortion)) - trans true q varSpace (SynExpr.ImplicitZero comp.Range) (fun holeFill -> translatedCtxt (SynExpr.Sequential (SuppressSequencePointOnStmtOfSequential, true, comp, holeFill, comp.Range))) + trans true q varSpace (SynExpr.ImplicitZero comp.Range) (fun holeFill -> + let fillExpr = + if enableImplicitYield then + let implicitYieldExpr = mkSynCall "Yield" comp.Range [comp] + SynExpr.SequentialOrImplicitYield(SuppressSequencePointOnStmtOfSequential, comp, holeFill, implicitYieldExpr, comp.Range) + else + SynExpr.Sequential(SuppressSequencePointOnStmtOfSequential, true, comp, holeFill, comp.Range) + translatedCtxt fillExpr) - let basicSynExpr = trans true (hasCustomOperations ()) (LazyWithContext.NotLazy ([], env)) comp (fun holeFill -> holeFill) + let basicSynExpr = + trans true (hasCustomOperations ()) (LazyWithContext.NotLazy ([], env)) comp (fun holeFill -> holeFill) let delayedExpr = match TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad "Delay" builderTy with | [] -> basicSynExpr | _ -> mkSynCall "Delay" mBuilderVal [(mkSynDelay2 basicSynExpr)] - let quotedSynExpr = if isAutoQuote then SynExpr.Quote (mkSynIdGet (mBuilderVal.MakeSynthetic()) (CompileOpName "<@ @>"), (*isRaw=*)false, delayedExpr, (*isFromQueryExpression=*)true, mWhole) else delayedExpr - let runExpr = match TryFindIntrinsicOrExtensionMethInfo ResultCollectionSettings.AtMostOneResult cenv env mBuilderVal ad "Run" builderTy with @@ -8406,6 +8440,11 @@ and TcSequenceExpression cenv env tpenv comp overallTy m = // Allow subsumption at 'yield' if the element type is nominal prior to the analysis of the body of the sequence expression let flex = not (isTyparTy cenv.g genEnumElemTy) + // If there are no 'yield' in the computation expression then allow the type-directed rule + // interpreting non-unit-typed expressions in statement positions as 'yield'. 'yield!' may be + // present in the computation expression. + let enableImplicitYield = YieldFree comp + let mkDelayedExpr (coreExpr: Expr) = let m = coreExpr.Range let overallTy = tyOfExpr cenv.g coreExpr @@ -8465,8 +8504,6 @@ and TcSequenceExpression cenv env tpenv comp overallTy m = let innerExprMark = innerExpr.Range Some(mkSeqFinally cenv env innerExprMark genOuterTy innerExpr unwindExpr, tpenv) - | SynExpr.Paren (_, _, _, m) -> - error(Error(FSComp.SR.tcConstructIsAmbiguousInSequenceExpression(), m)) | SynExpr.ImplicitZero m -> Some(mkSeqEmpty cenv env m genOuterTy, tpenv ) @@ -8477,17 +8514,15 @@ and TcSequenceExpression cenv env tpenv comp overallTy m = | SynExpr.Sequential (sp, true, innerComp1, innerComp2, m) -> // "expr; cexpr" is treated as sequential execution // "cexpr; cexpr" is treated as append - match tryTcSequenceExprBody env genOuterTy tpenv innerComp1 with - | None -> - let innerExpr1, tpenv = TcStmtThatCantBeCtorBody cenv env tpenv innerComp1 - let innerExpr2, tpenv = tcSequenceExprBody env genOuterTy tpenv innerComp2 - - Some(Expr.Sequential (innerExpr1, innerExpr2, NormalSeq, sp, m), tpenv) - - | Some (innerExpr1, tpenv) -> + let res, tpenv = tcSequenceExprBodyAsSequenceOrStatement env genOuterTy tpenv innerComp1 + match res with + | Choice1Of2 innerExpr1 -> let innerExpr2, tpenv = tcSequenceExprBody env genOuterTy tpenv innerComp2 let innerExpr2 = mkDelayedExpr innerExpr2 Some(mkSeqAppend cenv env innerComp1.Range genOuterTy innerExpr1 innerExpr2, tpenv) + | Choice2Of2 stmt1 -> + let innerExpr2, tpenv = tcSequenceExprBody env genOuterTy tpenv innerComp2 + Some(Expr.Sequential(stmt1, innerExpr2, NormalSeq, sp, m), tpenv) | SynExpr.IfThenElse (guardExpr, thenComp, elseCompOpt, spIfToThen, _isRecovery, mIfToThen, mIfToEndOfElseBranch) -> let guardExpr', tpenv = TcExpr cenv cenv.g.bool_ty env tpenv guardExpr @@ -8561,15 +8596,34 @@ and TcSequenceExpression cenv env tpenv comp overallTy m = | _ -> None and tcSequenceExprBody env genOuterTy tpenv comp = + let res, tpenv = tcSequenceExprBodyAsSequenceOrStatement env genOuterTy tpenv comp + match res with + | Choice1Of2 expr -> + expr, tpenv + | Choice2Of2 stmt -> + let m = comp.Range + let resExpr = Expr.Sequential(stmt, mkSeqEmpty cenv env m genOuterTy, NormalSeq, SuppressSequencePointOnStmtOfSequential, m) + resExpr, tpenv + + and tcSequenceExprBodyAsSequenceOrStatement env genOuterTy tpenv comp = match tryTcSequenceExprBody env genOuterTy tpenv comp with - | Some e -> e + | Some (expr, tpenv) -> Choice1Of2 expr, tpenv | None -> - // seq { ...; expr } is treated as 'seq { ... ; expr; yield! Seq.empty }' - // Note this means seq { ...; () } is treated as 'seq { ... ; (); yield! Seq.empty }' - let m = comp.Range let env = { env with eContextInfo = ContextInfo.SequenceExpression genOuterTy } - let expr, tpenv = TcStmtThatCantBeCtorBody cenv env tpenv comp - Expr.Sequential (expr, mkSeqEmpty cenv env m genOuterTy, NormalSeq, SuppressSequencePointOnStmtOfSequential, m), tpenv + if enableImplicitYield then + let hasTypeUnit, expr, tpenv = TryTcStmt cenv env tpenv comp + if hasTypeUnit then + Choice2Of2 expr, tpenv + else + let genResultTy = NewInferenceType () + UnifyTypes cenv env m genOuterTy (mkSeqTy cenv.g genResultTy) + let exprTy = tyOfExpr cenv.g expr + AddCxTypeMustSubsumeType env.eContextInfo env.DisplayEnv cenv.css m NoTrace genResultTy exprTy + let resExpr = mkCallSeqSingleton cenv.g m genResultTy (mkCoerceExpr(expr, genResultTy, m, exprTy)) + Choice1Of2 resExpr, tpenv + else + let stmt, tpenv = TcStmtThatCantBeCtorBody cenv env tpenv comp + Choice2Of2 stmt, tpenv let coreExpr, tpenv = tcSequenceExprBody env overallTy tpenv comp let delayedExpr = mkDelayedExpr coreExpr @@ -8789,7 +8843,7 @@ and TcFunctionApplicationThen cenv overallTy env tpenv mExprAndArg expr exprty ( // OK, 'expr' doesn't have function type, but perhaps 'expr' is a computation expression builder, and 'arg' is '{ ... }' match synArg with | SynExpr.CompExpr (false, _isNotNakedRefCell, comp, _m) -> - let bodyOfCompExpr, tpenv = TcComputationOrSequenceExpression cenv env overallTy mFunExpr (Some(expr.Expr, exprty)) tpenv comp + let bodyOfCompExpr, tpenv = TcComputationExpression cenv env overallTy mFunExpr expr.Expr exprty tpenv comp TcDelayed cenv overallTy env tpenv mExprAndArg (MakeApplicableExprNoFlex cenv bodyOfCompExpr) (tyOfExpr cenv.g bodyOfCompExpr) ExprAtomicFlag.NonAtomic delayed | _ -> error (NotAFunction(denv, overallTy, mFunExpr, mArg)) @@ -9173,6 +9227,7 @@ and TcItemThen cenv overallTy env tpenv (item, mItem, rest, afterResolution) del | SynExpr.TryFinally _ | SynExpr.Lazy _ | SynExpr.Sequential _ + | SynExpr.SequentialOrImplicitYield _ | SynExpr.LetOrUse _ | SynExpr.DotSet _ | SynExpr.DotIndexedSet _ diff --git a/src/fsharp/ast.fs b/src/fsharp/ast.fs index 57343ec57e..7eefb1470a 100644 --- a/src/fsharp/ast.fs +++ b/src/fsharp/ast.fs @@ -672,7 +672,7 @@ and /// F# syntax: lazy expr | Lazy of SynExpr * range: range - /// Seq(seqPoint, isTrueSeq, e1, e2, m) + /// Sequential(seqPoint, isTrueSeq, e1, e2, m) /// isTrueSeq: false indicates "let v = a in b; v" /// /// F# syntax: expr; expr @@ -750,10 +750,12 @@ and /// Computation expressions only, based on JOIN_IN token from lex filter | JoinIn of SynExpr * range * SynExpr * range: range - /// F# syntax: - /// Computation expressions only, implied by final "do" or "do!" + /// Used internally during type checking for translating computation expressions. | ImplicitZero of range: range + /// Used internally during type checking for translating computation expressions. + | SequentialOrImplicitYield of seqPoint:SequencePointInfoForSeq * expr1:SynExpr * expr2:SynExpr * ifNotStmt:SynExpr * range:range + /// F# syntax: yield expr /// F# syntax: return expr /// Computation expressions only @@ -834,6 +836,7 @@ and | SynExpr.TryWith (range=m) | SynExpr.TryFinally (range=m) | SynExpr.Sequential (range=m) + | SynExpr.SequentialOrImplicitYield (range=m) | SynExpr.ArbitraryAfterError (range=m) | SynExpr.FromParseError (range=m) | SynExpr.DiscardAfterMissingQualificationAfterDot (range=m) @@ -873,138 +876,25 @@ and /// range ignoring any (parse error) extra trailing dots member e.RangeSansAnyExtraDot = match e with - | SynExpr.Paren (range=m) - | SynExpr.Quote (range=m) - | SynExpr.Const (range=m) - | SynExpr.Typed (range=m) - | SynExpr.Tuple (range=m) - | SynExpr.ArrayOrList (range=m) - | SynExpr.AnonRecd (range=m) - | SynExpr.Record (range=m) - | SynExpr.New (range=m) - | SynExpr.ObjExpr (range=m) - | SynExpr.While (range=m) - | SynExpr.For (range=m) - | SynExpr.ForEach (range=m) - | SynExpr.CompExpr (range=m) - | SynExpr.ArrayOrListOfSeqExpr (range=m) - | SynExpr.Lambda (range=m) - | SynExpr.Match (range=m) - | SynExpr.MatchLambda (range=m) - | SynExpr.Do (range=m) - | SynExpr.Assert (range=m) - | SynExpr.App (range=m) - | SynExpr.TypeApp (range=m) - | SynExpr.LetOrUse (range=m) - | SynExpr.TryWith (range=m) - | SynExpr.TryFinally (range=m) - | SynExpr.Sequential (range=m) - | SynExpr.ArbitraryAfterError (range=m) - | SynExpr.FromParseError (range=m) - | SynExpr.IfThenElse (range=m) - | SynExpr.LongIdentSet (range=m) - | SynExpr.NamedIndexedPropertySet (range=m) - | SynExpr.DotIndexedGet (range=m) - | SynExpr.DotIndexedSet (range=m) - | SynExpr.DotSet (range=m) - | SynExpr.Set (range=m) - | SynExpr.DotNamedIndexedPropertySet (range=m) - | SynExpr.LibraryOnlyUnionCaseFieldGet (range=m) - | SynExpr.LibraryOnlyUnionCaseFieldSet (range=m) - | SynExpr.LibraryOnlyILAssembly (range=m) - | SynExpr.LibraryOnlyStaticOptimization (range=m) - | SynExpr.TypeTest (range=m) - | SynExpr.Upcast (range=m) - | SynExpr.AddressOf (range=m) - | SynExpr.Downcast (range=m) - | SynExpr.JoinIn (range=m) - | SynExpr.InferredUpcast (range=m) - | SynExpr.InferredDowncast (range=m) - | SynExpr.Null (range=m) - | SynExpr.Lazy (range=m) - | SynExpr.TraitCall (range=m) - | SynExpr.ImplicitZero (range=m) - | SynExpr.YieldOrReturn (range=m) - | SynExpr.YieldOrReturnFrom (range=m) - | SynExpr.LetOrUseBang (range=m) - | SynExpr.MatchBang (range=m) - | SynExpr.DoBang (range=m) -> m | SynExpr.DotGet (expr, _, lidwd, m) -> if lidwd.ThereIsAnExtraDotAtTheEnd then unionRanges expr.Range lidwd.RangeSansAnyExtraDot else m | SynExpr.LongIdent (_, lidwd, _, _) -> lidwd.RangeSansAnyExtraDot | SynExpr.DiscardAfterMissingQualificationAfterDot (expr, _) -> expr.Range - | SynExpr.Fixed (_, m) -> m - | SynExpr.Ident id -> id.idRange + | _ -> e.Range /// Attempt to get the range of the first token or initial portion only - this is extremely ad-hoc, just a cheap way to improve a certain 'query custom operation' error range member e.RangeOfFirstPortion = match e with - // haven't bothered making these cases better than just .Range - | SynExpr.Quote (range=m) - | SynExpr.Const (range=m) - | SynExpr.Typed (range=m) - | SynExpr.Tuple (range=m) - | SynExpr.ArrayOrList (range=m) - | SynExpr.AnonRecd (range=m) - | SynExpr.Record (range=m) - | SynExpr.New (range=m) - | SynExpr.ObjExpr (range=m) - | SynExpr.While (range=m) - | SynExpr.For (range=m) - | SynExpr.CompExpr (range=m) - | SynExpr.ArrayOrListOfSeqExpr (range=m) - | SynExpr.Lambda (range=m) - | SynExpr.Match (range=m) - | SynExpr.MatchLambda (range=m) - | SynExpr.Do (range=m) - | SynExpr.Assert (range=m) - | SynExpr.TypeApp (range=m) - | SynExpr.LetOrUse (range=m) - | SynExpr.TryWith (range=m) - | SynExpr.TryFinally (range=m) - | SynExpr.ArbitraryAfterError (range=m) - | SynExpr.FromParseError (range=m) - | SynExpr.DiscardAfterMissingQualificationAfterDot (range=m) - | SynExpr.IfThenElse (range=m) - | SynExpr.LongIdent (range=m) - | SynExpr.LongIdentSet (range=m) - | SynExpr.NamedIndexedPropertySet (range=m) - | SynExpr.DotIndexedGet (range=m) - | SynExpr.DotIndexedSet (range=m) - | SynExpr.DotGet (range=m) - | SynExpr.DotSet (range=m) - | SynExpr.Set (range=m) - | SynExpr.DotNamedIndexedPropertySet (range=m) - | SynExpr.LibraryOnlyUnionCaseFieldGet (range=m) - | SynExpr.LibraryOnlyUnionCaseFieldSet (range=m) - | SynExpr.LibraryOnlyILAssembly (range=m) - | SynExpr.LibraryOnlyStaticOptimization (range=m) - | SynExpr.TypeTest (range=m) - | SynExpr.Upcast (range=m) - | SynExpr.AddressOf (range=m) - | SynExpr.Downcast (range=m) - | SynExpr.JoinIn (range=m) - | SynExpr.InferredUpcast (range=m) - | SynExpr.InferredDowncast (range=m) - | SynExpr.Null (range=m) - | SynExpr.Lazy (range=m) - | SynExpr.TraitCall (range=m) - | SynExpr.ImplicitZero (range=m) - | SynExpr.YieldOrReturn (range=m) - | SynExpr.YieldOrReturnFrom (range=m) - | SynExpr.LetOrUseBang (range=m) - | SynExpr.MatchBang (range=m) - | SynExpr.DoBang (range=m) -> m // these are better than just .Range, and also commonly applicable inside queries | SynExpr.Paren (_, m, _, _) -> m | SynExpr.Sequential (_, _, e1, _, _) + | SynExpr.SequentialOrImplicitYield (_, e1, _, _, _) | SynExpr.App (_, _, e1, _, _) -> e1.RangeOfFirstPortion | SynExpr.ForEach (_, _, _, pat, _, _, r) -> let start = r.Start let e = (pat.Range: range).Start mkRange r.FileName start e - | SynExpr.Ident id -> id.idRange - | SynExpr.Fixed (_, m) -> m + | _ -> e.Range and [] @@ -2580,6 +2470,8 @@ let rec synExprContainsError inpExpr = walkExpr e1 || walkExpr e2 | SynExpr.Sequential (_, _, e1, e2, _) -> walkExpr e1 || walkExpr e2 + | SynExpr.SequentialOrImplicitYield (_, e1, e2, _, _) -> + walkExpr e1 || walkExpr e2 | SynExpr.IfThenElse (e1, e2, e3opt, _, _, _, _) -> walkExpr e1 || walkExpr e2 || walkExprOpt e3opt | SynExpr.DotIndexedGet (e1, es, _, _) -> diff --git a/src/fsharp/service/ServiceParseTreeWalk.fs b/src/fsharp/service/ServiceParseTreeWalk.fs index abd3472a68..eeab436524 100755 --- a/src/fsharp/service/ServiceParseTreeWalk.fs +++ b/src/fsharp/service/ServiceParseTreeWalk.fs @@ -412,6 +412,7 @@ module public AstTraversal = dive synExpr2 synExpr2.Range traverseSynExpr] |> pick expr | SynExpr.Lazy (synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.SequentialOrImplicitYield (_sequencePointInfoForSeq, synExpr, synExpr2, _, _range) | SynExpr.Sequential (_sequencePointInfoForSeq, _, synExpr, synExpr2, _range) -> [dive synExpr synExpr.Range traverseSynExpr dive synExpr2 synExpr2.Range traverseSynExpr] diff --git a/src/fsharp/service/ServiceUntypedParse.fs b/src/fsharp/service/ServiceUntypedParse.fs index f98fae2f72..84c8947d13 100755 --- a/src/fsharp/service/ServiceUntypedParse.fs +++ b/src/fsharp/service/ServiceUntypedParse.fs @@ -299,6 +299,7 @@ type FSharpParseFileResults(errors: FSharpErrorInfo[], input: Ast.ParsedInput op yield! walkTrySeqPt spTry yield! walkFinallySeqPt spFinally + | SynExpr.SequentialOrImplicitYield (spSeq, e1, e2, _, _) | SynExpr.Sequential (spSeq, _, e1, e2, _) -> yield! walkExpr (match spSeq with SuppressSequencePointOnStmtOfSequential -> false | _ -> true) e1 yield! walkExpr (match spSeq with SuppressSequencePointOnExprOfSequential -> false | _ -> true) e2 diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 7c1b38a4b5..6995c485ab 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -2847,11 +2847,6 @@ Neplatný objektový výraz. U objektů bez přepsání nebo rozhraní by se měl výraz formulovat pomocí notace new Type(args) bez složených závorek. - - Invalid object, sequence or record expression - Neplatný výraz objektu, pořadí nebo záznamu - - Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Neplatný výraz záznamu, pořadí nebo výpočtu. Výrazy pořadí by měly mít notaci seq {{ ... }}. diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 33a03002ea..1d4725f182 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -2847,11 +2847,6 @@ Ungültiger Objektausdruck. Objekte ohne Überschreibungen oder Schnittstellen sollten das Ausdrucksformat "new Type(args)" ohne geschweifte Klammern verwenden. - - Invalid object, sequence or record expression - Ungültiger Objekt-, Sequenz- oder Datensatzausdruck. - - Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Ungültiger Datensatz-, Sequenz- oder Berechnungsausdruck. Sequenzausdrücke müssen das Format "seq {{ ... }}" besitzen. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index 07a6a376d6..dba9ebb7f7 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -2847,11 +2847,6 @@ Expresión de objeto no válida. Los objetos sin invalidaciones ni interfaces deben usar el formato de expresión 'new Type(args)' sin llaves. - - Invalid object, sequence or record expression - Expresión de objeto, secuencia o registro no válida. - - Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Expresión de registro, secuencia o cómputo no válida. Las expresiones de secuencia deben tener el formato 'seq {{ ... }}'. diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index db443013cc..067c0d42c9 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -2847,11 +2847,6 @@ Expression d'objet non valide. Les objets sans substitutions ou interfaces doivent utiliser la forme d'expression 'new Type(args)' sans accolades. - - Invalid object, sequence or record expression - Expression d'objet, de séquence ou d'enregistrement non valide - - Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Expression d'enregistrement, de séquence ou de calcul non valide. Les expressions de séquence doivent avoir le format 'seq {{ ... }}' diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 27d3af91a0..6ff1a46835 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -2847,11 +2847,6 @@ Espressione oggetto non valida. Gli oggetti senza override o interfacce devono usare il formato di espressione 'new Type(args)' senza parentesi graffe. - - Invalid object, sequence or record expression - Espressione record, sequenza o oggetto non valida - - Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Espressione di calcolo, sequenza o record non valida. Il formato delle espressioni sequenza deve essere 'seq {{ ... }}' diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 47430c5e72..822ef18990 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -2847,11 +2847,6 @@ オブジェクト式が無効です。オーバーライドまたはインターフェイスがないオブジェクトには、かっこなしで 'new Type(args)' という形式の式を使用してください。 - - Invalid object, sequence or record expression - オブジェクト式、シーケンス式、またはレコード式が無効です - - Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' 無効なレコード、シーケンス式、またはコンピュテーション式です。シーケンス式は 'seq {{ ... }}' という形式にしてください。 diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index 2f3708ed03..b77f3b4cad 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -2847,11 +2847,6 @@ 개체 식이 잘못되었습니다. 재정의 또는 인터페이스가 없는 개체는 중괄호 없이 식 형식 'new Type(args)'을 사용해야 합니다. - - Invalid object, sequence or record expression - 개체, 시퀀스 또는 레코드 식이 잘못되었습니다. - - Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' 레코드, 시퀀스 또는 계산 식이 잘못되었습니다. 시퀀스 식의 형식은 'seq {{ ... }}'여야 합니다. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index 4b92b5b6a5..0f3e6ef69b 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -2847,11 +2847,6 @@ Nieprawidłowe wyrażenie obiektu. Obiekty bez przesłonięć lub interfejsy powinny używać wyrażenia w postaci „new Typ(argumenty)” bez nawiasów. - - Invalid object, sequence or record expression - Nieprawidłowe wyrażenie obiektu, sekwencji lub rekordu - - Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Nieprawidłowe wyrażenie rekordu, sekwencji lub obliczenia. Wyrażenia sekwencji powinny mieć postać „seq {{ ... }}” diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index d679c9502a..2e4ea8c6dc 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -2847,11 +2847,6 @@ Expressão de objeto inválida. Objetos sem substituições ou interfaces devem usar o formato de expressão 'new Type(args)' sem as chaves. - - Invalid object, sequence or record expression - Expressão de objeto, sequência ou registro inválida - - Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Expressão de registro, sequência ou computação inválida. Expressões de sequência devem estar na forma 'seq {{ ... }}' diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 3fc4173787..5ead284114 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -2847,11 +2847,6 @@ Недопустимое выражение объекта. Объекты без переопределений или интерфейсов должны использовать форму выражения "new Type(args)" без фигурных скобок. - - Invalid object, sequence or record expression - Недопустимое выражение объекта, последовательности или записи - - Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Недопустимая запись, выражение последовательности или вычислительное выражение. Выражения последовательностей должны иметь форму "seq {{ ... }}' diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index a04bc7ada5..db70140c76 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -2847,11 +2847,6 @@ Geçersiz nesne ifadesi. Geçersiz kılmaların ve arabirimlerin olmadığı nesneler küme ayraçsız 'new Type(args)' ifade biçimini kullanmalıdır. - - Invalid object, sequence or record expression - Geçersiz nesne, dizi veya kayıt ifadesi - - Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Geçersiz kayıt, dizi veya hesaplama ifadesi. Dizi ifadeleri 'seq {{ ... }}' biçiminde olmalıdır diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index 38918ceec9..d90cfb843c 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -2847,11 +2847,6 @@ 对象表达式无效。没有重写或接口的对象应使用不带括号的表达式格式“new Type(args)”。 - - Invalid object, sequence or record expression - 对象、序列或记录表达式无效 - - Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' 记录、序列或计算表达式无效。序列表达式的格式应为“seq {{ ... }}”}}' diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 1a02de7e41..6bdcae208b 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -2847,11 +2847,6 @@ 無效的物件運算式。沒有覆寫或介面的物件應該使用不加大括號的運算式形式 'new Type(args)'。 - - Invalid object, sequence or record expression - 無效的物件、順序或記錄運算式 - - Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' 無效的記錄、循序項或計算運算式。循序項運算式應該是 'seq {{ ... }}' 形式。 diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index dd911df60a..e065d6bee9 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -2384,7 +2384,11 @@ module TypecheckTests = let ``type check neg23`` () = singleNegTest (testConfig "typecheck/sigs") "neg23" [] - let ``type check neg24`` () = singleNegTest (testConfig "typecheck/sigs") "neg24" + let ``type check neg24`` () = + let cfg = testConfig "typecheck/sigs" + // For some reason this warning is off by default in the test framework but in this case we are testing for it + let cfg = { cfg with fsc_flags = cfg.fsc_flags.Replace("--nowarn:20", "") } + singleNegTest cfg "neg24" [] let ``type check neg25`` () = singleNegTest (testConfig "typecheck/sigs") "neg25" diff --git a/tests/fsharp/typecheck/sigs/neg24.bsl b/tests/fsharp/typecheck/sigs/neg24.bsl index b782269bb5..f276c01968 100644 --- a/tests/fsharp/typecheck/sigs/neg24.bsl +++ b/tests/fsharp/typecheck/sigs/neg24.bsl @@ -1,30 +1,44 @@ -neg24.fs(11,14,11,39): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression +neg24.fs(53,24,53,30): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. -neg24.fs(12,14,12,41): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression +neg24.fs(55,31,55,37): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. -neg24.fs(13,14,13,33): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression +neg24.fs(57,38,57,42): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. -neg24.fs(14,14,14,41): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression +neg24.fs(60,24,60,34): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. -neg24.fs(15,14,15,43): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression +neg24.fs(62,31,62,41): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. -neg24.fs(16,14,16,35): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression +neg24.fs(64,44,64,48): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. -neg24.fs(17,18,17,45): typecheck error FS0739: Invalid object, sequence or record expression +neg24.fs(70,15,70,18): typecheck error FS0495: The member or object constructor 'M' has no argument or settable return property 'qez'. The required signature is member C.M : abc:int * def:string -> int. -neg24.fs(17,20,17,43): typecheck error FS0793: This construct is ambiguous as part of a sequence expression. Nested expressions may be written using 'let _ = (...)' and nested sequences using 'yield! seq {... }'. +neg24.fs(300,29,300,30): typecheck error FS0020: The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. -neg24.fs(53,24,53,30): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. +neg24.fs(301,17,301,18): typecheck error FS0020: The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. -neg24.fs(55,31,55,37): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. +neg24.fs(302,33,302,34): typecheck error FS0001: All elements of a list must be of the same type as the first element, which here is 'unit'. This element has type 'int'. -neg24.fs(57,38,57,42): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. +neg24.fs(302,36,302,37): typecheck error FS0001: All elements of a list must be of the same type as the first element, which here is 'unit'. This element has type 'int'. -neg24.fs(60,24,60,34): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. +neg24.fs(304,11,305,32): typecheck error FS0193: Type constraint mismatch. The type + 'int' +is not compatible with type + 'unit' -neg24.fs(62,31,62,41): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. -neg24.fs(64,44,64,48): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. +neg24.fs(308,30,308,31): typecheck error FS0020: The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. -neg24.fs(70,15,70,18): typecheck error FS0495: The member or object constructor 'M' has no argument or settable return property 'qez'. The required signature is member C.M : abc:int * def:string -> int. +neg24.fs(309,31,309,32): typecheck error FS0001: This 'if' expression is missing an 'else' branch. Because 'if' is an expression, and not a statement, add an 'else' branch which also returns a value of type 'int'. + +neg24.fs(312,33,312,34): typecheck error FS0020: The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + +neg24.fs(313,38,313,39): typecheck error FS0020: The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + +neg24.fs(313,47,313,48): typecheck error FS0020: The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. + +neg24.fs(331,24,331,25): typecheck error FS0001: The 'if' expression needs to have type 'obj' to satisfy context type requirements. It currently has type 'int'. + +neg24.fs(337,30,337,31): typecheck error FS0001: The 'if' expression needs to have type 'obj' to satisfy context type requirements. It currently has type 'int'. + +neg24.fs(337,37,337,42): typecheck error FS0020: The result of this expression has type 'obj' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'. diff --git a/tests/fsharp/typecheck/sigs/neg24.fs b/tests/fsharp/typecheck/sigs/neg24.fs index 22a8f4df45..6e1e072cf1 100644 --- a/tests/fsharp/typecheck/sigs/neg24.fs +++ b/tests/fsharp/typecheck/sigs/neg24.fs @@ -6,15 +6,15 @@ let test2 (v : Expr<'a> -> Expr<'b>) = <@ fun (i: 'a) -> %v <@i@> @> let test (v : 'a -> Expr<'b>) = <@ fun (i: 'a) -> %(v i) @> -// expect warning -module Negative = - let v1 = [ if true then 1 else 2 ] - let v2 = [ if true then () else () ] - let v6 = [ if true then () ] - let a1 = [| if true then 1 else 2 |] - let a2 = [| if true then () else () |] - let a6 = [| if true then () |] - let s3 = seq { (if true then 1 else 2) } + +module OldNegative = + let v1 = [ if true then 1 else 2 ] // no longer an error or warning + let v2 = [ if true then () else () ] // no longer an error or warning + let v6 = [ if true then () ] // no longer an error or warning + let a1 = [| if true then 1 else 2 |] // no longer an error or warning + let a2 = [| if true then () else () |] // no longer an error or warning + let a6 = [| if true then () |] // no longer an error or warning + let s3 = seq { (if true then 1 else 2) } // no longer an error or warning // expect no warning module Positive = @@ -69,3 +69,271 @@ type C() = // Check that the error for a named argument/setter that does not exist is located in a good place let _ = C().M(qez=3) +module ListPositive2 = + // In this example, implicit yield is enabled becaue there is no explicit 'yield' + let v3 = + [ if true then 1 else 2 ] + + // In this example, implicit yield is enabled because there is no explicit 'yield'. + // When using implicit yield, statements are detected via a type-directed rule which tries + // checks the statement without an expected type and then checks if the type of the resulting + // expression has type 'unit'. + let v3a = + [ printfn "hello" + if true then 1 else 2 // implicit yield enabled + ] + + // In this example, implicit yield is enabled even though there is an explicit 'yield!' + // This is because using 'yield!' is the only way to yield anything + let v3b = + [ printfn "hello" + if true then 1 else 2 + yield! [] ] + + // This example checks subsumption is permitted when using implicit yield + let v3c : obj list = + [ printfn "hello" + if true then 1 else obj() ] + + // Another check that implicit yield is enabled , even though there is a `yield!` + let v3d = + [ if true then 1 else 2 + yield! [] ] + + // Another check that implicit yield is enabled , even though there is a `yield!` + let v3e = + [ yield! [] + if true then 1 else 2 + ] + + // Another check that implicit yield is enabled + let v3f = + [ if true then + printfn "hello" + 1 + else + 2 ] + + // Another check that implicit yield is enabled + let v3g = + [ if true then + 1 + else + printfn "hello" + 2 ] + + // Another check that implicit yield is enabled + let v3h = + [ for i in 1 .. 10 do + 10 + printfn "hello" ] + + // Another check that implicit yield is enabled + let v5 = + [ if true then 1 ] + + // Another check that implicit yield is enabled + let v5a = + [ printfn "hello"; + if true then 1 ] + + // Another check that implicit yield is enabled + let v5b = + [ if true then + printfn "hello" + 1 + ] + +module ArrayPositive2 = + let a3 = + [| (if true then 1 else 2) |] // simple single element sequence + + let a5 = + [| if true then 1 |] + + let l10 = + [ printfn "hello"; yield 1; yield 2 ] // expect ok - the printfn has type unit and is not interpreted as a yield + + // simple case of explicit yield + let l12 : int list = + [ printfn "hello" + if true then yield 1 else yield 2 ] + + // check subsumption is allowed when using explicit yield + let l13 : obj list = + [ printfn "hello" + if true then yield 1 else yield 2 ] + + // check subsumption is allowed when using explicit yield + let l14 : obj list = + [ printfn "hello" + if true then yield 1 ] + +module SeqPositive2 = + let s2 = + seq { if true then () else () } + + let s6 = + seq { if true then () } + + let s4 = + seq { if true then 1 else 2 } + + let s6 = + seq { if true then 1 } + + let s7 = + seq { match 1 with 1 -> 4 | 2 -> 5 | 3 -> 6 | _ -> () } + +module BuilderPositive2 = + type L<'T> = { Make: (unit -> 'T list) } + let L f = { Make = f } + + type ListBuilder() = + member __.Combine(x1: L<'T>, x2: L<'T>) = L(fun () -> x1.Make() @ x2.Make()) + member __.Delay(f: unit -> L<'T>) = L(fun () -> f().Make()) + member __.Zero() = L(fun () -> []) + member __.Yield(a: 'T) = L(fun () -> [a]) + member __.YieldFrom(x: L<'T>) = x + + let list = ListBuilder() + let empty<'T> : L<'T> = list.Zero() + + let v3 = + list { if true then 1 else 2 } // implicit yield enabled + + let v3y = + list { if true then yield 1 else yield 2 } // equivalent explicit yield + + let v3a = + list { + printfn "hello" + if true then 1 else 2 // implicit yield enabled + } + + let v3ay = + list { + printfn "hello" + if true then yield 1 else yield 2 // equivalent explicit yield + } + + let v3b = + list { + printfn "hello" + if true then 1 else 2 // implicit yield, even though there is a `yield!` + yield! empty + } + + let v3bc = + list { + printfn "hello" + if true then yield 1 else yield 2 // equivalent explicit yield + yield! empty + } + + + + + + + + + + + + + + let v3d = + list { + if true then 1 else 2 // implicit yield enabled , even though there is a `yield!` + yield! empty + } + + let v3dy = + list { + if true then yield 1 else yield 2 // equivalent explicit yield + yield! empty + } + + let v3e = + list { + yield! empty + if true then 1 else 2 // implicit yield enabled , even though there is a `yield!` + } + + let v3f = + list { + if true then + printfn "hello" + 1 + else 2 + } + + let v3g = + list { + if true then + 1 + else + printfn "hello" + 2 + } + + let v5 = + list { + if true then 1 + } + + let v5a = + list { + printfn "hello"; + if true then 1 + } + + let v5b = + list { + if true then + printfn "hello" + 1 + } + +module ListNegative2 = + let v4 = [ if true then 1 else yield 2 ] // expect warning about "1" being ignored. There is a 'yield' so statements are statements. + let l11 = [ 4; yield 1; yield 2 ] // expect warning about "1" being ignored. There is a 'yield' so statements are statements. + let l9 = [ printfn "hello"; 1; 2 ] // Note, this is interpreted as a "SimpleSemicolonSequence", so we get "All elements of a list must be of the same type as the first element, which here is 'unit'. This element..." + let v3a : unit list = + [ printfn "hello" + if true then 1 else 2 ] + +module ArrayNegative2 = + let a4 = [| if true then 1 else yield 2 |] // expect warning about "1" being ignored. There is a 'yield' so statements are statements. + let a4 = [| (if true then 1) |] + +module SeqNegative2 = + let s5 = seq { if true then 1 else yield 2 } // expect warning about "1" being ignored. There is a 'yield' so statements are statements. + let s8 = seq { match 1 with 1 -> 4 | 2 -> 5 | 3 -> yield 6 | _ -> () } // expect warning about "4" being ignored. There is a 'yield' so statements are statements. + +module BuilderNegative2 = + type L<'T> = { Make: (unit -> 'T list) } + let L f = { Make = f } + + type ListBuilder() = + member __.Combine(x1: L<'T>, x2: L<'T>) = L(fun () -> x1.Make() @ x2.Make()) + member __.Delay(f: unit -> L<'T>) = L(fun () -> f().Make()) + member __.Zero() = L(fun () -> []) + member __.Yield(a: 'T) = L(fun () -> [a]) + member __.YieldFrom(x: L<'T>) = x + + let list = ListBuilder() + + let v3c : L = + list { + printfn "hello" + if true then 1 else obj() + } + + let v3c : L = + list { + printfn "hello" + if true then yield 1 else obj() + } + diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse01.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse01.fs index 56a7a81993..c2b85aece6 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse01.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse01.fs @@ -1,11 +1,11 @@ // #Regression #Conformance #DataExpressions #Sequences -// Regression test for FSHARP1.0:4527 -//.+'if ... then ... else' +// Note, implicit yield is enabled because no 'yield' is used + + + + + -// warning FS0035: This construct is deprecated: This list or array -// expression includes an element of the form 'if ... then ... else'. Parenthesize -// this expression to indicate it is an individual element of the list or array, to -// disambiguate this from a list generated using a sequence expression. let p = [ if true then 1 else 2 ] (if p = [ 1 ] then 0 else 1) |> exit diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse02.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse02.fs index 724a9b55cc..cabe197b92 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse02.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse02.fs @@ -1,11 +1,11 @@ // #Regression #Conformance #DataExpressions #Sequences -// Regression test for FSHARP1.0:4527 -//.+'if ... then ... else' +// Note, implicit yield is enabled because no 'yield' is used -// warning FS0035: This construct is deprecated: This list or array -// expression includes an element of the form 'if ... then ... else'. Parenthesize -// this expression to indicate it is an individual element of the list or array, to -// disambiguate this from a list generated using a sequence expression. -let p = [ if true then 1 else printfn "hello"; 3 ] -(if p = [ 1 ] then 0 else 1) |> exit + + + + + +let p = [ if false then 1 else printfn "hello"; 3 ] +(if p = [ 3 ] then 0 else 1) |> exit diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse03.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse03.fs index 0d139cd715..286fecdce6 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse03.fs +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse03.fs @@ -1,11 +1,11 @@ // #Regression #Conformance #DataExpressions #Sequences -// Regression test for FSHARP1.0:4527 -//.+'if ... then ... else' +// Note, implicit yield is enabled because no 'yield' is used -// warning FS0035: This construct is deprecated: This list or array -// expression includes an element of the form 'if ... then ... else'. Parenthesize -// this expression to indicate it is an individual element of the list or array, to -// disambiguate this from a list generated using a sequence expression. -let p = [ if true then printfn "hello"; () ];; -(if p = [ () ] then 0 else 1) |> exit + + + + + +let p : unit list = [ if true then printfn "hello"; () ];; // note, both unit-typed expressions interpreted as side-effecting operations +(match p with [ ] -> 0 | _ -> 1) |> exit diff --git a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs b/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs index d47a4c1376..87bf47412c 100644 --- a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs +++ b/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs @@ -1,5 +1,5 @@ -// #Warnings -// +// This no longer gives a warning because implicit yields are now allowed + let div _ _ = 1 let subView _ _ = [1; 2] diff --git a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs b/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs index d360da4d66..d7ca60baec 100644 --- a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs +++ b/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs @@ -1,9 +1,10 @@ -// #Warnings -// +// This no longer gives a warning because implicit yields are now allowed + // stupid things to make the sample compile let div _ _ = 1 let subView _ _ = [1; 2] +let subView2 _ _ = 1 let y = 1 // elmish view @@ -12,7 +13,7 @@ let view model dispatch = div [] [ match y with | 1 -> yield! subView model dispatch - | _ -> subView model dispatch + | _ -> subView2 model dispatch ] ] diff --git a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs b/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs index 238d4388f9..e503582752 100644 --- a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs +++ b/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs @@ -1,5 +1,5 @@ -// #Warnings -// +// This no longer gives a warning because implicit yields are now allowed + // stupid things to make the sample compile let div _ _ = 1 From 8c33139acf6557529aa5286661d62a980940fbc5 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Thu, 4 Jul 2019 20:30:44 +0300 Subject: [PATCH 143/286] Add FSharpChecker.ParseFileNoCache (#7108) * Add FSharpChecker.ParseFileNoCache * Review feedback --- src/fsharp/service/service.fs | 11 +++++++++++ src/fsharp/service/service.fsi | 27 +++++++++++++++++---------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/fsharp/service/service.fs b/src/fsharp/service/service.fs index 5c4bce54d3..6250c87a92 100644 --- a/src/fsharp/service/service.fs +++ b/src/fsharp/service/service.fs @@ -423,6 +423,12 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC return res } + member bc.ParseFileNoCache(filename, sourceText, options, userOpName) = + async { + let parseErrors, parseTreeOpt, anyErrors = ParseAndCheckFile.parseFile(sourceText, filename, options, userOpName, false) + return FSharpParseFileResults(parseErrors, parseTreeOpt, anyErrors, options.SourceFiles) + } + /// Fetch the parse information from the background compiler (which checks w.r.t. the FileSystem API) member __.GetBackgroundParseResultsForFileInProject(filename, options, userOpName) = reactor.EnqueueAndAwaitOpAsync(userOpName, "GetBackgroundParseResultsForFileInProject ", filename, fun ctok -> @@ -961,6 +967,11 @@ type FSharpChecker(legacyReferenceResolver, ic.CheckMaxMemoryReached() backgroundCompiler.ParseFile(filename, sourceText, options, userOpName) + member ic.ParseFileNoCache(filename, sourceText, options, ?userOpName) = + let userOpName = defaultArg userOpName "Unknown" + ic.CheckMaxMemoryReached() + backgroundCompiler.ParseFileNoCache(filename, sourceText, options, userOpName) + member ic.ParseFileInProject(filename, source: string, options, ?userOpName: string) = let userOpName = defaultArg userOpName "Unknown" let parsingOptions, _ = ic.GetParsingOptionsFromProjectOptions(options) diff --git a/src/fsharp/service/service.fsi b/src/fsharp/service/service.fsi index 28e0e6ee6e..9f81f8fccd 100755 --- a/src/fsharp/service/service.fsi +++ b/src/fsharp/service/service.fsi @@ -103,25 +103,32 @@ type public FSharpChecker = member MatchBraces: filename: string * source: string * options: FSharpProjectOptions * ?userOpName: string -> Async<(range * range)[]> /// - /// Parse a source code file, returning a handle that can be used for obtaining navigation bar information - /// To get the full information, call 'CheckFileInProject' method on the result + /// Parses a source code for a file and caches the results. Returns an AST that can be traversed for various features. /// /// - /// The filename for the file. - /// The full source for the file. + /// The path for the file. The file name is used as a module name for implicit top level modules (e.g. in scripts). + /// The source to be parsed. /// Parsing options for the project or script. /// An optional string used for tracing compiler operations associated with this request. member ParseFile: filename: string * sourceText: ISourceText * options: FSharpParsingOptions * ?userOpName: string -> Async /// - /// Parse a source code file, returning a handle that can be used for obtaining navigation bar information - /// To get the full information, call 'CheckFileInProject' method on the result - /// All files except the one being checked are read from the FileSystem API + /// Parses a source code for a file. Returns an AST that can be traversed for various features. /// /// - /// The filename for the file. - /// The full source for the file. - /// The options for the project or script, used to determine active --define conditionals and other options relevant to parsing. + /// The path for the file. The file name is also as a module name for implicit top level modules (e.g. in scripts). + /// The source to be parsed. + /// Parsing options for the project or script. + /// An optional string used for tracing compiler operations associated with this request. + member ParseFileNoCache: filename: string * sourceText: ISourceText * options: FSharpParsingOptions * ?userOpName: string -> Async + + /// + /// Parses a source code for a file. Returns an AST that can be traversed for various features. + /// + /// + /// The path for the file. The file name is also as a module name for implicit top level modules (e.g. in scripts). + /// The source to be parsed. + /// Parsing options for the project or script. /// An optional string used for tracing compiler operations associated with this request. [] member ParseFileInProject: filename: string * source: string * options: FSharpProjectOptions * ?userOpName: string -> Async From a63be4814ab61a8365e8034acdc14bdc60a49987 Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Fri, 5 Jul 2019 12:57:01 +0000 Subject: [PATCH 144/286] Update dependencies from https://github.com/dotnet/arcade build 20190704.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19354.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index daf1a40ab3..7bd629dece 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 733f8297b68dd824044a77d955e62305b9dc43d5 + 30553c0de34454fb8da5229962501af65eb1233f diff --git a/global.json b/global.json index 4fd944a3f1..b141141136 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19353.19", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19354.2", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From f764e6bf8dd5189eaea201dcb29a45edd21a8fb7 Mon Sep 17 00:00:00 2001 From: Kevin Malenfant Date: Fri, 5 Jul 2019 14:15:49 -0600 Subject: [PATCH 145/286] support struct tuple in leaf expression converter (#7144) --- src/fsharp/FSharp.Core/Linq.fs | 7 ++++++- .../core/queriesLeafExpressionConvert/test.fsx | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/fsharp/FSharp.Core/Linq.fs b/src/fsharp/FSharp.Core/Linq.fs index 4663e6f79a..e4deedbf07 100644 --- a/src/fsharp/FSharp.Core/Linq.fs +++ b/src/fsharp/FSharp.Core/Linq.fs @@ -744,7 +744,12 @@ module LeafExpressionConverter = Expression.Lambda(dty, bodyP, vsP) |> asExpr | Patterns.NewTuple args -> - let tupTy = args |> List.map (fun arg -> arg.Type) |> Array.ofList |> Reflection.FSharpType.MakeTupleType + let tupTy = + let argTypes = args |> List.map (fun arg -> arg.Type) |> Array.ofList + if inp.Type.IsValueType then + Reflection.FSharpType.MakeStructTupleType(inp.Type.Assembly, argTypes) + else + Reflection.FSharpType.MakeTupleType(argTypes) let argsP = ConvExprsToLinq env args let rec build ty (argsP: Expression[]) = match Reflection.FSharpValue.PreComputeTupleConstructorInfo ty with diff --git a/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx b/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx index 4e4d1b9f6e..5bc7546828 100644 --- a/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx +++ b/tests/fsharp/core/queriesLeafExpressionConvert/test.fsx @@ -146,6 +146,24 @@ module LeafExpressionEvaluationTests = checkEval "2ver9ewrx" (<@ (1,2,3,4,5,6,7,8,9,10) @>) (1,2,3,4,5,6,7,8,9,10) checkEval "2ver9ewrc" (<@ (1,2,3,4,5,6,7,8,9,10,11) @>) (1,2,3,4,5,6,7,8,9,10,11) checkEval "2ver9ewrv" (<@ (1,2,3,4,5,6,7,8,9,10,11,12) @>) (1,2,3,4,5,6,7,8,9,10,11,12) + + + check "2ver9ewrsf" (let v2 = struct(3,4) in Eval <@ v2 @>) struct(3,4) + + check "2ver9ewrsg" (let v2 = struct(3,4) in Eval <@ struct(v2,v2) @>) struct(struct(3,4),struct(3,4)) + + checkEval "2ver9ewrst" (<@ struct(1,2) @>) struct(1,2) + checkEval "2ver9ewvsk" (<@ struct(1,2,3) @>) struct(1,2,3) + checkEval "2ver9ewrsh" (<@ struct(1,2,3,4) @>) struct(1,2,3,4) + checkEval "2ver9ewrsj" (<@ struct(1,2,3,4,5) @>) struct(1,2,3,4,5) + checkEval "2ver9ewrsk" (<@ struct(1,2,3,4,5,6) @>) struct(1,2,3,4,5,6) + checkEval "2ver9ewrsl" (<@ struct(1,2,3,4,5,6,7) @>) struct(1,2,3,4,5,6,7) + checkEval "2ver9ewrsa" (<@ struct(1,2,3,4,5,6,7,8) @>) struct(1,2,3,4,5,6,7,8) + checkEval "2ver9ewrss" (<@ struct(1,2,3,4,5,6,7,8,9) @>) struct(1,2,3,4,5,6,7,8,9) + checkEval "2ver9ewrsx" (<@ struct(1,2,3,4,5,6,7,8,9,10) @>) struct(1,2,3,4,5,6,7,8,9,10) + checkEval "2ver9ewrsc" (<@ struct(1,2,3,4,5,6,7,8,9,10,11) @>) struct(1,2,3,4,5,6,7,8,9,10,11) + checkEval "2ver9ewrsv" (<@ struct(1,2,3,4,5,6,7,8,9,10,11,12) @>) struct(1,2,3,4,5,6,7,8,9,10,11,12) + checkEval "2ver9ewrb" (<@ System.DateTime.Now.DayOfWeek @>) System.DateTime.Now.DayOfWeek checkEval "2ver9ewrn" (<@ Checked.(+) 1 1 @>) 2 checkEval "2ver9ewrm" (<@ Checked.(-) 1 1 @>) 0 From 8bfca24aa50d6fe392469909816570855b706352 Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Sat, 6 Jul 2019 13:01:21 +0000 Subject: [PATCH 146/286] Update dependencies from https://github.com/dotnet/arcade build 20190705.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19355.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7bd629dece..afc992eb6c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 30553c0de34454fb8da5229962501af65eb1233f + 3e0cbbc6fd6c6d45d7083ee0deb71cec7ea2d91f diff --git a/global.json b/global.json index b141141136..bddc5927b5 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19354.2", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19355.2", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From f2e9ed1f010a5d0dbc31c5fe0811e3c5f8f80a1f Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Sun, 7 Jul 2019 12:54:27 +0000 Subject: [PATCH 147/286] Update dependencies from https://github.com/dotnet/arcade build 20190706.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19356.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index afc992eb6c..4ff4113207 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 3e0cbbc6fd6c6d45d7083ee0deb71cec7ea2d91f + a65d0966dc28861394ce78cfdcb9d5dff370957c diff --git a/global.json b/global.json index bddc5927b5..71a3f7705a 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19355.2", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19356.1", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 274c9a04dae9adc14b592584e6a6018efecbae93 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Wed, 10 Jul 2019 00:50:52 +0100 Subject: [PATCH 148/286] [RFC FS-1068] open static classes (#6807) * open static classes feature * add missing change back * Update dependencies from https://github.com/dotnet/arcade build 20190704.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19354.2 * support struct tuple in leaf expression converter (#7144) * Update dependencies from https://github.com/dotnet/arcade build 20190705.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19355.2 * Update dependencies from https://github.com/dotnet/arcade build 20190706.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19356.1 * fix merge --- eng/Version.Details.xml | 4 +- global.json | 2 +- src/fsharp/ErrorLogger.fs | 8 +- src/fsharp/ExtensionTyping.fs | 1 + src/fsharp/ExtensionTyping.fsi | 1 + src/fsharp/NameResolution.fs | 416 +++++++++++------- src/fsharp/NameResolution.fsi | 6 +- src/fsharp/TastOps.fs | 16 + src/fsharp/TastOps.fsi | 1 + src/fsharp/TypeChecker.fs | 28 +- src/fsharp/service/FSharpCheckerResults.fs | 7 +- src/fsharp/tast.fs | 6 +- .../ProvidedTypes/ProvidedTypes.fs | 2 +- tests/fsharp/core/longnames/test.fsx | 60 +++ tests/service/EditorTests.fs | 10 - .../UnitTests/CompletionProviderTests.fs | 8 + .../Tests.LanguageService.Completion.fs | 4 +- 17 files changed, 373 insertions(+), 207 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index daf1a40ab3..4ff4113207 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 733f8297b68dd824044a77d955e62305b9dc43d5 + a65d0966dc28861394ce78cfdcb9d5dff370957c diff --git a/global.json b/global.json index 4fd944a3f1..71a3f7705a 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19353.19", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19356.1", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } diff --git a/src/fsharp/ErrorLogger.fs b/src/fsharp/ErrorLogger.fs index 680e7c5796..5760aef8a2 100755 --- a/src/fsharp/ErrorLogger.fs +++ b/src/fsharp/ErrorLogger.fs @@ -671,7 +671,7 @@ type public FSharpErrorSeverityOptions = // See https://github.com/Microsoft/visualfsharp/issues/6417, if a compile of the FSharp.Compiler.Services.dll or other compiler -// binary produces exactly 65536 methods then older versions of the compiler raise a bug. If you hit this bug again then try removing -// this. -let dummyMethodFOrBug6417A() = () -let dummyMethodFOrBug6417B() = () +// binary produces exactly 65536 methods then older versions of the compiler raise a bug. If you hit this bug again then try adding +// this back in. +// let dummyMethodFOrBug6417A() = () +// let dummyMethodFOrBug6417B() = () diff --git a/src/fsharp/ExtensionTyping.fs b/src/fsharp/ExtensionTyping.fs index 0c880dd9da..c075e0dbe9 100755 --- a/src/fsharp/ExtensionTyping.fs +++ b/src/fsharp/ExtensionTyping.fs @@ -415,6 +415,7 @@ module internal ExtensionTyping = member __.IsEnum = x.IsEnum member __.IsClass = x.IsClass member __.IsSealed = x.IsSealed + member __.IsAbstract = x.IsAbstract member __.IsInterface = x.IsInterface member __.GetArrayRank() = x.GetArrayRank() member __.GenericParameterPosition = x.GenericParameterPosition diff --git a/src/fsharp/ExtensionTyping.fsi b/src/fsharp/ExtensionTyping.fsi index 5049fffa77..5c679fe69e 100755 --- a/src/fsharp/ExtensionTyping.fsi +++ b/src/fsharp/ExtensionTyping.fsi @@ -120,6 +120,7 @@ module internal ExtensionTyping = member IsInterface : bool member IsClass : bool member IsSealed : bool + member IsAbstract : bool member IsPublic : bool member IsNestedPublic : bool member GenericParameterPosition : int diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index cd8b59794f..06cade8922 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -79,7 +79,6 @@ let ActivePatternElemsOfValRef vref = | Some apinfo -> apinfo.ActiveTags |> List.mapi (fun i _ -> APElemRef(apinfo, vref, i)) | None -> [] - /// Try to make a reference to a value in a module. // // mkNestedValRef may fail if the assembly load set is @@ -315,6 +314,7 @@ type FullyQualifiedFlag = | OpenQualified +type UnqualifiedItems = LayeredMap [] /// The environment of information used to resolve names @@ -322,8 +322,8 @@ type NameResolutionEnv = { /// Display environment information for output eDisplayEnv: DisplayEnv - /// Values and Data Tags available by unqualified name - eUnqualifiedItems: LayeredMap + /// Values, functions, methods and other items available by unqualified name + eUnqualifiedItems: UnqualifiedItems /// Data Tags and Active Pattern Tags available by unqualified name ePatItems: NameMap @@ -418,6 +418,12 @@ type NameResolutionEnv = // Helpers to do with extension members //------------------------------------------------------------------------- +/// Indicates if we only need one result or all possible results from a resolution. +[] +type ResultCollectionSettings = + | AllResults + | AtMostOneResult + /// Allocate the next extension method priority. This is an incrementing sequence of integers /// during type checking. let NextExtensionMethodPriority() = uint64 (newStamp()) @@ -489,6 +495,125 @@ let private GetCSharpStyleIndexedExtensionMembersForTyconRef (amap: Import.Impor [] +/// Query the declared properties of a type (including inherited properties) +let IntrinsicPropInfosOfTypeInScope (infoReader: InfoReader) optFilter ad findFlag m ty = + let g = infoReader.g + let amap = infoReader.amap + let pinfos = GetIntrinsicPropInfoSetsOfType infoReader optFilter ad AllowMultiIntfInstantiations.Yes findFlag m ty + let pinfos = pinfos |> ExcludeHiddenOfPropInfos g amap m + pinfos + +/// Select from a list of extension properties +let SelectPropInfosFromExtMembers (infoReader: InfoReader) ad optFilter declaringTy m extMemInfos = + let g = infoReader.g + let amap = infoReader.amap + // NOTE: multiple "open"'s push multiple duplicate values into eIndexedExtensionMembers, hence use a set. + let seen = HashSet(ExtensionMember.Comparer g) + let propCollector = new PropertyCollector(g, amap, m, declaringTy, optFilter, ad) + for emem in extMemInfos do + if seen.Add emem then + match emem with + | FSExtMem (vref, _pri) -> + match vref.MemberInfo with + | None -> () + | Some membInfo -> propCollector.Collect(membInfo, vref) + | ILExtMem _ -> + // No extension properties coming from .NET + () + propCollector.Close() + +/// Query the available extension properties of a type (including extension properties for inherited types) +let ExtensionPropInfosOfTypeInScope collectionSettings (infoReader:InfoReader) (nenv: NameResolutionEnv) optFilter ad m ty = + let g = infoReader.g + + let extMemsDangling = SelectPropInfosFromExtMembers infoReader ad optFilter ty m nenv.eUnindexedExtensionMembers + + if collectionSettings = ResultCollectionSettings.AtMostOneResult && not (isNil extMemsDangling) then + extMemsDangling + else + let extMemsFromHierarchy = + infoReader.GetEntireTypeHierachy(AllowMultiIntfInstantiations.Yes, m, ty) + |> List.collect (fun ty -> + if isAppTy g ty then + let tcref = tcrefOfAppTy g ty + let extMemInfos = nenv.eIndexedExtensionMembers.Find tcref + SelectPropInfosFromExtMembers infoReader ad optFilter ty m extMemInfos + else []) + + extMemsDangling @ extMemsFromHierarchy + +/// Get all the available properties of a type (both intrinsic and extension) +let AllPropInfosOfTypeInScope collectionSettings infoReader nenv optFilter ad findFlag m ty = + IntrinsicPropInfosOfTypeInScope infoReader optFilter ad findFlag m ty + @ ExtensionPropInfosOfTypeInScope collectionSettings infoReader nenv optFilter ad m ty + +/// Get the available methods of a type (both declared and inherited) +let IntrinsicMethInfosOfType (infoReader:InfoReader) optFilter ad allowMultiIntfInst findFlag m ty = + let g = infoReader.g + let amap = infoReader.amap + let minfos = GetIntrinsicMethInfoSetsOfType infoReader optFilter ad allowMultiIntfInst findFlag m ty + let minfos = minfos |> ExcludeHiddenOfMethInfos g amap m + minfos + +/// Select from a list of extension methods +let SelectMethInfosFromExtMembers (infoReader:InfoReader) optFilter apparentTy m extMemInfos = + let g = infoReader.g + // NOTE: multiple "open"'s push multiple duplicate values into eIndexedExtensionMembers + let seen = HashSet(ExtensionMember.Comparer g) + [ + for emem in extMemInfos do + if seen.Add emem then + match emem with + | FSExtMem (vref, pri) -> + match vref.MemberInfo with + | None -> () + | Some membInfo -> + match TrySelectMemberVal g optFilter apparentTy (Some pri) membInfo vref with + | Some m -> yield m + | _ -> () + | ILExtMem (actualParent, minfo, pri) when (match optFilter with None -> true | Some nm -> nm = minfo.LogicalName) -> + // Make a reference to the type containing the extension members + match minfo with + | ILMeth(_, ilminfo, _) -> + yield (MethInfo.CreateILExtensionMeth (infoReader.amap, m, apparentTy, actualParent, Some pri, ilminfo.RawMetadata)) + // F#-defined IL-style extension methods are not seen as extension methods in F# code + | FSMeth(g, _, vref, _) -> + yield (FSMeth(g, apparentTy, vref, Some pri)) +#if !NO_EXTENSIONTYPING + // // Provided extension methods are not yet supported + | ProvidedMeth(amap, providedMeth, _, m) -> + yield (ProvidedMeth(amap, providedMeth, Some pri, m)) +#endif + | DefaultStructCtor _ -> + () + | _ -> () + ] + +/// Query the available extension properties of a methods (including extension methods for inherited types) +let ExtensionMethInfosOfTypeInScope (collectionSettings:ResultCollectionSettings) (infoReader:InfoReader) (nenv: NameResolutionEnv) optFilter m ty = + let extMemsDangling = SelectMethInfosFromExtMembers infoReader optFilter ty m nenv.eUnindexedExtensionMembers + if collectionSettings = ResultCollectionSettings.AtMostOneResult && not (isNil extMemsDangling) then + extMemsDangling + else + let extMemsFromHierarchy = + infoReader.GetEntireTypeHierachy(AllowMultiIntfInstantiations.Yes, m, ty) + |> List.collect (fun ty -> + let g = infoReader.g + if isAppTy g ty then + let tcref = tcrefOfAppTy g ty + let extValRefs = nenv.eIndexedExtensionMembers.Find tcref + SelectMethInfosFromExtMembers infoReader optFilter ty m extValRefs + else []) + extMemsDangling @ extMemsFromHierarchy + +/// Get all the available methods of a type (both intrinsic and extension) +let AllMethInfosOfTypeInScope collectionSettings infoReader nenv optFilter ad findFlag m ty = + let intrinsic = IntrinsicMethInfosOfType infoReader optFilter ad AllowMultiIntfInstantiations.Yes findFlag m ty + if collectionSettings = ResultCollectionSettings.AtMostOneResult && not (isNil intrinsic) then + intrinsic + else + intrinsic @ ExtensionMethInfosOfTypeInScope collectionSettings infoReader nenv optFilter m ty + //------------------------------------------------------------------------- // Helpers to do with building environments //------------------------------------------------------------------------- @@ -505,7 +630,7 @@ type BulkAdd = Yes | No /// bulkAddMode: true when adding the values from the 'open' of a namespace /// or module, when we collapse the value table down to a dictionary. -let AddValRefsToItems (bulkAddMode: BulkAdd) (eUnqualifiedItems: LayeredMap<_, _>) (vrefs: ValRef[]) = +let AddValRefsToItems (bulkAddMode: BulkAdd) (eUnqualifiedItems: UnqualifiedItems) (vrefs: ValRef[]) = // Object model members are not added to the unqualified name resolution environment let vrefs = vrefs |> Array.filter (fun vref -> not vref.IsMember) @@ -617,7 +742,7 @@ let AddUnionCases1 (tab: Map<_, _>) (ucrefs: UnionCaseRef list) = acc.Add (ucref.CaseName, item)) /// Add a set of union cases to the corresponding sub-table of the environment -let AddUnionCases2 bulkAddMode (eUnqualifiedItems: LayeredMap<_, _>) (ucrefs: UnionCaseRef list) = +let AddUnionCases2 bulkAddMode (eUnqualifiedItems: UnqualifiedItems) (ucrefs: UnionCaseRef list) = match bulkAddMode with | BulkAdd.Yes -> let items = @@ -631,6 +756,30 @@ let AddUnionCases2 bulkAddMode (eUnqualifiedItems: LayeredMap<_, _>) (ucrefs: Un let item = Item.UnionCase(GeneralizeUnionCaseRef ucref, false) acc.Add (ucref.CaseName, item)) +let AddStaticContentOfTyconRefToNameEnv (g:TcGlobals) (amap: Import.ImportMap) m (nenv: NameResolutionEnv) (tcref:TyconRef) = + let ty = generalizedTyconRef tcref + let infoReader = InfoReader(g,amap) + let items = + [| let methGroups = + AllMethInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty + |> List.groupBy (fun m -> m.LogicalName) + + for (methName, methGroup) in methGroups do + let methGroup = methGroup |> List.filter (fun m -> not m.IsInstance && not m.IsClassConstructor) + if not methGroup.IsEmpty then + yield KeyValuePair(methName, Item.MethodGroup(methName, methGroup, None)) + + let propInfos = + AllPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty + |> List.groupBy (fun m -> m.PropertyName) + + for (propName, propInfos) in propInfos do + let propInfos = propInfos |> List.filter (fun m -> m.IsStatic) + for propInfo in propInfos do + yield KeyValuePair(propName , Item.Property(propName,[propInfo])) |] + + { nenv with eUnqualifiedItems = nenv.eUnqualifiedItems.AddAndMarkAsCollapsible items } + /// Add any implied contents of a type definition to the environment. let private AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition (g: TcGlobals) amap m nenv (tcref: TyconRef) = @@ -680,10 +829,14 @@ let private AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition (g: TcGlobals) | _ -> Item.UnqualifiedType [tcref])) else tab - if isILOrRequiredQualifiedAccess || List.isEmpty ucrefs then - tab - else - AddUnionCases2 bulkAddMode tab ucrefs + + let tab = + if isILOrRequiredQualifiedAccess || List.isEmpty ucrefs then + tab + else + AddUnionCases2 bulkAddMode tab ucrefs + + tab let ePatItems = if isILOrRequiredQualifiedAccess || List.isEmpty ucrefs then @@ -691,12 +844,21 @@ let private AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition (g: TcGlobals) else AddUnionCases1 nenv.ePatItems ucrefs - { nenv with - eFieldLabels = eFieldLabels - eUnqualifiedItems = eUnqualifiedItems - ePatItems = ePatItems - eIndexedExtensionMembers = eIndexedExtensionMembers - eUnindexedExtensionMembers = eUnindexedExtensionMembers } + let nenv = + { nenv with + eFieldLabels = eFieldLabels + eUnqualifiedItems = eUnqualifiedItems + ePatItems = ePatItems + eIndexedExtensionMembers = eIndexedExtensionMembers + eUnindexedExtensionMembers = eUnindexedExtensionMembers } + + let nenv = + if TryFindFSharpBoolAttribute g g.attrib_AutoOpenAttribute tcref.Attribs = Some true && isStaticClass g tcref then + AddStaticContentOfTyconRefToNameEnv g amap m nenv tcref + else + nenv + + nenv /// Add a set of type definitions to the name resolution environment let AddTyconRefsToNameEnv bulkAddMode ownDefinition g amap m root nenv tcrefs = @@ -818,8 +980,14 @@ and AddModuleOrNamespaceContentsToNameEnv (g: TcGlobals) amap (ad: AccessorDomai // open M1 // // The list contains [M1b; M1a] -and AddModulesAndNamespacesContentsToNameEnv g amap ad m root nenv modrefs = - (modrefs, nenv) ||> List.foldBack (fun modref acc -> AddModuleOrNamespaceContentsToNameEnv g amap ad m root acc modref) +and AddEntitiesContentsToNameEnv g amap ad m root nenv modrefs = + (modrefs, nenv) ||> List.foldBack (fun modref acc -> AddEntityContentsToNameEnv g amap ad m root acc modref) + +and AddEntityContentsToNameEnv g amap ad m root nenv (modref: EntityRef) = + if modref.IsModuleOrNamespace then + AddModuleOrNamespaceContentsToNameEnv g amap ad m root nenv modref + else + AddStaticContentOfTyconRefToNameEnv g amap m nenv modref /// Add a single modules or namespace to the name resolution environment let AddModuleOrNamespaceRefToNameEnv g amap m root ad nenv (modref: EntityRef) = @@ -911,18 +1079,13 @@ let AddResults res1 res2 = let NoResultsOrUsefulErrors = Result [] -/// Indicates if we only need one result or all possible results from a resolution. -[] -type ResultCollectionSettings = -| AllResults -| AtMostOneResult - let rec CollectResults f = function | [] -> NoResultsOrUsefulErrors | [h] -> OneResult (f h) | h :: t -> AddResults (OneResult (f h)) (CollectResults f t) -let rec CollectAtMostOneResult f = function +let rec CollectAtMostOneResult f inputs = + match inputs with | [] -> NoResultsOrUsefulErrors | [h] -> OneResult (f h) | h :: t -> @@ -1829,13 +1992,13 @@ let CheckForTypeLegitimacyAndMultipleGenericTypeAmbiguities //------------------------------------------------------------------------- /// Perform name resolution for an identifier which must resolve to be a namespace or module. -let rec ResolveLongIndentAsModuleOrNamespace sink atMostOne amap m first fullyQualified (nenv: NameResolutionEnv) ad (id: Ident) (rest: Ident list) isOpenDecl = +let rec ResolveLongIndentAsModuleOrNamespaceOrStaticClass sink (atMostOne: ResultCollectionSettings) amap m allowStaticClasses first fullyQualified (nenv: NameResolutionEnv) ad (id:Ident) (rest: Ident list) isOpenDecl = if first && id.idText = MangledGlobalName then match rest with | [] -> error (Error(FSComp.SR.nrGlobalUsedOnlyAsFirstName(), id.idRange)) | id2 :: rest2 -> - ResolveLongIndentAsModuleOrNamespace sink atMostOne amap m false FullyQualified nenv ad id2 rest2 isOpenDecl + ResolveLongIndentAsModuleOrNamespaceOrStaticClass sink atMostOne amap m allowStaticClasses false FullyQualified nenv ad id2 rest2 isOpenDecl else let moduleOrNamespaces = nenv.ModulesAndNamespaces fullyQualified let namespaceNotFound = lazy( @@ -1848,6 +2011,8 @@ let rec ResolveLongIndentAsModuleOrNamespace sink atMostOne amap m first fullyQu UndefinedName(0, FSComp.SR.undefinedNameNamespaceOrModule, id, suggestModulesAndNamespaces)) + // Avoid generating the same error and name suggestion thunk twice It's not clear this is necessary + // since it's just saving an allocation. let mutable moduleNotFoundErrorCache = None let moduleNotFound (modref: ModuleOrNamespaceRef) (mty: ModuleOrNamespaceType) (id: Ident) depth = match moduleNotFoundErrorCache with @@ -1868,35 +2033,68 @@ let rec ResolveLongIndentAsModuleOrNamespace sink atMostOne amap m first fullyQu let occurence = if isOpenDecl then ItemOccurence.Open else ItemOccurence.Use CallNameResolutionSink sink (m, nenv, item, item, emptyTyparInst, occurence, nenv.DisplayEnv, ad) - match moduleOrNamespaces.TryGetValue id.idText with - | true, modrefs -> + let erefs = + let modrefs = + match moduleOrNamespaces.TryGetValue id.idText with + | true, modrefs -> modrefs + | _ -> [] + + let tcrefs = + if allowStaticClasses then + LookupTypeNameInEnvNoArity fullyQualified id.idText nenv |> List.filter (isStaticClass amap.g) + else [] + + modrefs @ tcrefs + + if not erefs.IsEmpty then /// Look through the sub-namespaces and/or modules - let rec look depth (modref: ModuleOrNamespaceRef) (mty: ModuleOrNamespaceType) (lid: Ident list) = + let rec look depth allowStaticClasses (modref: ModuleOrNamespaceRef) (lid: Ident list) = + let mty = modref.ModuleOrNamespaceType match lid with - | [] -> success (depth, modref, mty) - | id :: rest -> - match mty.ModulesAndNamespacesByDemangledName.TryGetValue id.idText with - | true, mspec -> - let subref = modref.NestedTyconRef mspec - if IsEntityAccessible amap m ad subref then - notifyNameResolution subref id.idRange - look (depth+1) subref mspec.ModuleOrNamespaceType rest - else - moduleNotFound modref mty id depth - | _ -> moduleNotFound modref mty id depth - + | [] -> + success [ (depth, modref, mty) ] - modrefs |> CollectResults2 atMostOne (fun modref -> - if IsEntityAccessible amap m ad modref then - notifyNameResolution modref id.idRange - look 1 modref modref.ModuleOrNamespaceType rest + | id :: rest -> + let especs = + let mspecs = + match mty.ModulesAndNamespacesByDemangledName.TryGetValue id.idText with + | true, res -> [res] + | _ -> [] + let tspecs = + if allowStaticClasses then + LookupTypeNameInEntityNoArity id.idRange id.idText mty + |> List.filter (modref.NestedTyconRef >> isStaticClass amap.g) + else [] + mspecs @ tspecs + + if not especs.IsEmpty then + especs + |> List.map (fun espec -> + let subref = modref.NestedTyconRef espec + if IsEntityAccessible amap m ad subref then + notifyNameResolution subref id.idRange + let allowStaticClasses = allowStaticClasses && (subref.IsModuleOrNamespace || isStaticClass amap.g subref) + look (depth+1) allowStaticClasses subref rest + else + moduleNotFound modref mty id depth) + |> List.reduce AddResults + else + moduleNotFound modref mty id depth + + erefs + |> List.map (fun eref -> + if IsEntityAccessible amap m ad eref then + notifyNameResolution eref id.idRange + let allowStaticClasses = allowStaticClasses && (eref.IsModuleOrNamespace || isStaticClass amap.g eref) + look 1 allowStaticClasses eref rest else raze (namespaceNotFound.Force())) - | _ -> raze (namespaceNotFound.Force()) - + |> List.reduce AddResults + else + raze (namespaceNotFound.Force()) let ResolveLongIndentAsModuleOrNamespaceThen sink atMostOne amap m fullyQualified (nenv: NameResolutionEnv) ad id rest isOpenDecl f = - match ResolveLongIndentAsModuleOrNamespace sink ResultCollectionSettings.AllResults amap m true fullyQualified nenv ad id [] isOpenDecl with + match ResolveLongIndentAsModuleOrNamespaceOrStaticClass sink ResultCollectionSettings.AllResults amap m false true fullyQualified nenv ad id [] isOpenDecl with | Result modrefs -> match rest with | [] -> error(Error(FSComp.SR.nrUnexpectedEmptyLongId(), id.idRange)) @@ -1944,126 +2142,6 @@ let ResolveObjectConstructor (ncenv: NameResolver) edenv m ad ty = // Bind the "." notation (member lookup or lookup in a type) //------------------------------------------------------------------------- -/// Query the declared properties of a type (including inherited properties) -let IntrinsicPropInfosOfTypeInScope (infoReader:InfoReader) optFilter ad findFlag m ty = - let g = infoReader.g - let amap = infoReader.amap - let pinfos = GetIntrinsicPropInfoSetsOfType infoReader optFilter ad AllowMultiIntfInstantiations.Yes findFlag m ty - let pinfos = pinfos |> ExcludeHiddenOfPropInfos g amap m - pinfos - -/// Select from a list of extension properties -let SelectPropInfosFromExtMembers (infoReader:InfoReader) ad optFilter declaringTy m extMemInfos = - let g = infoReader.g - let amap = infoReader.amap - // NOTE: multiple "open"'s push multiple duplicate values into eIndexedExtensionMembers, hence setify. - let seen = HashSet(ExtensionMember.Comparer g) - let propCollector = new PropertyCollector(g, amap, m, declaringTy, optFilter, ad) - for emem in extMemInfos do - if seen.Add emem then - match emem with - | FSExtMem (vref, _pri) -> - match vref.MemberInfo with - | None -> () - | Some membInfo -> propCollector.Collect(membInfo, vref) - | ILExtMem _ -> - // No extension properties coming from .NET - () - propCollector.Close() - -/// Query the available extension properties of a type (including extension properties for inherited types) -let ExtensionPropInfosOfTypeInScope collectionSettings (infoReader:InfoReader) (nenv: NameResolutionEnv) optFilter ad m ty = - let g = infoReader.g - - let extMemsDangling = SelectPropInfosFromExtMembers infoReader ad optFilter ty m nenv.eUnindexedExtensionMembers - - if collectionSettings = ResultCollectionSettings.AtMostOneResult && not (isNil extMemsDangling) then - extMemsDangling - else - let extMemsFromHierarchy = - infoReader.GetEntireTypeHierachy(AllowMultiIntfInstantiations.Yes,m,ty) - |> List.collect (fun ty -> - if isAppTy g ty then - let tcref = tcrefOfAppTy g ty - let extMemInfos = nenv.eIndexedExtensionMembers.Find tcref - SelectPropInfosFromExtMembers infoReader ad optFilter ty m extMemInfos - else []) - - extMemsDangling @ extMemsFromHierarchy - -/// Get all the available properties of a type (both intrinsic and extension) -let AllPropInfosOfTypeInScope collectionSettings infoReader nenv optFilter ad findFlag m ty = - IntrinsicPropInfosOfTypeInScope infoReader optFilter ad findFlag m ty - @ ExtensionPropInfosOfTypeInScope collectionSettings infoReader nenv optFilter ad m ty - -/// Get the available methods of a type (both declared and inherited) -let IntrinsicMethInfosOfType (infoReader:InfoReader) optFilter ad allowMultiIntfInst findFlag m ty = - let g = infoReader.g - let amap = infoReader.amap - let minfos = GetIntrinsicMethInfoSetsOfType infoReader optFilter ad allowMultiIntfInst findFlag m ty - let minfos = minfos |> ExcludeHiddenOfMethInfos g amap m - minfos - -/// Select from a list of extension methods -let SelectMethInfosFromExtMembers (infoReader: InfoReader) optFilter apparentTy m extMemInfos = - let g = infoReader.g - // NOTE: multiple "open"'s push multiple duplicate values into eIndexedExtensionMembers - let seen = HashSet(ExtensionMember.Comparer g) - [ - for emem in extMemInfos do - if seen.Add emem then - match emem with - | FSExtMem (vref, pri) -> - match vref.MemberInfo with - | None -> () - | Some membInfo -> - match TrySelectMemberVal g optFilter apparentTy (Some pri) membInfo vref with - | Some m -> yield m - | _ -> () - | ILExtMem (actualParent, minfo, pri) when (match optFilter with None -> true | Some nm -> nm = minfo.LogicalName) -> - // Make a reference to the type containing the extension members - match minfo with - | ILMeth(_, ilminfo, _) -> - yield (MethInfo.CreateILExtensionMeth (infoReader.amap, m, apparentTy, actualParent, Some pri, ilminfo.RawMetadata)) - // F#-defined IL-style extension methods are not seen as extension methods in F# code - | FSMeth(g, _, vref, _) -> - yield (FSMeth(g, apparentTy, vref, Some pri)) -#if !NO_EXTENSIONTYPING - // // Provided extension methods are not yet supported - | ProvidedMeth(amap, providedMeth, _, m) -> - yield (ProvidedMeth(amap, providedMeth, Some pri, m)) -#endif - | DefaultStructCtor _ -> - () - | _ -> () - ] - -/// Query the available extension properties of a methods (including extension methods for inherited types) -let ExtensionMethInfosOfTypeInScope (collectionSettings:ResultCollectionSettings) (infoReader:InfoReader) (nenv: NameResolutionEnv) optFilter m ty = - let extMemsDangling = SelectMethInfosFromExtMembers infoReader optFilter ty m nenv.eUnindexedExtensionMembers - if collectionSettings = ResultCollectionSettings.AtMostOneResult && not (isNil extMemsDangling) then - extMemsDangling - else - let extMemsFromHierarchy = - infoReader.GetEntireTypeHierachy(AllowMultiIntfInstantiations.Yes,m,ty) - |> List.collect (fun ty -> - let g = infoReader.g - if isAppTy g ty then - let tcref = tcrefOfAppTy g ty - let extValRefs = nenv.eIndexedExtensionMembers.Find tcref - SelectMethInfosFromExtMembers infoReader optFilter ty m extValRefs - else []) - extMemsDangling @ extMemsFromHierarchy - -/// Get all the available methods of a type (both intrinsic and extension) -let AllMethInfosOfTypeInScope collectionSettings infoReader nenv optFilter ad findFlag m ty = - let intrinsic = IntrinsicMethInfosOfType infoReader optFilter ad AllowMultiIntfInstantiations.Yes findFlag m ty - if collectionSettings = ResultCollectionSettings.AtMostOneResult && not (isNil intrinsic) then - intrinsic - else - intrinsic @ ExtensionMethInfosOfTypeInScope collectionSettings infoReader nenv optFilter m ty - - /// Used to report an error condition where name resolution failed due to an indeterminate type exception IndeterminateType of range @@ -3980,6 +4058,7 @@ let rec ResolvePartialLongIdentPrim (ncenv: NameResolver) (nenv: NameResolutionE ResolvePartialLongIdentInModuleOrNamespace ncenv nenv isApplicableMeth m ad modref rest allowObsolete else []) + // Look for values called 'id' that accept the dot-notation let values, isItemVal = (match nenv.eUnqualifiedItems.TryGetValue id with @@ -4140,6 +4219,7 @@ and ResolvePartialLongIdentToClassOrRecdFieldsImpl (ncenv: NameResolver) (nenv: ResolvePartialLongIdentInModuleOrNamespaceForRecordFields ncenv nenv m ad modref rest allowObsolete else []) + let qualifiedFields = match rest with | [] -> diff --git a/src/fsharp/NameResolution.fsi b/src/fsharp/NameResolution.fsi index 8ec9caedc7..4d809d435a 100755 --- a/src/fsharp/NameResolution.fsi +++ b/src/fsharp/NameResolution.fsi @@ -201,7 +201,7 @@ val internal AddModuleOrNamespaceRefsToNameEnv : TcGlobals -> val internal AddModuleOrNamespaceRefToNameEnv : TcGlobals -> ImportMap -> range -> bool -> AccessorDomain -> NameResolutionEnv -> ModuleOrNamespaceRef -> NameResolutionEnv /// Add a list of modules or namespaces to the name resolution environment -val internal AddModulesAndNamespacesContentsToNameEnv : TcGlobals -> ImportMap -> AccessorDomain -> range -> bool -> NameResolutionEnv -> ModuleOrNamespaceRef list -> NameResolutionEnv +val internal AddEntitiesContentsToNameEnv : TcGlobals -> ImportMap -> AccessorDomain -> range -> bool -> NameResolutionEnv -> ModuleOrNamespaceRef list -> NameResolutionEnv /// A flag which indicates if it is an error to have two declared type parameters with identical names /// in the name resolution environment. @@ -468,8 +468,8 @@ type PermitDirectReferenceToGeneratedType = | Yes | No -/// Resolve a long identifier to a namespace or module. -val internal ResolveLongIndentAsModuleOrNamespace : TcResultsSink -> ResultCollectionSettings -> Import.ImportMap -> range -> bool -> FullyQualifiedFlag -> NameResolutionEnv -> AccessorDomain -> Ident -> Ident list -> isOpenDecl: bool -> ResultOrException<(int * ModuleOrNamespaceRef * ModuleOrNamespaceType) list > +/// Resolve a long identifier to a namespace, module or static class. +val internal ResolveLongIndentAsModuleOrNamespaceOrStaticClass : TcResultsSink -> ResultCollectionSettings -> Import.ImportMap -> range -> allowStaticClasses: bool -> first: bool -> FullyQualifiedFlag -> NameResolutionEnv -> AccessorDomain -> Ident -> Ident list -> isOpenDecl: bool -> ResultOrException<(int * ModuleOrNamespaceRef * ModuleOrNamespaceType) list > /// Resolve a long identifier to an object constructor. val internal ResolveObjectConstructor : NameResolver -> DisplayEnv -> range -> AccessorDomain -> TType -> ResultOrException diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index cdf9aef3d5..11c5d5e8a1 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -8941,3 +8941,19 @@ let isThreadOrContextStatic g attrs = let mkUnitDelayLambda (g: TcGlobals) m e = let uv, _ = mkCompGenLocal m "unitVar" g.unit_ty mkLambda m uv (e, tyOfExpr g e) + + +let isStaticClass (g:TcGlobals) (x: EntityRef) = + not x.IsModuleOrNamespace && + x.TyparsNoRange.IsEmpty && + ((x.IsILTycon && + x.ILTyconRawMetadata.IsSealed && + x.ILTyconRawMetadata.IsAbstract) +#if !NO_EXTENSIONTYPING + || (x.IsProvided && + match x.TypeReprInfo with + | TProvidedTypeExtensionPoint info -> info.IsSealed && info.IsAbstract + | _ -> false) +#endif + || (not x.IsILTycon && not x.IsProvided && HasFSharpAttribute g g.attrib_AbstractClassAttribute x.Attribs)) && + not (HasFSharpAttribute g g.attrib_RequireQualifiedAccessAttribute x.Attribs) diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 46088de6bd..01e2070c41 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -2295,3 +2295,4 @@ val isThreadOrContextStatic: TcGlobals -> Attrib list -> bool val mkUnitDelayLambda: TcGlobals -> range -> Expr -> Expr +val isStaticClass: g: TcGlobals -> tcref: TyconRef -> bool \ No newline at end of file diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 0364200cca..fdbb1482b7 100644 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -371,11 +371,11 @@ let AddLocalTyconsAndReport tcSink scopem g amap m tycons env = CallEnvSink tcSink (scopem, env.NameEnv, env.eAccessRights) env -/// Adjust the TcEnv to account for opening the set of modules and namespaces implied by an `open` declaration -let OpenModulesOrNamespaces tcSink g amap scopem root env mvvs openDeclaration = +/// Adjust the TcEnv to account for opening the set of modules, namespaces or static classes implied by an `open` declaration +let OpenEntities tcSink g amap scopem root env mvvs openDeclaration = let env = if isNil mvvs then env else - { env with eNameResEnv = AddModulesAndNamespacesContentsToNameEnv g amap env.eAccessRights scopem root env.eNameResEnv mvvs } + { env with eNameResEnv = AddEntitiesContentsToNameEnv g amap env.eAccessRights scopem root env.eNameResEnv mvvs } CallEnvSink tcSink (scopem, env.NameEnv, env.eAccessRights) CallOpenDeclarationSink tcSink openDeclaration env @@ -645,11 +645,11 @@ let ImplicitlyOpenOwnNamespace tcSink g amap scopem enclosingNamespacePath env = match enclosingNamespacePathToOpen with | id :: rest -> let ad = env.eAccessRights - match ResolveLongIndentAsModuleOrNamespace tcSink ResultCollectionSettings.AllResults amap scopem true OpenQualified env.eNameResEnv ad id rest true with + match ResolveLongIndentAsModuleOrNamespaceOrStaticClass tcSink ResultCollectionSettings.AllResults amap scopem true true OpenQualified env.eNameResEnv ad id rest true with | Result modrefs -> let modrefs = List.map p23 modrefs let openDecl = OpenDeclaration.Create (enclosingNamespacePathToOpen, modrefs, scopem, true) - OpenModulesOrNamespaces tcSink g amap scopem false env modrefs openDecl + OpenEntities tcSink g amap scopem false env modrefs openDecl | Exception _ -> env | _ -> env @@ -6884,7 +6884,7 @@ and TcConstExpr cenv overallTy env m tpenv c = let expr = let modName = "NumericLiteral" + suffix let ad = env.eAccessRights - match ResolveLongIndentAsModuleOrNamespace cenv.tcSink ResultCollectionSettings.AtMostOneResult cenv.amap m true OpenQualified env.eNameResEnv ad (ident (modName, m)) [] false with + match ResolveLongIndentAsModuleOrNamespaceOrStaticClass cenv.tcSink ResultCollectionSettings.AtMostOneResult cenv.amap m true true OpenQualified env.eNameResEnv ad (ident (modName, m)) [] false with | Result [] | Exception _ -> error(Error(FSComp.SR.tcNumericLiteralRequiresModule modName, m)) | Result ((_, mref, _) :: _) -> @@ -8774,7 +8774,7 @@ and TcNameOfExpr cenv env tpenv (synArg: SynExpr) = | LongOrSingleIdent (false, (LongIdentWithDots(longId, _) as lidd), _, _) when longId.Length > 0 -> let ad = env.eAccessRights let id, rest = List.headAndTail longId - match ResolveLongIndentAsModuleOrNamespace cenv.tcSink ResultCollectionSettings.AllResults cenv.amap m true OpenQualified env.eNameResEnv ad id rest true with + match ResolveLongIndentAsModuleOrNamespaceOrStaticClass cenv.tcSink ResultCollectionSettings.AllResults cenv.amap m false true OpenQualified env.eNameResEnv ad id rest true with | Result modref when delayed.IsEmpty && modref |> List.exists (p23 >> IsEntityAccessible cenv.amap m ad) -> () // resolved to a module or namespace, done with checks | _ -> @@ -12642,19 +12642,19 @@ let TcTyconMemberSpecs cenv env containerInfo declKind tpenv (augSpfn: SynMember // Bind 'open' declarations //------------------------------------------------------------------------- -let TcModuleOrNamespaceLidAndPermitAutoResolve tcSink env amap (longId: Ident list) = +let TcOpenLidAndPermitAutoResolve tcSink env amap (longId : Ident list) = let ad = env.eAccessRights match longId with | [] -> [] | id :: rest -> let m = longId |> List.map (fun id -> id.idRange) |> List.reduce unionRanges - match ResolveLongIndentAsModuleOrNamespace tcSink ResultCollectionSettings.AllResults amap m true OpenQualified env.eNameResEnv ad id rest true with + match ResolveLongIndentAsModuleOrNamespaceOrStaticClass tcSink ResultCollectionSettings.AllResults amap m true true OpenQualified env.eNameResEnv ad id rest true with | Result res -> res | Exception err -> errorR(err); [] let TcOpenDecl tcSink (g: TcGlobals) amap m scopem env (longId: Ident list) = - match TcModuleOrNamespaceLidAndPermitAutoResolve tcSink env amap longId with + match TcOpenLidAndPermitAutoResolve tcSink env amap longId with | [] -> env | modrefs -> @@ -12706,7 +12706,7 @@ let TcOpenDecl tcSink (g: TcGlobals) amap m scopem env (longId: Ident list) = modrefs |> List.iter (fun modref -> CheckEntityAttributes g modref m |> CommitOperationResult) let openDecl = OpenDeclaration.Create (longId, modrefs, scopem, false) - let env = OpenModulesOrNamespaces tcSink g amap scopem false env modrefs openDecl + let env = OpenEntities tcSink g amap scopem false env modrefs openDecl env @@ -14181,7 +14181,7 @@ module MutRecBindingChecking = let resolved = match p with | [] -> Result [] - | id :: rest -> ResolveLongIndentAsModuleOrNamespace cenv.tcSink ResultCollectionSettings.AllResults cenv.amap m true OpenQualified env.eNameResEnv ad id rest false + | id :: rest -> ResolveLongIndentAsModuleOrNamespaceOrStaticClass cenv.tcSink ResultCollectionSettings.AllResults cenv.amap m false true OpenQualified env.eNameResEnv ad id rest false let mvvs = ForceRaise resolved if isNil mvvs then env else let modrefs = mvvs |> List.map p23 @@ -17008,7 +17008,7 @@ let rec TcSignatureElementNonMutRec cenv parent typeNames endm (env: TcEnv) synS let resolved = match p with | [] -> Result [] - | id :: rest -> ResolveLongIndentAsModuleOrNamespace cenv.tcSink ResultCollectionSettings.AllResults cenv.amap m true OpenQualified env.eNameResEnv ad id rest false + | id :: rest -> ResolveLongIndentAsModuleOrNamespaceOrStaticClass cenv.tcSink ResultCollectionSettings.AllResults cenv.amap m false true OpenQualified env.eNameResEnv ad id rest false let mvvs = ForceRaise resolved let scopem = unionRanges m endm let unfilteredModrefs = mvvs |> List.map p23 @@ -17562,7 +17562,7 @@ let ApplyAssemblyLevelAutoOpenAttributeToTcEnv g amap (ccu: CcuThunk) scopem env | ValueNone -> warn() | ValueSome _ -> let openDecl = OpenDeclaration.Create ([], [modref], scopem, false) - OpenModulesOrNamespaces TcResultsSink.NoSink g amap scopem root env [modref] openDecl + OpenEntities TcResultsSink.NoSink g amap scopem root env [modref] openDecl // Add the CCU and apply the "AutoOpen" attributes let AddCcuToTcEnv(g, amap, scopem, env, assemblyName, ccu, autoOpens, internalsVisible) = diff --git a/src/fsharp/service/FSharpCheckerResults.fs b/src/fsharp/service/FSharpCheckerResults.fs index 278467ca06..9a5c778db3 100644 --- a/src/fsharp/service/FSharpCheckerResults.fs +++ b/src/fsharp/service/FSharpCheckerResults.fs @@ -850,7 +850,12 @@ type internal TypeCheckInfo | Some(CompletionContext.OpenDeclaration) -> GetDeclaredItems (parseResultsOpt, lineStr, origLongIdentOpt, colAtEndOfNamesAndResidue, residueOpt, lastDotPos, line, loc, filterCtors, resolveOverloads, hasTextChangedSinceLastTypecheck, false, getAllSymbols) |> Option.map (fun (items, denv, m) -> - items |> List.filter (fun x -> match x.Item with Item.ModuleOrNamespaces _ -> true | _ -> false), denv, m) + items + |> List.filter (fun x -> + match x.Item with + | Item.ModuleOrNamespaces _ -> true + | Item.Types (_, tcrefs) when tcrefs |> List.exists (fun ty -> isAppTy g ty && isStaticClass g (tcrefOfAppTy g ty)) -> true + | _ -> false), denv, m) // Completion at '(x: ...)" | Some (CompletionContext.PatternType) -> diff --git a/src/fsharp/tast.fs b/src/fsharp/tast.fs index dd8f0506f7..d59c33f700 100644 --- a/src/fsharp/tast.fs +++ b/src/fsharp/tast.fs @@ -1446,7 +1446,10 @@ and IsSealed: bool /// A flag read eagerly from the provided type and used to compute basic properties of the type definition. - IsInterface: bool + IsAbstract: bool + + /// A flag read eagerly from the provided type and used to compute basic properties of the type definition. + IsInterface: bool /// A flag read eagerly from the provided type and used to compute basic properties of the type definition. IsStructOrEnum: bool @@ -2009,6 +2012,7 @@ and Construct = IsStructOrEnum = st.PUntaint((fun st -> st.IsValueType || st.IsEnum), m) IsInterface = st.PUntaint((fun st -> st.IsInterface), m) IsSealed = st.PUntaint((fun st -> st.IsSealed), m) + IsAbstract = st.PUntaint((fun st -> st.IsAbstract), m) IsClass = st.PUntaint((fun st -> st.IsClass), m) IsErased = isErased IsSuppressRelocate = isSuppressRelocate } diff --git a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs index 4597451990..e7a924bcfa 100644 --- a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs +++ b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs @@ -4026,7 +4026,7 @@ namespace ProviderImplementation.ProvidedTypes.AssemblyReader // Emit compressed untagged integer member buf.EmitZUntaggedIndex big idx = if big then buf.EmitInt32 idx - elif idx > 0xffff then failwith "EmitZUntaggedIndex: too big for small address or simple index" + elif idx > 0xffff then failwithf "EmitZUntaggedIndex: too big for small address or simple index, idx = %d, big = %A, stack = %s" idx big ((new System.Diagnostics.StackTrace()).ToString()) else buf.EmitInt32AsUInt16 idx // Emit compressed tagged integer diff --git a/tests/fsharp/core/longnames/test.fsx b/tests/fsharp/core/longnames/test.fsx index 577dc547a6..3692043c7d 100644 --- a/tests/fsharp/core/longnames/test.fsx +++ b/tests/fsharp/core/longnames/test.fsx @@ -688,6 +688,66 @@ module rec Ok23 = test "lkneecec09iew23" (typeof.FullName.Contains("AModule") ) + +[] +type MyMath() = + static member Min(a: double, b: double) = System.Math.Min(a, b) + static member Min(a: int, b: int) = System.Math.Min(a, b) + +[] +type AutoOpenMyMath() = + static member AutoMin(a: double, b: double) = System.Math.Min(a, b) + static member AutoMin(a: int, b: int) = System.Math.Min(a, b) + +[] +type NotAllowedToOpen() = + static member QualifiedMin(a: double, b: double) = System.Math.Min(a, b) + static member QualifiedMin(a: int, b: int) = System.Math.Min(a, b) + +module OpenSystemMathOnce = + + open System.Math + let x = Min(1.0, 2.0) + test "vwejhweoiu" (x = 1.0) + + +module OpenSystemMathTwice = + + open System.Math + let x = Min(1.0, 2.0) + + open System.Math + let x2 = Min(2.0, 1.0) + + test "vwejhweoiu2" (x2 = 1.0) + +module OpenMyMathOnce = + + open MyMath + let x = Min(1.0, 2.0) + let x2 = Min(1, 2) + + test "vwejhweoiu2" (x = 1.0) + test "vwejhweoiu3" (x2 = 1) + +module DontOpenAutoMath = + + let x = AutoMin(1.0, 2.0) + let x2 = AutoMin(1, 2) + + test "vwejhweoiu2" (x = 1.0) + test "vwejhweoiu3" (x2 = 1) + +module OpenAutoMath = + open AutoOpenMyMath + //open NotAllowedToOpen + + let x = AutoMin(1.0, 2.0) + let x2 = AutoMin(1, 2) + + test "vwejhweoiu2" (x = 1.0) + test "vwejhweoiu3" (x2 = 1) + #if TESTS_AS_APP let RUN() = !failures #else diff --git a/tests/service/EditorTests.fs b/tests/service/EditorTests.fs index 63406f09cb..69b9e40764 100644 --- a/tests/service/EditorTests.fs +++ b/tests/service/EditorTests.fs @@ -1288,16 +1288,6 @@ let ``Test TPProject param info`` () = #endif // TEST_TP_PROJECTS -#if EXE - -``Intro test`` () -//``Test TPProject all symbols`` () -//``Test TPProject errors`` () -//``Test TPProject quick info`` () -//``Test TPProject param info`` () -``Basic cancellation test`` () -``Intro test`` () -#endif [] let ``FSharpField.IsNameGenerated`` () = diff --git a/vsintegration/tests/UnitTests/CompletionProviderTests.fs b/vsintegration/tests/UnitTests/CompletionProviderTests.fs index 91339ffde4..97ea7cbeff 100644 --- a/vsintegration/tests/UnitTests/CompletionProviderTests.fs +++ b/vsintegration/tests/UnitTests/CompletionProviderTests.fs @@ -444,6 +444,14 @@ List(). "ExtensionMeth"] VerifyCompletionListExactly(fileContents, "List().", expected) +[] +let ``Completion for open contains namespaces and static types``() = + let fileContents = """ +open System.Ma +""" + let expected = ["Management"; "Math"] // both namespace and static type + VerifyCompletionList(fileContents, "System.Ma", expected, []) + [] let ``No completion on type name at declaration site``() = let fileContents = """ diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs index 9e58d24c1f..a1ea76e717 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.Completion.fs @@ -3639,8 +3639,8 @@ let x = query { for bbbb in abbbbc(*D0*) do AssertAutoCompleteContains [ "open System." ] "." // marker - [ "Collections" ] // should contain (namespace) - [ "Console" ] // should not contain (type) + [ "Collections"; "Console" ] // should contain (namespace, static type) + [ "Int32" ] // should not contain (non-static type) [] member public this.``OpenNamespaceOrModule.CompletionOnlyContainsNamespaceOrModule.Case2``() = From 0a90022667ff1f5e9cb2f9ddf3c1ce4a32efd07b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2019 16:51:20 -0700 Subject: [PATCH 149/286] [master] Update dependencies from dotnet/arcade (#7162) * Update dependencies from https://github.com/dotnet/arcade build 20190708.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19358.1 * Update dependencies from https://github.com/dotnet/arcade build 20190709.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19359.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4ff4113207..cb67136ddc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - a65d0966dc28861394ce78cfdcb9d5dff370957c + ef3834feb8615429a58808cdcf9ad9284d767654 diff --git a/global.json b/global.json index 71a3f7705a..733aa27d45 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19356.1", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19359.1", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From e057f09a57448f15980048118b4a36842c9e3bb4 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Tue, 9 Jul 2019 18:11:36 -0700 Subject: [PATCH 150/286] Always recover when trying to parse inline IL (#7167) --- src/fsharp/ast.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/ast.fs b/src/fsharp/ast.fs index 3c341131fb..46bb6b1420 100644 --- a/src/fsharp/ast.fs +++ b/src/fsharp/ast.fs @@ -1982,7 +1982,7 @@ let ParseAssemblyCodeInstructions s m = try FSharp.Compiler.AbstractIL.Internal.AsciiParser.ilInstrs FSharp.Compiler.AbstractIL.Internal.AsciiLexer.token (UnicodeLexing.StringAsLexbuf s) - with RecoverableParseError -> + with _ -> errorR(Error(FSComp.SR.astParseEmbeddedILError(), m)); [| |] #endif From 91d783f8426634861faa2db3806b723b99b20fce Mon Sep 17 00:00:00 2001 From: Will Smith Date: Tue, 9 Jul 2019 19:47:20 -0700 Subject: [PATCH 151/286] Always recover when trying to parse inline IL (#7167) (#7176) --- src/fsharp/ast.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/ast.fs b/src/fsharp/ast.fs index 3c341131fb..46bb6b1420 100644 --- a/src/fsharp/ast.fs +++ b/src/fsharp/ast.fs @@ -1982,7 +1982,7 @@ let ParseAssemblyCodeInstructions s m = try FSharp.Compiler.AbstractIL.Internal.AsciiParser.ilInstrs FSharp.Compiler.AbstractIL.Internal.AsciiLexer.token (UnicodeLexing.StringAsLexbuf s) - with RecoverableParseError -> + with _ -> errorR(Error(FSComp.SR.astParseEmbeddedILError(), m)); [| |] #endif From be1cdd7afdaf33f6504ae5fd5097114fa3338a3a Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Wed, 10 Jul 2019 12:57:06 +0000 Subject: [PATCH 152/286] Update dependencies from https://github.com/dotnet/arcade build 20190709.6 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19359.6 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index cb67136ddc..0c5078f9f9 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - ef3834feb8615429a58808cdcf9ad9284d767654 + 0f5dd7680174620f31c9a00cdb2ac0b0e70e631f diff --git a/global.json b/global.json index 733aa27d45..4c66387e58 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19359.1", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19359.6", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From b3f4e987af96b1a25880506d9bacd5b0e43afedc Mon Sep 17 00:00:00 2001 From: Will Smith Date: Wed, 10 Jul 2019 13:27:09 -0700 Subject: [PATCH 153/286] Stack overflow fixes (#7151) * Trying to fix the stack overflow case in ilxgen * Added stack guard to GenExpr * Still trying to resolve this * This resolves the stack overflow, but need to review * Adding better tests * Fixing compile and run successfully assert * One test passes * Fixing a few things * Delete fieldNames.txt * Update IlxGen.fs * Update IlxGen.fs * Update IlxGen.fs * More work on CompilerAssert * Got verifying IL working on method * Always delay gen methods when already gen'ing in one. Some small refactoring, created IlxMethodInfo type instead of using large tuples. * Better error message for stack overflow * small msg change * Simplifying some tests * Removing attempt at bringing a FSharpQA test to nunit * Fixing up seq points * More seq point tweaks * Trying to fix ilxgen * Fixing ilxgen * Using RunScript * Fix test * removed IlxMethodInfo * trivial refactor * another quick refactor --- src/fsharp/IlxGen.fs | 188 +- src/fsharp/lib.fs | 11 + tests/fsharp/Compiler/CompilerAssert.fs | 94 +- tests/fsharp/Compiler/ILChecker.fs | 97 + tests/fsharp/Compiler/ILHelpers.fs | 140 - .../Language/SpanOptimizationTests.fs | 98 +- .../Language/StringConcatOptimizationTests.fs | 27 +- .../fsharp/Compiler/Stress/LargeExprTests.fs | 3550 +++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 3 +- 9 files changed, 3933 insertions(+), 275 deletions(-) create mode 100644 tests/fsharp/Compiler/ILChecker.fs delete mode 100644 tests/fsharp/Compiler/ILHelpers.fs create mode 100644 tests/fsharp/Compiler/Stress/LargeExprTests.fs diff --git a/src/fsharp/IlxGen.fs b/src/fsharp/IlxGen.fs index c188b54807..74d633b9f9 100644 --- a/src/fsharp/IlxGen.fs +++ b/src/fsharp/IlxGen.fs @@ -245,6 +245,12 @@ type cenv = /// Used to apply forced inlining optimizations to witnesses generated late during codegen mutable optimizeDuringCodeGen: (Expr -> Expr) + + /// What depth are we at when generating an expression? + mutable exprRecursionDepth: int + + /// Delayed Method Generation - prevents stack overflows when we need to generate methods that are split into many methods by the optimizer. + delayedGenMethods: Queue unit> } @@ -2130,20 +2136,53 @@ let DoesGenExprStartWithSequencePoint g sp expr = FirstEmittedCodeWillBeSequencePoint g sp expr || EmitSequencePointForWholeExpr g sp expr +let ProcessSequencePointForExpr (cenv: cenv) (cgbuf: CodeGenBuffer) sp expr = + let g = cenv.g + if not (FirstEmittedCodeWillBeSequencePoint g sp expr) then + if EmitSequencePointForWholeExpr g sp expr then + CG.EmitSeqPoint cgbuf (RangeOfSequencePointForWholeExpr g expr) + elif EmitHiddenCodeMarkerForWholeExpr g sp expr then + cgbuf.EmitStartOfHiddenCode() + //------------------------------------------------------------------------- // Generate expressions //------------------------------------------------------------------------- -let rec GenExpr (cenv: cenv) (cgbuf: CodeGenBuffer) eenv sp expr sequel = +let rec GenExpr cenv cgbuf eenv sp (expr: Expr) sequel = + cenv.exprRecursionDepth <- cenv.exprRecursionDepth + 1 + + if cenv.exprRecursionDepth > 1 then + StackGuard.EnsureSufficientExecutionStack cenv.exprRecursionDepth + GenExprAux cenv cgbuf eenv sp expr sequel + else + GenExprWithStackGuard cenv cgbuf eenv sp expr sequel + + cenv.exprRecursionDepth <- cenv.exprRecursionDepth - 1 + + if cenv.exprRecursionDepth = 0 then + ProcessDelayedGenMethods cenv + +and ProcessDelayedGenMethods cenv = + while cenv.delayedGenMethods.Count > 0 do + let gen = cenv.delayedGenMethods.Dequeue () + gen cenv + +and GenExprWithStackGuard cenv cgbuf eenv sp expr sequel = + assert (cenv.exprRecursionDepth = 1) + try + GenExprAux cenv cgbuf eenv sp expr sequel + assert (cenv.exprRecursionDepth = 1) + with + | :? System.InsufficientExecutionStackException -> + error(InternalError("Expression is too large and/or complex to emit.", expr.Range)) + +and GenExprAux (cenv: cenv) (cgbuf: CodeGenBuffer) eenv sp expr sequel = let g = cenv.g let expr = stripExpr expr - if not (FirstEmittedCodeWillBeSequencePoint g sp expr) then - if EmitSequencePointForWholeExpr g sp expr then - CG.EmitSeqPoint cgbuf (RangeOfSequencePointForWholeExpr g expr) - elif EmitHiddenCodeMarkerForWholeExpr g sp expr then - cgbuf.EmitStartOfHiddenCode() + ProcessSequencePointForExpr cenv cgbuf sp expr + // A sequence expression will always match Expr.App. match (if compileSequenceExpressions then LowerCallsAndSeqs.LowerSeqExpr g cenv.amap expr else None) with | Some info -> GenSequenceExpr cenv cgbuf eenv info sequel @@ -2154,32 +2193,8 @@ let rec GenExpr (cenv: cenv) (cgbuf: CodeGenBuffer) eenv sp expr sequel = GenConstant cenv cgbuf eenv (c, m, ty) sequel | Expr.Match (spBind, exprm, tree, targets, m, ty) -> GenMatch cenv cgbuf eenv (spBind, exprm, tree, targets, m, ty) sequel - | Expr.Sequential (e1, e2, dir, spSeq, m) -> - GenSequential cenv cgbuf eenv sp (e1, e2, dir, spSeq, m) sequel | Expr.LetRec (binds, body, m, _) -> GenLetRec cenv cgbuf eenv (binds, body, m) sequel - | Expr.Let (bind, body, _, _) -> - // This case implemented here to get a guaranteed tailcall - // Make sure we generate the sequence point outside the scope of the variable - let startScope, endScope as scopeMarks = StartDelayedLocalScope "let" cgbuf - let eenv = AllocStorageForBind cenv cgbuf scopeMarks eenv bind - let spBind = GenSequencePointForBind cenv cgbuf bind - GenBindingAfterSequencePoint cenv cgbuf eenv spBind bind (Some startScope) - - // Work out if we need a sequence point for the body. For any "user" binding then the body gets SPAlways. - // For invisible compiler-generated bindings we just use "sp", unless its body is another invisible binding - // For sticky bindings arising from inlining we suppress any immediate sequence point in the body - let spBody = - match bind.SequencePointInfo with - | SequencePointAtBinding _ - | NoSequencePointAtLetBinding - | NoSequencePointAtDoBinding -> SPAlways - | NoSequencePointAtInvisibleBinding -> sp - | NoSequencePointAtStickyBinding -> SPSuppress - - // Generate the body - GenExpr cenv cgbuf eenv spBody body (EndLocalScope(sequel, endScope)) - | Expr.Lambda _ | Expr.TyLambda _ -> GenLambda cenv cgbuf eenv false None expr sequel | Expr.App (Expr.Val (vref, _, m) as v, _, tyargs, [], _) when @@ -2200,8 +2215,10 @@ let rec GenExpr (cenv: cenv) (cgbuf: CodeGenBuffer) eenv sp expr sequel = // Most generation of linear expressions is implemented routinely using tailcalls and the correct sequels. // This is because the element of expansion happens to be the final thing generated in most cases. However // for large lists we have to process the linearity separately + | Expr.Sequential _ + | Expr.Let _ | LinearOpExpr _ -> - GenLinearExpr cenv cgbuf eenv expr sequel id |> ignore + GenLinearExpr cenv cgbuf eenv sp expr sequel (* canProcessSequencePoint *) false id |> ignore | Expr.Op (op, tyargs, args, m) -> match op, args, tyargs with @@ -2515,16 +2532,63 @@ and GenAllocUnionCase cenv cgbuf eenv (c,tyargs,args,m) sequel = GenAllocUnionCaseCore cenv cgbuf eenv (c,tyargs,args.Length,m) GenSequel cenv eenv.cloc cgbuf sequel -and GenLinearExpr cenv cgbuf eenv expr sequel (contf: FakeUnit -> FakeUnit) = - match expr with - | LinearOpExpr (TOp.UnionCase c, tyargs, argsFront, argLast, m) -> +and GenLinearExpr cenv cgbuf eenv sp expr sequel canProcessSequencePoint (contf: FakeUnit -> FakeUnit) = + match stripExpr expr with + | LinearOpExpr (TOp.UnionCase c, tyargs, argsFront, argLast, m) -> GenExprs cenv cgbuf eenv argsFront - GenLinearExpr cenv cgbuf eenv argLast Continue (contf << (fun Fake -> + GenLinearExpr cenv cgbuf eenv SPSuppress argLast Continue (* canProcessSequencePoint *) true (contf << (fun Fake -> GenAllocUnionCaseCore cenv cgbuf eenv (c, tyargs, argsFront.Length + 1, m) GenSequel cenv eenv.cloc cgbuf sequel Fake)) + + | Expr.Sequential (e1, e2, specialSeqFlag, spSeq, _) -> + if canProcessSequencePoint then + ProcessSequencePointForExpr cenv cgbuf sp expr + + // Compiler generated sequential executions result in suppressions of sequence points on both + // left and right of the sequence + let spAction, spExpr = + (match spSeq with + | SequencePointsAtSeq -> SPAlways, SPAlways + | SuppressSequencePointOnExprOfSequential -> SPSuppress, sp + | SuppressSequencePointOnStmtOfSequential -> sp, SPSuppress) + match specialSeqFlag with + | NormalSeq -> + GenExpr cenv cgbuf eenv spAction e1 discard + GenLinearExpr cenv cgbuf eenv spExpr e2 sequel (* canProcessSequencePoint *) true contf + | ThenDoSeq -> + GenExpr cenv cgbuf eenv spExpr e1 Continue + GenExpr cenv cgbuf eenv spAction e2 discard + GenSequel cenv eenv.cloc cgbuf sequel + contf Fake + + | Expr.Let (bind, body, _, _) -> + if canProcessSequencePoint then + ProcessSequencePointForExpr cenv cgbuf sp expr + + // This case implemented here to get a guaranteed tailcall + // Make sure we generate the sequence point outside the scope of the variable + let startScope, endScope as scopeMarks = StartDelayedLocalScope "let" cgbuf + let eenv = AllocStorageForBind cenv cgbuf scopeMarks eenv bind + let spBind = GenSequencePointForBind cenv cgbuf bind + GenBindingAfterSequencePoint cenv cgbuf eenv spBind bind (Some startScope) + + // Work out if we need a sequence point for the body. For any "user" binding then the body gets SPAlways. + // For invisible compiler-generated bindings we just use "sp", unless its body is another invisible binding + // For sticky bindings arising from inlining we suppress any immediate sequence point in the body + let spBody = + match bind.SequencePointInfo with + | SequencePointAtBinding _ + | NoSequencePointAtLetBinding + | NoSequencePointAtDoBinding -> SPAlways + | NoSequencePointAtInvisibleBinding -> sp + | NoSequencePointAtStickyBinding -> SPSuppress + + // Generate the body + GenLinearExpr cenv cgbuf eenv spBody body (EndLocalScope(sequel, endScope)) (* canProcessSequencePoint *) true contf + | _ -> - GenExpr cenv cgbuf eenv SPSuppress expr sequel + GenExpr cenv cgbuf eenv sp expr sequel contf Fake and GenAllocRecd cenv cgbuf eenv ctorInfo (tcref,argtys,args,m) sequel = @@ -3475,28 +3539,6 @@ and GenWhileLoop cenv cgbuf eenv (spWhile, e1, e2, m) sequel = // SEQUENCE POINTS: Emit a sequence point to cover 'done' if present GenUnitThenSequel cenv eenv m eenv.cloc cgbuf sequel -//-------------------------------------------------------------------------- -// Generate seq -//-------------------------------------------------------------------------- - -and GenSequential cenv cgbuf eenv spIn (e1, e2, specialSeqFlag, spSeq, _m) sequel = - - // Compiler generated sequential executions result in suppressions of sequence points on both - // left and right of the sequence - let spAction, spExpr = - (match spSeq with - | SequencePointsAtSeq -> SPAlways, SPAlways - | SuppressSequencePointOnExprOfSequential -> SPSuppress, spIn - | SuppressSequencePointOnStmtOfSequential -> spIn, SPSuppress) - match specialSeqFlag with - | NormalSeq -> - GenExpr cenv cgbuf eenv spAction e1 discard - GenExpr cenv cgbuf eenv spExpr e2 sequel - | ThenDoSeq -> - GenExpr cenv cgbuf eenv spExpr e1 Continue - GenExpr cenv cgbuf eenv spAction e2 discard - GenSequel cenv eenv.cloc cgbuf sequel - //-------------------------------------------------------------------------- // Generate IL assembly code. // Polymorphic IL/ILX instructions may be instantiated when polymorphic code is inlined. @@ -5210,7 +5252,14 @@ and GenBindingAfterSequencePoint cenv cgbuf eenv sp (TBind(vspec, rhsExpr, _)) s let tps, ctorThisValOpt, baseValOpt, vsl, body', bodyty = IteratedAdjustArityOfLambda g cenv.amap topValInfo rhsExpr let methodVars = List.concat vsl CommitStartScope cgbuf startScopeMarkOpt - GenMethodForBinding cenv cgbuf eenv (vspec, mspec, access, paramInfos, retInfo) (topValInfo, ctorThisValOpt, baseValOpt, tps, methodVars, methodArgTys, body', bodyty) + + let ilxMethInfoArgs = + (vspec, mspec, access, paramInfos, retInfo, topValInfo, ctorThisValOpt, baseValOpt, tps, methodVars, methodArgTys, body', bodyty) + // if we have any expression recursion depth, we should delay the generation of a method to prevent stack overflows + if cenv.exprRecursionDepth > 0 then + DelayGenMethodForBinding cenv cgbuf.mgbuf eenv ilxMethInfoArgs + else + GenMethodForBinding cenv cgbuf.mgbuf eenv ilxMethInfoArgs | StaticProperty (ilGetterMethSpec, optShadowLocal) -> @@ -5649,11 +5698,10 @@ and ComputeMethodImplAttribs cenv (_v: Val) attrs = let hasAggressiveInliningImplFlag = (implflags &&& 0x0100) <> 0x0 hasPreserveSigImplFlag, hasSynchronizedImplFlag, hasNoInliningImplFlag, hasAggressiveInliningImplFlag, attrs -and GenMethodForBinding - cenv cgbuf eenv - (v: Val, mspec, access, paramInfos, retInfo) - (topValInfo, ctorThisValOpt, baseValOpt, tps, methodVars, methodArgTys, body, returnTy) = +and DelayGenMethodForBinding cenv mgbuf eenv ilxMethInfoArgs = + cenv.delayedGenMethods.Enqueue (fun cenv -> GenMethodForBinding cenv mgbuf eenv ilxMethInfoArgs) +and GenMethodForBinding cenv mgbuf eenv (v, mspec, access, paramInfos, retInfo, topValInfo, ctorThisValOpt, baseValOpt, tps, methodVars, methodArgTys, body, returnTy) = let g = cenv.g let m = v.Range let selfMethodVars, nonSelfMethodVars, compileAsInstance = @@ -5714,7 +5762,7 @@ and GenMethodForBinding else body - let ilCode = CodeGenMethodForExpr cenv cgbuf.mgbuf (SPAlways, tailCallInfo, mspec.Name, eenvForMeth, 0, bodyExpr, sequel) + let ilCode = CodeGenMethodForExpr cenv mgbuf (SPAlways, tailCallInfo, mspec.Name, eenvForMeth, 0, bodyExpr, sequel) // This is the main code generation for most methods false, MethodBody.IL ilCode, false @@ -5780,7 +5828,7 @@ and GenMethodForBinding else mdef CountMethodDef() - cgbuf.mgbuf.AddMethodDef(tref, mdef) + mgbuf.AddMethodDef(tref, mdef) match v.MemberInfo with @@ -5817,7 +5865,7 @@ and GenMethodForBinding let mdef = List.fold (fun mdef f -> f mdef) mdef flagFixups // fixup can potentially change name of reflected definition that was already recorded - patch it if necessary - cgbuf.mgbuf.ReplaceNameOfReflectedDefinition(v, mdef.Name) + mgbuf.ReplaceNameOfReflectedDefinition(v, mdef.Name) mdef else mkILGenericNonVirtualMethod (v.CompiledName g.CompilerGlobalState, access, ilMethTypars, ilParams, ilReturn, ilMethodBody) @@ -5844,7 +5892,7 @@ and GenMethodForBinding // Emit the pseudo-property as an event, but not if its a private method impl if mdef.Access <> ILMemberAccess.Private then let edef = GenEventForProperty cenv eenvForMeth mspec v ilAttrsThatGoOnPrimaryItem m returnTy - cgbuf.mgbuf.AddEventDef(tref, edef) + mgbuf.AddEventDef(tref, edef) // The method def is dropped on the floor here else @@ -5854,7 +5902,7 @@ and GenMethodForBinding let ilPropTy = GenType cenv.amap m eenvUnderMethTypeTypars.tyenv vtyp let ilArgTys = v |> ArgInfosOfPropertyVal g |> List.map fst |> GenTypes cenv.amap m eenvUnderMethTypeTypars.tyenv let ilPropDef = GenPropertyForMethodDef compileAsInstance tref mdef v memberInfo ilArgTys ilPropTy (mkILCustomAttrs ilAttrsThatGoOnPrimaryItem) compiledName - cgbuf.mgbuf.AddOrMergePropertyDef(tref, ilPropDef, m) + mgbuf.AddOrMergePropertyDef(tref, ilPropDef, m) // Add the special name flag for all properties let mdef = mdef.WithSpecialName.With(customAttrs= mkILCustomAttrs ((GenAttrs cenv eenv attrsAppliedToGetterOrSetter) @ sourceNameAttribs @ ilAttrsCompilerGenerated)) @@ -7668,7 +7716,9 @@ type IlxAssemblyGenerator(amap: ImportMap, tcGlobals: TcGlobals, tcVal: Constrai casApplied = casApplied intraAssemblyInfo = intraAssemblyInfo opts = codeGenOpts - optimizeDuringCodeGen = (fun x -> x) } + optimizeDuringCodeGen = (fun x -> x) + exprRecursionDepth = 0 + delayedGenMethods = Queue () } GenerateCode (cenv, anonTypeTable, ilxGenEnv, typedAssembly, assemAttribs, moduleAttribs) /// Invert the compilation of the given value and clear the storage of the value diff --git a/src/fsharp/lib.fs b/src/fsharp/lib.fs index e7eaf9543f..dfcbddc2da 100755 --- a/src/fsharp/lib.fs +++ b/src/fsharp/lib.fs @@ -536,3 +536,14 @@ module UnmanagedProcessExecutionOptions = "HeapSetInformation() returned FALSE; LastError = 0x" + GetLastError().ToString("X").PadLeft(8, '0') + ".")) +[] +module StackGuard = + + open System.Runtime.CompilerServices + + [] + let private MaxUncheckedRecursionDepth = 20 + + let EnsureSufficientExecutionStack recursionDepth = + if recursionDepth > MaxUncheckedRecursionDepth then + RuntimeHelpers.EnsureSufficientExecutionStack () \ No newline at end of file diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index 029d9cf72d..c83947d331 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -11,6 +11,19 @@ open FSharp.Compiler.SourceCodeServices open FSharp.Compiler.Interactive.Shell open NUnit.Framework +open System.Reflection.Emit + +[] +type ILVerifier (dllFilePath: string) = + + member this.VerifyIL (qualifiedItemName: string, expectedIL: string) = + ILChecker.checkILItem qualifiedItemName dllFilePath [ expectedIL ] + + member this.VerifyIL (expectedIL: string list) = + ILChecker.checkIL dllFilePath expectedIL + + member this.VerifyILWithLineNumbers (qualifiedItemName: string, expectedIL: string) = + ILChecker.checkILItemWithLineNumbers qualifiedItemName dllFilePath [ expectedIL ] [] module CompilerAssert = @@ -48,10 +61,45 @@ module CompilerAssert = Stamp = None } - let lockObj = obj () + let private gate = obj () + + let private compile isExe source f = + lock gate <| fun () -> + let inputFilePath = Path.ChangeExtension(Path.GetTempFileName(), ".fs") + let outputFilePath = Path.ChangeExtension (Path.GetTempFileName(), if isExe then ".exe" else ".dll") + let runtimeConfigFilePath = Path.ChangeExtension (outputFilePath, ".runtimeconfig.json") + let fsCoreDllPath = config.FSCOREDLLPATH + let tmpFsCoreFilePath = Path.Combine (Path.GetDirectoryName(outputFilePath), Path.GetFileName(fsCoreDllPath)) + try + File.Copy (fsCoreDllPath , tmpFsCoreFilePath, true) + File.WriteAllText (inputFilePath, source) + File.WriteAllText (runtimeConfigFilePath, """ +{ + "runtimeOptions": { + "tfm": "netcoreapp2.1", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "2.1.0" + } + } +} + """) + + let args = + defaultProjectOptions.OtherOptions + |> Array.append [| "fsc.exe"; inputFilePath; "-o:" + outputFilePath; (if isExe then "--target:exe" else "--target:library"); "--nowin32manifest" |] + let errors, _ = checker.Compile args |> Async.RunSynchronously + + f (errors, outputFilePath) + + finally + try File.Delete inputFilePath with | _ -> () + try File.Delete outputFilePath with | _ -> () + try File.Delete runtimeConfigFilePath with | _ -> () + try File.Delete tmpFsCoreFilePath with | _ -> () let Pass (source: string) = - lock lockObj <| fun () -> + lock gate <| fun () -> let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, defaultProjectOptions) |> Async.RunSynchronously Assert.IsEmpty(parseResults.Errors, sprintf "Parse errors: %A" parseResults.Errors) @@ -64,7 +112,7 @@ module CompilerAssert = let TypeCheckSingleError (source: string) (expectedErrorNumber: int) (expectedErrorRange: int * int * int * int) (expectedErrorMsg: string) = - lock lockObj <| fun () -> + lock gate <| fun () -> let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, defaultProjectOptions) |> Async.RunSynchronously Assert.IsEmpty(parseResults.Errors, sprintf "Parse errors: %A" parseResults.Errors) @@ -82,8 +130,46 @@ module CompilerAssert = Assert.AreEqual(expectedErrorMsg, info.Message, "expectedErrorMsg") ) + let CompileExe (source: string) = + compile true source (fun (errors, _) -> + if errors.Length > 0 then + Assert.Fail (sprintf "Compile had warnings and/or errors: %A" errors)) + + let CompileExeAndRun (source: string) = + compile true source (fun (errors, outputExe) -> + + if errors.Length > 0 then + Assert.Fail (sprintf "Compile had warnings and/or errors: %A" errors) + + let pInfo = ProcessStartInfo () +#if NETCOREAPP + pInfo.FileName <- config.DotNetExe + pInfo.Arguments <- outputExe +#else + pInfo.FileName <- outputExe +#endif + + pInfo.RedirectStandardError <- true + pInfo.UseShellExecute <- false + + let p = Process.Start(pInfo) + + p.WaitForExit() + let errors = p.StandardError.ReadToEnd () + if not (String.IsNullOrWhiteSpace errors) then + Assert.Fail errors + ) + + let CompileLibraryAndVerifyIL (source: string) (f: ILVerifier -> unit) = + compile false source (fun (errors, outputFilePath) -> + if errors.Length > 0 then + Assert.Fail (sprintf "Compile had warnings and/or errors: %A" errors) + + f (ILVerifier outputFilePath) + ) + let RunScript (source: string) (expectedErrorMessages: string list) = - lock lockObj <| fun () -> + lock gate <| fun () -> // Intialize output and input streams use inStream = new StringReader("") use outStream = new StringWriter() diff --git a/tests/fsharp/Compiler/ILChecker.fs b/tests/fsharp/Compiler/ILChecker.fs new file mode 100644 index 0000000000..200206f861 --- /dev/null +++ b/tests/fsharp/Compiler/ILChecker.fs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open System +open System.IO +open System.Diagnostics + +open NUnit.Framework +open TestFramework + +[] +module ILChecker = + + let config = initializeSuite () + + let private exec exe args = + let startInfo = ProcessStartInfo(exe, String.concat " " args) + startInfo.RedirectStandardError <- true + startInfo.UseShellExecute <- false + use p = Process.Start(startInfo) + p.WaitForExit() + p.StandardError.ReadToEnd(), p.ExitCode + + /// Filters i.e ['The system type \'System.ReadOnlySpan`1\' was required but no referenced system DLL contained this type'] + let private filterSpecialComment (text: string) = + let pattern = @"(\[\'(.*?)\'\])" + System.Text.RegularExpressions.Regex.Replace(text, pattern, + (fun me -> String.Empty) + ) + + let private checkILAux ildasmArgs dllFilePath expectedIL = + let ilFilePath = Path.ChangeExtension(dllFilePath, ".il") + + let mutable errorMsgOpt = None + try + let ildasmPath = config.ILDASM + + exec ildasmPath (ildasmArgs @ [ sprintf "%s /out=%s" dllFilePath ilFilePath ]) |> ignore + + let text = File.ReadAllText(ilFilePath) + let blockComments = @"/\*(.*?)\*/" + let lineComments = @"//(.*?)\r?\n" + let strings = @"""((\\[^\n]|[^""\n])*)""" + let verbatimStrings = @"@(""[^""]*"")+" + let textNoComments = + System.Text.RegularExpressions.Regex.Replace(text, + blockComments + "|" + lineComments + "|" + strings + "|" + verbatimStrings, + (fun me -> + if (me.Value.StartsWith("/*") || me.Value.StartsWith("//")) then + if me.Value.StartsWith("//") then Environment.NewLine else String.Empty + else + me.Value), System.Text.RegularExpressions.RegexOptions.Singleline) + |> filterSpecialComment + + expectedIL + |> List.iter (fun (ilCode: string) -> + let expectedLines = ilCode.Split('\n') + let startIndex = textNoComments.IndexOf(expectedLines.[0]) + if startIndex = -1 || textNoComments.Length < startIndex + ilCode.Length then + errorMsgOpt <- Some("==EXPECTED CONTAINS==\n" + ilCode + "\n") + else + let errors = ResizeArray() + let actualLines = textNoComments.Substring(startIndex, textNoComments.Length - startIndex).Split('\n') + for i = 0 to expectedLines.Length - 1 do + let expected = expectedLines.[i].Trim() + let actual = actualLines.[i].Trim() + if expected <> actual then + errors.Add(sprintf "\n==\nName: %s\n\nExpected:\t %s\nActual:\t\t %s\n==" actualLines.[0] expected actual) + + if errors.Count > 0 then + let msg = String.concat "\n" errors + "\n\n\n==EXPECTED==\n" + ilCode + "\n" + errorMsgOpt <- Some(msg + "\n\n\n==ACTUAL==\n" + String.Join("\n", actualLines, 0, expectedLines.Length)) + ) + + if expectedIL.Length = 0 then + errorMsgOpt <- Some ("No Expected IL") + + match errorMsgOpt with + | Some(msg) -> errorMsgOpt <- Some(msg + "\n\n\n==ENTIRE ACTUAL==\n" + textNoComments) + | _ -> () + finally + try File.Delete(ilFilePath) with | _ -> () + + match errorMsgOpt with + | Some(errorMsg) -> + Assert.Fail(errorMsg) + | _ -> () + + let checkILItem item dllFilePath expectedIL = + checkILAux [ sprintf "/item:%s" item ] dllFilePath expectedIL + + let checkILItemWithLineNumbers item dllFilePath expectedIL = + checkILAux [ sprintf "/item:\"%s\"" item; "/linenum" ] dllFilePath expectedIL + + let checkIL dllFilePath expectedIL = + checkILAux [] dllFilePath expectedIL diff --git a/tests/fsharp/Compiler/ILHelpers.fs b/tests/fsharp/Compiler/ILHelpers.fs deleted file mode 100644 index f31c4fdbbd..0000000000 --- a/tests/fsharp/Compiler/ILHelpers.fs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace FSharp.Compiler.UnitTests - -open System -open System.IO -open System.Diagnostics - -open NUnit.Framework - -open FSharp.Compiler.SourceCodeServices - -open TestFramework - -[] -module ILChecker = - - let checker = CompilerAssert.checker - - let config = initializeSuite () - - let private exec exe args = - let startInfo = ProcessStartInfo(exe, String.concat " " args) - startInfo.RedirectStandardError <- true - startInfo.UseShellExecute <- false - use p = Process.Start(startInfo) - p.WaitForExit() - p.StandardError.ReadToEnd(), p.ExitCode - - /// Filters i.e ['The system type \'System.ReadOnlySpan`1\' was required but no referenced system DLL contained this type'] - let private filterSpecialComment (text: string) = - let pattern = @"(\[\'(.*?)\'\])" - System.Text.RegularExpressions.Regex.Replace(text, pattern, - (fun me -> String.Empty) - ) - - let private checkAux extraDlls source expectedIL = - let tmp = Path.GetTempFileName() - let tmpFs = Path.ChangeExtension(tmp, ".fs") - let tmpDll = Path.ChangeExtension(tmp, ".dll") - let tmpIL = Path.ChangeExtension(tmp, ".il") - - let mutable errorMsgOpt = None - try - let ildasmPath = config.ILDASM - - File.WriteAllText(tmpFs, source) - - let extraReferences = extraDlls |> Array.ofList |> Array.map (fun reference -> "-r:" + reference) - -#if NETCOREAPP - // Hack: Currently a hack to get the runtime assemblies for netcore in order to compile. - let runtimeAssemblies = - typeof.Assembly.Location - |> Path.GetDirectoryName - |> Directory.EnumerateFiles - |> Seq.toArray - |> Array.filter (fun x -> x.ToLowerInvariant().Contains("system.")) - |> Array.map (fun x -> sprintf "-r:%s" x) - - let extraReferences = Array.append runtimeAssemblies extraReferences - - let errors, exitCode = checker.Compile(Array.append [| "fsc.exe"; "--optimize+"; "-o"; tmpDll; "-a"; tmpFs; "--targetprofile:netcore"; "--noframework" |] extraReferences) |> Async.RunSynchronously -#else - let errors, exitCode = checker.Compile(Array.append [| "fsc.exe"; "--optimize+"; "-o"; tmpDll; "-a"; tmpFs |] extraReferences) |> Async.RunSynchronously -#endif - let errors = - String.concat "\n" (errors |> Array.map (fun x -> x.Message)) - - if exitCode = 0 then - exec ildasmPath [ sprintf "%s /out=%s" tmpDll tmpIL ] |> ignore - - let text = File.ReadAllText(tmpIL) - let blockComments = @"/\*(.*?)\*/" - let lineComments = @"//(.*?)\r?\n" - let strings = @"""((\\[^\n]|[^""\n])*)""" - let verbatimStrings = @"@(""[^""]*"")+" - let textNoComments = - System.Text.RegularExpressions.Regex.Replace(text, - blockComments + "|" + lineComments + "|" + strings + "|" + verbatimStrings, - (fun me -> - if (me.Value.StartsWith("/*") || me.Value.StartsWith("//")) then - if me.Value.StartsWith("//") then Environment.NewLine else String.Empty - else - me.Value), System.Text.RegularExpressions.RegexOptions.Singleline) - |> filterSpecialComment - - expectedIL - |> List.iter (fun (ilCode: string) -> - let expectedLines = ilCode.Split('\n') - let startIndex = textNoComments.IndexOf(expectedLines.[0]) - if startIndex = -1 || textNoComments.Length < startIndex + ilCode.Length then - errorMsgOpt <- Some("==EXPECTED CONTAINS==\n" + ilCode + "\n") - else - let errors = ResizeArray() - let actualLines = textNoComments.Substring(startIndex, textNoComments.Length - startIndex).Split('\n') - for i = 0 to expectedLines.Length - 1 do - let expected = expectedLines.[i].Trim() - let actual = actualLines.[i].Trim() - if expected <> actual then - errors.Add(sprintf "\n==\nName: %s\n\nExpected:\t %s\nActual:\t\t %s\n==" actualLines.[0] expected actual) - - if errors.Count > 0 then - let msg = String.concat "\n" errors + "\n\n\n==EXPECTED==\n" + ilCode + "\n" - errorMsgOpt <- Some(msg + "\n\n\n==ACTUAL==\n" + String.Join("\n", actualLines, 0, expectedLines.Length)) - ) - - if expectedIL.Length = 0 then - errorMsgOpt <- Some ("No Expected IL") - - match errorMsgOpt with - | Some(msg) -> errorMsgOpt <- Some(msg + "\n\n\n==ENTIRE ACTUAL==\n" + textNoComments) - | _ -> () - else - errorMsgOpt <- Some(errors) - finally - try File.Delete(tmp) with | _ -> () - try File.Delete(tmpFs) with | _ -> () - try File.Delete(tmpDll) with | _ -> () - try File.Delete(tmpIL) with | _ -> () - - match errorMsgOpt with - | Some(errorMsg) -> - Assert.Fail(errorMsg) - | _ -> () - - let getPackageDlls name version framework dllNames = - dllNames - |> List.map (fun dllName -> - requireFile (packagesDir ++ name ++ version ++ "lib" ++ framework ++ dllName) - ) - - /// Compile the source and check to see if the expected IL exists. - /// The first line of each expected IL string is found first. - let check source expectedIL = - checkAux [] source expectedIL - - let checkWithDlls extraDlls source expectedIL = - checkAux extraDlls source expectedIL - diff --git a/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs b/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs index b6f5ce9d95..efcea68afd 100644 --- a/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs +++ b/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs @@ -4,7 +4,7 @@ namespace FSharp.Compiler.UnitTests open NUnit.Framework -#if !NETCOREAPP +#if NETCOREAPP [] module SpanOptimizationTests = @@ -22,24 +22,24 @@ let test () = Console.WriteLine(item) """ - ILChecker.checkWithDlls - (ILChecker.getPackageDlls "System.Memory" "4.5.2" "netstandard2.0" [ "System.Memory.dll" ]) - source - [ - """.method public static void test() cil managed + CompilerAssert.CompileLibraryAndVerifyIL source + (fun verifier -> + verifier.VerifyIL + [ + """.method public static void test() cil managed { .maxstack 5 - .locals init (valuetype [System.Memory]System.Span`1 V_0, + .locals init (valuetype [System.Private.CoreLib]System.Span`1 V_0, int32 V_1, - int32 V_2, - object& V_3) - IL_0000: call valuetype [System.Memory]System.Span`1 valuetype [System.Memory]System.Span`1::get_Empty() + valuetype [System.Private.CoreLib]System.Int32 V_2, + class [System.Private.CoreLib]System.Object& V_3) + IL_0000: call valuetype [System.Private.CoreLib]System.Span`1 valuetype [System.Private.CoreLib]System.Span`1::get_Empty() IL_0005: stloc.0 IL_0006: ldc.i4.0 IL_0007: stloc.2 IL_0008: ldloca.s V_0 - IL_000a: call instance int32 valuetype [System.Memory]System.Span`1::get_Length() + IL_000a: call instance int32 valuetype [System.Private.CoreLib]System.Span`1::get_Length() IL_000f: ldc.i4.1 IL_0010: sub IL_0011: stloc.1 @@ -49,11 +49,11 @@ let test () = IL_0016: ldloca.s V_0 IL_0018: ldloc.2 - IL_0019: call instance !0& valuetype [System.Memory]System.Span`1::get_Item(int32) + IL_0019: call instance !0& valuetype [System.Private.CoreLib]System.Span`1::get_Item(int32) IL_001e: stloc.3 IL_001f: ldloc.3 - IL_0020: ldobj [mscorlib]System.Object - IL_0025: call void [mscorlib]System.Console::WriteLine(object) + IL_0020: ldobj [System.Private.CoreLib]System.Object + IL_0025: call void [System.Console]System.Console::WriteLine(object) IL_002a: ldloc.2 IL_002b: ldc.i4.1 IL_002c: add @@ -66,7 +66,7 @@ let test () = IL_0034: ret } """ - ] + ]) [] let ReadOnlySpanForInDo() = @@ -82,24 +82,24 @@ let test () = Console.WriteLine(item) """ - ILChecker.checkWithDlls - (ILChecker.getPackageDlls "System.Memory" "4.5.2" "netstandard2.0" [ "System.Memory.dll" ]) - source - [ - """.method public static void test() cil managed + CompilerAssert.CompileLibraryAndVerifyIL source + (fun verifier -> + verifier.VerifyIL + [ + """.method public static void test() cil managed { .maxstack 5 - .locals init (valuetype [System.Memory]System.ReadOnlySpan`1 V_0, + .locals init (valuetype [System.Private.CoreLib]System.ReadOnlySpan`1 V_0, int32 V_1, - int32 V_2, - object& V_3) - IL_0000: call valuetype [System.Memory]System.ReadOnlySpan`1 valuetype [System.Memory]System.ReadOnlySpan`1::get_Empty() + valuetype [System.Private.CoreLib]System.Int32 V_2, + class [System.Private.CoreLib]System.Object& V_3) + IL_0000: call valuetype [System.Private.CoreLib]System.ReadOnlySpan`1 valuetype [System.Private.CoreLib]System.ReadOnlySpan`1::get_Empty() IL_0005: stloc.0 IL_0006: ldc.i4.0 IL_0007: stloc.2 IL_0008: ldloca.s V_0 - IL_000a: call instance int32 valuetype [System.Memory]System.ReadOnlySpan`1::get_Length() + IL_000a: call instance int32 valuetype [System.Private.CoreLib]System.ReadOnlySpan`1::get_Length() IL_000f: ldc.i4.1 IL_0010: sub IL_0011: stloc.1 @@ -109,11 +109,11 @@ let test () = IL_0016: ldloca.s V_0 IL_0018: ldloc.2 - IL_0019: call instance !0& modreq([netstandard]System.Runtime.InteropServices.InAttribute) valuetype [System.Memory]System.ReadOnlySpan`1::get_Item(int32) + IL_0019: call instance !0& modreq([System.Private.CoreLib]System.Runtime.InteropServices.InAttribute) valuetype [System.Private.CoreLib]System.ReadOnlySpan`1::get_Item(int32) IL_001e: stloc.3 IL_001f: ldloc.3 - IL_0020: ldobj [mscorlib]System.Object - IL_0025: call void [mscorlib]System.Console::WriteLine(object) + IL_0020: ldobj [System.Private.CoreLib]System.Object + IL_0025: call void [System.Console]System.Console::WriteLine(object) IL_002a: ldloc.2 IL_002b: ldc.i4.1 IL_002c: add @@ -126,7 +126,7 @@ let test () = IL_0034: ret }""" - ] + ]) [] let ExplicitSpanTypeForInDo() = @@ -150,7 +150,7 @@ open System.Runtime.CompilerServices type Span<'T>(arr: 'T []) = member __.Item - with get (i: int) = &arr.[0] + with get (i: int) = &arr.[i] member __.Length with get () = 0 @@ -170,36 +170,36 @@ module Test = """ // The current behavior doesn't optimize, but it could in the future. Making a test to catch if it ever does. - ILChecker.checkWithDlls - (ILChecker.getPackageDlls "System.Memory" "4.5.2" "netstandard2.0" [ "System.Memory.dll" ]) - source - [ - """.method public static void test() cil managed + CompilerAssert.CompileLibraryAndVerifyIL source + (fun verifier -> + verifier.VerifyIL + [ + """.method public static void test() cil managed { .maxstack 3 - .locals init (valuetype System.Span`1 V_0, - class [mscorlib]System.Collections.IEnumerator V_1, + .locals init (valuetype System.Span`1 V_0, + class [System.Private.CoreLib]System.Collections.IEnumerator V_1, class [FSharp.Core]Microsoft.FSharp.Core.Unit V_2, - class [mscorlib]System.IDisposable V_3) + class [System.Private.CoreLib]System.IDisposable V_3) IL_0000: ldc.i4.0 - IL_0001: newarr [mscorlib]System.Object - IL_0006: newobj instance void valuetype System.Span`1::.ctor(!0[]) + IL_0001: newarr [System.Private.CoreLib]System.Object + IL_0006: newobj instance void valuetype System.Span`1::.ctor(!0[]) IL_000b: stloc.0 IL_000c: ldloc.0 - IL_000d: box valuetype System.Span`1 - IL_0012: unbox.any [mscorlib]System.Collections.IEnumerable - IL_0017: callvirt instance class [mscorlib]System.Collections.IEnumerator [mscorlib]System.Collections.IEnumerable::GetEnumerator() + IL_000d: box valuetype System.Span`1 + IL_0012: unbox.any [System.Private.CoreLib]System.Collections.IEnumerable + IL_0017: callvirt instance class [System.Private.CoreLib]System.Collections.IEnumerator [System.Private.CoreLib]System.Collections.IEnumerable::GetEnumerator() IL_001c: stloc.1 .try { IL_001d: ldloc.1 - IL_001e: callvirt instance bool [mscorlib]System.Collections.IEnumerator::MoveNext() + IL_001e: callvirt instance bool [System.Private.CoreLib]System.Collections.IEnumerator::MoveNext() IL_0023: brfalse.s IL_0032 IL_0025: ldloc.1 - IL_0026: callvirt instance object [mscorlib]System.Collections.IEnumerator::get_Current() - IL_002b: call void [mscorlib]System.Console::WriteLine(object) + IL_0026: callvirt instance object [System.Private.CoreLib]System.Collections.IEnumerator::get_Current() + IL_002b: call void [System.Console]System.Console::WriteLine(object) IL_0030: br.s IL_001d IL_0032: ldnull @@ -210,13 +210,13 @@ module Test = finally { IL_0036: ldloc.1 - IL_0037: isinst [mscorlib]System.IDisposable + IL_0037: isinst [System.Private.CoreLib]System.IDisposable IL_003c: stloc.3 IL_003d: ldloc.3 IL_003e: brfalse.s IL_0049 IL_0040: ldloc.3 - IL_0041: callvirt instance void [mscorlib]System.IDisposable::Dispose() + IL_0041: callvirt instance void [System.Private.CoreLib]System.IDisposable::Dispose() IL_0046: ldnull IL_0047: pop IL_0048: endfinally @@ -228,5 +228,5 @@ module Test = IL_004d: pop IL_004e: ret }""" - ] + ]) #endif diff --git a/tests/fsharp/Compiler/Language/StringConcatOptimizationTests.fs b/tests/fsharp/Compiler/Language/StringConcatOptimizationTests.fs index 494b4f1fe6..37f3ce3c41 100644 --- a/tests/fsharp/Compiler/Language/StringConcatOptimizationTests.fs +++ b/tests/fsharp/Compiler/Language/StringConcatOptimizationTests.fs @@ -833,16 +833,19 @@ let test9 () = test9Source ] let source = String.Join("", sources) - ILChecker.check source - [ - test1IL - test2IL - test3IL - test4IL - test5IL - test6IL - test7IL - test8IL - test9IL - ] + CompilerAssert.CompileLibraryAndVerifyIL source + (fun verifier -> + verifier.VerifyIL + [ + test1IL + test2IL + test3IL + test4IL + test5IL + test6IL + test7IL + test8IL + test9IL + ] + ) #endif \ No newline at end of file diff --git a/tests/fsharp/Compiler/Stress/LargeExprTests.fs b/tests/fsharp/Compiler/Stress/LargeExprTests.fs new file mode 100644 index 0000000000..572c0e5355 --- /dev/null +++ b/tests/fsharp/Compiler/Stress/LargeExprTests.fs @@ -0,0 +1,3550 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework + +[] +module LargeExprTests = + + [] + let LargeRecordDoesNotStackOverflow() = + CompilerAssert.CompileExe + """ +type TestRecord = + { + test1: int + test2: int + test3: int + test4: int + test5: int + test6: int + test7: int + test8: int + test9: int + test10: int + test11: int + test12: int + test13: int + test14: int + test15: int + test16: int + test17: int + test18: int + test19: int + test20: int + test21: int + test22: int + test23: int + test24: int + test25: int + test26: int + test27: int + test28: int + test29: int + test30: int + test31: int + test32: int + test33: int + test34: int + test35: int + test36: int + test37: int + test38: int + test39: int + test40: int + test41: int + test42: int + test43: int + test44: int + test45: int + test46: int + test47: int + test48: int + test49: int + test50: int + test51: int + test52: int + test53: int + test54: int + test55: int + test56: int + test57: int + test58: int + test59: int + test60: int + test61: int + test62: int + test63: int + test64: int + test65: int + test66: int + test67: int + test68: int + test69: int + test70: int + test71: int + test72: int + test73: int + test74: int + test75: int + test76: int + test77: int + test78: int + test79: int + test80: int + test81: int + test82: int + test83: int + test84: int + test85: int + test86: int + test87: int + test88: int + test89: int + test90: int + test91: int + test92: int + test93: int + test94: int + test95: int + test96: int + test97: int + test98: int + test99: int + test100: int + test101: int + test102: int + test103: int + test104: int + test105: int + test106: int + test107: int + test108: int + test109: int + test110: int + test111: int + test112: int + test113: int + test114: int + test115: int + test116: int + test117: int + test118: int + test119: int + test120: int + test121: int + test122: int + test123: int + test124: int + test125: int + test126: int + test127: int + test128: int + test129: int + test130: int + test131: int + test132: int + test133: int + test134: int + test135: int + test136: int + test137: int + test138: int + test139: int + test140: int + test141: int + test142: int + test143: int + test144: int + test145: int + test146: int + test147: int + test148: int + test149: int + test150: int + test151: int + test152: int + test153: int + test154: int + test155: int + test156: int + test157: int + test158: int + test159: int + test160: int + test161: int + test162: int + test163: int + test164: int + test165: int + test166: int + test167: int + test168: int + test169: int + test170: int + test171: int + test172: int + test173: int + test174: int + test175: int + test176: int + test177: int + test178: int + test179: int + test180: int + test181: int + test182: int + test183: int + test184: int + test185: int + test186: int + test187: int + test188: int + test189: int + test190: int + test191: int + test192: int + test193: int + test194: int + test195: int + test196: int + test197: int + test198: int + test199: int + test200: int + test201: int + test202: int + test203: int + test204: int + test205: int + test206: int + test207: int + test208: int + test209: int + test210: int + test211: int + test212: int + test213: int + test214: int + test215: int + test216: int + test217: int + test218: int + test219: int + test220: int + test221: int + test222: int + test223: int + test224: int + test225: int + test226: int + test227: int + test228: int + test229: int + test230: int + test231: int + test232: int + test233: int + test234: int + test235: int + test236: int + test237: int + test238: int + test239: int + test240: int + test241: int + test242: int + test243: int + test244: int + test245: int + test246: int + test247: int + test248: int + test249: int + test250: int + test251: int + test252: int + test253: int + test254: int + test255: int + test256: int + test257: int + test258: int + test259: int + test260: int + test261: int + test262: int + test263: int + test264: int + test265: int + test266: int + test267: int + test268: int + test269: int + test270: int + test271: int + test272: int + test273: int + test274: int + test275: int + test276: int + test277: int + test278: int + test279: int + test280: int + test281: int + test282: int + test283: int + test284: int + test285: int + test286: int + test287: int + test288: int + test289: int + test290: int + test291: int + test292: int + test293: int + test294: int + test295: int + test296: int + test297: int + test298: int + test299: int + test300: int + test301: int + test302: int + test303: int + test304: int + test305: int + test306: int + test307: int + test308: int + test309: int + test310: int + test311: int + test312: int + test313: int + test314: int + test315: int + test316: int + test317: int + test318: int + test319: int + test320: int + test321: int + test322: int + test323: int + test324: int + test325: int + test326: int + test327: int + test328: int + test329: int + test330: int + test331: int + test332: int + test333: int + test334: int + test335: int + test336: int + test337: int + test338: int + test339: int + test340: int + test341: int + test342: int + test343: int + test344: int + test345: int + test346: int + test347: int + test348: int + test349: int + test350: int + test351: int + test352: int + test353: int + test354: int + test355: int + test356: int + test357: int + test358: int + test359: int + test360: int + test361: int + test362: int + test363: int + test364: int + test365: int + test366: int + test367: int + test368: int + test369: int + test370: int + test371: int + test372: int + test373: int + test374: int + test375: int + test376: int + test377: int + test378: int + test379: int + test380: int + test381: int + test382: int + test383: int + test384: int + test385: int + test386: int + test387: int + test388: int + test389: int + test390: int + test391: int + test392: int + test393: int + test394: int + test395: int + test396: int + test397: int + test398: int + test399: int + test400: int + test401: int + test402: int + test403: int + test404: int + test405: int + test406: int + test407: int + test408: int + test409: int + test410: int + test411: int + test412: int + test413: int + test414: int + test415: int + test416: int + test417: int + test418: int + test419: int + test420: int + test421: int + test422: int + test423: int + test424: int + test425: int + test426: int + test427: int + test428: int + test429: int + test430: int + test431: int + test432: int + test433: int + test434: int + test435: int + test436: int + test437: int + test438: int + test439: int + test440: int + test441: int + test442: int + test443: int + test444: int + test445: int + test446: int + test447: int + test448: int + test449: int + test450: int + test451: int + test452: int + test453: int + test454: int + test455: int + test456: int + test457: int + test458: int + test459: int + test460: int + test461: int + test462: int + test463: int + test464: int + test465: int + test466: int + test467: int + test468: int + test469: int + test470: int + test471: int + test472: int + test473: int + test474: int + test475: int + test476: int + test477: int + test478: int + test479: int + test480: int + test481: int + test482: int + test483: int + test484: int + test485: int + test486: int + test487: int + test488: int + test489: int + test490: int + test491: int + test492: int + test493: int + test494: int + test495: int + test496: int + test497: int + test498: int + test499: int + test500: int + test501: int + test502: int + test503: int + test504: int + test505: int + test506: int + test507: int + test508: int + test509: int + test510: int + test511: int + test512: int + test513: int + test514: int + test515: int + test516: int + test517: int + test518: int + test519: int + test520: int + test521: int + test522: int + test523: int + test524: int + test525: int + test526: int + test527: int + test528: int + test529: int + test530: int + test531: int + test532: int + test533: int + test534: int + test535: int + test536: int + test537: int + test538: int + test539: int + test540: int + test541: int + test542: int + test543: int + test544: int + test545: int + test546: int + test547: int + test548: int + test549: int + test550: int + test551: int + test552: int + test553: int + test554: int + test555: int + test556: int + test557: int + test558: int + test559: int + test560: int + test561: int + test562: int + test563: int + test564: int + test565: int + test566: int + test567: int + test568: int + test569: int + test570: int + test571: int + test572: int + test573: int + test574: int + test575: int + test576: int + test577: int + test578: int + test579: int + test580: int + test581: int + test582: int + test583: int + test584: int + test585: int + test586: int + test587: int + test588: int + test589: int + test590: int + test591: int + test592: int + test593: int + test594: int + test595: int + test596: int + test597: int + test598: int + test599: int + test600: int + test601: int + test602: int + test603: int + test604: int + test605: int + test606: int + test607: int + test608: int + test609: int + test610: int + test611: int + test612: int + test613: int + test614: int + test615: int + test616: int + test617: int + test618: int + test619: int + test620: int + test621: int + test622: int + test623: int + test624: int + test625: int + test626: int + test627: int + test628: int + test629: int + test630: int + test631: int + test632: int + test633: int + test634: int + test635: int + test636: int + test637: int + test638: int + test639: int + test640: int + test641: int + test642: int + test643: int + test644: int + test645: int + test646: int + test647: int + test648: int + test649: int + test650: int + test651: int + test652: int + test653: int + test654: int + test655: int + test656: int + test657: int + test658: int + test659: int + test660: int + test661: int + test662: int + test663: int + test664: int + test665: int + test666: int + test667: int + test668: int + test669: int + test670: int + test671: int + test672: int + test673: int + test674: int + test675: int + test676: int + test677: int + test678: int + test679: int + test680: int + test681: int + test682: int + test683: int + test684: int + test685: int + test686: int + test687: int + test688: int + test689: int + test690: int + test691: int + test692: int + test693: int + test694: int + test695: int + test696: int + test697: int + test698: int + test699: int + test700: int + test701: int + test702: int + test703: int + test704: int + test705: int + test706: int + test707: int + test708: int + test709: int + test710: int + test711: int + test712: int + test713: int + test714: int + test715: int + test716: int + test717: int + test718: int + test719: int + test720: int + test721: int + test722: int + test723: int + test724: int + test725: int + test726: int + test727: int + test728: int + test729: int + test730: int + test731: int + test732: int + test733: int + test734: int + test735: int + test736: int + test737: int + test738: int + test739: int + test740: int + test741: int + test742: int + test743: int + test744: int + test745: int + test746: int + test747: int + test748: int + test749: int + test750: int + test751: int + test752: int + test753: int + test754: int + test755: int + test756: int + test757: int + test758: int + test759: int + test760: int + test761: int + test762: int + test763: int + test764: int + test765: int + test766: int + test767: int + test768: int + test769: int + test770: int + test771: int + test772: int + test773: int + test774: int + test775: int + test776: int + test777: int + test778: int + test779: int + test780: int + test781: int + test782: int + test783: int + test784: int + test785: int + test786: int + test787: int + test788: int + test789: int + test790: int + test791: int + test792: int + test793: int + test794: int + test795: int + test796: int + test797: int + test798: int + test799: int + test800: int + test801: int + test802: int + test803: int + test804: int + test805: int + test806: int + test807: int + test808: int + test809: int + test810: int + test811: int + test812: int + test813: int + test814: int + test815: int + test816: int + test817: int + test818: int + test819: int + test820: int + test821: int + test822: int + test823: int + test824: int + test825: int + test826: int + test827: int + test828: int + test829: int + test830: int + test831: int + test832: int + test833: int + test834: int + test835: int + test836: int + test837: int + test838: int + test839: int + test840: int + test841: int + test842: int + test843: int + test844: int + test845: int + test846: int + test847: int + test848: int + test849: int + test850: int + test851: int + test852: int + test853: int + test854: int + test855: int + test856: int + test857: int + test858: int + test859: int + test860: int + test861: int + test862: int + test863: int + test864: int + test865: int + test866: int + test867: int + test868: int + test869: int + test870: int + test871: int + test872: int + test873: int + test874: int + test875: int + test876: int + test877: int + test878: int + test879: int + test880: int + test881: int + test882: int + test883: int + test884: int + test885: int + test886: int + test887: int + test888: int + test889: int + test890: int + test891: int + test892: int + test893: int + test894: int + test895: int + test896: int + test897: int + test898: int + test899: int + test900: int + test901: int + test902: int + test903: int + test904: int + test905: int + test906: int + test907: int + test908: int + test909: int + test910: int + test911: int + test912: int + test913: int + test914: int + test915: int + test916: int + test917: int + test918: int + test919: int + test920: int + test921: int + test922: int + test923: int + test924: int + test925: int + test926: int + test927: int + test928: int + test929: int + test930: int + test931: int + test932: int + test933: int + test934: int + test935: int + test936: int + test937: int + test938: int + test939: int + test940: int + test941: int + test942: int + test943: int + test944: int + test945: int + test946: int + test947: int + test948: int + test949: int + test950: int + test951: int + test952: int + test953: int + test954: int + test955: int + test956: int + test957: int + test958: int + test959: int + test960: int + test961: int + test962: int + test963: int + test964: int + test965: int + test966: int + test967: int + test968: int + test969: int + test970: int + test971: int + test972: int + test973: int + test974: int + test975: int + test976: int + test977: int + test978: int + test979: int + test980: int + test981: int + test982: int + test983: int + test984: int + test985: int + test986: int + test987: int + test988: int + test989: int + test990: int + test991: int + test992: int + test993: int + test994: int + test995: int + test996: int + test997: int + test998: int + test999: int + test1000: int + } + +[] +let main _ = 0 + """ + + [] + let LargeExprDoesNotStackOverflow() = + CompilerAssert.CompileExe + """ +module Test = + let test () = + let test1 = obj () + let test2 = obj () + let test3 = obj () + let test4 = obj () + let test5 = obj () + let test6 = obj () + let test7 = obj () + let test8 = obj () + let test9 = obj () + let test10 = obj () + let test11 = obj () + let test12 = obj () + let test13 = obj () + let test14 = obj () + let test15 = obj () + let test16 = obj () + let test17 = obj () + let test18 = obj () + let test19 = obj () + let test20 = obj () + let test21 = obj () + let test22 = obj () + let test23 = obj () + let test24 = obj () + let test25 = obj () + let test26 = obj () + let test27 = obj () + let test28 = obj () + let test29 = obj () + let test30 = obj () + let test31 = obj () + let test32 = obj () + let test33 = obj () + let test34 = obj () + let test35 = obj () + let test36 = obj () + let test37 = obj () + let test38 = obj () + let test39 = obj () + let test40 = obj () + let test41 = obj () + let test42 = obj () + let test43 = obj () + let test44 = obj () + let test45 = obj () + let test46 = obj () + let test47 = obj () + let test48 = obj () + let test49 = obj () + let test50 = obj () + let test51 = obj () + let test52 = obj () + let test53 = obj () + let test54 = obj () + let test55 = obj () + let test56 = obj () + let test57 = obj () + let test58 = obj () + let test59 = obj () + let test60 = obj () + let test61 = obj () + let test62 = obj () + let test63 = obj () + let test64 = obj () + let test65 = obj () + let test66 = obj () + let test67 = obj () + let test68 = obj () + let test69 = obj () + let test70 = obj () + let test71 = obj () + let test72 = obj () + let test73 = obj () + let test74 = obj () + let test75 = obj () + let test76 = obj () + let test77 = obj () + let test78 = obj () + let test79 = obj () + let test80 = obj () + let test81 = obj () + let test82 = obj () + let test83 = obj () + let test84 = obj () + let test85 = obj () + let test86 = obj () + let test87 = obj () + let test88 = obj () + let test89 = obj () + let test90 = obj () + let test91 = obj () + let test92 = obj () + let test93 = obj () + let test94 = obj () + let test95 = obj () + let test96 = obj () + let test97 = obj () + let test98 = obj () + let test99 = obj () + let test100 = obj () + let test101 = obj () + let test102 = obj () + let test103 = obj () + let test104 = obj () + let test105 = obj () + let test106 = obj () + let test107 = obj () + let test108 = obj () + let test109 = obj () + let test110 = obj () + let test111 = obj () + let test112 = obj () + let test113 = obj () + let test114 = obj () + let test115 = obj () + let test116 = obj () + let test117 = obj () + let test118 = obj () + let test119 = obj () + let test120 = obj () + let test121 = obj () + let test122 = obj () + let test123 = obj () + let test124 = obj () + let test125 = obj () + let test126 = obj () + let test127 = obj () + let test128 = obj () + let test129 = obj () + let test130 = obj () + let test131 = obj () + let test132 = obj () + let test133 = obj () + let test134 = obj () + let test135 = obj () + let test136 = obj () + let test137 = obj () + let test138 = obj () + let test139 = obj () + let test140 = obj () + let test141 = obj () + let test142 = obj () + let test143 = obj () + let test144 = obj () + let test145 = obj () + let test146 = obj () + let test147 = obj () + let test148 = obj () + let test149 = obj () + let test150 = obj () + let test151 = obj () + let test152 = obj () + let test153 = obj () + let test154 = obj () + let test155 = obj () + let test156 = obj () + let test157 = obj () + let test158 = obj () + let test159 = obj () + let test160 = obj () + let test161 = obj () + let test162 = obj () + let test163 = obj () + let test164 = obj () + let test165 = obj () + let test166 = obj () + let test167 = obj () + let test168 = obj () + let test169 = obj () + let test170 = obj () + let test171 = obj () + let test172 = obj () + let test173 = obj () + let test174 = obj () + let test175 = obj () + let test176 = obj () + let test177 = obj () + let test178 = obj () + let test179 = obj () + let test180 = obj () + let test181 = obj () + let test182 = obj () + let test183 = obj () + let test184 = obj () + let test185 = obj () + let test186 = obj () + let test187 = obj () + let test188 = obj () + let test189 = obj () + let test190 = obj () + let test191 = obj () + let test192 = obj () + let test193 = obj () + let test194 = obj () + let test195 = obj () + let test196 = obj () + let test197 = obj () + let test198 = obj () + let test199 = obj () + let test200 = obj () + let test201 = obj () + let test202 = obj () + let test203 = obj () + let test204 = obj () + let test205 = obj () + let test206 = obj () + let test207 = obj () + let test208 = obj () + let test209 = obj () + let test210 = obj () + let test211 = obj () + let test212 = obj () + let test213 = obj () + let test214 = obj () + let test215 = obj () + let test216 = obj () + let test217 = obj () + let test218 = obj () + let test219 = obj () + let test220 = obj () + let test221 = obj () + let test222 = obj () + let test223 = obj () + let test224 = obj () + let test225 = obj () + let test226 = obj () + let test227 = obj () + let test228 = obj () + let test229 = obj () + let test230 = obj () + let test231 = obj () + let test232 = obj () + let test233 = obj () + let test234 = obj () + let test235 = obj () + let test236 = obj () + let test237 = obj () + let test238 = obj () + let test239 = obj () + let test240 = obj () + let test241 = obj () + let test242 = obj () + let test243 = obj () + let test244 = obj () + let test245 = obj () + let test246 = obj () + let test247 = obj () + let test248 = obj () + let test249 = obj () + let test250 = obj () + let test251 = obj () + let test252 = obj () + let test253 = obj () + let test254 = obj () + let test255 = obj () + let test256 = obj () + let test257 = obj () + let test258 = obj () + let test259 = obj () + let test260 = obj () + let test261 = obj () + let test262 = obj () + let test263 = obj () + let test264 = obj () + let test265 = obj () + let test266 = obj () + let test267 = obj () + let test268 = obj () + let test269 = obj () + let test270 = obj () + let test271 = obj () + let test272 = obj () + let test273 = obj () + let test274 = obj () + let test275 = obj () + let test276 = obj () + let test277 = obj () + let test278 = obj () + let test279 = obj () + let test280 = obj () + let test281 = obj () + let test282 = obj () + let test283 = obj () + let test284 = obj () + let test285 = obj () + let test286 = obj () + let test287 = obj () + let test288 = obj () + let test289 = obj () + let test290 = obj () + let test291 = obj () + let test292 = obj () + let test293 = obj () + let test294 = obj () + let test295 = obj () + let test296 = obj () + let test297 = obj () + let test298 = obj () + let test299 = obj () + let test300 = obj () + let test301 = obj () + let test302 = obj () + let test303 = obj () + let test304 = obj () + let test305 = obj () + let test306 = obj () + let test307 = obj () + let test308 = obj () + let test309 = obj () + let test310 = obj () + let test311 = obj () + let test312 = obj () + let test313 = obj () + let test314 = obj () + let test315 = obj () + let test316 = obj () + let test317 = obj () + let test318 = obj () + let test319 = obj () + let test320 = obj () + let test321 = obj () + let test322 = obj () + let test323 = obj () + let test324 = obj () + let test325 = obj () + let test326 = obj () + let test327 = obj () + let test328 = obj () + let test329 = obj () + let test330 = obj () + let test331 = obj () + let test332 = obj () + let test333 = obj () + let test334 = obj () + let test335 = obj () + let test336 = obj () + let test337 = obj () + let test338 = obj () + let test339 = obj () + let test340 = obj () + let test341 = obj () + let test342 = obj () + let test343 = obj () + let test344 = obj () + let test345 = obj () + let test346 = obj () + let test347 = obj () + let test348 = obj () + let test349 = obj () + let test350 = obj () + let test351 = obj () + let test352 = obj () + let test353 = obj () + let test354 = obj () + let test355 = obj () + let test356 = obj () + let test357 = obj () + let test358 = obj () + let test359 = obj () + let test360 = obj () + let test361 = obj () + let test362 = obj () + let test363 = obj () + let test364 = obj () + let test365 = obj () + let test366 = obj () + let test367 = obj () + let test368 = obj () + let test369 = obj () + let test370 = obj () + let test371 = obj () + let test372 = obj () + let test373 = obj () + let test374 = obj () + let test375 = obj () + let test376 = obj () + let test377 = obj () + let test378 = obj () + let test379 = obj () + let test380 = obj () + let test381 = obj () + let test382 = obj () + let test383 = obj () + let test384 = obj () + let test385 = obj () + let test386 = obj () + let test387 = obj () + let test388 = obj () + let test389 = obj () + let test390 = obj () + let test391 = obj () + let test392 = obj () + let test393 = obj () + let test394 = obj () + let test395 = obj () + let test396 = obj () + let test397 = obj () + let test398 = obj () + let test399 = obj () + let test400 = obj () + let test401 = obj () + let test402 = obj () + let test403 = obj () + let test404 = obj () + let test405 = obj () + let test406 = obj () + let test407 = obj () + let test408 = obj () + let test409 = obj () + let test410 = obj () + let test411 = obj () + let test412 = obj () + let test413 = obj () + let test414 = obj () + let test415 = obj () + let test416 = obj () + let test417 = obj () + let test418 = obj () + let test419 = obj () + let test420 = obj () + let test421 = obj () + let test422 = obj () + let test423 = obj () + let test424 = obj () + let test425 = obj () + let test426 = obj () + let test427 = obj () + let test428 = obj () + let test429 = obj () + let test430 = obj () + let test431 = obj () + let test432 = obj () + let test433 = obj () + let test434 = obj () + let test435 = obj () + let test436 = obj () + let test437 = obj () + let test438 = obj () + let test439 = obj () + let test440 = obj () + let test441 = obj () + let test442 = obj () + let test443 = obj () + let test444 = obj () + let test445 = obj () + let test446 = obj () + let test447 = obj () + let test448 = obj () + let test449 = obj () + let test450 = obj () + let test451 = obj () + let test452 = obj () + let test453 = obj () + let test454 = obj () + let test455 = obj () + let test456 = obj () + let test457 = obj () + let test458 = obj () + let test459 = obj () + let test460 = obj () + let test461 = obj () + let test462 = obj () + let test463 = obj () + let test464 = obj () + let test465 = obj () + let test466 = obj () + let test467 = obj () + let test468 = obj () + let test469 = obj () + let test470 = obj () + let test471 = obj () + let test472 = obj () + let test473 = obj () + let test474 = obj () + let test475 = obj () + let test476 = obj () + let test477 = obj () + let test478 = obj () + let test479 = obj () + let test480 = obj () + let test481 = obj () + let test482 = obj () + let test483 = obj () + let test484 = obj () + let test485 = obj () + let test486 = obj () + let test487 = obj () + let test488 = obj () + let test489 = obj () + let test490 = obj () + let test491 = obj () + let test492 = obj () + let test493 = obj () + let test494 = obj () + let test495 = obj () + let test496 = obj () + let test497 = obj () + let test498 = obj () + let test499 = obj () + let test500 = obj () + let test501 = obj () + let test502 = obj () + let test503 = obj () + let test504 = obj () + let test505 = obj () + let test506 = obj () + let test507 = obj () + let test508 = obj () + let test509 = obj () + let test510 = obj () + let test511 = obj () + let test512 = obj () + let test513 = obj () + let test514 = obj () + let test515 = obj () + let test516 = obj () + let test517 = obj () + let test518 = obj () + let test519 = obj () + let test520 = obj () + let test521 = obj () + let test522 = obj () + let test523 = obj () + let test524 = obj () + let test525 = obj () + let test526 = obj () + let test527 = obj () + let test528 = obj () + let test529 = obj () + let test530 = obj () + let test531 = obj () + let test532 = obj () + let test533 = obj () + let test534 = obj () + let test535 = obj () + let test536 = obj () + let test537 = obj () + let test538 = obj () + let test539 = obj () + let test540 = obj () + let test541 = obj () + let test542 = obj () + let test543 = obj () + let test544 = obj () + let test545 = obj () + let test546 = obj () + let test547 = obj () + let test548 = obj () + let test549 = obj () + let test550 = obj () + let test551 = obj () + let test552 = obj () + let test553 = obj () + let test554 = obj () + let test555 = obj () + let test556 = obj () + let test557 = obj () + let test558 = obj () + let test559 = obj () + let test560 = obj () + let test561 = obj () + let test562 = obj () + let test563 = obj () + let test564 = obj () + let test565 = obj () + let test566 = obj () + let test567 = obj () + let test568 = obj () + let test569 = obj () + let test570 = obj () + let test571 = obj () + let test572 = obj () + let test573 = obj () + let test574 = obj () + let test575 = obj () + let test576 = obj () + let test577 = obj () + let test578 = obj () + let test579 = obj () + let test580 = obj () + let test581 = obj () + let test582 = obj () + let test583 = obj () + let test584 = obj () + let test585 = obj () + let test586 = obj () + let test587 = obj () + let test588 = obj () + let test589 = obj () + let test590 = obj () + let test591 = obj () + let test592 = obj () + let test593 = obj () + let test594 = obj () + let test595 = obj () + let test596 = obj () + let test597 = obj () + let test598 = obj () + let test599 = obj () + let test600 = obj () + let test601 = obj () + let test602 = obj () + let test603 = obj () + let test604 = obj () + let test605 = obj () + let test606 = obj () + let test607 = obj () + let test608 = obj () + let test609 = obj () + let test610 = obj () + let test611 = obj () + let test612 = obj () + let test613 = obj () + let test614 = obj () + let test615 = obj () + let test616 = obj () + let test617 = obj () + let test618 = obj () + let test619 = obj () + let test620 = obj () + let test621 = obj () + let test622 = obj () + let test623 = obj () + let test624 = obj () + let test625 = obj () + let test626 = obj () + let test627 = obj () + let test628 = obj () + let test629 = obj () + let test630 = obj () + let test631 = obj () + let test632 = obj () + let test633 = obj () + let test634 = obj () + let test635 = obj () + let test636 = obj () + let test637 = obj () + let test638 = obj () + let test639 = obj () + let test640 = obj () + let test641 = obj () + let test642 = obj () + let test643 = obj () + let test644 = obj () + let test645 = obj () + let test646 = obj () + let test647 = obj () + let test648 = obj () + let test649 = obj () + let test650 = obj () + let test651 = obj () + let test652 = obj () + let test653 = obj () + let test654 = obj () + let test655 = obj () + let test656 = obj () + let test657 = obj () + let test658 = obj () + let test659 = obj () + let test660 = obj () + let test661 = obj () + let test662 = obj () + let test663 = obj () + let test664 = obj () + let test665 = obj () + let test666 = obj () + let test667 = obj () + let test668 = obj () + let test669 = obj () + let test670 = obj () + let test671 = obj () + let test672 = obj () + let test673 = obj () + let test674 = obj () + let test675 = obj () + let test676 = obj () + let test677 = obj () + let test678 = obj () + let test679 = obj () + let test680 = obj () + let test681 = obj () + let test682 = obj () + let test683 = obj () + let test684 = obj () + let test685 = obj () + let test686 = obj () + let test687 = obj () + let test688 = obj () + let test689 = obj () + let test690 = obj () + let test691 = obj () + let test692 = obj () + let test693 = obj () + let test694 = obj () + let test695 = obj () + let test696 = obj () + let test697 = obj () + let test698 = obj () + let test699 = obj () + let test700 = obj () + let test701 = obj () + let test702 = obj () + let test703 = obj () + let test704 = obj () + let test705 = obj () + let test706 = obj () + let test707 = obj () + let test708 = obj () + let test709 = obj () + let test710 = obj () + let test711 = obj () + let test712 = obj () + let test713 = obj () + let test714 = obj () + let test715 = obj () + let test716 = obj () + let test717 = obj () + let test718 = obj () + let test719 = obj () + let test720 = obj () + let test721 = obj () + let test722 = obj () + let test723 = obj () + let test724 = obj () + let test725 = obj () + let test726 = obj () + let test727 = obj () + let test728 = obj () + let test729 = obj () + let test730 = obj () + let test731 = obj () + let test732 = obj () + let test733 = obj () + let test734 = obj () + let test735 = obj () + let test736 = obj () + let test737 = obj () + let test738 = obj () + let test739 = obj () + let test740 = obj () + let test741 = obj () + let test742 = obj () + let test743 = obj () + let test744 = obj () + let test745 = obj () + let test746 = obj () + let test747 = obj () + let test748 = obj () + let test749 = obj () + let test750 = obj () + let test751 = obj () + let test752 = obj () + let test753 = obj () + let test754 = obj () + let test755 = obj () + let test756 = obj () + let test757 = obj () + let test758 = obj () + let test759 = obj () + let test760 = obj () + let test761 = obj () + let test762 = obj () + let test763 = obj () + let test764 = obj () + let test765 = obj () + let test766 = obj () + let test767 = obj () + let test768 = obj () + let test769 = obj () + let test770 = obj () + let test771 = obj () + let test772 = obj () + let test773 = obj () + let test774 = obj () + let test775 = obj () + let test776 = obj () + let test777 = obj () + let test778 = obj () + let test779 = obj () + let test780 = obj () + let test781 = obj () + let test782 = obj () + let test783 = obj () + let test784 = obj () + let test785 = obj () + let test786 = obj () + let test787 = obj () + let test788 = obj () + let test789 = obj () + let test790 = obj () + let test791 = obj () + let test792 = obj () + let test793 = obj () + let test794 = obj () + let test795 = obj () + let test796 = obj () + let test797 = obj () + let test798 = obj () + let test799 = obj () + let test800 = obj () + let test801 = obj () + let test802 = obj () + let test803 = obj () + let test804 = obj () + let test805 = obj () + let test806 = obj () + let test807 = obj () + let test808 = obj () + let test809 = obj () + let test810 = obj () + let test811 = obj () + let test812 = obj () + let test813 = obj () + let test814 = obj () + let test815 = obj () + let test816 = obj () + let test817 = obj () + let test818 = obj () + let test819 = obj () + let test820 = obj () + let test821 = obj () + let test822 = obj () + let test823 = obj () + let test824 = obj () + let test825 = obj () + let test826 = obj () + let test827 = obj () + let test828 = obj () + let test829 = obj () + let test830 = obj () + let test831 = obj () + let test832 = obj () + let test833 = obj () + let test834 = obj () + let test835 = obj () + let test836 = obj () + let test837 = obj () + let test838 = obj () + let test839 = obj () + let test840 = obj () + let test841 = obj () + let test842 = obj () + let test843 = obj () + let test844 = obj () + let test845 = obj () + let test846 = obj () + let test847 = obj () + let test848 = obj () + let test849 = obj () + let test850 = obj () + let test851 = obj () + let test852 = obj () + let test853 = obj () + let test854 = obj () + let test855 = obj () + let test856 = obj () + let test857 = obj () + let test858 = obj () + let test859 = obj () + let test860 = obj () + let test861 = obj () + let test862 = obj () + let test863 = obj () + let test864 = obj () + let test865 = obj () + let test866 = obj () + let test867 = obj () + let test868 = obj () + let test869 = obj () + let test870 = obj () + let test871 = obj () + let test872 = obj () + let test873 = obj () + let test874 = obj () + let test875 = obj () + let test876 = obj () + let test877 = obj () + let test878 = obj () + let test879 = obj () + let test880 = obj () + let test881 = obj () + let test882 = obj () + let test883 = obj () + let test884 = obj () + let test885 = obj () + let test886 = obj () + let test887 = obj () + let test888 = obj () + let test889 = obj () + let test890 = obj () + let test891 = obj () + let test892 = obj () + let test893 = obj () + let test894 = obj () + let test895 = obj () + let test896 = obj () + let test897 = obj () + let test898 = obj () + let test899 = obj () + let test900 = obj () + let test901 = obj () + let test902 = obj () + let test903 = obj () + let test904 = obj () + let test905 = obj () + let test906 = obj () + let test907 = obj () + let test908 = obj () + let test909 = obj () + let test910 = obj () + let test911 = obj () + let test912 = obj () + let test913 = obj () + let test914 = obj () + let test915 = obj () + let test916 = obj () + let test917 = obj () + let test918 = obj () + let test919 = obj () + let test920 = obj () + let test921 = obj () + let test922 = obj () + let test923 = obj () + let test924 = obj () + let test925 = obj () + let test926 = obj () + let test927 = obj () + let test928 = obj () + let test929 = obj () + let test930 = obj () + let test931 = obj () + let test932 = obj () + let test933 = obj () + let test934 = obj () + let test935 = obj () + let test936 = obj () + let test937 = obj () + let test938 = obj () + let test939 = obj () + let test940 = obj () + let test941 = obj () + let test942 = obj () + let test943 = obj () + let test944 = obj () + let test945 = obj () + let test946 = obj () + let test947 = obj () + let test948 = obj () + let test949 = obj () + let test950 = obj () + let test951 = obj () + let test952 = obj () + let test953 = obj () + let test954 = obj () + let test955 = obj () + let test956 = obj () + let test957 = obj () + let test958 = obj () + let test959 = obj () + let test960 = obj () + let test961 = obj () + let test962 = obj () + let test963 = obj () + let test964 = obj () + let test965 = obj () + let test966 = obj () + let test967 = obj () + let test968 = obj () + let test969 = obj () + let test970 = obj () + let test971 = obj () + let test972 = obj () + let test973 = obj () + let test974 = obj () + let test975 = obj () + let test976 = obj () + let test977 = obj () + let test978 = obj () + let test979 = obj () + let test980 = obj () + let test981 = obj () + let test982 = obj () + let test983 = obj () + let test984 = obj () + let test985 = obj () + let test986 = obj () + let test987 = obj () + let test988 = obj () + let test989 = obj () + let test990 = obj () + let test991 = obj () + let test992 = obj () + let test993 = obj () + let test994 = obj () + let test995 = obj () + let test996 = obj () + let test997 = obj () + let test998 = obj () + let test999 = obj () + let test1000 = obj () + + printfn "%A" test1 + printfn "%A" test2 + printfn "%A" test3 + printfn "%A" test4 + printfn "%A" test5 + printfn "%A" test6 + printfn "%A" test7 + printfn "%A" test8 + printfn "%A" test9 + printfn "%A" test10 + printfn "%A" test11 + printfn "%A" test12 + printfn "%A" test13 + printfn "%A" test14 + printfn "%A" test15 + printfn "%A" test16 + printfn "%A" test17 + printfn "%A" test18 + printfn "%A" test19 + printfn "%A" test20 + printfn "%A" test21 + printfn "%A" test22 + printfn "%A" test23 + printfn "%A" test24 + printfn "%A" test25 + printfn "%A" test26 + printfn "%A" test27 + printfn "%A" test28 + printfn "%A" test29 + printfn "%A" test30 + printfn "%A" test31 + printfn "%A" test32 + printfn "%A" test33 + printfn "%A" test34 + printfn "%A" test35 + printfn "%A" test36 + printfn "%A" test37 + printfn "%A" test38 + printfn "%A" test39 + printfn "%A" test40 + printfn "%A" test41 + printfn "%A" test42 + printfn "%A" test43 + printfn "%A" test44 + printfn "%A" test45 + printfn "%A" test46 + printfn "%A" test47 + printfn "%A" test48 + printfn "%A" test49 + printfn "%A" test50 + printfn "%A" test51 + printfn "%A" test52 + printfn "%A" test53 + printfn "%A" test54 + printfn "%A" test55 + printfn "%A" test56 + printfn "%A" test57 + printfn "%A" test58 + printfn "%A" test59 + printfn "%A" test60 + printfn "%A" test61 + printfn "%A" test62 + printfn "%A" test63 + printfn "%A" test64 + printfn "%A" test65 + printfn "%A" test66 + printfn "%A" test67 + printfn "%A" test68 + printfn "%A" test69 + printfn "%A" test70 + printfn "%A" test71 + printfn "%A" test72 + printfn "%A" test73 + printfn "%A" test74 + printfn "%A" test75 + printfn "%A" test76 + printfn "%A" test77 + printfn "%A" test78 + printfn "%A" test79 + printfn "%A" test80 + printfn "%A" test81 + printfn "%A" test82 + printfn "%A" test83 + printfn "%A" test84 + printfn "%A" test85 + printfn "%A" test86 + printfn "%A" test87 + printfn "%A" test88 + printfn "%A" test89 + printfn "%A" test90 + printfn "%A" test91 + printfn "%A" test92 + printfn "%A" test93 + printfn "%A" test94 + printfn "%A" test95 + printfn "%A" test96 + printfn "%A" test97 + printfn "%A" test98 + printfn "%A" test99 + printfn "%A" test100 + printfn "%A" test101 + printfn "%A" test102 + printfn "%A" test103 + printfn "%A" test104 + printfn "%A" test105 + printfn "%A" test106 + printfn "%A" test107 + printfn "%A" test108 + printfn "%A" test109 + printfn "%A" test110 + printfn "%A" test111 + printfn "%A" test112 + printfn "%A" test113 + printfn "%A" test114 + printfn "%A" test115 + printfn "%A" test116 + printfn "%A" test117 + printfn "%A" test118 + printfn "%A" test119 + printfn "%A" test120 + printfn "%A" test121 + printfn "%A" test122 + printfn "%A" test123 + printfn "%A" test124 + printfn "%A" test125 + printfn "%A" test126 + printfn "%A" test127 + printfn "%A" test128 + printfn "%A" test129 + printfn "%A" test130 + printfn "%A" test131 + printfn "%A" test132 + printfn "%A" test133 + printfn "%A" test134 + printfn "%A" test135 + printfn "%A" test136 + printfn "%A" test137 + printfn "%A" test138 + printfn "%A" test139 + printfn "%A" test140 + printfn "%A" test141 + printfn "%A" test142 + printfn "%A" test143 + printfn "%A" test144 + printfn "%A" test145 + printfn "%A" test146 + printfn "%A" test147 + printfn "%A" test148 + printfn "%A" test149 + printfn "%A" test150 + printfn "%A" test151 + printfn "%A" test152 + printfn "%A" test153 + printfn "%A" test154 + printfn "%A" test155 + printfn "%A" test156 + printfn "%A" test157 + printfn "%A" test158 + printfn "%A" test159 + printfn "%A" test160 + printfn "%A" test161 + printfn "%A" test162 + printfn "%A" test163 + printfn "%A" test164 + printfn "%A" test165 + printfn "%A" test166 + printfn "%A" test167 + printfn "%A" test168 + printfn "%A" test169 + printfn "%A" test170 + printfn "%A" test171 + printfn "%A" test172 + printfn "%A" test173 + printfn "%A" test174 + printfn "%A" test175 + printfn "%A" test176 + printfn "%A" test177 + printfn "%A" test178 + printfn "%A" test179 + printfn "%A" test180 + printfn "%A" test181 + printfn "%A" test182 + printfn "%A" test183 + printfn "%A" test184 + printfn "%A" test185 + printfn "%A" test186 + printfn "%A" test187 + printfn "%A" test188 + printfn "%A" test189 + printfn "%A" test190 + printfn "%A" test191 + printfn "%A" test192 + printfn "%A" test193 + printfn "%A" test194 + printfn "%A" test195 + printfn "%A" test196 + printfn "%A" test197 + printfn "%A" test198 + printfn "%A" test199 + printfn "%A" test200 + printfn "%A" test201 + printfn "%A" test202 + printfn "%A" test203 + printfn "%A" test204 + printfn "%A" test205 + printfn "%A" test206 + printfn "%A" test207 + printfn "%A" test208 + printfn "%A" test209 + printfn "%A" test210 + printfn "%A" test211 + printfn "%A" test212 + printfn "%A" test213 + printfn "%A" test214 + printfn "%A" test215 + printfn "%A" test216 + printfn "%A" test217 + printfn "%A" test218 + printfn "%A" test219 + printfn "%A" test220 + printfn "%A" test221 + printfn "%A" test222 + printfn "%A" test223 + printfn "%A" test224 + printfn "%A" test225 + printfn "%A" test226 + printfn "%A" test227 + printfn "%A" test228 + printfn "%A" test229 + printfn "%A" test230 + printfn "%A" test231 + printfn "%A" test232 + printfn "%A" test233 + printfn "%A" test234 + printfn "%A" test235 + printfn "%A" test236 + printfn "%A" test237 + printfn "%A" test238 + printfn "%A" test239 + printfn "%A" test240 + printfn "%A" test241 + printfn "%A" test242 + printfn "%A" test243 + printfn "%A" test244 + printfn "%A" test245 + printfn "%A" test246 + printfn "%A" test247 + printfn "%A" test248 + printfn "%A" test249 + printfn "%A" test250 + printfn "%A" test251 + printfn "%A" test252 + printfn "%A" test253 + printfn "%A" test254 + printfn "%A" test255 + printfn "%A" test256 + printfn "%A" test257 + printfn "%A" test258 + printfn "%A" test259 + printfn "%A" test260 + printfn "%A" test261 + printfn "%A" test262 + printfn "%A" test263 + printfn "%A" test264 + printfn "%A" test265 + printfn "%A" test266 + printfn "%A" test267 + printfn "%A" test268 + printfn "%A" test269 + printfn "%A" test270 + printfn "%A" test271 + printfn "%A" test272 + printfn "%A" test273 + printfn "%A" test274 + printfn "%A" test275 + printfn "%A" test276 + printfn "%A" test277 + printfn "%A" test278 + printfn "%A" test279 + printfn "%A" test280 + printfn "%A" test281 + printfn "%A" test282 + printfn "%A" test283 + printfn "%A" test284 + printfn "%A" test285 + printfn "%A" test286 + printfn "%A" test287 + printfn "%A" test288 + printfn "%A" test289 + printfn "%A" test290 + printfn "%A" test291 + printfn "%A" test292 + printfn "%A" test293 + printfn "%A" test294 + printfn "%A" test295 + printfn "%A" test296 + printfn "%A" test297 + printfn "%A" test298 + printfn "%A" test299 + printfn "%A" test300 + printfn "%A" test301 + printfn "%A" test302 + printfn "%A" test303 + printfn "%A" test304 + printfn "%A" test305 + printfn "%A" test306 + printfn "%A" test307 + printfn "%A" test308 + printfn "%A" test309 + printfn "%A" test310 + printfn "%A" test311 + printfn "%A" test312 + printfn "%A" test313 + printfn "%A" test314 + printfn "%A" test315 + printfn "%A" test316 + printfn "%A" test317 + printfn "%A" test318 + printfn "%A" test319 + printfn "%A" test320 + printfn "%A" test321 + printfn "%A" test322 + printfn "%A" test323 + printfn "%A" test324 + printfn "%A" test325 + printfn "%A" test326 + printfn "%A" test327 + printfn "%A" test328 + printfn "%A" test329 + printfn "%A" test330 + printfn "%A" test331 + printfn "%A" test332 + printfn "%A" test333 + printfn "%A" test334 + printfn "%A" test335 + printfn "%A" test336 + printfn "%A" test337 + printfn "%A" test338 + printfn "%A" test339 + printfn "%A" test340 + printfn "%A" test341 + printfn "%A" test342 + printfn "%A" test343 + printfn "%A" test344 + printfn "%A" test345 + printfn "%A" test346 + printfn "%A" test347 + printfn "%A" test348 + printfn "%A" test349 + printfn "%A" test350 + printfn "%A" test351 + printfn "%A" test352 + printfn "%A" test353 + printfn "%A" test354 + printfn "%A" test355 + printfn "%A" test356 + printfn "%A" test357 + printfn "%A" test358 + printfn "%A" test359 + printfn "%A" test360 + printfn "%A" test361 + printfn "%A" test362 + printfn "%A" test363 + printfn "%A" test364 + printfn "%A" test365 + printfn "%A" test366 + printfn "%A" test367 + printfn "%A" test368 + printfn "%A" test369 + printfn "%A" test370 + printfn "%A" test371 + printfn "%A" test372 + printfn "%A" test373 + printfn "%A" test374 + printfn "%A" test375 + printfn "%A" test376 + printfn "%A" test377 + printfn "%A" test378 + printfn "%A" test379 + printfn "%A" test380 + printfn "%A" test381 + printfn "%A" test382 + printfn "%A" test383 + printfn "%A" test384 + printfn "%A" test385 + printfn "%A" test386 + printfn "%A" test387 + printfn "%A" test388 + printfn "%A" test389 + printfn "%A" test390 + printfn "%A" test391 + printfn "%A" test392 + printfn "%A" test393 + printfn "%A" test394 + printfn "%A" test395 + printfn "%A" test396 + printfn "%A" test397 + printfn "%A" test398 + printfn "%A" test399 + printfn "%A" test400 + printfn "%A" test401 + printfn "%A" test402 + printfn "%A" test403 + printfn "%A" test404 + printfn "%A" test405 + printfn "%A" test406 + printfn "%A" test407 + printfn "%A" test408 + printfn "%A" test409 + printfn "%A" test410 + printfn "%A" test411 + printfn "%A" test412 + printfn "%A" test413 + printfn "%A" test414 + printfn "%A" test415 + printfn "%A" test416 + printfn "%A" test417 + printfn "%A" test418 + printfn "%A" test419 + printfn "%A" test420 + printfn "%A" test421 + printfn "%A" test422 + printfn "%A" test423 + printfn "%A" test424 + printfn "%A" test425 + printfn "%A" test426 + printfn "%A" test427 + printfn "%A" test428 + printfn "%A" test429 + printfn "%A" test430 + printfn "%A" test431 + printfn "%A" test432 + printfn "%A" test433 + printfn "%A" test434 + printfn "%A" test435 + printfn "%A" test436 + printfn "%A" test437 + printfn "%A" test438 + printfn "%A" test439 + printfn "%A" test440 + printfn "%A" test441 + printfn "%A" test442 + printfn "%A" test443 + printfn "%A" test444 + printfn "%A" test445 + printfn "%A" test446 + printfn "%A" test447 + printfn "%A" test448 + printfn "%A" test449 + printfn "%A" test450 + printfn "%A" test451 + printfn "%A" test452 + printfn "%A" test453 + printfn "%A" test454 + printfn "%A" test455 + printfn "%A" test456 + printfn "%A" test457 + printfn "%A" test458 + printfn "%A" test459 + printfn "%A" test460 + printfn "%A" test461 + printfn "%A" test462 + printfn "%A" test463 + printfn "%A" test464 + printfn "%A" test465 + printfn "%A" test466 + printfn "%A" test467 + printfn "%A" test468 + printfn "%A" test469 + printfn "%A" test470 + printfn "%A" test471 + printfn "%A" test472 + printfn "%A" test473 + printfn "%A" test474 + printfn "%A" test475 + printfn "%A" test476 + printfn "%A" test477 + printfn "%A" test478 + printfn "%A" test479 + printfn "%A" test480 + printfn "%A" test481 + printfn "%A" test482 + printfn "%A" test483 + printfn "%A" test484 + printfn "%A" test485 + printfn "%A" test486 + printfn "%A" test487 + printfn "%A" test488 + printfn "%A" test489 + printfn "%A" test490 + printfn "%A" test491 + printfn "%A" test492 + printfn "%A" test493 + printfn "%A" test494 + printfn "%A" test495 + printfn "%A" test496 + printfn "%A" test497 + printfn "%A" test498 + printfn "%A" test499 + printfn "%A" test500 + printfn "%A" test501 + printfn "%A" test502 + printfn "%A" test503 + printfn "%A" test504 + printfn "%A" test505 + printfn "%A" test506 + printfn "%A" test507 + printfn "%A" test508 + printfn "%A" test509 + printfn "%A" test510 + printfn "%A" test511 + printfn "%A" test512 + printfn "%A" test513 + printfn "%A" test514 + printfn "%A" test515 + printfn "%A" test516 + printfn "%A" test517 + printfn "%A" test518 + printfn "%A" test519 + printfn "%A" test520 + printfn "%A" test521 + printfn "%A" test522 + printfn "%A" test523 + printfn "%A" test524 + printfn "%A" test525 + printfn "%A" test526 + printfn "%A" test527 + printfn "%A" test528 + printfn "%A" test529 + printfn "%A" test530 + printfn "%A" test531 + printfn "%A" test532 + printfn "%A" test533 + printfn "%A" test534 + printfn "%A" test535 + printfn "%A" test536 + printfn "%A" test537 + printfn "%A" test538 + printfn "%A" test539 + printfn "%A" test540 + printfn "%A" test541 + printfn "%A" test542 + printfn "%A" test543 + printfn "%A" test544 + printfn "%A" test545 + printfn "%A" test546 + printfn "%A" test547 + printfn "%A" test548 + printfn "%A" test549 + printfn "%A" test550 + printfn "%A" test551 + printfn "%A" test552 + printfn "%A" test553 + printfn "%A" test554 + printfn "%A" test555 + printfn "%A" test556 + printfn "%A" test557 + printfn "%A" test558 + printfn "%A" test559 + printfn "%A" test560 + printfn "%A" test561 + printfn "%A" test562 + printfn "%A" test563 + printfn "%A" test564 + printfn "%A" test565 + printfn "%A" test566 + printfn "%A" test567 + printfn "%A" test568 + printfn "%A" test569 + printfn "%A" test570 + printfn "%A" test571 + printfn "%A" test572 + printfn "%A" test573 + printfn "%A" test574 + printfn "%A" test575 + printfn "%A" test576 + printfn "%A" test577 + printfn "%A" test578 + printfn "%A" test579 + printfn "%A" test580 + printfn "%A" test581 + printfn "%A" test582 + printfn "%A" test583 + printfn "%A" test584 + printfn "%A" test585 + printfn "%A" test586 + printfn "%A" test587 + printfn "%A" test588 + printfn "%A" test589 + printfn "%A" test590 + printfn "%A" test591 + printfn "%A" test592 + printfn "%A" test593 + printfn "%A" test594 + printfn "%A" test595 + printfn "%A" test596 + printfn "%A" test597 + printfn "%A" test598 + printfn "%A" test599 + printfn "%A" test600 + printfn "%A" test601 + printfn "%A" test602 + printfn "%A" test603 + printfn "%A" test604 + printfn "%A" test605 + printfn "%A" test606 + printfn "%A" test607 + printfn "%A" test608 + printfn "%A" test609 + printfn "%A" test610 + printfn "%A" test611 + printfn "%A" test612 + printfn "%A" test613 + printfn "%A" test614 + printfn "%A" test615 + printfn "%A" test616 + printfn "%A" test617 + printfn "%A" test618 + printfn "%A" test619 + printfn "%A" test620 + printfn "%A" test621 + printfn "%A" test622 + printfn "%A" test623 + printfn "%A" test624 + printfn "%A" test625 + printfn "%A" test626 + printfn "%A" test627 + printfn "%A" test628 + printfn "%A" test629 + printfn "%A" test630 + printfn "%A" test631 + printfn "%A" test632 + printfn "%A" test633 + printfn "%A" test634 + printfn "%A" test635 + printfn "%A" test636 + printfn "%A" test637 + printfn "%A" test638 + printfn "%A" test639 + printfn "%A" test640 + printfn "%A" test641 + printfn "%A" test642 + printfn "%A" test643 + printfn "%A" test644 + printfn "%A" test645 + printfn "%A" test646 + printfn "%A" test647 + printfn "%A" test648 + printfn "%A" test649 + printfn "%A" test650 + printfn "%A" test651 + printfn "%A" test652 + printfn "%A" test653 + printfn "%A" test654 + printfn "%A" test655 + printfn "%A" test656 + printfn "%A" test657 + printfn "%A" test658 + printfn "%A" test659 + printfn "%A" test660 + printfn "%A" test661 + printfn "%A" test662 + printfn "%A" test663 + printfn "%A" test664 + printfn "%A" test665 + printfn "%A" test666 + printfn "%A" test667 + printfn "%A" test668 + printfn "%A" test669 + printfn "%A" test670 + printfn "%A" test671 + printfn "%A" test672 + printfn "%A" test673 + printfn "%A" test674 + printfn "%A" test675 + printfn "%A" test676 + printfn "%A" test677 + printfn "%A" test678 + printfn "%A" test679 + printfn "%A" test680 + printfn "%A" test681 + printfn "%A" test682 + printfn "%A" test683 + printfn "%A" test684 + printfn "%A" test685 + printfn "%A" test686 + printfn "%A" test687 + printfn "%A" test688 + printfn "%A" test689 + printfn "%A" test690 + printfn "%A" test691 + printfn "%A" test692 + printfn "%A" test693 + printfn "%A" test694 + printfn "%A" test695 + printfn "%A" test696 + printfn "%A" test697 + printfn "%A" test698 + printfn "%A" test699 + printfn "%A" test700 + printfn "%A" test701 + printfn "%A" test702 + printfn "%A" test703 + printfn "%A" test704 + printfn "%A" test705 + printfn "%A" test706 + printfn "%A" test707 + printfn "%A" test708 + printfn "%A" test709 + printfn "%A" test710 + printfn "%A" test711 + printfn "%A" test712 + printfn "%A" test713 + printfn "%A" test714 + printfn "%A" test715 + printfn "%A" test716 + printfn "%A" test717 + printfn "%A" test718 + printfn "%A" test719 + printfn "%A" test720 + printfn "%A" test721 + printfn "%A" test722 + printfn "%A" test723 + printfn "%A" test724 + printfn "%A" test725 + printfn "%A" test726 + printfn "%A" test727 + printfn "%A" test728 + printfn "%A" test729 + printfn "%A" test730 + printfn "%A" test731 + printfn "%A" test732 + printfn "%A" test733 + printfn "%A" test734 + printfn "%A" test735 + printfn "%A" test736 + printfn "%A" test737 + printfn "%A" test738 + printfn "%A" test739 + printfn "%A" test740 + printfn "%A" test741 + printfn "%A" test742 + printfn "%A" test743 + printfn "%A" test744 + printfn "%A" test745 + printfn "%A" test746 + printfn "%A" test747 + printfn "%A" test748 + printfn "%A" test749 + printfn "%A" test750 + printfn "%A" test751 + printfn "%A" test752 + printfn "%A" test753 + printfn "%A" test754 + printfn "%A" test755 + printfn "%A" test756 + printfn "%A" test757 + printfn "%A" test758 + printfn "%A" test759 + printfn "%A" test760 + printfn "%A" test761 + printfn "%A" test762 + printfn "%A" test763 + printfn "%A" test764 + printfn "%A" test765 + printfn "%A" test766 + printfn "%A" test767 + printfn "%A" test768 + printfn "%A" test769 + printfn "%A" test770 + printfn "%A" test771 + printfn "%A" test772 + printfn "%A" test773 + printfn "%A" test774 + printfn "%A" test775 + printfn "%A" test776 + printfn "%A" test777 + printfn "%A" test778 + printfn "%A" test779 + printfn "%A" test780 + printfn "%A" test781 + printfn "%A" test782 + printfn "%A" test783 + printfn "%A" test784 + printfn "%A" test785 + printfn "%A" test786 + printfn "%A" test787 + printfn "%A" test788 + printfn "%A" test789 + printfn "%A" test790 + printfn "%A" test791 + printfn "%A" test792 + printfn "%A" test793 + printfn "%A" test794 + printfn "%A" test795 + printfn "%A" test796 + printfn "%A" test797 + printfn "%A" test798 + printfn "%A" test799 + printfn "%A" test800 + printfn "%A" test801 + printfn "%A" test802 + printfn "%A" test803 + printfn "%A" test804 + printfn "%A" test805 + printfn "%A" test806 + printfn "%A" test807 + printfn "%A" test808 + printfn "%A" test809 + printfn "%A" test810 + printfn "%A" test811 + printfn "%A" test812 + printfn "%A" test813 + printfn "%A" test814 + printfn "%A" test815 + printfn "%A" test816 + printfn "%A" test817 + printfn "%A" test818 + printfn "%A" test819 + printfn "%A" test820 + printfn "%A" test821 + printfn "%A" test822 + printfn "%A" test823 + printfn "%A" test824 + printfn "%A" test825 + printfn "%A" test826 + printfn "%A" test827 + printfn "%A" test828 + printfn "%A" test829 + printfn "%A" test830 + printfn "%A" test831 + printfn "%A" test832 + printfn "%A" test833 + printfn "%A" test834 + printfn "%A" test835 + printfn "%A" test836 + printfn "%A" test837 + printfn "%A" test838 + printfn "%A" test839 + printfn "%A" test840 + printfn "%A" test841 + printfn "%A" test842 + printfn "%A" test843 + printfn "%A" test844 + printfn "%A" test845 + printfn "%A" test846 + printfn "%A" test847 + printfn "%A" test848 + printfn "%A" test849 + printfn "%A" test850 + printfn "%A" test851 + printfn "%A" test852 + printfn "%A" test853 + printfn "%A" test854 + printfn "%A" test855 + printfn "%A" test856 + printfn "%A" test857 + printfn "%A" test858 + printfn "%A" test859 + printfn "%A" test860 + printfn "%A" test861 + printfn "%A" test862 + printfn "%A" test863 + printfn "%A" test864 + printfn "%A" test865 + printfn "%A" test866 + printfn "%A" test867 + printfn "%A" test868 + printfn "%A" test869 + printfn "%A" test870 + printfn "%A" test871 + printfn "%A" test872 + printfn "%A" test873 + printfn "%A" test874 + printfn "%A" test875 + printfn "%A" test876 + printfn "%A" test877 + printfn "%A" test878 + printfn "%A" test879 + printfn "%A" test880 + printfn "%A" test881 + printfn "%A" test882 + printfn "%A" test883 + printfn "%A" test884 + printfn "%A" test885 + printfn "%A" test886 + printfn "%A" test887 + printfn "%A" test888 + printfn "%A" test889 + printfn "%A" test890 + printfn "%A" test891 + printfn "%A" test892 + printfn "%A" test893 + printfn "%A" test894 + printfn "%A" test895 + printfn "%A" test896 + printfn "%A" test897 + printfn "%A" test898 + printfn "%A" test899 + printfn "%A" test900 + printfn "%A" test901 + printfn "%A" test902 + printfn "%A" test903 + printfn "%A" test904 + printfn "%A" test905 + printfn "%A" test906 + printfn "%A" test907 + printfn "%A" test908 + printfn "%A" test909 + printfn "%A" test910 + printfn "%A" test911 + printfn "%A" test912 + printfn "%A" test913 + printfn "%A" test914 + printfn "%A" test915 + printfn "%A" test916 + printfn "%A" test917 + printfn "%A" test918 + printfn "%A" test919 + printfn "%A" test920 + printfn "%A" test921 + printfn "%A" test922 + printfn "%A" test923 + printfn "%A" test924 + printfn "%A" test925 + printfn "%A" test926 + printfn "%A" test927 + printfn "%A" test928 + printfn "%A" test929 + printfn "%A" test930 + printfn "%A" test931 + printfn "%A" test932 + printfn "%A" test933 + printfn "%A" test934 + printfn "%A" test935 + printfn "%A" test936 + printfn "%A" test937 + printfn "%A" test938 + printfn "%A" test939 + printfn "%A" test940 + printfn "%A" test941 + printfn "%A" test942 + printfn "%A" test943 + printfn "%A" test944 + printfn "%A" test945 + printfn "%A" test946 + printfn "%A" test947 + printfn "%A" test948 + printfn "%A" test949 + printfn "%A" test950 + printfn "%A" test951 + printfn "%A" test952 + printfn "%A" test953 + printfn "%A" test954 + printfn "%A" test955 + printfn "%A" test956 + printfn "%A" test957 + printfn "%A" test958 + printfn "%A" test959 + printfn "%A" test960 + printfn "%A" test961 + printfn "%A" test962 + printfn "%A" test963 + printfn "%A" test964 + printfn "%A" test965 + printfn "%A" test966 + printfn "%A" test967 + printfn "%A" test968 + printfn "%A" test969 + printfn "%A" test970 + printfn "%A" test971 + printfn "%A" test972 + printfn "%A" test973 + printfn "%A" test974 + printfn "%A" test975 + printfn "%A" test976 + printfn "%A" test977 + printfn "%A" test978 + printfn "%A" test979 + printfn "%A" test980 + printfn "%A" test981 + printfn "%A" test982 + printfn "%A" test983 + printfn "%A" test984 + printfn "%A" test985 + printfn "%A" test986 + printfn "%A" test987 + printfn "%A" test988 + printfn "%A" test989 + printfn "%A" test990 + printfn "%A" test991 + printfn "%A" test992 + printfn "%A" test993 + printfn "%A" test994 + printfn "%A" test995 + printfn "%A" test996 + printfn "%A" test997 + printfn "%A" test998 + printfn "%A" test999 + printfn "%A" test1000 + +[] +let main _ = 0 + """ + + [] + let LargeListExprDoesNotStackOverflow() = + let source = """ +let test () : unit = + let largeList = + [ + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 + 45 + 46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 + 100 + 101 + 102 + 103 + 104 + 105 + 106 + 107 + 108 + 109 + 110 + 111 + 112 + 113 + 114 + 115 + 116 + 117 + 118 + 119 + 120 + 121 + 122 + 123 + 124 + 125 + 126 + 127 + 128 + 129 + 130 + 131 + 132 + 133 + 134 + 135 + 136 + 137 + 138 + 139 + 140 + 141 + 142 + 143 + 144 + 145 + 146 + 147 + 148 + 149 + 150 + 151 + 152 + 153 + 154 + 155 + 156 + 157 + 158 + 159 + 160 + 161 + 162 + 163 + 164 + 165 + 166 + 167 + 168 + 169 + 170 + 171 + 172 + 173 + 174 + 175 + 176 + 177 + 178 + 179 + 180 + 181 + 182 + 183 + 184 + 185 + 186 + 187 + 188 + 189 + 190 + 191 + 192 + 193 + 194 + 195 + 196 + 197 + 198 + 199 + 200 + 201 + 202 + 203 + 204 + 205 + 206 + 207 + 208 + 209 + 210 + 211 + 212 + 213 + 214 + 215 + 216 + 217 + 218 + 219 + 220 + 221 + 222 + 223 + 224 + 225 + 226 + 227 + 228 + 229 + 230 + 231 + 232 + 233 + 234 + 235 + 236 + 237 + 238 + 239 + 240 + 241 + 242 + 243 + 244 + 245 + 246 + 247 + 248 + 249 + 250 + 251 + 252 + 253 + 254 + 255 + 256 + 257 + 258 + 259 + 260 + 261 + 262 + 263 + 264 + 265 + 266 + 267 + 268 + 269 + 270 + 271 + 272 + 273 + 274 + 275 + 276 + 277 + 278 + 279 + 280 + 281 + 282 + 283 + 284 + 285 + 286 + 287 + 288 + 289 + 290 + 291 + 292 + 293 + 294 + 295 + 296 + 297 + 298 + 299 + 300 + 301 + 302 + 303 + 304 + 305 + 306 + 307 + 308 + 309 + 310 + 311 + 312 + 313 + 314 + 315 + 316 + 317 + 318 + 319 + 320 + 321 + 322 + 323 + 324 + 325 + 326 + 327 + 328 + 329 + 330 + 331 + 332 + 333 + 334 + 335 + 336 + 337 + 338 + 339 + 340 + 341 + 342 + 343 + 344 + 345 + 346 + 347 + 348 + 349 + 350 + 351 + 352 + 353 + 354 + 355 + 356 + 357 + 358 + 359 + 360 + 361 + 362 + 363 + 364 + 365 + 366 + 367 + 368 + 369 + 370 + 371 + 372 + 373 + 374 + 375 + 376 + 377 + 378 + 379 + 380 + 381 + 382 + 383 + 384 + 385 + 386 + 387 + 388 + 389 + 390 + 391 + 392 + 393 + 394 + 395 + 396 + 397 + 398 + 399 + 400 + 401 + 402 + 403 + 404 + 405 + 406 + 407 + 408 + 409 + 410 + 411 + 412 + 413 + 414 + 415 + 416 + 417 + 418 + 419 + 420 + 421 + 422 + 423 + 424 + 425 + 426 + 427 + 428 + 429 + 430 + 431 + 432 + 433 + 434 + 435 + 436 + 437 + 438 + 439 + 440 + 441 + 442 + 443 + 444 + 445 + 446 + 447 + 448 + 449 + 450 + 451 + 452 + 453 + 454 + 455 + 456 + 457 + 458 + 459 + 460 + 461 + 462 + 463 + 464 + 465 + 466 + 467 + 468 + 469 + 470 + 471 + 472 + 473 + 474 + 475 + 476 + 477 + 478 + 479 + 480 + 481 + 482 + 483 + 484 + 485 + 486 + 487 + 488 + 489 + 490 + 491 + 492 + 493 + 494 + 495 + 496 + 497 + 498 + 499 + 500 + ] + if largeList.Length <> 500 then + failwith "Length is not 500" + + for i = 1 to 500 do + if largeList.[i - 1] <> i then + failwithf "Element was %i. Expecting %i." largeList.[i - 1] i + +test () +""" + CompilerAssert.RunScript source [] \ No newline at end of file diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 56240b466b..10e1f4733a 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -30,13 +30,14 @@ + - + From ef0949cc1eabd5bccb195d121d7ffa92a159cfbe Mon Sep 17 00:00:00 2001 From: JC Aguilera Date: Wed, 10 Jul 2019 17:16:08 -0700 Subject: [PATCH 154/286] Copy sources from Versions.props to NuGet.config (#7191) --- NuGet.config | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/NuGet.config b/NuGet.config index 8f21de1b15..a8664a73c5 100644 --- a/NuGet.config +++ b/NuGet.config @@ -8,6 +8,20 @@ + + + + + + + + + + + + + + From 1bc2896fdc5443b307aaf75bb0d4e79a22c4a486 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Wed, 10 Jul 2019 18:10:45 -0700 Subject: [PATCH 155/286] Implement Langversion switch for implicit yields (#7166) * Langversion tests for ImplicitYield * tweak * Update single-test.fs removed some printfns * Feedback * One more cleanup * Uncore une fois * Update TypeChecker.fs Fix bug --- src/fsharp/FSComp.txt | 1 + src/fsharp/LanguageFeatures.fs | 3 + src/fsharp/LanguageFeatures.fsi | 2 + src/fsharp/TypeChecker.fs | 131 +++++++++++++----- src/fsharp/xlf/FSComp.txt.cs.xlf | 5 + src/fsharp/xlf/FSComp.txt.de.xlf | 5 + src/fsharp/xlf/FSComp.txt.es.xlf | 5 + src/fsharp/xlf/FSComp.txt.fr.xlf | 5 + src/fsharp/xlf/FSComp.txt.it.xlf | 5 + src/fsharp/xlf/FSComp.txt.ja.xlf | 5 + src/fsharp/xlf/FSComp.txt.ko.xlf | 5 + src/fsharp/xlf/FSComp.txt.pl.xlf | 5 + src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 5 + src/fsharp/xlf/FSComp.txt.ru.xlf | 5 + src/fsharp/xlf/FSComp.txt.tr.xlf | 5 + src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 5 + src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 5 + tests/fsharp/single-test.fs | 13 +- tests/fsharp/tests.fs | 18 ++- .../fsharp/typecheck/sigs/version46/neg24.bsl | 30 ++++ .../fsharp/typecheck/sigs/version46/neg24.fs | 70 ++++++++++ .../typecheck/sigs/{ => version47}/neg24.bsl | 0 .../typecheck/sigs/{ => version47}/neg24.fs | 0 .../SequenceExpressions/env.lst | 10 +- .../version46/W_IfThenElse01.fs | 11 ++ .../version46/W_IfThenElse02.fs | 11 ++ .../version46/W_IfThenElse03.fs | 11 ++ .../{ => version47}/W_IfThenElse01.fs | 0 .../{ => version47}/W_IfThenElse02.fs | 0 .../{ => version47}/W_IfThenElse03.fs | 0 tests/fsharpqa/Source/Warnings/env.lst | 11 +- .../version46/WarnIfDiscardedInList.fs | 14 ++ .../version46/WarnIfDiscardedInList2.fs | 19 +++ .../version46/WarnIfDiscardedInList3.fs | 19 +++ .../{ => version47}/WarnIfDiscardedInList.fs | 0 .../{ => version47}/WarnIfDiscardedInList2.fs | 0 .../{ => version47}/WarnIfDiscardedInList3.fs | 0 37 files changed, 389 insertions(+), 50 deletions(-) create mode 100644 tests/fsharp/typecheck/sigs/version46/neg24.bsl create mode 100644 tests/fsharp/typecheck/sigs/version46/neg24.fs rename tests/fsharp/typecheck/sigs/{ => version47}/neg24.bsl (100%) rename tests/fsharp/typecheck/sigs/{ => version47}/neg24.fs (100%) create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version46/W_IfThenElse01.fs create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version46/W_IfThenElse02.fs create mode 100644 tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version46/W_IfThenElse03.fs rename tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/{ => version47}/W_IfThenElse01.fs (100%) rename tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/{ => version47}/W_IfThenElse02.fs (100%) rename tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/{ => version47}/W_IfThenElse03.fs (100%) create mode 100644 tests/fsharpqa/Source/Warnings/version46/WarnIfDiscardedInList.fs create mode 100644 tests/fsharpqa/Source/Warnings/version46/WarnIfDiscardedInList2.fs create mode 100644 tests/fsharpqa/Source/Warnings/version46/WarnIfDiscardedInList3.fs rename tests/fsharpqa/Source/Warnings/{ => version47}/WarnIfDiscardedInList.fs (100%) rename tests/fsharpqa/Source/Warnings/{ => version47}/WarnIfDiscardedInList2.fs (100%) rename tests/fsharpqa/Source/Warnings/{ => version47}/WarnIfDiscardedInList3.fs (100%) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 27d6bfd4b4..4b5f756f06 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -574,6 +574,7 @@ tcUseWhenPatternGuard,"Character range matches have been removed in F#. Consider 736,tcExprUndelayed,"TcExprUndelayed: delayed" 737,tcExpressionRequiresSequence,"This expression form may only be used in sequence and computation expressions" 738,tcInvalidObjectExpressionSyntaxForm,"Invalid object expression. Objects without overrides or interfaces should use the expression form 'new Type(args)' without braces." +739,tcInvalidObjectSequenceOrRecordExpression,"Invalid object, sequence or record expression" 740,tcInvalidSequenceExpressionSyntaxForm,"Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}'" tcExpressionWithIfRequiresParenthesis,"This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression" 741,tcUnableToParseFormatString,"Unable to parse format string '%s'" diff --git a/src/fsharp/LanguageFeatures.fs b/src/fsharp/LanguageFeatures.fs index c8c67a4ddf..a88ebdcf9a 100644 --- a/src/fsharp/LanguageFeatures.fs +++ b/src/fsharp/LanguageFeatures.fs @@ -25,6 +25,8 @@ type LanguageFeature = | WildCardInForLoop = 3 | RelaxWhitespace = 4 | NameOf = 5 + | ImplicitYield = 6 + /// LanguageVersion management type LanguageVersion (specifiedVersion) = @@ -49,6 +51,7 @@ type LanguageVersion (specifiedVersion) = LanguageFeature.WildCardInForLoop, previewVersion LanguageFeature.RelaxWhitespace, previewVersion LanguageFeature.NameOf, previewVersion + LanguageFeature.ImplicitYield, previewVersion |] let specified = diff --git a/src/fsharp/LanguageFeatures.fsi b/src/fsharp/LanguageFeatures.fsi index fef3df9ba8..44eb178840 100644 --- a/src/fsharp/LanguageFeatures.fsi +++ b/src/fsharp/LanguageFeatures.fsi @@ -12,6 +12,8 @@ type LanguageFeature = | WildCardInForLoop = 3 | RelaxWhitespace = 4 | NameOf = 5 + | ImplicitYield = 6 + /// LanguageVersion management type LanguageVersion = diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index fdbb1482b7..604d113fc7 100644 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -3518,14 +3518,84 @@ let (|ExprAsPat|_|) (f: SynExpr) = None | _ -> None +/// Check if a computation or sequence expression is syntactically free of 'yield' (though not yield!) +let YieldFree cenv expr = + if cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield then + + // Implement yield free logic for F# Language including the LanguageFeature.ImplicitYield + let rec YieldFree expr = + match expr with + | SynExpr.Sequential (_, _, e1, e2, _) -> + YieldFree e1 && YieldFree e2 + + | SynExpr.IfThenElse (_, e2, e3opt, _, _, _, _) -> + YieldFree e2 && Option.forall YieldFree e3opt + + | SynExpr.TryWith (e1, _, clauses, _, _, _, _) -> + YieldFree e1 && clauses |> List.forall (fun (Clause(_, _, e, _, _)) -> YieldFree e) + + | (SynExpr.Match (_, _, clauses, _) | SynExpr.MatchBang (_, _, clauses, _)) -> + clauses |> List.forall (fun (Clause(_, _, e, _, _)) -> YieldFree e) + + | SynExpr.For (_, _, _, _, _, body, _) + | SynExpr.TryFinally (body, _, _, _, _) + | SynExpr.LetOrUse (_, _, _, body, _) + | SynExpr.While (_, _, body, _) + | SynExpr.ForEach (_, _, _, _, _, body, _) -> + YieldFree body + + | SynExpr.LetOrUseBang(_, _, _, _, _, body, _) -> + YieldFree body + + | SynExpr.YieldOrReturn((true, _), _, _) -> false + + | _ -> true + + YieldFree expr + else + // Implement yield free logic for F# Language without the LanguageFeature.ImplicitYield + let rec YieldFree expr = + match expr with + | SynExpr.Sequential (_, _, e1, e2, _) -> + YieldFree e1 && YieldFree e2 + + | SynExpr.IfThenElse (_, e2, e3opt, _, _, _, _) -> + YieldFree e2 && Option.forall YieldFree e3opt + + | SynExpr.TryWith (e1, _, clauses, _, _, _, _) -> + YieldFree e1 && clauses |> List.forall (fun (Clause(_, _, e, _, _)) -> YieldFree e) + + | (SynExpr.Match (_, _, clauses, _) | SynExpr.MatchBang (_, _, clauses, _)) -> + clauses |> List.forall (fun (Clause(_, _, e, _, _)) -> YieldFree e) + + | SynExpr.For (_, _, _, _, _, body, _) + | SynExpr.TryFinally (body, _, _, _, _) + | SynExpr.LetOrUse (_, _, _, body, _) + | SynExpr.While (_, _, body, _) + | SynExpr.ForEach (_, _, _, _, _, body, _) -> + YieldFree body + + | SynExpr.LetOrUseBang _ + | SynExpr.YieldOrReturnFrom _ + | SynExpr.YieldOrReturn _ + | SynExpr.ImplicitZero _ + | SynExpr.Do _ -> false + + | _ -> true + + YieldFree expr + + /// Determine if a syntactic expression inside 'seq { ... }' or '[...]' counts as a "simple sequence /// of semicolon separated values". For example [1;2;3]. +/// 'acceptDeprecated' is true for the '[ ... ]' case, where we allow the syntax '[ if g then t else e ]' but ask it to be parenthesized /// -let (|SimpleSemicolonSequence|_|) cexpr = +let (|SimpleSemicolonSequence|_|) cenv acceptDeprecated cexpr = let IsSimpleSemicolonSequenceElement expr = - match expr with - | SynExpr.IfThenElse _ + match expr with + | SynExpr.IfThenElse _ when acceptDeprecated && YieldFree cenv expr -> true + | SynExpr.IfThenElse _ | SynExpr.TryWith _ | SynExpr.Match _ | SynExpr.For _ @@ -5734,6 +5804,13 @@ and TcExprUndelayedNoType cenv env tpenv synExpr: Expr * TType * _ = expr, overallTy, tpenv and TcExprUndelayed cenv overallTy env tpenv (synExpr: SynExpr) = + + // LanguageFeatures.ImplicitYield do not require this validation + let implicitYieldEnabled = cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield + let validateObjectSequenceOrRecordExpression = not implicitYieldEnabled + let validateExpressionWithIfRequiresParenethesis = not implicitYieldEnabled + let acceptDeprecatedIfThenExpression = not implicitYieldEnabled + match synExpr with | SynExpr.Paren (expr2, _, _, mWholeExprIncludingParentheses) -> // We invoke CallExprHasTypeSink for every construct which is atomic in the syntax, i.e. where a '.' immediately following the @@ -5932,6 +6009,8 @@ and TcExprUndelayed cenv overallTy env tpenv (synExpr: SynExpr) = match comp with | SynExpr.New _ -> errorR(Error(FSComp.SR.tcInvalidObjectExpressionSyntaxForm(), m)) + | SimpleSemicolonSequence cenv false _ when validateObjectSequenceOrRecordExpression -> + errorR(Error(FSComp.SR.tcInvalidObjectSequenceOrRecordExpression(), m)) | _ -> () if not !isNotNakedRefCell && not cenv.g.compilingFslib then @@ -5941,9 +6020,12 @@ and TcExprUndelayed cenv overallTy env tpenv (synExpr: SynExpr) = | SynExpr.ArrayOrListOfSeqExpr (isArray, comp, m) -> CallExprHasTypeSink cenv.tcSink (m, env.NameEnv, overallTy, env.DisplayEnv, env.eAccessRights) - match comp with - | SynExpr.CompExpr (_, _, SimpleSemicolonSequence elems, _) -> + | SynExpr.CompExpr (_, _, (SimpleSemicolonSequence cenv acceptDeprecatedIfThenExpression elems as body), _) -> + match body with + | SimpleSemicolonSequence cenv false _ -> () + | _ when validateExpressionWithIfRequiresParenethesis -> errorR(Deprecated(FSComp.SR.tcExpressionWithIfRequiresParenthesis(), m)) + | _ -> () let replacementExpr = if isArray then @@ -7331,31 +7413,6 @@ and TcQuotationExpr cenv overallTy env tpenv (_oper, raw, ast, isFromQueryExpres /// Ignores an attribute and IgnoreAttribute _ = None -/// Check if a computation or sequence expression is syntactically free of 'yield' (though not yield!) -and YieldFree expr = - match expr with - | SynExpr.Sequential (_, _, e1, e2, _) -> YieldFree e1 && YieldFree e2 - | SynExpr.IfThenElse (_, e2, e3opt, _, _, _, _) -> YieldFree e2 && Option.forall YieldFree e3opt - | SynExpr.TryWith (e1, _, clauses, _, _, _, _) -> - YieldFree e1 && clauses |> List.forall (fun (Clause(_, _, e, _, _)) -> YieldFree e) - | (SynExpr.Match (_, _, clauses, _) | SynExpr.MatchBang (_, _, clauses, _)) -> - clauses |> List.forall (fun (Clause(_, _, e, _, _)) -> YieldFree e) - | SynExpr.For (_, _, _, _, _, body, _) - | SynExpr.TryFinally (body, _, _, _, _) - | SynExpr.LetOrUse (_, _, _, body, _) - | SynExpr.LetOrUseBang(_, _, _, _, _, body, _) - | SynExpr.LetOrUse (_, _, _, body, _) - | SynExpr.While (_, _, body, _) - | SynExpr.ForEach (_, _, _, _, _, body, _) -> - YieldFree body - - // 'yield!' in expressions doesn't trigger the 'yield free' rule - //| SynExpr.YieldOrReturnFrom _ - | SynExpr.YieldOrReturn((true, _), _, _) -> - false - - | _ -> true - /// Used for all computation expressions except sequence expressions and TcComputationExpression cenv env overallTy mWhole (interpExpr: Expr) builderTy tpenv (comp: SynExpr) = @@ -7814,7 +7871,9 @@ and TcComputationExpression cenv env overallTy mWhole (interpExpr: Expr) builder // If there are no 'yield' in the computation expression, and the builder supports 'Yield', // then allow the type-directed rule interpreting non-unit-typed expressions in statement // positions as 'yield'. 'yield!' may be present in the computation expression. - let enableImplicitYield = hasMethInfo "Yield" && hasMethInfo "Combine" && hasMethInfo "Delay" && YieldFree comp + let enableImplicitYield = + cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield + && (hasMethInfo "Yield" && hasMethInfo "Combine" && hasMethInfo "Delay" && YieldFree cenv comp) // q - a flag indicating if custom operators are allowed. They are not allowed inside try/with, try/finally, if/then/else etc. // varSpace - a lazy data structure indicating the variables bound so far in the overall computation @@ -8200,8 +8259,7 @@ and TcComputationExpression cenv env overallTy mWhole (interpExpr: Expr) builder | _ -> Some (trans true q varSpace innerComp2 (fun holeFill -> let fillExpr = - if enableImplicitYield then - + if enableImplicitYield then // When implicit yields are enabled, then if the 'innerComp1' checks as type // 'unit' we interpret the expression as a sequential, and when it doesn't // have type 'unit' we interpret it as a 'Yield + Combine'. @@ -8443,7 +8501,9 @@ and TcSequenceExpression cenv env tpenv comp overallTy m = // If there are no 'yield' in the computation expression then allow the type-directed rule // interpreting non-unit-typed expressions in statement positions as 'yield'. 'yield!' may be // present in the computation expression. - let enableImplicitYield = YieldFree comp + let enableImplicitYield = + cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield + && (YieldFree cenv comp) let mkDelayedExpr (coreExpr: Expr) = let m = coreExpr.Range @@ -8505,6 +8565,9 @@ and TcSequenceExpression cenv env tpenv comp overallTy m = Some(mkSeqFinally cenv env innerExprMark genOuterTy innerExpr unwindExpr, tpenv) + | SynExpr.Paren (_, _, _, m) when not (cenv.g.langVersion.SupportsFeature LanguageFeature.ImplicitYield)-> + error(Error(FSComp.SR.tcConstructIsAmbiguousInSequenceExpression(), m)) + | SynExpr.ImplicitZero m -> Some(mkSeqEmpty cenv env m genOuterTy, tpenv ) diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 6995c485ab..7c1b38a4b5 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -2847,6 +2847,11 @@ Neplatný objektový výraz. U objektů bez přepsání nebo rozhraní by se měl výraz formulovat pomocí notace new Type(args) bez složených závorek. + + Invalid object, sequence or record expression + Neplatný výraz objektu, pořadí nebo záznamu + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Neplatný výraz záznamu, pořadí nebo výpočtu. Výrazy pořadí by měly mít notaci seq {{ ... }}. diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 1d4725f182..33a03002ea 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -2847,6 +2847,11 @@ Ungültiger Objektausdruck. Objekte ohne Überschreibungen oder Schnittstellen sollten das Ausdrucksformat "new Type(args)" ohne geschweifte Klammern verwenden. + + Invalid object, sequence or record expression + Ungültiger Objekt-, Sequenz- oder Datensatzausdruck. + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Ungültiger Datensatz-, Sequenz- oder Berechnungsausdruck. Sequenzausdrücke müssen das Format "seq {{ ... }}" besitzen. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index dba9ebb7f7..07a6a376d6 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -2847,6 +2847,11 @@ Expresión de objeto no válida. Los objetos sin invalidaciones ni interfaces deben usar el formato de expresión 'new Type(args)' sin llaves. + + Invalid object, sequence or record expression + Expresión de objeto, secuencia o registro no válida. + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Expresión de registro, secuencia o cómputo no válida. Las expresiones de secuencia deben tener el formato 'seq {{ ... }}'. diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index 067c0d42c9..db443013cc 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -2847,6 +2847,11 @@ Expression d'objet non valide. Les objets sans substitutions ou interfaces doivent utiliser la forme d'expression 'new Type(args)' sans accolades. + + Invalid object, sequence or record expression + Expression d'objet, de séquence ou d'enregistrement non valide + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Expression d'enregistrement, de séquence ou de calcul non valide. Les expressions de séquence doivent avoir le format 'seq {{ ... }}' diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 6ff1a46835..27d3af91a0 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -2847,6 +2847,11 @@ Espressione oggetto non valida. Gli oggetti senza override o interfacce devono usare il formato di espressione 'new Type(args)' senza parentesi graffe. + + Invalid object, sequence or record expression + Espressione record, sequenza o oggetto non valida + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Espressione di calcolo, sequenza o record non valida. Il formato delle espressioni sequenza deve essere 'seq {{ ... }}' diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 822ef18990..47430c5e72 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -2847,6 +2847,11 @@ オブジェクト式が無効です。オーバーライドまたはインターフェイスがないオブジェクトには、かっこなしで 'new Type(args)' という形式の式を使用してください。 + + Invalid object, sequence or record expression + オブジェクト式、シーケンス式、またはレコード式が無効です + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' 無効なレコード、シーケンス式、またはコンピュテーション式です。シーケンス式は 'seq {{ ... }}' という形式にしてください。 diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index b77f3b4cad..2f3708ed03 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -2847,6 +2847,11 @@ 개체 식이 잘못되었습니다. 재정의 또는 인터페이스가 없는 개체는 중괄호 없이 식 형식 'new Type(args)'을 사용해야 합니다. + + Invalid object, sequence or record expression + 개체, 시퀀스 또는 레코드 식이 잘못되었습니다. + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' 레코드, 시퀀스 또는 계산 식이 잘못되었습니다. 시퀀스 식의 형식은 'seq {{ ... }}'여야 합니다. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index 0f3e6ef69b..4b92b5b6a5 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -2847,6 +2847,11 @@ Nieprawidłowe wyrażenie obiektu. Obiekty bez przesłonięć lub interfejsy powinny używać wyrażenia w postaci „new Typ(argumenty)” bez nawiasów. + + Invalid object, sequence or record expression + Nieprawidłowe wyrażenie obiektu, sekwencji lub rekordu + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Nieprawidłowe wyrażenie rekordu, sekwencji lub obliczenia. Wyrażenia sekwencji powinny mieć postać „seq {{ ... }}” diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 2e4ea8c6dc..d679c9502a 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -2847,6 +2847,11 @@ Expressão de objeto inválida. Objetos sem substituições ou interfaces devem usar o formato de expressão 'new Type(args)' sem as chaves. + + Invalid object, sequence or record expression + Expressão de objeto, sequência ou registro inválida + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Expressão de registro, sequência ou computação inválida. Expressões de sequência devem estar na forma 'seq {{ ... }}' diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 5ead284114..3fc4173787 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -2847,6 +2847,11 @@ Недопустимое выражение объекта. Объекты без переопределений или интерфейсов должны использовать форму выражения "new Type(args)" без фигурных скобок. + + Invalid object, sequence or record expression + Недопустимое выражение объекта, последовательности или записи + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Недопустимая запись, выражение последовательности или вычислительное выражение. Выражения последовательностей должны иметь форму "seq {{ ... }}' diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index db70140c76..a04bc7ada5 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -2847,6 +2847,11 @@ Geçersiz nesne ifadesi. Geçersiz kılmaların ve arabirimlerin olmadığı nesneler küme ayraçsız 'new Type(args)' ifade biçimini kullanmalıdır. + + Invalid object, sequence or record expression + Geçersiz nesne, dizi veya kayıt ifadesi + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' Geçersiz kayıt, dizi veya hesaplama ifadesi. Dizi ifadeleri 'seq {{ ... }}' biçiminde olmalıdır diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index d90cfb843c..38918ceec9 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -2847,6 +2847,11 @@ 对象表达式无效。没有重写或接口的对象应使用不带括号的表达式格式“new Type(args)”。 + + Invalid object, sequence or record expression + 对象、序列或记录表达式无效 + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' 记录、序列或计算表达式无效。序列表达式的格式应为“seq {{ ... }}”}}' diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 6bdcae208b..1a02de7e41 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -2847,6 +2847,11 @@ 無效的物件運算式。沒有覆寫或介面的物件應該使用不加大括號的運算式形式 'new Type(args)'。 + + Invalid object, sequence or record expression + 無效的物件、順序或記錄運算式 + + Invalid record, sequence or computation expression. Sequence expressions should be of the form 'seq {{ ... }}' 無效的記錄、循序項或計算運算式。循序項運算式應該是 'seq {{ ... }}' 形式。 diff --git a/tests/fsharp/single-test.fs b/tests/fsharp/single-test.fs index c1707f619e..6a24d80bd5 100644 --- a/tests/fsharp/single-test.fs +++ b/tests/fsharp/single-test.fs @@ -379,9 +379,13 @@ let singleTestBuildAndRunVersion dir p version = let cfg = testConfig dir singleTestBuildAndRunCore cfg "" p version -let singleNegTest (cfg: TestConfig) testname = +let singleVersionedNegTest (cfg: TestConfig) version testname = - let cfg = { cfg with fsc_flags = sprintf "%s --define:NEGATIVE" cfg.fsc_flags } + let cfg = { + cfg with + fsc_flags = sprintf "%s %s --define:NEGATIVE" cfg.fsc_flags (if not (String.IsNullOrEmpty(version)) then "--langversion:" + version else "") + fsi_flags = sprintf "%s %s" cfg.fsi_flags (if not (String.IsNullOrEmpty(version)) then "--langversion:" + version else "") + } // REM == Set baseline (fsc vs vs, in case the vs baseline exists) let VSBSLFILE = @@ -405,7 +409,8 @@ let singleNegTest (cfg: TestConfig) testname = ] if fileExists cfg (testname + "-pre.fs") - then fsc cfg "%s -a -o:%s-pre.dll" cfg.fsc_flags testname [testname + "-pre.fs"] + then + fsc cfg "%s -a -o:%s-pre.dll" cfg.fsc_flags testname [testname + "-pre.fs"] else () if fileExists cfg (testname + "-pre.fsx") then @@ -444,3 +449,5 @@ let singleNegTest (cfg: TestConfig) testname = log "***** %s.err %s.bsl differed: a bug or baseline may need updating" testname testname log "***** %s.vserr %s differed: a bug or baseline may need updating" testname VSBSLFILE failwithf "%s.err %s.bsl differ; %A; %s.vserr %s differ; %A" testname testname l1 testname VSBSLFILE l2 + +let singleNegTest (cfg: TestConfig) testname = singleVersionedNegTest (cfg: TestConfig) "" testname diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index e065d6bee9..fe30c684bf 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -29,7 +29,7 @@ let FSI_BASIC = FSI_FILE #endif // ^^^^^^^^^^^^ To run these tests in F# Interactive , 'build net40', then send this chunk, then evaluate body of a test ^^^^^^^^^^^^ -module CoreTests = +module CoreTests = // These tests are enabled for .NET Framework and .NET Core [] let ``access-FSC_BASIC``() = singleTestBuildAndRun "core/access" FSC_BASIC @@ -1829,7 +1829,6 @@ module VersionTests = [] let ``nameof-fsi``() = singleTestBuildAndRunVersion "core/nameof/version47" FSI_BASIC "preview" - #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS module ToolsTests = @@ -2383,14 +2382,21 @@ module TypecheckTests = [] let ``type check neg23`` () = singleNegTest (testConfig "typecheck/sigs") "neg23" - [] - let ``type check neg24`` () = - let cfg = testConfig "typecheck/sigs" + [] + let ``type check neg24 version 4.6`` () = + let cfg = testConfig "typecheck/sigs/version46" // For some reason this warning is off by default in the test framework but in this case we are testing for it let cfg = { cfg with fsc_flags = cfg.fsc_flags.Replace("--nowarn:20", "") } - singleNegTest cfg "neg24" + singleVersionedNegTest cfg "4.6" "neg24" [] + let ``type check neg24 version 4.7`` () = + let cfg = testConfig "typecheck/sigs/version47" + // For some reason this warning is off by default in the test framework but in this case we are testing for it + let cfg = { cfg with fsc_flags = cfg.fsc_flags.Replace("--nowarn:20", "") } + singleVersionedNegTest cfg "preview" "neg24" + + [] let ``type check neg25`` () = singleNegTest (testConfig "typecheck/sigs") "neg25" [] diff --git a/tests/fsharp/typecheck/sigs/version46/neg24.bsl b/tests/fsharp/typecheck/sigs/version46/neg24.bsl new file mode 100644 index 0000000000..96a64e8c88 --- /dev/null +++ b/tests/fsharp/typecheck/sigs/version46/neg24.bsl @@ -0,0 +1,30 @@ + +neg24.fs(11,14,11,39): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression + +neg24.fs(12,14,12,41): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression + +neg24.fs(13,14,13,33): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression + +neg24.fs(14,14,14,41): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression + +neg24.fs(15,14,15,43): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression + +neg24.fs(16,14,16,35): typecheck error FS0035: This construct is deprecated: This list or array expression includes an element of the form 'if ... then ... else'. Parenthesize this expression to indicate it is an individual element of the list or array, to disambiguate this from a list generated using a sequence expression + +neg24.fs(17,18,17,45): typecheck error FS0739: Invalid object, sequence or record expression + +neg24.fs(17,20,17,43): typecheck error FS0793: This construct is ambiguous as part of a sequence expression. Nested expressions may be written using 'let _ = (...)' and nested sequences using 'yield! seq {... }'. + +neg24.fs(53,24,53,30): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. + +neg24.fs(55,31,55,37): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. + +neg24.fs(57,38,57,42): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. + +neg24.fs(60,24,60,34): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. + +neg24.fs(62,31,62,41): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. + +neg24.fs(64,44,64,48): typecheck error FS0816: One or more of the overloads of this method has curried arguments. Consider redesigning these members to take arguments in tupled form. + +neg24.fs(70,15,70,18): typecheck error FS0495: The member or object constructor 'M' has no argument or settable return property 'qez'. The required signature is member C.M : abc:int * def:string -> int. \ No newline at end of file diff --git a/tests/fsharp/typecheck/sigs/version46/neg24.fs b/tests/fsharp/typecheck/sigs/version46/neg24.fs new file mode 100644 index 0000000000..745cb52fff --- /dev/null +++ b/tests/fsharp/typecheck/sigs/version46/neg24.fs @@ -0,0 +1,70 @@ +module Test +open Microsoft.FSharp.Quotations + + +let test2 (v : Expr<'a> -> Expr<'b>) = <@ fun (i: 'a) -> %v <@i@> @> + +let test (v : 'a -> Expr<'b>) = <@ fun (i: 'a) -> %(v i) @> + +// expect warning +module Negative = + let v1 = [ if true then 1 else 2 ] + let v2 = [ if true then () else () ] + let v6 = [ if true then () ] + let a1 = [| if true then 1 else 2 |] + let a2 = [| if true then () else () |] + let a6 = [| if true then () |] + let s3 = seq { (if true then 1 else 2) } + +// expect no warning +module Positive = + let v3 = [ (if true then 1 else 2) ] + let v4 = [ if true then yield 1 else yield 2 ] + let v5 = [ if true then yield 1 ] + let a3 = [| (if true then 1 else 2) |] + let a4 = [| if true then yield 1 else yield 2 |] + let a5 = [| if true then yield 1 |] + let s2 = seq { if true then () else () } + let s6 = seq { if true then () } + let s4 = seq { if true then yield 1 else yield 2 } + let s5 = seq { if true then yield 1 } + + +module BadCurriedExtensionMember = + type C() = + member x.P = 1 + + module M1 = + type C with + member x.M1 a b = a + b + member x.M2 (a,b) c = a + b + c + + module M2 = + type C with + member x.M1 a b = a + b + member x.M2 (a,b) c = a + b + c + + open M1 + open M2 + + let c = C() + + // negative test - error expected here + let x1 : int = c.M1 3 4 + // negative test - error expected here + let x2 : int -> int = c.M1 3 + // negative test - error expected here + let x3 : int -> int -> int = c.M1 + + // negative test - error expected here + let y1 : int = c.M2 (3,4) 4 + // negative test - error expected here + let y2 : int -> int = c.M2 (3,4) + // negative test - error expected here + let y3 : int * int -> int -> int = c.M2 + +type C() = + member x.M(abc:int,def:string) = abc + def.Length + +// Check that the error for a named argument/setter that does not exist is located in a good place +let _ = C().M(qez=3) diff --git a/tests/fsharp/typecheck/sigs/neg24.bsl b/tests/fsharp/typecheck/sigs/version47/neg24.bsl similarity index 100% rename from tests/fsharp/typecheck/sigs/neg24.bsl rename to tests/fsharp/typecheck/sigs/version47/neg24.bsl diff --git a/tests/fsharp/typecheck/sigs/neg24.fs b/tests/fsharp/typecheck/sigs/version47/neg24.fs similarity index 100% rename from tests/fsharp/typecheck/sigs/neg24.fs rename to tests/fsharp/typecheck/sigs/version47/neg24.fs diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/env.lst b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/env.lst index e0c8f701ba..5f210dd6e4 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/env.lst +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/env.lst @@ -1,6 +1,10 @@ - SOURCE=W_IfThenElse01.fs SCFLAGS="--test:ErrorRanges" # W_IfThenElse01.fs - SOURCE=W_IfThenElse02.fs SCFLAGS="--test:ErrorRanges" # W_IfThenElse02.fs - SOURCE=W_IfThenElse03.fs SCFLAGS="--test:ErrorRanges" # W_IfThenElse03.fs + SOURCE=version46/W_IfThenElse01.fs SCFLAGS="--langversion:4.6 --test:ErrorRanges" # version46 W_IfThenElse01.fs + SOURCE=version46/W_IfThenElse02.fs SCFLAGS="--langversion:4.6 --test:ErrorRanges" # version46 W_IfThenElse02.fs + SOURCE=version46/W_IfThenElse03.fs SCFLAGS="--langversion:4.6 --test:ErrorRanges" # version46 W_IfThenElse03.fs + SOURCE=version47/W_IfThenElse01.fs SCFLAGS="--langversion:preview --test:ErrorRanges" # version47 W_IfThenElse01.fs + SOURCE=version47/W_IfThenElse02.fs SCFLAGS="--langversion:preview --test:ErrorRanges" # version47 W_IfThenElse02.fs + SOURCE=version47/W_IfThenElse03.fs SCFLAGS="--langversion:preview --test:ErrorRanges" # version47 W_IfThenElse03.fs + SOURCE=IfThenElse04.fs SCFLAGS="--test:ErrorRanges --warnaserror" # IfThenElse04.fs SOURCE=IfThenElse05.fs SCFLAGS="--test:ErrorRanges --warnaserror" # IfThenElse05.fs SOURCE=IfThenElse06.fs SCFLAGS="--test:ErrorRanges --warnaserror" # IfThenElse06.fs diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version46/W_IfThenElse01.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version46/W_IfThenElse01.fs new file mode 100644 index 0000000000..4e948ea575 --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version46/W_IfThenElse01.fs @@ -0,0 +1,11 @@ +// #Regression #Conformance #DataExpressions #Sequences +// Regression test for FSHARP1.0:4527 +//.+'if ... then ... else' + +// warning FS0035: This construct is deprecated: This list or array +// expression includes an element of the form 'if ... then ... else'. Parenthesize +// this expression to indicate it is an individual element of the list or array, to +// disambiguate this from a list generated using a sequence expression. + +let p = [ if true then 1 else 2 ] +(if p = [ 1 ] then 0 else 1) |> exit \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version46/W_IfThenElse02.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version46/W_IfThenElse02.fs new file mode 100644 index 0000000000..805af8ee0e --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version46/W_IfThenElse02.fs @@ -0,0 +1,11 @@ +// #Regression #Conformance #DataExpressions #Sequences +// Regression test for FSHARP1.0:4527 +//.+'if ... then ... else' + +// warning FS0035: This construct is deprecated: This list or array +// expression includes an element of the form 'if ... then ... else'. Parenthesize +// this expression to indicate it is an individual element of the list or array, to +// disambiguate this from a list generated using a sequence expression. + +let p = [ if true then 1 else printfn "hello"; 3 ] +(if p = [ 1 ] then 0 else 1) |> exit \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version46/W_IfThenElse03.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version46/W_IfThenElse03.fs new file mode 100644 index 0000000000..9a357a9f2c --- /dev/null +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version46/W_IfThenElse03.fs @@ -0,0 +1,11 @@ +// #Regression #Conformance #DataExpressions #Sequences +// Regression test for FSHARP1.0:4527 +//.+'if ... then ... else' + +// warning FS0035: This construct is deprecated: This list or array +// expression includes an element of the form 'if ... then ... else'. Parenthesize +// this expression to indicate it is an individual element of the list or array, to +// disambiguate this from a list generated using a sequence expression. + +let p = [ if true then printfn "hello"; () ];; +(if p = [ () ] then 0 else 1) |> exit \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse01.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version47/W_IfThenElse01.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse01.fs rename to tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version47/W_IfThenElse01.fs diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse02.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version47/W_IfThenElse02.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse02.fs rename to tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version47/W_IfThenElse02.fs diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse03.fs b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version47/W_IfThenElse03.fs similarity index 100% rename from tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/W_IfThenElse03.fs rename to tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/version47/W_IfThenElse03.fs diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 383c291e90..3986ab5bc9 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -47,7 +47,7 @@ SOURCE=GuardHasWrongType.fs # GuardHasWrongType.fs SOURCE=ElseBranchHasWrongType.fs # ElseBranchHasWrongType.fs SOURCE=ElseBranchHasWrongType2.fs # ElseBranchHasWrongType2.fs - SOURCE=ElseBranchHasWrongType3.fs # ElseBranchHasWrongType3.fs + SOURCE=ElseBranchHasWrongType3.fs # ElseBranchHasWrongType3.fs SOURCE=ElseBranchHasWrongType4.fs # ElseBranchHasWrongType4.fs SOURCE=NestedElseBranchHasWrongType.fs # NestedElseBranchHasWrongType.fs SOURCE=ElseBranchHasWrongContextType.fs # ElseBranchHasWrongContextType.fs @@ -77,9 +77,12 @@ SOURCE=WarnIfPossibleDotNetPropertySetter.fs SOURCE=DontWarnIfPropertyWithoutSetter.fs SOURCE=WarnIfImplicitlyDiscarded.fs - SOURCE=WarnIfDiscardedInList.fs - SOURCE=WarnIfDiscardedInList2.fs - SOURCE=WarnIfDiscardedInList3.fs + SOURCE=version46/WarnIfDiscardedInList.fs SCFLAGS="--langversion:4.6" #version46/WarnIfDiscardedInList + SOURCE=version46/WarnIfDiscardedInList2.fs SCFLAGS="--langversion:4.6" #version46/WarnIfDiscardedInList2 + SOURCE=version46/WarnIfDiscardedInList3.fs SCFLAGS="--langversion:4.6" #version46/WarnIfDiscardedInList3 + SOURCE=version47/WarnIfDiscardedInList.fs SCFLAGS="--langversion:preview" #version47/WarnIfDiscardedInList + SOURCE=version47/WarnIfDiscardedInList2.fs SCFLAGS="--langversion:preview" #version47/WarnIfDiscardedInList2 + SOURCE=version47/WarnIfDiscardedInList3.fs SCFLAGS="--langversion:preview" #version47/WarnIfDiscardedInList3 SOURCE=WarnOnlyOnLastExpression.fs SOURCE=WarnIfPossiblePropertySetter.fs SOURCE=DoCannotHaveVisibilityDeclarations.fs diff --git a/tests/fsharpqa/Source/Warnings/version46/WarnIfDiscardedInList.fs b/tests/fsharpqa/Source/Warnings/version46/WarnIfDiscardedInList.fs new file mode 100644 index 0000000000..d47a4c1376 --- /dev/null +++ b/tests/fsharpqa/Source/Warnings/version46/WarnIfDiscardedInList.fs @@ -0,0 +1,14 @@ +// #Warnings +// + +let div _ _ = 1 +let subView _ _ = [1; 2] + +// elmish view +let view model dispatch = + [ + yield! subView model dispatch + div [] [] + ] + +exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/version46/WarnIfDiscardedInList2.fs b/tests/fsharpqa/Source/Warnings/version46/WarnIfDiscardedInList2.fs new file mode 100644 index 0000000000..cf0a8cc6e8 --- /dev/null +++ b/tests/fsharpqa/Source/Warnings/version46/WarnIfDiscardedInList2.fs @@ -0,0 +1,19 @@ +// #Warnings +// + +// stupid things to make the sample compile +let div _ _ = 1 +let subView _ _ = [1; 2] +let y = 1 + +// elmish view +let view model dispatch = + [ + div [] [ + match y with + | 1 -> yield! subView model dispatch + | _ -> subView model dispatch + ] + ] + +exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/version46/WarnIfDiscardedInList3.fs b/tests/fsharpqa/Source/Warnings/version46/WarnIfDiscardedInList3.fs new file mode 100644 index 0000000000..238d4388f9 --- /dev/null +++ b/tests/fsharpqa/Source/Warnings/version46/WarnIfDiscardedInList3.fs @@ -0,0 +1,19 @@ +// #Warnings +// + +// stupid things to make the sample compile +let div _ _ = 1 +let subView _ _ = true +let y = 1 + +// elmish view +let view model dispatch = + [ + div [] [ + match y with + | 1 -> () + | _ -> subView model dispatch + ] + ] + +exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs b/tests/fsharpqa/Source/Warnings/version47/WarnIfDiscardedInList.fs similarity index 100% rename from tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs rename to tests/fsharpqa/Source/Warnings/version47/WarnIfDiscardedInList.fs diff --git a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs b/tests/fsharpqa/Source/Warnings/version47/WarnIfDiscardedInList2.fs similarity index 100% rename from tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs rename to tests/fsharpqa/Source/Warnings/version47/WarnIfDiscardedInList2.fs diff --git a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs b/tests/fsharpqa/Source/Warnings/version47/WarnIfDiscardedInList3.fs similarity index 100% rename from tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs rename to tests/fsharpqa/Source/Warnings/version47/WarnIfDiscardedInList3.fs From 0c9ccae80518c26a6a3869380fbc125ec1fc18c9 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Thu, 11 Jul 2019 03:11:56 +0200 Subject: [PATCH 156/286] Only check distinct errors (#7140) --- tests/fsharp/Compiler/CompilerAssert.fs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index c83947d331..40da516c51 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -121,8 +121,12 @@ module CompilerAssert = | FSharpCheckFileAnswer.Aborted _ -> Assert.Fail("Type Checker Aborted") | FSharpCheckFileAnswer.Succeeded(typeCheckResults) -> - Assert.AreEqual(1, typeCheckResults.Errors.Length, sprintf "Expected one type check error: %A" typeCheckResults.Errors) - typeCheckResults.Errors + let errors = + typeCheckResults.Errors + |> Array.distinctBy (fun e -> e.Severity, e.ErrorNumber, e.StartLineAlternate, e.StartColumn, e.EndLineAlternate, e.EndColumn, e.Message) + + Assert.AreEqual(1, errors.Length, sprintf "Expected one type check error: %A" typeCheckResults.Errors) + errors |> Array.iter (fun info -> Assert.AreEqual(FSharpErrorSeverity.Error, info.Severity) Assert.AreEqual(expectedErrorNumber, info.ErrorNumber, "expectedErrorNumber") @@ -203,4 +207,4 @@ module CompilerAssert = ||> Seq.iter2 (fun expectedErrorMessage errorMessage -> Assert.AreEqual(expectedErrorMessage, errorMessage) ) - \ No newline at end of file + From 598db3e138453fa19e4dda988ace1c0e5a29b95a Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Thu, 11 Jul 2019 10:12:51 +0200 Subject: [PATCH 157/286] Use 1-based column numbers in tests (#7141) * Use 1-based column numbers in tests * Helper that can check for multiple type errors --- tests/fsharp/Compiler/CompilerAssert.fs | 18 ++++++++++++------ .../Compiler/Language/AnonRecordTests.fs | 9 ++++++--- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index 40da516c51..9c74845549 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -111,7 +111,8 @@ module CompilerAssert = Assert.IsEmpty(typeCheckResults.Errors, sprintf "Type Check errors: %A" typeCheckResults.Errors) - let TypeCheckSingleError (source: string) (expectedErrorNumber: int) (expectedErrorRange: int * int * int * int) (expectedErrorMsg: string) = + + let TypeCheckWithErrors (source: string) expectedTypeErrors = lock gate <| fun () -> let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, defaultProjectOptions) |> Async.RunSynchronously @@ -125,15 +126,20 @@ module CompilerAssert = typeCheckResults.Errors |> Array.distinctBy (fun e -> e.Severity, e.ErrorNumber, e.StartLineAlternate, e.StartColumn, e.EndLineAlternate, e.EndColumn, e.Message) - Assert.AreEqual(1, errors.Length, sprintf "Expected one type check error: %A" typeCheckResults.Errors) - errors - |> Array.iter (fun info -> - Assert.AreEqual(FSharpErrorSeverity.Error, info.Severity) + Assert.AreEqual(Array.length expectedTypeErrors, errors.Length, sprintf "Type check errors: %A" typeCheckResults.Errors) + + Array.zip errors expectedTypeErrors + |> Array.iter (fun (info, expectedError) -> + let (expectedServerity: FSharpErrorSeverity, expectedErrorNumber: int, expectedErrorRange: int * int * int * int, expectedErrorMsg: string) = expectedError + Assert.AreEqual(expectedServerity, info.Severity) Assert.AreEqual(expectedErrorNumber, info.ErrorNumber, "expectedErrorNumber") - Assert.AreEqual(expectedErrorRange, (info.StartLineAlternate, info.StartColumn, info.EndLineAlternate, info.EndColumn), "expectedErrorRange") + Assert.AreEqual(expectedErrorRange, (info.StartLineAlternate, info.StartColumn + 1, info.EndLineAlternate, info.EndColumn + 1), "expectedErrorRange") Assert.AreEqual(expectedErrorMsg, info.Message, "expectedErrorMsg") ) + let TypeCheckSingleError (source: string) (expectedServerity: FSharpErrorSeverity) (expectedErrorNumber: int) (expectedErrorRange: int * int * int * int) (expectedErrorMsg: string) = + TypeCheckWithErrors (source: string) [| expectedServerity, expectedErrorNumber, expectedErrorRange, expectedErrorMsg |] + let CompileExe (source: string) = compile true source (fun (errors, _) -> if errors.Length > 0 then diff --git a/tests/fsharp/Compiler/Language/AnonRecordTests.fs b/tests/fsharp/Compiler/Language/AnonRecordTests.fs index 7182e359b1..0a4d1c18d9 100644 --- a/tests/fsharp/Compiler/Language/AnonRecordTests.fs +++ b/tests/fsharp/Compiler/Language/AnonRecordTests.fs @@ -3,6 +3,7 @@ namespace FSharp.Compiler.UnitTests open NUnit.Framework +open FSharp.Compiler.SourceCodeServices [] module AnonRecordsTests = @@ -30,8 +31,9 @@ let sAnon = StructClass() type RefClass<'a when 'a : not struct>() = class end let rAnon = RefClass() """ + FSharpErrorSeverity.Error 1 - (3, 12, 3, 41) + (3, 13, 3, 42) "A generic construct requires that the type 'struct {|R : int|}' have reference semantics, but it does not, i.e. it is a struct" [] @@ -40,7 +42,8 @@ let rAnon = RefClass() """ type StructClass<'a when 'a : struct>() = class end let sAnon = StructClass<{| S: int |}>() - """ + """ + FSharpErrorSeverity.Error 1 - (3, 12, 3, 37) + (3, 13, 3, 38) "A generic construct requires that the type '{|S : int|}' is a CLI or F# struct type" \ No newline at end of file From bf1055cd70b50d2f7b22c4d433606dece27cd10b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 11 Jul 2019 11:42:21 -0700 Subject: [PATCH 158/286] Update dependencies from https://github.com/dotnet/arcade build 20190710.8 (#7200) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19360.8 --- eng/Version.Details.xml | 4 +- eng/common/SigningValidation.proj | 2 +- eng/common/performance/perfhelixpublish.proj | 77 ++++++++ eng/common/performance/performance-setup.ps1 | 91 +++++++++ eng/common/performance/performance-setup.sh | 176 ++++++++++++++++++ eng/common/pipeline-logging-functions.ps1 | 7 +- .../post-build/trigger-subscriptions.ps1 | 6 +- eng/common/templates/job/performance.yml | 93 +++++++++ .../channels/internal-servicing.yml | 8 +- .../channels/public-dev-release.yml | 1 + .../post-build/channels/public-release.yml | 8 +- .../channels/public-validation-release.yml | 1 + .../templates/post-build/common-variables.yml | 3 + .../templates/steps/perf-send-to-helix.yml | 66 +++++++ eng/common/tools.ps1 | 4 +- global.json | 2 +- 16 files changed, 529 insertions(+), 20 deletions(-) create mode 100644 eng/common/performance/perfhelixpublish.proj create mode 100644 eng/common/performance/performance-setup.ps1 create mode 100644 eng/common/performance/performance-setup.sh create mode 100644 eng/common/templates/job/performance.yml create mode 100644 eng/common/templates/steps/perf-send-to-helix.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0c5078f9f9..bfb72eca15 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 0f5dd7680174620f31c9a00cdb2ac0b0e70e631f + a6ae1b637ed236354529992729af875f6c8a180a diff --git a/eng/common/SigningValidation.proj b/eng/common/SigningValidation.proj index 7045fb6fb9..3d0ac80af3 100644 --- a/eng/common/SigningValidation.proj +++ b/eng/common/SigningValidation.proj @@ -3,7 +3,7 @@ + + + $(WorkItemDirectory) + $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --artifacts $(ArtifactsDirectory) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" + 4:00 + + + + + $(WorkItemDirectory) + $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --artifacts $(ArtifactsDirectory)" + 4:00 + + + \ No newline at end of file diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 new file mode 100644 index 0000000000..7e5441f797 --- /dev/null +++ b/eng/common/performance/performance-setup.ps1 @@ -0,0 +1,91 @@ +Param( + [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, + [string] $CoreRootDirectory, + [string] $Architecture="x64", + [string] $Framework="netcoreapp3.0", + [string] $CompilationMode="Tiered", + [string] $Repository=$env:BUILD_REPOSITORY_NAME, + [string] $Branch=$env:BUILD_SOURCEBRANCH, + [string] $CommitSha=$env:BUILD_SOURCEVERSION, + [string] $BuildNumber=$env:BUILD_BUILDNUMBER, + [string] $RunCategories="coreclr corefx", + [string] $Csproj="src\benchmarks\micro\MicroBenchmarks.csproj", + [string] $Kind="micro", + [switch] $Internal, + [string] $Configurations="CompilationMode=$CompilationMode" +) + +$RunFromPerformanceRepo = ($Repository -eq "dotnet/performance") +$UseCoreRun = ($CoreRootDirectory -ne [string]::Empty) + +$PayloadDirectory = (Join-Path $SourceDirectory "Payload") +$PerformanceDirectory = (Join-Path $PayloadDirectory "performance") +$WorkItemDirectory = (Join-Path $SourceDirectory "workitem") +$ExtraBenchmarkDotNetArguments = "--iterationCount 1 --warmupCount 0 --invocationCount 1 --unrollFactor 1 --strategy ColdStart --stopOnFirstError true" +$Creator = $env:BUILD_DEFINITIONNAME +$PerfLabArguments = "" +$HelixSourcePrefix = "pr" + +$Queue = "Windows.10.Amd64.ClientRS4.DevEx.15.8.Open" + +if ($Framework.StartsWith("netcoreapp")) { + $Queue = "Windows.10.Amd64.ClientRS4.Open" +} + +if ($Internal) { + $Queue = "Windows.10.Amd64.ClientRS5.Perf" + $PerfLabArguments = "--upload-to-perflab-container" + $ExtraBenchmarkDotNetArguments = "" + $Creator = "" + $HelixSourcePrefix = "official" +} + +$CommonSetupArguments="--frameworks $Framework --queue $Queue --build-number $BuildNumber --build-configs $Configurations" +$SetupArguments = "--repository https://github.com/$Repository --branch $Branch --get-perf-hash --commit-sha $CommitSha $CommonSetupArguments" + +if ($RunFromPerformanceRepo) { + $SetupArguments = "--perf-hash $CommitSha $CommonSetupArguments" + + robocopy $SourceDirectory $PerformanceDirectory /E /XD $PayloadDirectory $SourceDirectory\artifacts $SourceDirectory\.git +} +else { + git clone --branch master --depth 1 --quiet https://github.com/dotnet/performance $PerformanceDirectory +} + +if ($UseCoreRun) { + $NewCoreRoot = (Join-Path $PayloadDirectory "Core_Root") + Move-Item -Path $CoreRootDirectory -Destination $NewCoreRoot +} + +$DocsDir = (Join-Path $PerformanceDirectory "docs") +robocopy $DocsDir $WorkItemDirectory + +# Set variables that we will need to have in future steps +$ci = $true + +. "$PSScriptRoot\..\pipeline-logging-functions.ps1" + +# Directories +Write-PipelineSetVariable -Name 'PayloadDirectory' -Value "$PayloadDirectory" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'PerformanceDirectory' -Value "$PerformanceDirectory" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'WorkItemDirectory' -Value "$WorkItemDirectory" -IsMultiJobVariable $false + +# Script Arguments +Write-PipelineSetVariable -Name 'Python' -Value "py -3" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'ExtraBenchmarkDotNetArguments' -Value "$ExtraBenchmarkDotNetArguments" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'SetupArguments' -Value "$SetupArguments" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'PerfLabArguments' -Value "$PerfLabArguments" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'BDNCategories' -Value "$RunCategories" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'TargetCsproj' -Value "$Csproj" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'Kind' -Value "$Kind" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'Architecture' -Value "$Architecture" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'UseCoreRun' -Value "$UseCoreRun" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'RunFromPerfRepo' -Value "$RunFromPerformanceRepo" -IsMultiJobVariable $false + +# Helix Arguments +Write-PipelineSetVariable -Name 'Creator' -Value "$Creator" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'Queue' -Value "$Queue" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'HelixSourcePrefix' -Value "$HelixSourcePrefix" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name '_BuildConfig' -Value "$Architecture.$Kind.$Framework" -IsMultiJobVariable $false + +exit 0 \ No newline at end of file diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh new file mode 100644 index 0000000000..126da5f76d --- /dev/null +++ b/eng/common/performance/performance-setup.sh @@ -0,0 +1,176 @@ +#!/usr/bin/env bash + +source_directory=$BUILD_SOURCESDIRECTORY +core_root_directory= +architecture=x64 +framework=netcoreapp3.0 +compilation_mode=tiered +repository=$BUILD_REPOSITORY_NAME +branch=$BUILD_SOURCEBRANCH +commit_sha=$BUILD_SOURCEVERSION +build_number=$BUILD_BUILDNUMBER +internal=false +kind="micro" +run_categories="coreclr corefx" +csproj="src\benchmarks\micro\MicroBenchmarks.csproj" +configurations= +run_from_perf_repo=false +use_core_run=true + +while (($# > 0)); do + lowerI="$(echo $1 | awk '{print tolower($0)}')" + case $lowerI in + --sourcedirectory) + source_directory=$2 + shift 2 + ;; + --corerootdirectory) + core_root_directory=$2 + shift 2 + ;; + --architecture) + architecture=$2 + shift 2 + ;; + --framework) + framework=$2 + shift 2 + ;; + --compilationmode) + compilation_mode=$2 + shift 2 + ;; + --repository) + repository=$2 + shift 2 + ;; + --branch) + branch=$2 + shift 2 + ;; + --commitsha) + commit_sha=$2 + shift 2 + ;; + --buildnumber) + build_number=$2 + shift 2 + ;; + --kind) + kind=$2 + shift 2 + ;; + --runcategories) + run_categories=$2 + shift 2 + ;; + --csproj) + csproj=$2 + shift 2 + ;; + --internal) + internal=true + shift 1 + ;; + --configurations) + configurations=$2 + shift 2 + ;; + --help) + echo "Common settings:" + echo " --corerootdirectory Directory where Core_Root exists, if running perf testing with --corerun" + echo " --architecture Architecture of the testing being run" + echo " --configurations List of key=value pairs that will be passed to perf testing infrastructure." + echo " ex: --configurations \"CompilationMode=Tiered OptimzationLevel=PGO\"" + echo " --help Print help and exit" + echo "" + echo "Advanced settings:" + echo " --framework The framework to run, if not running in master" + echo " --compliationmode The compilation mode if not passing --configurations" + echo " --sourcedirectory The directory of the sources. Defaults to env:BUILD_SOURCESDIRECTORY" + echo " --repository The name of the repository in the / format. Defaults to env:BUILD_REPOSITORY_NAME" + echo " --branch The name of the branch. Defaults to env:BUILD_SOURCEBRANCH" + echo " --commitsha The commit sha1 to run against. Defaults to env:BUILD_SOURCEVERSION" + echo " --buildnumber The build number currently running. Defaults to env:BUILD_BUILDNUMBER" + echo " --csproj The relative path to the benchmark csproj whose tests should be run. Defaults to src\benchmarks\micro\MicroBenchmarks.csproj" + echo " --kind Related to csproj. The kind of benchmarks that should be run. Defaults to micro" + echo " --runcategories Related to csproj. Categories of benchmarks to run. Defaults to \"coreclr corefx\"" + echo " --internal If the benchmarks are running as an official job." + echo "" + exit 0 + ;; + esac +done + +if [[ "$repository" == "dotnet/performance" ]]; then + run_from_perf_repo=true +fi + +if [ -z "$configurations" ]; then + configurations="CompliationMode=$compilation_mode" +fi + +if [ -z "$core_root_directory" ]; then + use_core_run=false +fi + +payload_directory=$source_directory/Payload +performance_directory=$payload_directory/performance +workitem_directory=$source_directory/workitem +extra_benchmark_dotnet_arguments="--iterationCount 1 --warmupCount 0 --invocationCount 1 --unrollFactor 1 --strategy ColdStart --stopOnFirstError true" +perflab_arguments= +queue=Ubuntu.1804.Amd64.Open +creator=$BUILD_DEFINITIONNAME +helix_source_prefix="pr" + +if [[ "$internal" == true ]]; then + perflab_arguments="--upload-to-perflab-container" + helix_source_prefix="official" + creator= + extra_benchmark_dotnet_arguments= + + if [[ "$architecture" = "arm64" ]]; then + queue=Ubuntu.1804.Arm64.Perf + else + queue=Ubuntu.1804.Amd64.Perf + fi +fi + +common_setup_arguments="--frameworks $framework --queue $queue --build-number $build_number --build-configs $configurations" +setup_arguments="--repository https://github.com/$repository --branch $branch --get-perf-hash --commit-sha $commit_sha $common_setup_arguments" + +if [[ "$run_from_perf_repo" = true ]]; then + payload_directory= + workitem_directory=$source_directory + performance_directory=$workitem_directory + setup_arguments="--perf-hash $commit_sha $common_setup_arguments" +else + git clone --branch master --depth 1 --quiet https://github.com/dotnet/performance $performance_directory + + docs_directory=$performance_directory/docs + mv $docs_directory $workitem_directory +fi + +if [[ "$use_core_run" = true ]]; then + new_core_root=$payload_directory/Core_Root + mv $core_root_directory $new_core_root +fi + +# Make sure all of our variables are available for future steps +echo "##vso[task.setvariable variable=UseCoreRun]$use_core_run" +echo "##vso[task.setvariable variable=Architecture]$architecture" +echo "##vso[task.setvariable variable=PayloadDirectory]$payload_directory" +echo "##vso[task.setvariable variable=PerformanceDirectory]$performance_directory" +echo "##vso[task.setvariable variable=WorkItemDirectory]$workitem_directory" +echo "##vso[task.setvariable variable=Queue]$queue" +echo "##vso[task.setvariable variable=SetupArguments]$setup_arguments" +echo "##vso[task.setvariable variable=Python]python3" +echo "##vso[task.setvariable variable=PerfLabArguments]$perflab_arguments" +echo "##vso[task.setvariable variable=ExtraBenchmarkDotNetArguments]$extra_benchmark_dotnet_arguments" +echo "##vso[task.setvariable variable=BDNCategories]$run_categories" +echo "##vso[task.setvariable variable=TargetCsproj]$csproj" +echo "##vso[task.setvariable variable=RunFromPerfRepo]$run_from_perf_repo" +echo "##vso[task.setvariable variable=Creator]$creator" +echo "##vso[task.setvariable variable=HelixSourcePrefix]$helix_source_prefix" +echo "##vso[task.setvariable variable=Kind]$kind" +echo "##vso[task.setvariable variable=_BuildConfig]$architecture.$kind.$framework" \ No newline at end of file diff --git a/eng/common/pipeline-logging-functions.ps1 b/eng/common/pipeline-logging-functions.ps1 index 7b61376f8a..af5f48aace 100644 --- a/eng/common/pipeline-logging-functions.ps1 +++ b/eng/common/pipeline-logging-functions.ps1 @@ -77,13 +77,14 @@ function Write-PipelineTaskError { [string]$Name, [string]$Value, [switch]$Secret, - [switch]$AsOutput) - + [switch]$AsOutput, + [bool]$IsMultiJobVariable=$true) + if($ci) { Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $Value -Properties @{ 'variable' = $Name 'isSecret' = $Secret - 'isOutput' = 'true' + 'isOutput' = $IsMultiJobVariable } -AsOutput:$AsOutput } } diff --git a/eng/common/post-build/trigger-subscriptions.ps1 b/eng/common/post-build/trigger-subscriptions.ps1 index db8a839457..1a91dab037 100644 --- a/eng/common/post-build/trigger-subscriptions.ps1 +++ b/eng/common/post-build/trigger-subscriptions.ps1 @@ -19,14 +19,14 @@ function Get-Headers([string]$accept, [string]$barToken) { } # Get all the $SourceRepo subscriptions -$normalizedSurceRepo = $SourceRepo.Replace('dnceng@', '') -$getSubscriptionsApiEndpoint = "$maestroEndpoint/api/subscriptions?sourceRepository=$normalizedSurceRepo&api-version=$apiVersion" +$normalizedSourceRepo = $SourceRepo.Replace('dnceng@', '') +$getSubscriptionsApiEndpoint = "$maestroEndpoint/api/subscriptions?sourceRepository=$normalizedSourceRepo&api-version=$apiVersion" $headers = Get-Headers 'application/json' $barToken $subscriptions = Invoke-WebRequest -Uri $getSubscriptionsApiEndpoint -Headers $headers | ConvertFrom-Json if (!$subscriptions) { - Write-Host "No subscriptions found for source repo '$normalizedSurceRepo' in channel '$ChannelId'" + Write-Host "No subscriptions found for source repo '$normalizedSourceRepo' in channel '$ChannelId'" return } diff --git a/eng/common/templates/job/performance.yml b/eng/common/templates/job/performance.yml new file mode 100644 index 0000000000..ef809253d1 --- /dev/null +++ b/eng/common/templates/job/performance.yml @@ -0,0 +1,93 @@ +parameters: + steps: [] # optional -- any additional steps that need to happen before pulling down the performance repo and sending the performance benchmarks to helix (ie building your repo) + variables: [] # optional -- list of additional variables to send to the template + jobName: '' # required -- job name + displayName: '' # optional -- display name for the job. Will use jobName if not passed + pool: '' # required -- name of the Build pool + container: '' # required -- name of the container + extraSetupParameters: '' # optional -- extra arguments to pass to the setup script + frameworks: ['netcoreapp3.0'] # optional -- list of frameworks to run against + continueOnError: 'false' # optional -- determines whether to continue the build if the step errors + dependsOn: '' # optional -- dependencies of the job + timeoutInMinutes: 320 # optional -- timeout for the job + enableTelemetry: false # optional -- enable for telemetry + +jobs: +- template: ../jobs/jobs.yml + parameters: + dependsOn: ${{ parameters.dependsOn }} + enableTelemetry: ${{ parameters.enableTelemetry }} + enablePublishBuildArtifacts: true + continueOnError: ${{ parameters.continueOnError }} + + jobs: + - job: '${{ parameters.jobName }}' + + ${{ if ne(parameters.displayName, '') }}: + displayName: '${{ parameters.displayName }}' + ${{ if eq(parameters.displayName, '') }}: + displayName: '${{ parameters.jobName }}' + + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + + variables: + + - ${{ each variable in parameters.variables }}: + - ${{ if ne(variable.name, '') }}: + - name: ${{ variable.name }} + value: ${{ variable.value }} + - ${{ if ne(variable.group, '') }}: + - group: ${{ variable.group }} + + - IsInternal: '' + - HelixApiAccessToken: '' + - HelixPreCommand: '' + + - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(variables['Agent.Os'], 'Windows_NT') }}: + - HelixPreCommand: 'set "PERFLAB_UPLOAD_TOKEN=$(PerfCommandUploadToken)"' + - IsInternal: -Internal + - ${{ if ne(variables['Agent.Os'], 'Windows_NT') }}: + - HelixPreCommand: 'export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"' + - IsInternal: --internal + - group: DotNet-HelixApi-Access + - group: dotnet-benchview + + workspace: + clean: all + pool: + ${{ parameters.pool }} + container: ${{ parameters.container }} + strategy: + matrix: + ${{ each framework in parameters.frameworks }}: + ${{ framework }}: + _Framework: ${{ framework }} + steps: + - checkout: self + clean: true + # Run all of the steps to setup repo + - ${{ each step in parameters.steps }}: + - ${{ step }} + - powershell: $(Build.SourcesDirectory)\eng\common\performance\performance-setup.ps1 $(IsInternal) -Framework $(_Framework) ${{ parameters.extraSetupParameters }} + displayName: Performance Setup (Windows) + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: $(Build.SourcesDirectory)/eng/common/performance/performance-setup.sh $(IsInternal) --framework $(_Framework) ${{ parameters.extraSetupParameters }} + displayName: Performance Setup (Unix) + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: $(Python) $(PerformanceDirectory)/scripts/ci_setup.py $(SetupArguments) + displayName: Run ci setup script + # Run perf testing in helix + - template: /eng/common/templates/steps/perf-send-to-helix.yml + parameters: + HelixSource: '$(HelixSourcePrefix)/$(Build.Repository.Name)/$(Build.SourceBranch)' # sources must start with pr/, official/, prodcon/, or agent/ + HelixType: 'test/performance/$(Kind)/$(_Framework)/$(Architecture)' + HelixAccessToken: $(HelixApiAccessToken) + HelixTargetQueues: $(Queue) + HelixPreCommands: $(HelixPreCommand) + Creator: $(Creator) + WorkItemTimeout: 4:00 # 4 hours + WorkItemDirectory: '$(WorkItemDirectory)' # WorkItemDirectory can not be empty, so we send it some docs to keep it happy + CorrelationPayloadDirectory: '$(PayloadDirectory)' # it gets checked out to a folder with shorter path than WorkItemDirectory so we can avoid file name too long exceptions \ No newline at end of file diff --git a/eng/common/templates/post-build/channels/internal-servicing.yml b/eng/common/templates/post-build/channels/internal-servicing.yml index 808d46b17f..50ad724fc0 100644 --- a/eng/common/templates/post-build/channels/internal-servicing.yml +++ b/eng/common/templates/post-build/channels/internal-servicing.yml @@ -81,10 +81,10 @@ stages: /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) + /p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName) + /p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1) + /p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url) /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' /p:BARBuildId=$(BARBuildId) /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' /p:BuildAssetRegistryToken='$(MaestroAccessToken)' @@ -167,4 +167,4 @@ stages: - template: ../promote-build.yml parameters: - ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} \ No newline at end of file + ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml index 79c6822db7..bdc631016b 100644 --- a/eng/common/templates/post-build/channels/public-dev-release.yml +++ b/eng/common/templates/post-build/channels/public-dev-release.yml @@ -77,6 +77,7 @@ stages: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ChannelId=$(PublicDevRelease_30_Channel_Id) + /p:ArtifactsCategory=.NetCore /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) diff --git a/eng/common/templates/post-build/channels/public-release.yml b/eng/common/templates/post-build/channels/public-release.yml index 25923020df..574cb1c2b9 100644 --- a/eng/common/templates/post-build/channels/public-release.yml +++ b/eng/common/templates/post-build/channels/public-release.yml @@ -81,10 +81,10 @@ stages: /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(Agent.BuildDirectory)/Nuget/NuGet.exe - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName) + /p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1) + /p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url) + /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe /p:BARBuildId=$(BARBuildId) /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' /p:BuildAssetRegistryToken='$(MaestroAccessToken)' diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index 114477d3ad..f12f402ad9 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -48,6 +48,7 @@ stages: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ChannelId=$(PublicValidationRelease_30_Channel_Id) + /p:ArtifactsCategory=.NetCoreValidation /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index 8283467352..42df4ae77e 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -14,5 +14,8 @@ variables: # Whether the build is internal or not IsInternalBuild: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} + # Storage account name for proxy-backed feeds + ProxyBackedFeedsAccountName: dotnetfeed + SourceLinkCLIVersion: 3.0.0 SymbolToolVersion: 1.0.1 diff --git a/eng/common/templates/steps/perf-send-to-helix.yml b/eng/common/templates/steps/perf-send-to-helix.yml new file mode 100644 index 0000000000..b3ea9acf1f --- /dev/null +++ b/eng/common/templates/steps/perf-send-to-helix.yml @@ -0,0 +1,66 @@ +# Please remember to update the documentation if you make changes to these parameters! +parameters: + HelixSource: 'pr/default' # required -- sources must start with pr/, official/, prodcon/, or agent/ + HelixType: 'tests/default/' # required -- Helix telemetry which identifies what type of data this is; should include "test" for clarity and must end in '/' + HelixBuild: $(Build.BuildNumber) # required -- the build number Helix will use to identify this -- automatically set to the AzDO build number + HelixTargetQueues: '' # required -- semicolon delimited list of Helix queues to test on; see https://helix.dot.net/ for a list of queues + HelixAccessToken: '' # required -- access token to make Helix API requests; should be provided by the appropriate variable group + HelixPreCommands: '' # optional -- commands to run before Helix work item execution + HelixPostCommands: '' # optional -- commands to run after Helix work item execution + WorkItemDirectory: '' # optional -- a payload directory to zip up and send to Helix; requires WorkItemCommand; incompatible with XUnitProjects + CorrelationPayloadDirectory: '' # optional -- a directory to zip up and send to Helix as a correlation payload + IncludeDotNetCli: false # optional -- true will download a version of the .NET CLI onto the Helix machine as a correlation payload; requires DotNetCliPackageType and DotNetCliVersion + DotNetCliPackageType: '' # optional -- either 'sdk' or 'runtime'; determines whether the sdk or runtime will be sent to Helix; see https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json + DotNetCliVersion: '' # optional -- version of the CLI to send to Helix; based on this: https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases.json + EnableXUnitReporter: false # optional -- true enables XUnit result reporting to Mission Control + WaitForWorkItemCompletion: true # optional -- true will make the task wait until work items have been completed and fail the build if work items fail. False is "fire and forget." + Creator: '' # optional -- if the build is external, use this to specify who is sending the job + DisplayNamePrefix: 'Send job to Helix' # optional -- rename the beginning of the displayName of the steps in AzDO + condition: succeeded() # optional -- condition for step to execute; defaults to succeeded() + continueOnError: false # optional -- determines whether to continue the build if the step errors; defaults to false + +steps: + - powershell: $(Build.SourcesDirectory)\eng\common\msbuild.ps1 $(Build.SourcesDirectory)\eng\common\performance\perfhelixpublish.proj /restore /t:Test /bl:$(Build.SourcesDirectory)\artifacts\log\$env:BuildConfig\SendToHelix.binlog + displayName: ${{ parameters.DisplayNamePrefix }} (Windows) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, eq(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} + - script: $BUILD_SOURCESDIRECTORY/eng/common/msbuild.sh $BUILD_SOURCESDIRECTORY/eng/common/performance/perfhelixpublish.proj /restore /t:Test /bl:$BUILD_SOURCESDIRECTORY/artifacts/log/$BuildConfig/SendToHelix.binlog + displayName: ${{ parameters.DisplayNamePrefix }} (Unix) + env: + BuildConfig: $(_BuildConfig) + HelixSource: ${{ parameters.HelixSource }} + HelixType: ${{ parameters.HelixType }} + HelixBuild: ${{ parameters.HelixBuild }} + HelixTargetQueues: ${{ parameters.HelixTargetQueues }} + HelixAccessToken: ${{ parameters.HelixAccessToken }} + HelixPreCommands: ${{ parameters.HelixPreCommands }} + HelixPostCommands: ${{ parameters.HelixPostCommands }} + WorkItemDirectory: ${{ parameters.WorkItemDirectory }} + CorrelationPayloadDirectory: ${{ parameters.CorrelationPayloadDirectory }} + IncludeDotNetCli: ${{ parameters.IncludeDotNetCli }} + DotNetCliPackageType: ${{ parameters.DotNetCliPackageType }} + DotNetCliVersion: ${{ parameters.DotNetCliVersion }} + EnableXUnitReporter: ${{ parameters.EnableXUnitReporter }} + WaitForWorkItemCompletion: ${{ parameters.WaitForWorkItemCompletion }} + Creator: ${{ parameters.Creator }} + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + condition: and(${{ parameters.condition }}, ne(variables['Agent.Os'], 'Windows_NT')) + continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 60741f0390..9abaac015f 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -84,7 +84,7 @@ function Exec-Process([string]$command, [string]$commandArgs) { return $global:LASTEXITCODE = $process.ExitCode } finally { - # If we didn't finish then an error occured or the user hit ctrl-c. Either + # If we didn't finish then an error occurred or the user hit ctrl-c. Either # way kill the process if (-not $finished) { $process.Kill() @@ -147,7 +147,7 @@ function InitializeDotNetCli([bool]$install) { # It also ensures that VS msbuild will use the downloaded sdk targets. $env:PATH = "$dotnetRoot;$env:PATH" - # Make Sure that our bootstrapped dotnet cli is avaliable in future steps of the Azure Pipelines build + # Make Sure that our bootstrapped dotnet cli is available in future steps of the Azure Pipelines build Write-PipelinePrependPath -Path $dotnetRoot Write-PipelineSetVariable -Name 'DOTNET_MULTILEVEL_LOOKUP' -Value '0' Write-PipelineSetVariable -Name 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' -Value '1' diff --git a/global.json b/global.json index 4c66387e58..60dbe5efe9 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19359.6", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19360.8", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 742449ae3e057344628a8f0e93cda30d2c00d596 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Thu, 11 Jul 2019 17:01:06 -0700 Subject: [PATCH 159/286] Implement langversion switch for openstaticclasses (#7195) * Add langver support and tests for open static classes language feature * features flag * Feedback * neg tests do not yet work on coreclr --- src/fsharp/LanguageFeatures.fs | 3 +- src/fsharp/LanguageFeatures.fsi | 2 +- src/fsharp/NameResolution.fs | 49 +++++----- tests/fsharp/core/longnames/test.fsx | 60 ------------ .../fsharp/core/longnames/version46/test.bsl | 39 ++++++++ tests/fsharp/core/longnames/version46/test.fs | 84 +++++++++++++++++ .../fsharp/core/longnames/version47/test.fsx | 91 +++++++++++++++++++ tests/fsharp/tests.fs | 15 +++ 8 files changed, 260 insertions(+), 83 deletions(-) create mode 100644 tests/fsharp/core/longnames/version46/test.bsl create mode 100644 tests/fsharp/core/longnames/version46/test.fs create mode 100644 tests/fsharp/core/longnames/version47/test.fsx diff --git a/src/fsharp/LanguageFeatures.fs b/src/fsharp/LanguageFeatures.fs index a88ebdcf9a..5d42651609 100644 --- a/src/fsharp/LanguageFeatures.fs +++ b/src/fsharp/LanguageFeatures.fs @@ -26,7 +26,7 @@ type LanguageFeature = | RelaxWhitespace = 4 | NameOf = 5 | ImplicitYield = 6 - + | OpenStaticClasses = 7 /// LanguageVersion management type LanguageVersion (specifiedVersion) = @@ -52,6 +52,7 @@ type LanguageVersion (specifiedVersion) = LanguageFeature.RelaxWhitespace, previewVersion LanguageFeature.NameOf, previewVersion LanguageFeature.ImplicitYield, previewVersion + LanguageFeature.OpenStaticClasses, previewVersion |] let specified = diff --git a/src/fsharp/LanguageFeatures.fsi b/src/fsharp/LanguageFeatures.fsi index 44eb178840..2dd2aaef62 100644 --- a/src/fsharp/LanguageFeatures.fsi +++ b/src/fsharp/LanguageFeatures.fsi @@ -13,7 +13,7 @@ type LanguageFeature = | RelaxWhitespace = 4 | NameOf = 5 | ImplicitYield = 6 - + | OpenStaticClasses = 7 /// LanguageVersion management type LanguageVersion = diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index 06cade8922..af800ac659 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -756,29 +756,33 @@ let AddUnionCases2 bulkAddMode (eUnqualifiedItems: UnqualifiedItems) (ucrefs: Un let item = Item.UnionCase(GeneralizeUnionCaseRef ucref, false) acc.Add (ucref.CaseName, item)) -let AddStaticContentOfTyconRefToNameEnv (g:TcGlobals) (amap: Import.ImportMap) m (nenv: NameResolutionEnv) (tcref:TyconRef) = - let ty = generalizedTyconRef tcref - let infoReader = InfoReader(g,amap) - let items = - [| let methGroups = - AllMethInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty - |> List.groupBy (fun m -> m.LogicalName) - - for (methName, methGroup) in methGroups do - let methGroup = methGroup |> List.filter (fun m -> not m.IsInstance && not m.IsClassConstructor) - if not methGroup.IsEmpty then - yield KeyValuePair(methName, Item.MethodGroup(methName, methGroup, None)) +let AddStaticContentOfTyconRefToNameEnv (g:TcGlobals) (amap: Import.ImportMap) m (nenv: NameResolutionEnv) (tcref:TyconRef) = + // If OpenStaticClasses is not enabled then don't do this + if amap.g.langVersion.SupportsFeature LanguageFeature.OpenStaticClasses then + let ty = generalizedTyconRef tcref + let infoReader = InfoReader(g,amap) + let items = + [| let methGroups = + AllMethInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty + |> List.groupBy (fun m -> m.LogicalName) + + for (methName, methGroup) in methGroups do + let methGroup = methGroup |> List.filter (fun m -> not m.IsInstance && not m.IsClassConstructor) + if not methGroup.IsEmpty then + yield KeyValuePair(methName, Item.MethodGroup(methName, methGroup, None)) - let propInfos = - AllPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty - |> List.groupBy (fun m -> m.PropertyName) + let propInfos = + AllPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty + |> List.groupBy (fun m -> m.PropertyName) - for (propName, propInfos) in propInfos do - let propInfos = propInfos |> List.filter (fun m -> m.IsStatic) - for propInfo in propInfos do - yield KeyValuePair(propName , Item.Property(propName,[propInfo])) |] + for (propName, propInfos) in propInfos do + let propInfos = propInfos |> List.filter (fun m -> m.IsStatic) + for propInfo in propInfos do + yield KeyValuePair(propName , Item.Property(propName,[propInfo])) |] - { nenv with eUnqualifiedItems = nenv.eUnqualifiedItems.AddAndMarkAsCollapsible items } + { nenv with eUnqualifiedItems = nenv.eUnqualifiedItems.AddAndMarkAsCollapsible items } + else + nenv /// Add any implied contents of a type definition to the environment. let private AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition (g: TcGlobals) amap m nenv (tcref: TyconRef) = @@ -1992,7 +1996,10 @@ let CheckForTypeLegitimacyAndMultipleGenericTypeAmbiguities //------------------------------------------------------------------------- /// Perform name resolution for an identifier which must resolve to be a namespace or module. -let rec ResolveLongIndentAsModuleOrNamespaceOrStaticClass sink (atMostOne: ResultCollectionSettings) amap m allowStaticClasses first fullyQualified (nenv: NameResolutionEnv) ad (id:Ident) (rest: Ident list) isOpenDecl = +let rec ResolveLongIndentAsModuleOrNamespaceOrStaticClass sink (atMostOne: ResultCollectionSettings) (amap: Import.ImportMap) m allowStaticClasses first fullyQualified (nenv: NameResolutionEnv) ad (id:Ident) (rest: Ident list) isOpenDecl = + + // If the selected language version doesn't support open static classes then turn them off. + let allowStaticClasses = allowStaticClasses && amap.g.langVersion.SupportsFeature LanguageFeature.OpenStaticClasses if first && id.idText = MangledGlobalName then match rest with | [] -> diff --git a/tests/fsharp/core/longnames/test.fsx b/tests/fsharp/core/longnames/test.fsx index 3692043c7d..577dc547a6 100644 --- a/tests/fsharp/core/longnames/test.fsx +++ b/tests/fsharp/core/longnames/test.fsx @@ -688,66 +688,6 @@ module rec Ok23 = test "lkneecec09iew23" (typeof.FullName.Contains("AModule") ) - -[] -type MyMath() = - static member Min(a: double, b: double) = System.Math.Min(a, b) - static member Min(a: int, b: int) = System.Math.Min(a, b) - -[] -type AutoOpenMyMath() = - static member AutoMin(a: double, b: double) = System.Math.Min(a, b) - static member AutoMin(a: int, b: int) = System.Math.Min(a, b) - -[] -type NotAllowedToOpen() = - static member QualifiedMin(a: double, b: double) = System.Math.Min(a, b) - static member QualifiedMin(a: int, b: int) = System.Math.Min(a, b) - -module OpenSystemMathOnce = - - open System.Math - let x = Min(1.0, 2.0) - test "vwejhweoiu" (x = 1.0) - - -module OpenSystemMathTwice = - - open System.Math - let x = Min(1.0, 2.0) - - open System.Math - let x2 = Min(2.0, 1.0) - - test "vwejhweoiu2" (x2 = 1.0) - -module OpenMyMathOnce = - - open MyMath - let x = Min(1.0, 2.0) - let x2 = Min(1, 2) - - test "vwejhweoiu2" (x = 1.0) - test "vwejhweoiu3" (x2 = 1) - -module DontOpenAutoMath = - - let x = AutoMin(1.0, 2.0) - let x2 = AutoMin(1, 2) - - test "vwejhweoiu2" (x = 1.0) - test "vwejhweoiu3" (x2 = 1) - -module OpenAutoMath = - open AutoOpenMyMath - //open NotAllowedToOpen - - let x = AutoMin(1.0, 2.0) - let x2 = AutoMin(1, 2) - - test "vwejhweoiu2" (x = 1.0) - test "vwejhweoiu3" (x2 = 1) - #if TESTS_AS_APP let RUN() = !failures #else diff --git a/tests/fsharp/core/longnames/version46/test.bsl b/tests/fsharp/core/longnames/version46/test.bsl new file mode 100644 index 0000000000..70f110197b --- /dev/null +++ b/tests/fsharp/core/longnames/version46/test.bsl @@ -0,0 +1,39 @@ + +test.fs(34,17,34,21): typecheck error FS0039: The namespace 'Math' is not defined. + +test.fs(35,13,35,16): typecheck error FS0039: The value or constructor 'Min' is not defined. Maybe you want one of the following: + min + sin + +test.fs(41,17,41,21): typecheck error FS0039: The namespace 'Math' is not defined. + +test.fs(42,13,42,16): typecheck error FS0039: The value or constructor 'Min' is not defined. Maybe you want one of the following: + min + sin + +test.fs(44,17,44,21): typecheck error FS0039: The namespace 'Math' is not defined. + +test.fs(45,14,45,17): typecheck error FS0039: The value or constructor 'Min' is not defined. Maybe you want one of the following: + min + sin + +test.fs(51,10,51,16): typecheck error FS0039: The namespace or module 'MyMath' is not defined. Maybe you want one of the following: + Math + +test.fs(52,13,52,16): typecheck error FS0039: The value or constructor 'Min' is not defined. Maybe you want one of the following: + min + sin + +test.fs(53,14,53,17): typecheck error FS0039: The value or constructor 'Min' is not defined. Maybe you want one of the following: + min + sin + +test.fs(60,13,60,20): typecheck error FS0039: The value or constructor 'AutoMin' is not defined. + +test.fs(61,14,61,21): typecheck error FS0039: The value or constructor 'AutoMin' is not defined. + +test.fs(67,10,67,24): typecheck error FS0039: The namespace or module 'AutoOpenMyMath' is not defined. + +test.fs(70,13,70,20): typecheck error FS0039: The value or constructor 'AutoMin' is not defined. + +test.fs(71,14,71,21): typecheck error FS0039: The value or constructor 'AutoMin' is not defined. diff --git a/tests/fsharp/core/longnames/version46/test.fs b/tests/fsharp/core/longnames/version46/test.fs new file mode 100644 index 0000000000..8c41fdc81f --- /dev/null +++ b/tests/fsharp/core/longnames/version46/test.fs @@ -0,0 +1,84 @@ +module Core_longnames +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +(* Some test expressions *) +[] +type MyMath() = + static member Min(a: double, b: double) = System.Math.Min(a, b) + static member Min(a: int, b: int) = System.Math.Min(a, b) + +[] +type AutoOpenMyMath() = + static member AutoMin(a: double, b: double) = System.Math.Min(a, b) + static member AutoMin(a: int, b: int) = System.Math.Min(a, b) + +[] +type NotAllowedToOpen() = + static member QualifiedMin(a: double, b: double) = System.Math.Min(a, b) + static member QualifiedMin(a: int, b: int) = System.Math.Min(a, b) + +module OpenSystemMathOnce = + + open System.Math + let x = Min(1.0, 2.0) + test "vwejhweoiu" (x = 1.0) + + +module OpenSystemMathTwice = + + open System.Math + let x = Min(1.0, 2.0) + + open System.Math + let x2 = Min(2.0, 1.0) + + test "vwejhweoiu2" (x2 = 1.0) + +module OpenMyMathOnce = + + open MyMath + let x = Min(1.0, 2.0) + let x2 = Min(1, 2) + + test "vwejhweoiu2" (x = 1.0) + test "vwejhweoiu3" (x2 = 1) + +module DontOpenAutoMath = + + let x = AutoMin(1.0, 2.0) + let x2 = AutoMin(1, 2) + + test "vwejhweoiu2" (x = 1.0) + test "vwejhweoiu3" (x2 = 1) + +module OpenAutoMath = + open AutoOpenMyMath + //open NotAllowedToOpen + + let x = AutoMin(1.0, 2.0) + let x2 = AutoMin(1, 2) + + test "vwejhweoiu2" (x = 1.0) + test "vwejhweoiu3" (x2 = 1) + +let RUN() = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 diff --git a/tests/fsharp/core/longnames/version47/test.fsx b/tests/fsharp/core/longnames/version47/test.fsx new file mode 100644 index 0000000000..03702cb996 --- /dev/null +++ b/tests/fsharp/core/longnames/version47/test.fsx @@ -0,0 +1,91 @@ +// #Conformance #ObjectConstructors +#if TESTS_AS_APP +module Core_longnames +#endif +let failures = ref [] + +let report_failure (s : string) = + stderr.Write" NO: " + stderr.WriteLine s + failures := !failures @ [s] + +let test (s : string) b = + stderr.Write(s) + if b then stderr.WriteLine " OK" + else report_failure (s) + +let check s b1 b2 = test s (b1 = b2) + +(* Some test expressions *) +[] +type MyMath() = + static member Min(a: double, b: double) = System.Math.Min(a, b) + static member Min(a: int, b: int) = System.Math.Min(a, b) + +[] +type AutoOpenMyMath() = + static member AutoMin(a: double, b: double) = System.Math.Min(a, b) + static member AutoMin(a: int, b: int) = System.Math.Min(a, b) + +[] +type NotAllowedToOpen() = + static member QualifiedMin(a: double, b: double) = System.Math.Min(a, b) + static member QualifiedMin(a: int, b: int) = System.Math.Min(a, b) + +module OpenSystemMathOnce = + + open System.Math + let x = Min(1.0, 2.0) + test "vwejhweoiu" (x = 1.0) + + +module OpenSystemMathTwice = + + open System.Math + let x = Min(1.0, 2.0) + + open System.Math + let x2 = Min(2.0, 1.0) + + test "vwejhweoiu2" (x2 = 1.0) + +module OpenMyMathOnce = + + open MyMath + let x = Min(1.0, 2.0) + let x2 = Min(1, 2) + + test "vwejhweoiu2" (x = 1.0) + test "vwejhweoiu3" (x2 = 1) + +module DontOpenAutoMath = + + let x = AutoMin(1.0, 2.0) + let x2 = AutoMin(1, 2) + + test "vwejhweoiu2" (x = 1.0) + test "vwejhweoiu3" (x2 = 1) + +module OpenAutoMath = + open AutoOpenMyMath + //open NotAllowedToOpen + + let x = AutoMin(1.0, 2.0) + let x2 = AutoMin(1, 2) + + test "vwejhweoiu2" (x = 1.0) + test "vwejhweoiu3" (x2 = 1) + +#if TESTS_AS_APP +let RUN() = !failures +#else +let aa = + match !failures with + | [] -> + stdout.WriteLine "Test Passed" + System.IO.File.WriteAllText("test.ok","ok") + exit 0 + | _ -> + stdout.WriteLine "Test Failed" + exit 1 +#endif diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index fe30c684bf..c6159b5851 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -1302,6 +1302,21 @@ module CoreTests = [] let ``longnames-FSI_BASIC`` () = singleTestBuildAndRun "core/longnames" FSI_BASIC +#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS + [] + let ``longnames-version46`` () = + let cfg = testConfig "core/longnames/version46" + // For some reason this warning is off by default in the test framework but in this case we are testing for it + let cfg = { cfg with fsc_flags = cfg.fsc_flags.Replace("--nowarn:20", "") } + singleVersionedNegTest cfg "4.6" "test" +#endif + + [] + let ``longnames-version47-FSC_BASIC`` () = singleTestBuildAndRunVersion "core/longnames/version47" FSC_BASIC "preview" + + [] + let ``longnames-version47-FSI_BASIC`` () = singleTestBuildAndRunVersion "core/longnames/version47" FSI_BASIC "preview" + [] let ``math-numbersVS2008-FSC_BASIC`` () = singleTestBuildAndRun "core/math/numbersVS2008" FSC_BASIC From da432e1188ac1f461ec733e78a0a7c9c53a8d4d7 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Thu, 11 Jul 2019 20:14:51 -0700 Subject: [PATCH 160/286] Better record and value formatting in tools (#7021) * Remove semicolons from record tooltips * Update to put a space between braces * Update formatting as best I can, plus some tests I guess * More baseline updates * Anonymous records * Update anon records tests * Add vsbsl lol * Update baselines and reduce a simple filter * Update baselines maybe last time * Update fsharpqa test * make tests pass * Add formatting for values * Update tests * Update test * Update fsharpqa tests * tryit * lol * get yote * shlerp * Update tests again I guess * more update * mother of pearl * this is a real turd --- src/fsharp/NicePrint.fs | 22 +- src/utils/sformat.fs | 20 +- .../Compiler/Language/AnonRecordTests.fs | 4 +- tests/fsharp/core/anon/lib.fs | 4 +- tests/fsharp/core/anon/test.fsx | 6 +- tests/fsharp/core/members/basics/test.fs | 4 +- .../printing/z.output.test.1000.stdout.bsl | 268 +-- .../printing/z.output.test.200.stdout.bsl | 124 +- .../printing/z.output.test.default.stdout.bsl | 1444 ++++++++--------- .../printing/z.output.test.off.stdout.bsl | 56 +- tests/fsharp/typecheck/sigs/neg113.bsl | 12 +- tests/fsharp/typecheck/sigs/neg113.vsbsl | 12 +- tests/fsharp/typecheck/sigs/neg_anon_1.bsl | 12 +- .../Source/Printing/BindingsWithValues01.fsx | 6 +- .../Source/Printing/CustomExceptions01.fs | 2 +- .../Tests.LanguageService.QuickInfo.fs | 2 +- .../tests/UnitTests/QuickInfoTests.fs | 6 +- 17 files changed, 1003 insertions(+), 1001 deletions(-) diff --git a/src/fsharp/NicePrint.fs b/src/fsharp/NicePrint.fs index 5d56543e99..2d9ea197db 100644 --- a/src/fsharp/NicePrint.fs +++ b/src/fsharp/NicePrint.fs @@ -32,8 +32,8 @@ module internal PrintUtilities = let bracketIfL x lyt = if x then bracketL lyt else lyt let squareAngleL x = LeftL.leftBracketAngle ^^ x ^^ RightL.rightBracketAngle let angleL x = sepL Literals.leftAngle ^^ x ^^ rightL Literals.rightAngle - let braceL x = leftL Literals.leftBrace ^^ x ^^ rightL Literals.rightBrace - let braceBarL x = leftL Literals.leftBraceBar ^^ x ^^ rightL Literals.rightBraceBar + let braceL x = wordL Literals.leftBrace ^^ x ^^ wordL Literals.rightBrace + let braceBarL x = wordL Literals.leftBraceBar ^^ x ^^ wordL Literals.rightBraceBar let comment str = wordL (tagText (sprintf "(* %s *)" str)) @@ -942,7 +942,7 @@ module private PrintTypes = // Layout a tuple type | TType_anon (anonInfo, tys) -> - let core = sepListL (wordL (tagPunctuation ";")) (List.map2 (fun nm ty -> wordL (tagField nm) ^^ wordL (tagPunctuation ":") ^^ layoutTypeWithInfoAndPrec denv env prec ty) (Array.toList anonInfo.SortedNames) tys) + let core = sepListL (rightL (tagPunctuation ";")) (List.map2 (fun nm ty -> wordL (tagField nm) ^^ rightL (tagPunctuation ":") ^^ layoutTypeWithInfoAndPrec denv env prec ty) (Array.toList anonInfo.SortedNames) tys) if evalAnonInfoIsStruct anonInfo then WordL.keywordStruct --- braceBarL core else @@ -1457,7 +1457,7 @@ module private TastDefinitionPrinting = let lhs = tagRecordField fld.Name |> mkNav fld.DefinitionRange - |> wordL + |> wordL let lhs = (if addAccess then layoutAccessibility denv fld.Accessibility lhs else lhs) let lhs = if fld.IsMutable then wordL (tagKeyword "mutable") --- lhs else lhs (lhs ^^ RightL.colon) --- layoutType denv fld.FormalType @@ -1738,8 +1738,15 @@ module private TastDefinitionPrinting = let denv = denv.AddAccessibility tycon.TypeReprAccessibility match repr with | TRecdRepr _ -> - let recdFieldRefL fld = layoutRecdField false denv fld ^^ rightL (tagPunctuation ";") - let recdL = tycon.TrueFieldsAsList |> List.map recdFieldRefL |> applyMaxMembers denv.maxMembers |> aboveListL |> braceL + let recdFieldRefL fld = layoutRecdField false denv fld + + let recdL = + tycon.TrueFieldsAsList + |> List.map recdFieldRefL + |> applyMaxMembers denv.maxMembers + |> aboveListL + |> braceL + Some (addMembersAsWithEnd (addReprAccessL recdL)) | TFSharpObjectRepr r -> @@ -1771,8 +1778,7 @@ module private TastDefinitionPrinting = | _ -> [] let vsprs = tycon.MembersOfFSharpTyconSorted - |> List.filter (fun v -> isNil (Option.get v.MemberInfo).ImplementedSlotSigs) - |> List.filter (fun v -> v.IsDispatchSlot) + |> List.filter (fun v -> isNil (Option.get v.MemberInfo).ImplementedSlotSigs && v.IsDispatchSlot) |> List.map (fun vref -> PrintTastMemberOrVals.prettyLayoutOfValOrMemberNoInst denv vref.Deref) let staticValsLs = tycon.TrueFieldsAsList diff --git a/src/utils/sformat.fs b/src/utils/sformat.fs index b490283f67..228f4aba39 100644 --- a/src/utils/sformat.fs +++ b/src/utils/sformat.fs @@ -759,18 +759,14 @@ namespace Microsoft.FSharp.Text.StructuredPrintfImpl // pprinter: attributes // -------------------------------------------------------------------- - let makeRecordVerticalL nameXs = - let itemL (name,xL) = let labelL = wordL name in ((labelL ^^ wordL Literals.equals)) -- (xL ^^ (rightL Literals.semicolon)) - let braceL xs = (leftL Literals.leftBrace) ^^ xs ^^ (rightL Literals.rightBrace) - braceL (aboveListL (List.map itemL nameXs)) - - // This is a more compact rendering of records - and is more like tuples - let makeRecordHorizontalL nameXs = - let itemL (name,xL) = let labelL = wordL name in ((labelL ^^ wordL Literals.equals)) -- xL - let braceL xs = (leftL Literals.leftBrace) ^^ xs ^^ (rightL Literals.rightBrace) - braceL (sepListL (rightL Literals.semicolon) (List.map itemL nameXs)) - - let makeRecordL nameXs = makeRecordVerticalL nameXs + let makeRecordL nameXs = + let itemL (name,xL) = wordL name ^^ wordL Literals.equals -- xL + let braceL xs = (wordL Literals.leftBrace) ^^ xs ^^ (wordL Literals.rightBrace) + + nameXs + |> List.map itemL + |> aboveListL + |> braceL let makePropertiesL nameXs = let itemL (name,v) = diff --git a/tests/fsharp/Compiler/Language/AnonRecordTests.fs b/tests/fsharp/Compiler/Language/AnonRecordTests.fs index 0a4d1c18d9..befa39f2bf 100644 --- a/tests/fsharp/Compiler/Language/AnonRecordTests.fs +++ b/tests/fsharp/Compiler/Language/AnonRecordTests.fs @@ -34,7 +34,7 @@ let rAnon = RefClass() FSharpErrorSeverity.Error 1 (3, 13, 3, 42) - "A generic construct requires that the type 'struct {|R : int|}' have reference semantics, but it does not, i.e. it is a struct" + "A generic construct requires that the type 'struct {| R: int |}' have reference semantics, but it does not, i.e. it is a struct" [] let StructConstraintFail() = @@ -46,4 +46,4 @@ let sAnon = StructClass<{| S: int |}>() FSharpErrorSeverity.Error 1 (3, 13, 3, 38) - "A generic construct requires that the type '{|S : int|}' is a CLI or F# struct type" \ No newline at end of file + "A generic construct requires that the type '{| S: int |}' is a CLI or F# struct type" diff --git a/tests/fsharp/core/anon/lib.fs b/tests/fsharp/core/anon/lib.fs index 9fc219e1cb..cc3f7de704 100644 --- a/tests/fsharp/core/anon/lib.fs +++ b/tests/fsharp/core/anon/lib.fs @@ -52,8 +52,8 @@ module KindB1 = check "coijoiwcnkwle1" {| a = 1 |} {| a = 1 |} check "coijoiwcnkwle2" {| a = 2 |} {| a = 2 |} - check "coijoiwcnkwle3" (sprintf "%A" {| X = 10 |}) "{X = 10;}" - check "coijoiwcnkwle4" (sprintf "%A" {| X = 10; Y = 1 |} |> fun s -> s.Replace("\n","").Replace("\r","")) ("{X = 10; Y = 1;}".Replace("\n","").Replace("\r","")) + check "coijoiwcnkwle3" (sprintf "%A" {| X = 10 |}) "{ X = 10 }" + check "coijoiwcnkwle4" (sprintf "%A" {| X = 10; Y = 1 |}) "{ X = 10\n Y = 1 }" check "clekoiew09" (f2 {| X = {| X = 10 |} |}) 10 check "cewkew0oijew" (f2 {| X = {| X = 20 |} |}) 20 diff --git a/tests/fsharp/core/anon/test.fsx b/tests/fsharp/core/anon/test.fsx index 092a897714..580772b344 100644 --- a/tests/fsharp/core/anon/test.fsx +++ b/tests/fsharp/core/anon/test.fsx @@ -25,13 +25,13 @@ module Test = let testAccess = (KindB1.data1.X, KindB1.data3.X) - check "coijoiwcnkwle2" (sprintf "%A" KindB1.data1) "{X = 1;}" + check "coijoiwcnkwle2" (sprintf "%A" KindB1.data1) "{ X = 1 }" module Tests2 = let testAccess = (KindB2.data1.X, KindB2.data3.X, KindB2.data3.Y) - check "coijoiwcnkwle3" (sprintf "%A" KindB2.data1) "{X = 1;}" + check "coijoiwcnkwle3" (sprintf "%A" KindB2.data1) "{ X = 1 }" let _ = (KindB2.data1 = KindB2.data1) @@ -49,7 +49,7 @@ module CrossAssemblyTest = check "vrknvio1" (SampleAPI.SampleFunction {| A=1; B = "abc" |}) 4 // note, this is creating an instance of an anonymous record from another assembly. check "vrknvio2" (SampleAPI.SampleFunctionAcceptingList [ {| A=1; B = "abc" |}; {| A=2; B = "def" |} ]) [4; 5] // note, this is creating an instance of an anonymous record from another assembly. check "vrknvio3" (let d = SampleAPI.SampleFunctionReturningAnonRecd() in d.A + d.B.Length) 4 - check "vrknvio4" (let d = SampleAPIStruct.SampleFunctionReturningAnonRecd() in d.ToString().Replace("\n","").Replace("\r","")) """{A = 1; B = "abc";}""" + check "vrknvio4" (let d = SampleAPIStruct.SampleFunctionReturningAnonRecd() in d.ToString()) ("{ A = 1\n " + """B = "abc" }""") tests() module CrossAssemblyTestStruct = diff --git a/tests/fsharp/core/members/basics/test.fs b/tests/fsharp/core/members/basics/test.fs index 27c9e6c3a4..a5da244c0a 100644 --- a/tests/fsharp/core/members/basics/test.fs +++ b/tests/fsharp/core/members/basics/test.fs @@ -1178,8 +1178,8 @@ module ToStringOnRecordTest = begin let a1 = {A = "201"; B = 7} let c1 = {C = "20"; D = 17} - let expected1 = "{A = \"201\";\n B = 7;}" - let expected2 = "{C = \"20\";\n D = 17;}" + let expected1 = "{ A = \"201\"\n B = 7 }" + let expected2 = "{ C = \"20\"\n D = 17 }" do test "record-tostring-def" (a1.ToString() = expected1) do test "record-sprintfO-def" ((sprintf "%O" a1) = expected1) diff --git a/tests/fsharp/core/printing/z.output.test.1000.stdout.bsl b/tests/fsharp/core/printing/z.output.test.1000.stdout.bsl index 1f9224b67b..52c96dd759 100644 --- a/tests/fsharp/core/printing/z.output.test.1000.stdout.bsl +++ b/tests/fsharp/core/printing/z.output.test.1000.stdout.bsl @@ -226,7 +226,7 @@ type T = end val f_as_method : x:int -> int val f_as_thunk : (int -> int) -val refCell : string ref = {contents = "value";} +val refCell : string ref = { contents = "value" } module D1 = begin val words : System.Collections.Generic.IDictionary val words2000 : System.Collections.Generic.IDictionary @@ -1134,7 +1134,7 @@ end | B > type internal T2 = - {x: int;} + { x: int } > type internal T3 @@ -1148,28 +1148,28 @@ end | B > type T2 = - internal {x: int;} + internal { x: int } > type private T1 = | A | B > type private T2 = - {x: int;} + { x: int } > type T1 = private | A | B > type T2 = - private {x: int;} + private { x: int } > type internal T1 = private | A | B > type internal T2 = - private {x: int;} + private { x: int } > type private T3 @@ -1233,121 +1233,121 @@ type 'a T1Pre with member E : IEvent > type r = - {f0: int; - f1: int; - f2: int; - f3: int; - f4: int; - f5: int; - f6: int; - f7: int; - f8: int; - f9: int;} -val r10 : r = {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;} + { f0: int + f1: int + f2: int + f3: int + f4: int + f5: int + f6: int + f7: int + f8: int + f9: int } +val r10 : r = { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 } val r10s : r [] = - [|{f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; ...|] + [|{ f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; ...|] val r10s' : string * r [] = ("one extra node", - [|{f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = ...;}; ...|]) + [|{ f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = ... }; ...|]) > val x1564_A1 : int = 1 @@ -1398,7 +1398,7 @@ val x1564_A3 : int = 3 | A | B type T2 = - {x: int;} + { x: int } type T3 type T4 = class @@ -1408,22 +1408,22 @@ val x1564_A3 : int = 3 | A | B type T6 = - {x: int;} + { x: int } type private T7 = | A | B type private T8 = - {x: int;} + { x: int } type T9 = private | A | B type T10 = - private {x: int;} + private { x: int } type T11 = private | A | B type T12 = - private {x: int;} + private { x: int } type private T13 type private T14 = class @@ -1446,7 +1446,7 @@ module internal PrivateM = begin | A | B type T2 = - {x: int;} + { x: int } type T3 type T4 = class @@ -1456,22 +1456,22 @@ module internal PrivateM = begin | A | B type T6 = - {x: int;} + { x: int } type private T7 = | A | B type private T8 = - {x: int;} + { x: int } type T9 = private | A | B type T10 = - private {x: int;} + private { x: int } type T11 = private | A | B type T12 = - private {x: int;} + private { x: int } type private T13 type private T14 = class @@ -1806,9 +1806,9 @@ module Regression1019_long = begin val single_infinity : float32 = infinityf end -> val it : int ref = {contents = 1;} +> val it : int ref = { contents = 1 } -> val x : int ref = {contents = 1;} +> val x : int ref = { contents = 1 } val f : (unit -> int) > val it : int = 1 @@ -2732,11 +2732,11 @@ val namedEx1 : exn = MyNamedException1 (5,"") val namedEx2 : exn = MyNamedException7 25 > type optionRecord = - {x: int option;} -val x : optionRecord = {x = None;} + { x: int option } +val x : optionRecord = { x = None } > type optionRecord = - {x: obj;} -val x : optionRecord = {x = null;} + { x: obj } +val x : optionRecord = { x = null } > > > diff --git a/tests/fsharp/core/printing/z.output.test.200.stdout.bsl b/tests/fsharp/core/printing/z.output.test.200.stdout.bsl index 0877fcb800..249743e0cf 100644 --- a/tests/fsharp/core/printing/z.output.test.200.stdout.bsl +++ b/tests/fsharp/core/printing/z.output.test.200.stdout.bsl @@ -121,7 +121,7 @@ type T = end val f_as_method : x:int -> int val f_as_thunk : (int -> int) -val refCell : string ref = {contents = "value";} +val refCell : string ref = { contents = "value" } module D1 = begin val words : System.Collections.Generic.IDictionary val words2000 : System.Collections.Generic.IDictionary @@ -458,7 +458,7 @@ end | B > type internal T2 = - {x: int;} + { x: int } > type internal T3 @@ -472,28 +472,28 @@ end | B > type T2 = - internal {x: int;} + internal { x: int } > type private T1 = | A | B > type private T2 = - {x: int;} + { x: int } > type T1 = private | A | B > type T2 = - private {x: int;} + private { x: int } > type internal T1 = private | A | B > type internal T2 = - private {x: int;} + private { x: int } > type private T3 @@ -557,46 +557,46 @@ type 'a T1Pre with member E : IEvent > type r = - {f0: int; - f1: int; - f2: int; - f3: int; - f4: int; - f5: int; - f6: int; - f7: int; - f8: int; - f9: int;} -val r10 : r = {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;} -val r10s : r [] = [|{f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; ...|] -val r10s' : string * r [] = ("one extra node", [|{f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = ...;}; ...|]) + { f0: int + f1: int + f2: int + f3: int + f4: int + f5: int + f6: int + f7: int + f8: int + f9: int } +val r10 : r = { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 } +val r10s : r [] = [|{ f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; ...|] +val r10s' : string * r [] = ("one extra node", [|{ f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = ... }; ...|]) > val x1564_A1 : int = 1 @@ -647,7 +647,7 @@ val x1564_A3 : int = 3 | A | B type T2 = - {x: int;} + { x: int } type T3 type T4 = class @@ -657,22 +657,22 @@ val x1564_A3 : int = 3 | A | B type T6 = - {x: int;} + { x: int } type private T7 = | A | B type private T8 = - {x: int;} + { x: int } type T9 = private | A | B type T10 = - private {x: int;} + private { x: int } type T11 = private | A | B type T12 = - private {x: int;} + private { x: int } type private T13 type private T14 = class @@ -695,7 +695,7 @@ module internal PrivateM = begin | A | B type T2 = - {x: int;} + { x: int } type T3 type T4 = class @@ -705,22 +705,22 @@ module internal PrivateM = begin | A | B type T6 = - {x: int;} + { x: int } type private T7 = | A | B type private T8 = - {x: int;} + { x: int } type T9 = private | A | B type T10 = - private {x: int;} + private { x: int } type T11 = private | A | B type T12 = - private {x: int;} + private { x: int } type private T13 type private T14 = class @@ -1055,9 +1055,9 @@ module Regression1019_long = begin val single_infinity : float32 = infinityf end -> val it : int ref = {contents = 1;} +> val it : int ref = { contents = 1 } -> val x : int ref = {contents = 1;} +> val x : int ref = { contents = 1 } val f : (unit -> int) > val it : int = 1 @@ -1981,11 +1981,11 @@ val namedEx1 : exn = MyNamedException1 (5,"") val namedEx2 : exn = MyNamedException7 25 > type optionRecord = - {x: int option;} -val x : optionRecord = {x = None;} + { x: int option } +val x : optionRecord = { x = None } > type optionRecord = - {x: obj;} -val x : optionRecord = {x = null;} + { x: obj } +val x : optionRecord = { x = null } > > > diff --git a/tests/fsharp/core/printing/z.output.test.default.stdout.bsl b/tests/fsharp/core/printing/z.output.test.default.stdout.bsl index fab8d8dbaa..f861d11fef 100644 --- a/tests/fsharp/core/printing/z.output.test.default.stdout.bsl +++ b/tests/fsharp/core/printing/z.output.test.default.stdout.bsl @@ -241,7 +241,7 @@ type T = end val f_as_method : x:int -> int val f_as_thunk : (int -> int) -val refCell : string ref = {contents = "value";} +val refCell : string ref = { contents = "value" } module D1 = begin val words : System.Collections.Generic.IDictionary val words2000 : System.Collections.Generic.IDictionary @@ -4072,7 +4072,7 @@ end | B > type internal T2 = - {x: int;} + { x: int } > type internal T3 @@ -4086,28 +4086,28 @@ end | B > type T2 = - internal {x: int;} + internal { x: int } > type private T1 = | A | B > type private T2 = - {x: int;} + { x: int } > type T1 = private | A | B > type T2 = - private {x: int;} + private { x: int } > type internal T1 = private | A | B > type internal T2 = - private {x: int;} + private { x: int } > type private T3 @@ -4171,709 +4171,709 @@ type 'a T1Pre with member E : IEvent > type r = - {f0: int; - f1: int; - f2: int; - f3: int; - f4: int; - f5: int; - f6: int; - f7: int; - f8: int; - f9: int;} -val r10 : r = {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;} + { f0: int + f1: int + f2: int + f3: int + f4: int + f5: int + f6: int + f7: int + f8: int + f9: int } +val r10 : r = { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 } val r10s : r [] = - [|{f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; - {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; - {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; - {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; - {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; - {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; - {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}|] + [|{ f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; + { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; + { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; + { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; + { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; + { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; + { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }|] val r10s' : string * r [] = ("one extra node", - [|{f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; - {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; - {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; - {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; - {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; - {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}; - {f0 = 0; - f1 = 1; - f2 = 2; - f3 = 3; - f4 = 4; - f5 = 5; - f6 = 6; - f7 = 7; - f8 = 8; - f9 = 9;}|]) + [|{ f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; + { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; + { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; + { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; + { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; + { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }; + { f0 = 0 + f1 = 1 + f2 = 2 + f3 = 3 + f4 = 4 + f5 = 5 + f6 = 6 + f7 = 7 + f8 = 8 + f9 = 9 }|]) > val x1564_A1 : int = 1 @@ -4924,7 +4924,7 @@ val x1564_A3 : int = 3 | A | B type T2 = - {x: int;} + { x: int } type T3 type T4 = class @@ -4934,22 +4934,22 @@ val x1564_A3 : int = 3 | A | B type T6 = - {x: int;} + { x: int } type private T7 = | A | B type private T8 = - {x: int;} + { x: int } type T9 = private | A | B type T10 = - private {x: int;} + private { x: int } type T11 = private | A | B type T12 = - private {x: int;} + private { x: int } type private T13 type private T14 = class @@ -4972,7 +4972,7 @@ module internal PrivateM = begin | A | B type T2 = - {x: int;} + { x: int } type T3 type T4 = class @@ -4982,22 +4982,22 @@ module internal PrivateM = begin | A | B type T6 = - {x: int;} + { x: int } type private T7 = | A | B type private T8 = - {x: int;} + { x: int } type T9 = private | A | B type T10 = - private {x: int;} + private { x: int } type T11 = private | A | B type T12 = - private {x: int;} + private { x: int } type private T13 type private T14 = class @@ -5332,9 +5332,9 @@ module Regression1019_long = begin val single_infinity : float32 = infinityf end -> val it : int ref = {contents = 1;} +> val it : int ref = { contents = 1 } -> val x : int ref = {contents = 1;} +> val x : int ref = { contents = 1 } val f : (unit -> int) > val it : int = 1 @@ -6258,11 +6258,11 @@ val namedEx1 : exn = MyNamedException1 (5,"") val namedEx2 : exn = MyNamedException7 25 > type optionRecord = - {x: int option;} -val x : optionRecord = {x = None;} + { x: int option } +val x : optionRecord = { x = None } > type optionRecord = - {x: obj;} -val x : optionRecord = {x = null;} + { x: obj } +val x : optionRecord = { x = null } > > > diff --git a/tests/fsharp/core/printing/z.output.test.off.stdout.bsl b/tests/fsharp/core/printing/z.output.test.off.stdout.bsl index 2b0d6ca987..9c90f3e2fa 100644 --- a/tests/fsharp/core/printing/z.output.test.off.stdout.bsl +++ b/tests/fsharp/core/printing/z.output.test.off.stdout.bsl @@ -289,7 +289,7 @@ end | B > type internal T2 = - {x: int;} + { x: int } > type internal T3 @@ -303,28 +303,28 @@ end | B > type T2 = - internal {x: int;} + internal { x: int } > type private T1 = | A | B > type private T2 = - {x: int;} + { x: int } > type T1 = private | A | B > type T2 = - private {x: int;} + private { x: int } > type internal T1 = private | A | B > type internal T2 = - private {x: int;} + private { x: int } > type private T3 @@ -388,16 +388,16 @@ type 'a T1Pre with member E : IEvent > type r = - {f0: int; - f1: int; - f2: int; - f3: int; - f4: int; - f5: int; - f6: int; - f7: int; - f8: int; - f9: int;} + { f0: int + f1: int + f2: int + f3: int + f4: int + f5: int + f6: int + f7: int + f8: int + f9: int } val r10 : r val r10s : r [] val r10s' : string * r [] @@ -451,7 +451,7 @@ val x1564_A3 : int | A | B type T2 = - {x: int;} + { x: int } type T3 type T4 = class @@ -461,22 +461,22 @@ val x1564_A3 : int | A | B type T6 = - {x: int;} + { x: int } type private T7 = | A | B type private T8 = - {x: int;} + { x: int } type T9 = private | A | B type T10 = - private {x: int;} + private { x: int } type T11 = private | A | B type T12 = - private {x: int;} + private { x: int } type private T13 type private T14 = class @@ -499,7 +499,7 @@ module internal PrivateM = begin | A | B type T2 = - {x: int;} + { x: int } type T3 type T4 = class @@ -509,22 +509,22 @@ module internal PrivateM = begin | A | B type T6 = - {x: int;} + { x: int } type private T7 = | A | B type private T8 = - {x: int;} + { x: int } type T9 = private | A | B type T10 = - private {x: int;} + private { x: int } type T11 = private | A | B type T12 = - private {x: int;} + private { x: int } type private T13 type private T14 = class @@ -831,7 +831,7 @@ module Regression1019_long = begin val single_infinity : float32 end -> val it : int ref = {contents = 1;} +> val it : int ref = { contents = 1 } > val x : int ref val f : (unit -> int) @@ -1755,11 +1755,11 @@ val namedEx1 : exn val namedEx2 : exn > type optionRecord = - {x: int option;} + { x: int option } val x : optionRecord > type optionRecord = - {x: obj;} + { x: obj } val x : optionRecord > > > diff --git a/tests/fsharp/typecheck/sigs/neg113.bsl b/tests/fsharp/typecheck/sigs/neg113.bsl index 211ba670f9..b9f0190c63 100644 --- a/tests/fsharp/typecheck/sigs/neg113.bsl +++ b/tests/fsharp/typecheck/sigs/neg113.bsl @@ -3,20 +3,20 @@ neg113.fs(5,50,5,61): typecheck error FS0001: Two anonymous record types have mi neg113.fs(7,41,7,52): typecheck error FS0001: Two anonymous record types have mismatched sets of field names '["b"]' and '["a"]' -neg113.fs(10,27,10,55): typecheck error FS0059: The type '{|a : int|}' does not have any proper subtypes and need not be used as the target of a static coercion +neg113.fs(10,27,10,55): typecheck error FS0059: The type '{| a: int |}' does not have any proper subtypes and need not be used as the target of a static coercion neg113.fs(10,27,10,55): typecheck error FS0193: Type constraint mismatch. The type - '{|b : int|}' + '{| b: int |}' is not compatible with type - '{|a : int|}' + '{| a: int |}' -neg113.fs(13,27,13,62): typecheck error FS0059: The type '{|a : int|}' does not have any proper subtypes and need not be used as the target of a static coercion +neg113.fs(13,27,13,62): typecheck error FS0059: The type '{| a: int |}' does not have any proper subtypes and need not be used as the target of a static coercion neg113.fs(13,27,13,62): typecheck error FS0193: Type constraint mismatch. The type - '{|a : int ; b : int|}' + '{| a: int; b: int |}' is not compatible with type - '{|a : int|}' + '{| a: int |}' neg113.fs(18,34,18,36): typecheck error FS0001: The type '('a -> 'a)' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface diff --git a/tests/fsharp/typecheck/sigs/neg113.vsbsl b/tests/fsharp/typecheck/sigs/neg113.vsbsl index 211ba670f9..b9f0190c63 100644 --- a/tests/fsharp/typecheck/sigs/neg113.vsbsl +++ b/tests/fsharp/typecheck/sigs/neg113.vsbsl @@ -3,20 +3,20 @@ neg113.fs(5,50,5,61): typecheck error FS0001: Two anonymous record types have mi neg113.fs(7,41,7,52): typecheck error FS0001: Two anonymous record types have mismatched sets of field names '["b"]' and '["a"]' -neg113.fs(10,27,10,55): typecheck error FS0059: The type '{|a : int|}' does not have any proper subtypes and need not be used as the target of a static coercion +neg113.fs(10,27,10,55): typecheck error FS0059: The type '{| a: int |}' does not have any proper subtypes and need not be used as the target of a static coercion neg113.fs(10,27,10,55): typecheck error FS0193: Type constraint mismatch. The type - '{|b : int|}' + '{| b: int |}' is not compatible with type - '{|a : int|}' + '{| a: int |}' -neg113.fs(13,27,13,62): typecheck error FS0059: The type '{|a : int|}' does not have any proper subtypes and need not be used as the target of a static coercion +neg113.fs(13,27,13,62): typecheck error FS0059: The type '{| a: int |}' does not have any proper subtypes and need not be used as the target of a static coercion neg113.fs(13,27,13,62): typecheck error FS0193: Type constraint mismatch. The type - '{|a : int ; b : int|}' + '{| a: int; b: int |}' is not compatible with type - '{|a : int|}' + '{| a: int |}' neg113.fs(18,34,18,36): typecheck error FS0001: The type '('a -> 'a)' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface diff --git a/tests/fsharp/typecheck/sigs/neg_anon_1.bsl b/tests/fsharp/typecheck/sigs/neg_anon_1.bsl index d7aaaecd93..3e75d81144 100644 --- a/tests/fsharp/typecheck/sigs/neg_anon_1.bsl +++ b/tests/fsharp/typecheck/sigs/neg_anon_1.bsl @@ -3,20 +3,20 @@ neg_anon_1.fs(5,50,5,61): typecheck error FS0001: Two anonymous record types hav neg_anon_1.fs(7,41,7,52): typecheck error FS0001: Two anonymous record types have mismatched sets of field names '["b"]' and '["a"]' -neg_anon_1.fs(10,27,10,55): typecheck error FS0059: The type '{|a : int|}' does not have any proper subtypes and need not be used as the target of a static coercion +neg_anon_1.fs(10,27,10,55): typecheck error FS0059: The type '{| a: int |}' does not have any proper subtypes and need not be used as the target of a static coercion neg_anon_1.fs(10,27,10,55): typecheck error FS0193: Type constraint mismatch. The type - '{|b : int|}' + '{| b: int |}' is not compatible with type - '{|a : int|}' + '{| a: int |}' -neg_anon_1.fs(13,27,13,62): typecheck error FS0059: The type '{|a : int|}' does not have any proper subtypes and need not be used as the target of a static coercion +neg_anon_1.fs(13,27,13,62): typecheck error FS0059: The type '{| a: int |}' does not have any proper subtypes and need not be used as the target of a static coercion neg_anon_1.fs(13,27,13,62): typecheck error FS0193: Type constraint mismatch. The type - '{|a : int ; b : int|}' + '{| a: int; b: int |}' is not compatible with type - '{|a : int|}' + '{| a: int |}' neg_anon_1.fs(18,34,18,36): typecheck error FS0001: The type '('a -> 'a)' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface diff --git a/tests/fsharpqa/Source/Printing/BindingsWithValues01.fsx b/tests/fsharpqa/Source/Printing/BindingsWithValues01.fsx index 052100c05f..30b453b9fc 100644 --- a/tests/fsharpqa/Source/Printing/BindingsWithValues01.fsx +++ b/tests/fsharpqa/Source/Printing/BindingsWithValues01.fsx @@ -4,14 +4,14 @@ // Test for FSharp1.0:2581 - FSI should display bound values, not just evaluated expressions (was: FSI should print the value of the last declared value is there is no last expression) //type RecT = -// {Name: string;} +// { Name: string } //type Bldg = // \| House // \| Museum // \| Office //val a : int = 1 //val B : string = "Hello" -//val c' : RecT = {Name = "F#";} +//val c' : RecT = { Name = "F#" } //val _d : Bldg = Office //val e : seq //val F'F : int list = \[3; 2; 1] @@ -19,7 +19,7 @@ //val g' : Set<'a> //val getPointF : x:float32 \* y:float32 -> System\.Drawing\.PointF //val h : System\.Drawing\.PointF = {X=.+, Y=.+} -//val i : int \* RecT \* Bldg = \(1, {Name = "F#";}, Office\) +//val i : int \* RecT \* Bldg = \(1, { Name = "F#" }, Office\) //val J_ : int \[\] = \[\|1; 2; 3\|] //val j_' : float \[\] = \[\|1\.0; 1\.0\|] //val j_'_ : RecT \[\] = \[\|\|] diff --git a/tests/fsharpqa/Source/Printing/CustomExceptions01.fs b/tests/fsharpqa/Source/Printing/CustomExceptions01.fs index 6f33bff2e1..7a2949be91 100644 --- a/tests/fsharpqa/Source/Printing/CustomExceptions01.fs +++ b/tests/fsharpqa/Source/Printing/CustomExceptions01.fs @@ -16,7 +16,7 @@ exception WeekendEx of WeekendDay if sprintf "%A" (Foo) <> "Foo" || sprintf "%A" (Bar 10) <> "Bar 10" || sprintf "%A" (FooBaz System.DateTime.Today) <> ("FooBaz " + System.DateTime.Today.ToString()) - || sprintf "%A" (MarkupEx {Body = ""}) <> "MarkupEx {Body = \"\";}" + || sprintf "%A" (MarkupEx {Body = ""}) <> "MarkupEx { Body = \"\" }" || sprintf "%A" (WeekendEx Saturday) <> "WeekendEx Saturday" then exit 1 diff --git a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs index 16d2f34a4e..09f358678d 100644 --- a/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs +++ b/vsintegration/tests/UnitTests/LegacyLanguageService/Tests.LanguageService.QuickInfo.fs @@ -762,7 +762,7 @@ Full name: Microsoft.FSharp.Control.Async""".TrimStart().Replace("\r\n", "\n") let fileContents = """namespace NS type Re(*MarkerRecord*) = { X : int } """ - let expectedQuickinfoTypeRecored = "type Re = {X: int;}" + let expectedQuickinfoTypeRecored = "type Re = { X: int }" this.InfoInDeclarationTestQuickInfoImplWithTrim fileContents "Re(*MarkerRecord*)" expectedQuickinfoTypeRecored diff --git a/vsintegration/tests/UnitTests/QuickInfoTests.fs b/vsintegration/tests/UnitTests/QuickInfoTests.fs index bfa6c7df72..415079942e 100644 --- a/vsintegration/tests/UnitTests/QuickInfoTests.fs +++ b/vsintegration/tests/UnitTests/QuickInfoTests.fs @@ -154,9 +154,9 @@ module Test = let quickInfo = GetQuickInfoTextFromCode code let expected = expectedLines [ "type MyEmployee =" - " {mutable Name: string;" - " mutable Age: int;" - " mutable IsFTE: bool;}" + " { mutable Name: string" + " mutable Age: int" + " mutable IsFTE: bool }" "Full name: FsTest.MyEmployee" ] Assert.AreEqual(expected, quickInfo) () From f5f7f0f317cbb16bba86651f69753d9833f15ed0 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Thu, 11 Jul 2019 20:16:48 -0700 Subject: [PATCH 161/286] Enable 4.7 by default (#7204) * Enable 4.7 by default * Label format --- src/fsharp/LanguageFeatures.fs | 47 ++++++++++--------- src/fsharp/LanguageFeatures.fsi | 18 +++---- tests/fsharp/tests.fs | 10 ++-- .../langversion/langversionhelp.437.1033.bsl | 3 +- .../langversion/langversionhelp.437.1033.bsl | 3 +- .../DataExpressions/NameOf/env.lst | 22 ++++----- .../SequenceExpressions/env.lst | 6 +-- tests/fsharpqa/Source/Warnings/env.lst | 6 +-- 8 files changed, 60 insertions(+), 55 deletions(-) diff --git a/src/fsharp/LanguageFeatures.fs b/src/fsharp/LanguageFeatures.fs index 5d42651609..8894fb1fc1 100644 --- a/src/fsharp/LanguageFeatures.fs +++ b/src/fsharp/LanguageFeatures.fs @@ -19,14 +19,16 @@ open System /// LanguageFeature enumeration [] type LanguageFeature = - | LanguageVersion46 = 0 - | LanguageVersion47 = 1 - | SingleUnderscorePattern = 2 - | WildCardInForLoop = 3 - | RelaxWhitespace = 4 - | NameOf = 5 - | ImplicitYield = 6 - | OpenStaticClasses = 7 + | PreviewVersion = 0 + | LanguageVersion46 = 1 + | LanguageVersion47 = 2 + | SingleUnderscorePattern = 3 + | WildCardInForLoop = 4 + | RelaxWhitespace = 5 + | NameOf = 6 + | ImplicitYield = 7 + | OpenStaticClasses = 8 + /// LanguageVersion management type LanguageVersion (specifiedVersion) = @@ -34,25 +36,25 @@ type LanguageVersion (specifiedVersion) = // When we increment language versions here preview is higher than current RTM version static let languageVersion46 = 4.6m static let languageVersion47 = 4.7m - - static let previewVersion = languageVersion47 // Language version when preview specified - static let defaultVersion = languageVersion46 // Language version when default specified + static let previewVersion = 9999m // Language version when preview specified + static let defaultVersion = languageVersion47 // Language version when default specified static let latestVersion = defaultVersion // Language version when latest specified static let latestMajorVersion = languageVersion46 // Language version when latestmajor specified static let validOptions = [| "preview"; "default"; "latest"; "latestmajor" |] - static let languageVersions = set [| latestVersion |] + static let languageVersions = set [| languageVersion46; languageVersion47 |] static let features = dict [| // Add new LanguageVersions here ... - LanguageFeature.LanguageVersion47, 4.7m - LanguageFeature.LanguageVersion46, 4.6m - LanguageFeature.SingleUnderscorePattern, previewVersion - LanguageFeature.WildCardInForLoop, previewVersion - LanguageFeature.RelaxWhitespace, previewVersion - LanguageFeature.NameOf, previewVersion - LanguageFeature.ImplicitYield, previewVersion - LanguageFeature.OpenStaticClasses, previewVersion + LanguageFeature.LanguageVersion46, languageVersion46 + LanguageFeature.LanguageVersion47, languageVersion47 + LanguageFeature.PreviewVersion, previewVersion + LanguageFeature.SingleUnderscorePattern, languageVersion47 + LanguageFeature.WildCardInForLoop, languageVersion47 + LanguageFeature.RelaxWhitespace, languageVersion47 + LanguageFeature.NameOf, languageVersion47 + LanguageFeature.ImplicitYield, languageVersion47 + LanguageFeature.OpenStaticClasses, languageVersion47 |] let specified = @@ -88,7 +90,6 @@ type LanguageVersion (specifiedVersion) = /// Get a list of valid versions for help text member __.ValidVersions = [| for v in languageVersions |> Seq.sort do - let label = if v = defaultVersion || v = latestVersion then "(Default)" else "" - yield sprintf "%M %s" v label + let label = if v = defaultVersion then " (Default)" else "" + yield sprintf "%M%s" v label |] - diff --git a/src/fsharp/LanguageFeatures.fsi b/src/fsharp/LanguageFeatures.fsi index 2dd2aaef62..bda44fe171 100644 --- a/src/fsharp/LanguageFeatures.fsi +++ b/src/fsharp/LanguageFeatures.fsi @@ -6,14 +6,16 @@ module internal FSharp.Compiler.Features /// LanguageFeature enumeration [] type LanguageFeature = - | LanguageVersion46 = 0 - | LanguageVersion47 = 1 - | SingleUnderscorePattern = 2 - | WildCardInForLoop = 3 - | RelaxWhitespace = 4 - | NameOf = 5 - | ImplicitYield = 6 - | OpenStaticClasses = 7 + | PreviewVersion = 0 + | LanguageVersion46 = 1 + | LanguageVersion47 = 2 + | SingleUnderscorePattern = 3 + | WildCardInForLoop = 4 + | RelaxWhitespace = 5 + | NameOf = 6 + | ImplicitYield = 7 + | OpenStaticClasses = 8 + /// LanguageVersion management type LanguageVersion = diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index c6159b5851..fab4a5fa84 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -1824,25 +1824,25 @@ module VersionTests = let ``member-selfidentifier-version4.6``() = singleTestBuildAndRunVersion "core/members/self-identifier/version46" FSC_BUILDONLY "4.6" [] - let ``member-selfidentifier-version4.7``() = singleTestBuildAndRunVersion "core/members/self-identifier/version47" FSC_BUILDONLY "preview" + let ``member-selfidentifier-version4.7``() = singleTestBuildAndRun "core/members/self-identifier/version47" FSC_BUILDONLY [] let ``indent-version4.6``() = singleTestBuildAndRunVersion "core/indent/version46" FSC_BUILDONLY "4.6" [] - let ``indent-version4.7``() = singleTestBuildAndRunVersion "core/indent/version47" FSC_BUILDONLY "preview" + let ``indent-version4.7``() = singleTestBuildAndRun "core/indent/version47" FSC_BUILDONLY [] let ``nameof-version4.6``() = singleTestBuildAndRunVersion "core/nameof/version46" FSC_BUILDONLY "4.6" [] - let ``nameof-version4.7``() = singleTestBuildAndRunVersion "core/nameof/version47" FSC_BUILDONLY "preview" + let ``nameof-version4.7``() = singleTestBuildAndRun "core/nameof/version47" FSC_BUILDONLY [] - let ``nameof-execute``() = singleTestBuildAndRunVersion "core/nameof/version47" FSC_BASIC "preview" + let ``nameof-execute``() = singleTestBuildAndRun "core/nameof/version47" FSC_BASIC [] - let ``nameof-fsi``() = singleTestBuildAndRunVersion "core/nameof/version47" FSI_BASIC "preview" + let ``nameof-fsi``() = singleTestBuildAndRun "core/nameof/version47" FSI_BASIC #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS module ToolsTests = diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/langversionhelp.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/langversionhelp.437.1033.bsl index c98bf79962..83fd0bfa99 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/langversionhelp.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/langversion/langversionhelp.437.1033.bsl @@ -3,4 +3,5 @@ preview default latest latestmajor -4.6 (Default) \ No newline at end of file +4.6 +4.7 (Default) \ No newline at end of file diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/langversionhelp.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/langversionhelp.437.1033.bsl index c98bf79962..83fd0bfa99 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/langversionhelp.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/langversion/langversionhelp.437.1033.bsl @@ -3,4 +3,5 @@ preview default latest latestmajor -4.6 (Default) \ No newline at end of file +4.6 +4.7 (Default) \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst index 60368829aa..53b393330d 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst @@ -1,11 +1,11 @@ - SOURCE=E_NameOfIntConst.fs SCFLAGS="--langversion:preview" # E_NameOfIntConst.fs - SOURCE=E_NameOfStringConst.fs SCFLAGS="--langversion:preview" # E_NameOfStringConst.fs - SOURCE=E_NameOfAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfAppliedFunction.fs - SOURCE=E_NameOfIntegerAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfIntegerAppliedFunction.fs - SOURCE=E_NameOfPartiallyAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfPartiallyAppliedFunction.fs - SOURCE=E_NameOfDictLookup.fs SCFLAGS="--langversion:preview" # E_NameOfDictLookup.fs - SOURCE=E_NameOfAdditionExpr.fs SCFLAGS="--langversion:preview" # E_NameOfAdditionExpr.fs - SOURCE=E_NameOfParameterAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfParameterAppliedFunction.fs - SOURCE=E_NameOfAsAFunction.fs SCFLAGS="--langversion:preview" # E_NameOfAsAFunction.fs - SOURCE=E_NameOfWithPipe.fs SCFLAGS="--langversion:preview" # E_NameOfWithPipe.fs - SOURCE=E_NameOfUnresolvableName.fs SCFLAGS="--langversion:preview" # E_NameOfUnresolvableName.fs + SOURCE=E_NameOfIntConst.fs # E_NameOfIntConst.fs + SOURCE=E_NameOfStringConst.fs # E_NameOfStringConst.fs + SOURCE=E_NameOfAppliedFunction.fs # E_NameOfAppliedFunction.fs + SOURCE=E_NameOfIntegerAppliedFunction.fs # E_NameOfIntegerAppliedFunction.fs + SOURCE=E_NameOfPartiallyAppliedFunction.fs # E_NameOfPartiallyAppliedFunction.fs + SOURCE=E_NameOfDictLookup.fs # E_NameOfDictLookup.fs + SOURCE=E_NameOfAdditionExpr.fs # E_NameOfAdditionExpr.fs + SOURCE=E_NameOfParameterAppliedFunction.fs # E_NameOfParameterAppliedFunction.fs + SOURCE=E_NameOfAsAFunction.fs # E_NameOfAsAFunction.fs + SOURCE=E_NameOfWithPipe.fs # E_NameOfWithPipe.fs + SOURCE=E_NameOfUnresolvableName.fs # E_NameOfUnresolvableName.fs diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/env.lst b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/env.lst index 5f210dd6e4..c769c0a095 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/env.lst +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/SequenceExpressions/env.lst @@ -1,9 +1,9 @@ SOURCE=version46/W_IfThenElse01.fs SCFLAGS="--langversion:4.6 --test:ErrorRanges" # version46 W_IfThenElse01.fs SOURCE=version46/W_IfThenElse02.fs SCFLAGS="--langversion:4.6 --test:ErrorRanges" # version46 W_IfThenElse02.fs SOURCE=version46/W_IfThenElse03.fs SCFLAGS="--langversion:4.6 --test:ErrorRanges" # version46 W_IfThenElse03.fs - SOURCE=version47/W_IfThenElse01.fs SCFLAGS="--langversion:preview --test:ErrorRanges" # version47 W_IfThenElse01.fs - SOURCE=version47/W_IfThenElse02.fs SCFLAGS="--langversion:preview --test:ErrorRanges" # version47 W_IfThenElse02.fs - SOURCE=version47/W_IfThenElse03.fs SCFLAGS="--langversion:preview --test:ErrorRanges" # version47 W_IfThenElse03.fs + SOURCE=version47/W_IfThenElse01.fs SCFLAGS="--test:ErrorRanges" # W_IfThenElse01.fs + SOURCE=version47/W_IfThenElse02.fs SCFLAGS="--test:ErrorRanges" # W_IfThenElse02.fs + SOURCE=version47/W_IfThenElse03.fs SCFLAGS="--test:ErrorRanges" # W_IfThenElse03.fs SOURCE=IfThenElse04.fs SCFLAGS="--test:ErrorRanges --warnaserror" # IfThenElse04.fs SOURCE=IfThenElse05.fs SCFLAGS="--test:ErrorRanges --warnaserror" # IfThenElse05.fs diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 3986ab5bc9..2992fb0e58 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -80,9 +80,9 @@ SOURCE=version46/WarnIfDiscardedInList.fs SCFLAGS="--langversion:4.6" #version46/WarnIfDiscardedInList SOURCE=version46/WarnIfDiscardedInList2.fs SCFLAGS="--langversion:4.6" #version46/WarnIfDiscardedInList2 SOURCE=version46/WarnIfDiscardedInList3.fs SCFLAGS="--langversion:4.6" #version46/WarnIfDiscardedInList3 - SOURCE=version47/WarnIfDiscardedInList.fs SCFLAGS="--langversion:preview" #version47/WarnIfDiscardedInList - SOURCE=version47/WarnIfDiscardedInList2.fs SCFLAGS="--langversion:preview" #version47/WarnIfDiscardedInList2 - SOURCE=version47/WarnIfDiscardedInList3.fs SCFLAGS="--langversion:preview" #version47/WarnIfDiscardedInList3 + SOURCE=version47/WarnIfDiscardedInList.fs #version47/WarnIfDiscardedInList + SOURCE=version47/WarnIfDiscardedInList2.fs #version47/WarnIfDiscardedInList2 + SOURCE=version47/WarnIfDiscardedInList3.fs #version47/WarnIfDiscardedInList3 SOURCE=WarnOnlyOnLastExpression.fs SOURCE=WarnIfPossiblePropertySetter.fs SOURCE=DoCannotHaveVisibilityDeclarations.fs From 660a5457ca46d337df61aae49fe681eb7cbdbc4d Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 12 Jul 2019 06:04:23 +0100 Subject: [PATCH 162/286] fix portable PDBs for anon records (#7099) --- src/absil/ilwritepdb.fs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index 260ccbe238..2a992ed485 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -403,12 +403,17 @@ let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (s if i < 1 || offsetDelta > 0 then builder.WriteCompressedInteger offsetDelta - // Hidden-sequence-point-record - if startLine = 0xfeefee || endLine = 0xfeefee || (startColumn = 0 && endColumn = 0) + // Check for hidden-sequence-point-record + if startLine = 0xfeefee || + endLine = 0xfeefee || + (startColumn = 0 && endColumn = 0) || + ((endLine - startLine) = 0 && (endColumn - startColumn) = 0) then + // Hidden-sequence-point-record builder.WriteCompressedInteger 0 builder.WriteCompressedInteger 0 - else // Non-hidden-sequence-point-record + else + // Non-hidden-sequence-point-record let deltaLines = endLine - startLine // lines builder.WriteCompressedInteger deltaLines From 9dc9d0e6d0e07ed8efe2ea83e6f8532e87c5c237 Mon Sep 17 00:00:00 2001 From: Don Syme Date: Fri, 12 Jul 2019 06:04:23 +0100 Subject: [PATCH 163/286] fix portable PDBs for anon records (#7099) --- src/absil/ilwritepdb.fs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index 260ccbe238..2a992ed485 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -403,12 +403,17 @@ let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (s if i < 1 || offsetDelta > 0 then builder.WriteCompressedInteger offsetDelta - // Hidden-sequence-point-record - if startLine = 0xfeefee || endLine = 0xfeefee || (startColumn = 0 && endColumn = 0) + // Check for hidden-sequence-point-record + if startLine = 0xfeefee || + endLine = 0xfeefee || + (startColumn = 0 && endColumn = 0) || + ((endLine - startLine) = 0 && (endColumn - startColumn) = 0) then + // Hidden-sequence-point-record builder.WriteCompressedInteger 0 builder.WriteCompressedInteger 0 - else // Non-hidden-sequence-point-record + else + // Non-hidden-sequence-point-record let deltaLines = endLine - startLine // lines builder.WriteCompressedInteger deltaLines From 60c915afd59740184da73e34ae0146622feae582 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Fri, 12 Jul 2019 07:50:38 +0200 Subject: [PATCH 164/286] Moving ElseBranchHasWrongTypeTests over to NUnit (#7104) --- .../ElseBranchHasWrongTypeTests.fs | 176 ++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 3 +- .../ElseBranchContextDoesntPropagateInAppl.fs | 11 -- ...ElseBranchContextDoesntPropagateInAppl2.fs | 12 -- ...seBranchContextDoesntPropagateInForLoop.fs | 14 -- ...extDoesntPropagateToLinesBeforeLastLine.fs | 13 -- .../Warnings/ElseBranchHasWrongContextType.fs | 9 - .../Source/Warnings/ElseBranchHasWrongType.fs | 9 - .../Warnings/ElseBranchHasWrongType2.fs | 10 - .../Warnings/ElseBranchHasWrongType3.fs | 13 -- .../Warnings/ElseBranchHasWrongType4.fs | 15 -- .../Warnings/NestedElseBranchHasWrongType.fs | 10 - tests/fsharpqa/Source/Warnings/env.lst | 10 - 13 files changed, 178 insertions(+), 127 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/ElseBranchHasWrongTypeTests.fs delete mode 100644 tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateInAppl.fs delete mode 100644 tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateInAppl2.fs delete mode 100644 tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateInForLoop.fs delete mode 100644 tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateToLinesBeforeLastLine.fs delete mode 100644 tests/fsharpqa/Source/Warnings/ElseBranchHasWrongContextType.fs delete mode 100644 tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType.fs delete mode 100644 tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType2.fs delete mode 100644 tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType3.fs delete mode 100644 tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType4.fs delete mode 100644 tests/fsharpqa/Source/Warnings/NestedElseBranchHasWrongType.fs diff --git a/tests/fsharp/Compiler/ErrorMessages/ElseBranchHasWrongTypeTests.fs b/tests/fsharp/Compiler/ErrorMessages/ElseBranchHasWrongTypeTests.fs new file mode 100644 index 0000000000..21c7bb2926 --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/ElseBranchHasWrongTypeTests.fs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Else branch has wrong type`` = + + [] + let ``Else branch is int while if branch is string``() = + CompilerAssert.TypeCheckSingleError + """ +let test = 100 +let y = + if test > 10 then "test" + else 123 + """ + FSharpErrorSeverity.Error + 1 + (5, 10, 5, 13) + "All branches of an 'if' expression must return values of the same type as the first branch, which here is 'string'. This branch returns a value of type 'int'." + + [] + let ``Else branch is a function that returns int while if branch is string``() = + CompilerAssert.TypeCheckSingleError + """ +let test = 100 +let f x = test +let y = + if test > 10 then "test" + else f 10 + """ + FSharpErrorSeverity.Error + 1 + (6, 10, 6, 14) + "All branches of an 'if' expression must return values of the same type as the first branch, which here is 'string'. This branch returns a value of type 'int'." + + + [] + let ``Else branch is a sequence of expressions that returns int while if branch is string``() = + CompilerAssert.TypeCheckSingleError + """ +let f x = x + 4 + +let y = + if true then + "" + else + "" |> ignore + (f 5) + """ + FSharpErrorSeverity.Error + 1 + (9, 10, 9, 13) + "All branches of an 'if' expression must return values of the same type as the first branch, which here is 'string'. This branch returns a value of type 'int'." + + + [] + let ``Else branch is a longer sequence of expressions that returns int while if branch is string``() = + CompilerAssert.TypeCheckSingleError + """ +let f x = x + 4 + +let y = + if true then + "" + else + "" |> ignore + let z = f 4 + let a = 3 * z + (f a) + """ + FSharpErrorSeverity.Error + 1 + (11, 10, 11, 13) + "All branches of an 'if' expression must return values of the same type as the first branch, which here is 'string'. This branch returns a value of type 'int'." + + + [] + let ``Else branch context doesn't propagate into function application``() = + CompilerAssert.TypeCheckSingleError + """ +let test = 100 +let f x : string = x +let y = + if test > 10 then "test" + else + f 123 + """ + FSharpErrorSeverity.Error + 1 + (7, 11, 7, 14) + "This expression was expected to have type\n 'string' \nbut here has type\n 'int' " + + [] + let ``Else branch context doesn't propagate into function application even if not last expr``() = + CompilerAssert.TypeCheckSingleError + """ +let test = 100 +let f x = printfn "%s" x +let y = + if test > 10 then "test" + else + f 123 + "test" + """ + FSharpErrorSeverity.Error + 1 + (7, 11, 7, 14) + "This expression was expected to have type\n 'string' \nbut here has type\n 'int' " + + [] + let ``Else branch context doesn't propagate into for loop``() = + CompilerAssert.TypeCheckSingleError + """ +let test = 100 +let list = [1..10] +let y = + if test > 10 then "test" + else + for (x:string) in list do + printfn "%s" x + + "test" + """ + FSharpErrorSeverity.Error + 1 + (7, 14, 7, 22) + "This expression was expected to have type\n 'int' \nbut here has type\n 'string' " + + [] + let ``Else branch context doesn't propagate to lines before last line``() = + CompilerAssert.TypeCheckSingleError + """ +let test = 100 +let list = [1..10] +let y = + if test > 10 then "test" + else + printfn "%s" 1 + + "test" + """ + FSharpErrorSeverity.Error + 1 + (7, 22, 7, 23) + "This expression was expected to have type\n 'string' \nbut here has type\n 'int' " + + [] + let ``Else branch should not have wrong context type``() = + CompilerAssert.TypeCheckWithErrors + """ +let x = 1 +let y : bool = + if x = 2 then "A" + else "B" + """ + [| FSharpErrorSeverity.Error, 1, (4, 19, 4, 22), "The 'if' expression needs to have type 'bool' to satisfy context type requirements. It currently has type 'string'." + FSharpErrorSeverity.Error, 1, (5, 10, 5, 13), "All branches of an 'if' expression must return values of the same type as the first branch, which here is 'bool'. This branch returns a value of type 'string'." |] + + + [] + let ``Else branch has wrong type in nested if``() = + CompilerAssert.TypeCheckWithErrors + """ +let x = 1 +if x = 1 then true +else + if x = 2 then "A" + else "B" + """ + [| FSharpErrorSeverity.Error, 1, (5, 19, 5, 22), "All branches of an 'if' expression must return values of the same type as the first branch, which here is 'bool'. This branch returns a value of type 'string'." + FSharpErrorSeverity.Error, 1, (6, 10, 6, 13), "All branches of an 'if' expression must return values of the same type as the first branch, which here is 'bool'. This branch returns a value of type 'string'." + FSharpErrorSeverity.Warning, 20, (3, 1, 6, 13), "The result of this expression has type 'bool' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'." |] diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 10e1f4733a..6335b5172c 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -1,4 +1,4 @@ - + @@ -32,6 +32,7 @@ + diff --git a/tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateInAppl.fs b/tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateInAppl.fs deleted file mode 100644 index 79152abb78..0000000000 --- a/tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateInAppl.fs +++ /dev/null @@ -1,11 +0,0 @@ -// #Warnings -//This expression was expected to have - -let test = 100 -let f x : string = x -let y = - if test > 10 then "test" - else - f 123 - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateInAppl2.fs b/tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateInAppl2.fs deleted file mode 100644 index 5478d8b09d..0000000000 --- a/tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateInAppl2.fs +++ /dev/null @@ -1,12 +0,0 @@ -// #Warnings -//This expression was expected to have - -let test = 100 -let f x = printfn "%s" x -let y = - if test > 10 then "test" - else - f 123 - "test" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateInForLoop.fs b/tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateInForLoop.fs deleted file mode 100644 index bfd5a18dd1..0000000000 --- a/tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateInForLoop.fs +++ /dev/null @@ -1,14 +0,0 @@ -// #Warnings -//This expression was expected to have - -let test = 100 -let list = [1..10] -let y = - if test > 10 then "test" - else - for (x:string) in list do - printfn "%s" x - - "test" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateToLinesBeforeLastLine.fs b/tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateToLinesBeforeLastLine.fs deleted file mode 100644 index 9facc603ff..0000000000 --- a/tests/fsharpqa/Source/Warnings/ElseBranchContextDoesntPropagateToLinesBeforeLastLine.fs +++ /dev/null @@ -1,13 +0,0 @@ -// #Warnings -//This expression was expected to have type - -let test = 100 -let list = [1..10] -let y = - if test > 10 then "test" - else - printfn "%s" 1 - - "test" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongContextType.fs b/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongContextType.fs deleted file mode 100644 index 895881ac7b..0000000000 --- a/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongContextType.fs +++ /dev/null @@ -1,9 +0,0 @@ -// #Warnings -//The 'if' expression needs to have type 'bool' - -let x = 1 -let y : bool = - if x = 2 then "A" - else "B" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType.fs b/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType.fs deleted file mode 100644 index b14b495304..0000000000 --- a/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType.fs +++ /dev/null @@ -1,9 +0,0 @@ -// #Warnings -//All branches of an 'if' expression must return values of the same type as the first branch, which here is 'string'. This branch returns a value of type 'int'. - -let test = 100 -let y = - if test > 10 then "test" - else 123 - -exit 0 diff --git a/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType2.fs b/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType2.fs deleted file mode 100644 index 06d83f76aa..0000000000 --- a/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType2.fs +++ /dev/null @@ -1,10 +0,0 @@ -// #Warnings -//All branches of an 'if' expression must return values of the same type as the first branch, which here is 'string'. This branch returns a value of type 'int'. - -let test = 100 -let f x = test -let y = - if test > 10 then "test" - else f 10 - -exit 0 diff --git a/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType3.fs b/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType3.fs deleted file mode 100644 index 1306c79475..0000000000 --- a/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType3.fs +++ /dev/null @@ -1,13 +0,0 @@ -// #Warnings -//All branches of an 'if' expression must return values of the same type as the first branch, which here is 'string'. This branch returns a value of type 'int'. - -let f x = x + 4 - -let y = - if true then - "" - else - "" |> ignore - (f 5) - -exit 0 diff --git a/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType4.fs b/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType4.fs deleted file mode 100644 index 8339a930d3..0000000000 --- a/tests/fsharpqa/Source/Warnings/ElseBranchHasWrongType4.fs +++ /dev/null @@ -1,15 +0,0 @@ -// #Warnings -//All branches of an 'if' expression must return values of the same type as the first branch, which here is 'string'. This branch returns a value of type 'int'. - -let f x = x + 4 - -let y = - if true then - "" - else - "" |> ignore - let z = f 4 - let a = 3 * z - (f a) - -exit 0 diff --git a/tests/fsharpqa/Source/Warnings/NestedElseBranchHasWrongType.fs b/tests/fsharpqa/Source/Warnings/NestedElseBranchHasWrongType.fs deleted file mode 100644 index a8e63cee65..0000000000 --- a/tests/fsharpqa/Source/Warnings/NestedElseBranchHasWrongType.fs +++ /dev/null @@ -1,10 +0,0 @@ -// #Warnings -//All branches of an 'if' expression must return values of the same type as the first branch, which here is 'bool'. This branch returns a value of type 'string'. - -let x = 1 -if x = 1 then true -else - if x = 2 then "A" - else "B" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 383c291e90..127d78a21c 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -45,16 +45,6 @@ SOURCE=SuggestDoubleBacktickIdentifiers.fs SCFLAGS="--vserrors" # SuggestDoubleBacktickIdentifiers.fs SOURCE=SuggestDoubleBacktickUnions.fs SCFLAGS="--vserrors" # SuggestDoubleBacktickUnions.fs SOURCE=GuardHasWrongType.fs # GuardHasWrongType.fs - SOURCE=ElseBranchHasWrongType.fs # ElseBranchHasWrongType.fs - SOURCE=ElseBranchHasWrongType2.fs # ElseBranchHasWrongType2.fs - SOURCE=ElseBranchHasWrongType3.fs # ElseBranchHasWrongType3.fs - SOURCE=ElseBranchHasWrongType4.fs # ElseBranchHasWrongType4.fs - SOURCE=NestedElseBranchHasWrongType.fs # NestedElseBranchHasWrongType.fs - SOURCE=ElseBranchHasWrongContextType.fs # ElseBranchHasWrongContextType.fs - SOURCE=ElseBranchContextDoesntPropagateInAppl.fs # ElseBranchContextDoesntPropagateInAppl.fs - SOURCE=ElseBranchContextDoesntPropagateInAppl2.fs # ElseBranchContextDoesntPropagateInAppl2.fs - SOURCE=ElseBranchContextDoesntPropagateInForLoop.fs # ElseBranchContextDoesntPropagateInForLoop.fs - SOURCE=ElseBranchContextDoesntPropagateToLinesBeforeLastLine.fs # ElseBranchContextDoesntPropagateToLinesBeforeLastLine.fs SOURCE=MatchingMethodWithSameNameIsNotAbstract.fs # MatchingMethodWithSameNameIsNotAbstract.fs SOURCE=NoMatchingAbstractMethodWithSameName.fs # NoMatchingAbstractMethodWithSameName.fs SOURCE=MissingExpressionAfterLet.fs # MissingExpressionAfterLet.fs From 869c2bb395f18d5970f8f1bd4827d8449285bddf Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Fri, 12 Jul 2019 20:26:14 +0200 Subject: [PATCH 165/286] Port tests for missing else branch to NUnit (#7209) --- .../ErrorMessages/MissingElseBranch.fs | 50 +++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 3 +- .../Warnings/WarnIfMissingElseBranch.fs | 8 --- .../Warnings/WarnIfMissingElseBranch2.fs | 10 ---- .../Warnings/WarnIfMissingElseBranch3.fs | 8 --- tests/fsharpqa/Source/Warnings/env.lst | 3 -- 6 files changed, 52 insertions(+), 30 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/MissingElseBranch.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch2.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch3.fs diff --git a/tests/fsharp/Compiler/ErrorMessages/MissingElseBranch.fs b/tests/fsharp/Compiler/ErrorMessages/MissingElseBranch.fs new file mode 100644 index 0000000000..06f9cb160d --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/MissingElseBranch.fs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Else branch is missing`` = + + [] + let ``Fail if else branch is missing``() = + CompilerAssert.TypeCheckSingleError + """ +let x = 10 +let y = + if x > 10 then "test" + """ + FSharpErrorSeverity.Error + 1 + (4, 19, 4, 25) + "This 'if' expression is missing an 'else' branch. Because 'if' is an expression, and not a statement, add an 'else' branch which also returns a value of type 'string'." + + [] + let ``Fail on type error in condition``() = + CompilerAssert.TypeCheckSingleError + """ +let x = 10 +let y = + if x > 10 then + if x <> "test" then printfn "test" + () + """ + FSharpErrorSeverity.Error + 1 + (5, 14, 5, 20) + "This expression was expected to have type\n 'int' \nbut here has type\n 'string' " + + [] + let ``Fail if else branch is missing in nesting``() = + CompilerAssert.TypeCheckSingleError + """ +let x = 10 +let y = + if x > 10 then ("test") + """ + FSharpErrorSeverity.Error + 1 + (4, 20, 4, 26) + "This 'if' expression is missing an 'else' branch. Because 'if' is an expression, and not a statement, add an 'else' branch which also returns a value of type 'string'." diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 6335b5172c..8f450a1b3a 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -1,4 +1,4 @@ - + @@ -33,6 +33,7 @@ + diff --git a/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch.fs b/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch.fs deleted file mode 100644 index 9e6e9d7efe..0000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -//This 'if' expression is missing an 'else' branch. Because 'if' is an expression, and not a statement, add an 'else' branch which also returns a value of type 'string'. - -let x = 10 -let y = - if x > 10 then "test" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch2.fs b/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch2.fs deleted file mode 100644 index a8b98922a0..0000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch2.fs +++ /dev/null @@ -1,10 +0,0 @@ -// #Warnings -//This expression was expected to have type - -let x = 10 -let y = - if x > 10 then - if x <> "test" then printfn "test" - () - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch3.fs b/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch3.fs deleted file mode 100644 index cbf7d5acf1..0000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfMissingElseBranch3.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -//This 'if' expression is missing an 'else' branch. Because 'if' is an expression, and not a statement, add an 'else' branch which also returns a value of type 'string'. - -let x = 10 -let y = - if x > 10 then ("test") - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 127d78a21c..f711b79a37 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -1,7 +1,4 @@ SOURCE=WrongNumericLiteral.fs # WrongNumericLiteral.fs - SOURCE=WarnIfMissingElseBranch.fs # WarnIfMissingElseBranch.fs - SOURCE=WarnIfMissingElseBranch2.fs # WarnIfMissingElseBranch2.fs - SOURCE=WarnIfMissingElseBranch3.fs # WarnIfMissingElseBranch3.fs SOURCE=ReturnInsteadOfReturnBang.fs # ReturnInsteadOfReturnBang.fs SOURCE=YieldInsteadOfYieldBang.fs # YieldInsteadOfYieldBang.fs SOURCE=TupleInAbstractMethod.fs # TupleInAbstractMethod.fs From 59bfc836efc4cd2ba8df60871b0ae4c4dad06963 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2019 12:49:41 -0700 Subject: [PATCH 166/286] Update dependencies from https://github.com/dotnet/arcade build 20190711.7 (#7216) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19361.7 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bfb72eca15..e2195f4bc5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - a6ae1b637ed236354529992729af875f6c8a180a + f1b09644408f45f43f5835786b3e4bdfd2e78141 diff --git a/global.json b/global.json index 60dbe5efe9..ca0cec66a7 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19360.8", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19361.7", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 8ab272af8e62b6aaa527de6db8bedb22399fcb52 Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Sat, 13 Jul 2019 12:47:20 +0000 Subject: [PATCH 167/286] Update dependencies from https://github.com/dotnet/arcade build 20190712.5 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19362.5 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e2195f4bc5..55da8d6499 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - f1b09644408f45f43f5835786b3e4bdfd2e78141 + 15f50ca6a9d0b441c9927421657fb9dc91206cc9 diff --git a/global.json b/global.json index ca0cec66a7..a6d76946ba 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19361.7", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19362.5", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 7780cab8dcaaa042c31b0588deed3d408af0d210 Mon Sep 17 00:00:00 2001 From: Solomon Rutzky Date: Sat, 13 Jul 2019 14:59:46 -0400 Subject: [PATCH 168/286] Fix Supplementary Character / Surrogate Pair info (no code changes) (#7221) Terminology and info regarding Supplementary Characters / Surrogate Pairs is either incorrect, or at least incomplete (which then leads to incorrect statements and/or code). 1. Introduce the term "Supplementary Character" since that is often what we are dealing with, not "surrogate pairs" since that is an encoding-specific concept (UTF-16 only). 2. Add comment re: Supplementary Character code point range, which helps to explain the `elif high > 0x10 then Invalid` condition (line 173). 3. Fix URI for Unicode Standard PDF, Chapter 3, and specify the name of the section (i.e. "Surrogates") instead of the section number (i.e. 3.8) since the section number was 3.7 but is now 3.8 (line 174). 4. Add comment for definition of a valid "surrogate pair" because why make the reader guess or have to go look it up when it will never change? (line 175) 5. Correct and expand comment with example long Unicode escape sequence (line 64): `"\UDEADBEEF"` is _not_ a valid escape sequence. Usage of the `\U` escape has been misstated from the very beginning, both in this documentation as well as the C# Specification documentation, and the language references for "String" for both F# and C#: 1. `\U` is used to specify a Unicode code point (or UTF-32 code unit, which maps 1:1 with all Unicode code points, hence they are synonymous), not surrogate pairs. Hence the valid range is `00000000` - `0010FFFF`, hence the first two digits are static `0`s, and the third digit can only ever be a `0` or `1`. This escape sequence can specify either a BMP character or a Supplementary character. Supplementary characters are then encoded as a surrogate pair in UTF-16 only, not in UTF-8 or UTF-32. If you want to specify an actual surrogate pair, then use the `\u` escape, e.g. `\uD83D\uDC7D` == `\U0001F47D`. 2. Even if you could specify a surrogate pair using `\U`, "DEADBEEF" is not valid. U+DEAD is a valid surrogate, _but_ it's a low surrogate code point and cannot be specified first in the pair (meaning, at best one could use `\UxxxxDEAD`). Also, U+BEEF is _not_ a valid surrogate code point, high or low. Surrogate code points are in the range of U+D800 to U+DFFF. For more info, please see: https://sqlquantumleap.com/2019/06/26/unicode-escape-sequences-across-various-languages-and-platforms-including-supplementary-characters/#fsharp --- src/fsharp/lexhelp.fs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/fsharp/lexhelp.fs b/src/fsharp/lexhelp.fs index e966678486..fb66ac5f85 100644 --- a/src/fsharp/lexhelp.fs +++ b/src/fsharp/lexhelp.fs @@ -60,7 +60,8 @@ type lexargs = applyLineDirectives: bool pathMap: PathMap } -/// possible results of lexing a long unicode escape sequence in a string literal, e.g. "\UDEADBEEF" +/// possible results of lexing a long Unicode escape sequence in a string literal, e.g. "\U0001F47D", +/// "\U000000E7", or "\UDEADBEEF" returning SurrogatePair, SingleChar, or Invalid, respectively type LongUnicodeLexResult = | SurrogatePair of uint16 * uint16 | SingleChar of uint16 @@ -169,7 +170,9 @@ let unicodeGraphLong (s:string) = if high = 0 then SingleChar(uint16 low) // invalid encoding elif high > 0x10 then Invalid - // valid surrogate pair - see http://www.unicode.org/unicode/uni2book/ch03.pdf, section 3.7 *) + // valid supplementary character: code points U+10000 to U+10FFFF + // valid surrogate pair: see http://www.unicode.org/versions/latest/ch03.pdf , "Surrogates" section + // high-surrogate code point (U+D800 to U+DBFF) followed by low-surrogate code point (U+DC00 to U+DFFF) else let codepoint = high * 0x10000 + low let hiSurr = uint16 (0xD800 + ((codepoint - 0x10000) / 0x400)) From f9a8e2a200d863d0bbb81f55bce214097f4cf8d0 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Sat, 13 Jul 2019 18:47:41 -0700 Subject: [PATCH 169/286] Update IlxGen.fs (#7227) --- src/fsharp/IlxGen.fs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fsharp/IlxGen.fs b/src/fsharp/IlxGen.fs index 74d633b9f9..b77d06e508 100644 --- a/src/fsharp/IlxGen.fs +++ b/src/fsharp/IlxGen.fs @@ -2533,7 +2533,8 @@ and GenAllocUnionCase cenv cgbuf eenv (c,tyargs,args,m) sequel = GenSequel cenv eenv.cloc cgbuf sequel and GenLinearExpr cenv cgbuf eenv sp expr sequel canProcessSequencePoint (contf: FakeUnit -> FakeUnit) = - match stripExpr expr with + let expr = stripExpr expr + match expr with | LinearOpExpr (TOp.UnionCase c, tyargs, argsFront, argLast, m) -> GenExprs cenv cgbuf eenv argsFront GenLinearExpr cenv cgbuf eenv SPSuppress argLast Continue (* canProcessSequencePoint *) true (contf << (fun Fake -> From ec8a4249b74b678b7104b4188d09aae28ff48c02 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Sun, 14 Jul 2019 03:52:03 +0200 Subject: [PATCH 170/286] Check for exit code in compiler tests (#7211) --- tests/fsharp/Compiler/CompilerAssert.fs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index 9c74845549..d5f93d7810 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -168,6 +168,9 @@ module CompilerAssert = let errors = p.StandardError.ReadToEnd () if not (String.IsNullOrWhiteSpace errors) then Assert.Fail errors + + if p.ExitCode <> 0 then + Assert.Fail(sprintf "Program exited with exit code %d" p.ExitCode) ) let CompileLibraryAndVerifyIL (source: string) (f: ILVerifier -> unit) = From c4dba1f7b4f6c72f9d19b248b40431a563e948b2 Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Sun, 14 Jul 2019 11:27:24 +0300 Subject: [PATCH 171/286] Moving AccessOfTypeAbbreviationTests over to NUnit (#7226) * Moving AccessOfTypeAbbreviationTests over to NUnit * ha! now I know what this `1` means =) * Error range updated and removed `exit 0` * Error message prefixed by "This construct is deprecated." * Error messages changed based on current state of FSI --- .../AccessOfTypeAbbreviationTests.fs | 75 +++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + .../Warnings/AccessOfTypeAbbreviation.fs | 8 -- .../Warnings/AccessOfTypeAbbreviation2.fs | 8 -- .../Warnings/AccessOfTypeAbbreviation3.fs | 8 -- .../Warnings/AccessOfTypeAbbreviation4.fs | 8 -- .../Warnings/AccessOfTypeAbbreviation5.fs | 8 -- .../Warnings/AccessOfTypeAbbreviation6.fs | 8 -- tests/fsharpqa/Source/Warnings/env.lst | 6 -- 9 files changed, 76 insertions(+), 54 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs delete mode 100644 tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation.fs delete mode 100644 tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation2.fs delete mode 100644 tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation3.fs delete mode 100644 tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation4.fs delete mode 100644 tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation5.fs delete mode 100644 tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation6.fs diff --git a/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs new file mode 100644 index 0000000000..0143486a34 --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/AccessOfTypeAbbreviationTests.fs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Access Of Type Abbreviation`` = + + [] + let ``Test1``() = + CompilerAssert.TypeCheckSingleError + """ +module Library = + type private Hidden = Hidden of unit + type Exported = Hidden + """ + FSharpErrorSeverity.Warning + 44 + (4, 8, 4, 16) + "This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in.\r\nAs of F# 4.1, the accessibility of type abbreviations is checked at compile-time. Consider changing the accessibility of the type abbreviation. Ignoring this warning might lead to runtime errors." + + [] + let ``Test2``() = + CompilerAssert.Pass + """ +module Library = + type internal Hidden = Hidden of unit + type internal Exported = Hidden + """ + + [] + let ``Test3``() = + CompilerAssert.TypeCheckSingleError + """ +module Library = + type internal Hidden = Hidden of unit + type Exported = Hidden + """ + FSharpErrorSeverity.Warning + 44 + (4, 8, 4, 16) + "This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in.\r\nAs of F# 4.1, the accessibility of type abbreviations is checked at compile-time. Consider changing the accessibility of the type abbreviation. Ignoring this warning might lead to runtime errors." + + [] + let ``Test4``() = + CompilerAssert.TypeCheckSingleError + """ +module Library = + type private Hidden = Hidden of unit + type internal Exported = Hidden + """ + FSharpErrorSeverity.Warning + 44 + (4, 17, 4, 25) + "This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in.\r\nAs of F# 4.1, the accessibility of type abbreviations is checked at compile-time. Consider changing the accessibility of the type abbreviation. Ignoring this warning might lead to runtime errors." + + [] + let ``Test5``() = + CompilerAssert.Pass + """ +module Library = + type private Hidden = Hidden of unit + type private Exported = Hidden + """ + + [] + let ``Test6``() = + CompilerAssert.Pass + """ +module Library = + type Hidden = Hidden of unit + type Exported = Hidden + """ \ No newline at end of file diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 8f450a1b3a..5976803c10 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -32,6 +32,7 @@ + diff --git a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation.fs b/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation.fs deleted file mode 100644 index b72fdb7baa..0000000000 --- a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -//The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in - -module Library = - type private Hidden = Hidden of unit - type Exported = Hidden - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation2.fs b/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation2.fs deleted file mode 100644 index 898e941523..0000000000 --- a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation2.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -// - -module Library = - type internal Hidden = Hidden of unit - type internal Exported = Hidden - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation3.fs b/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation3.fs deleted file mode 100644 index de1875bf57..0000000000 --- a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation3.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -//The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in - -module Library = - type internal Hidden = Hidden of unit - type Exported = Hidden - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation4.fs b/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation4.fs deleted file mode 100644 index 728dc399bf..0000000000 --- a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation4.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -//The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in - -module Library = - type private Hidden = Hidden of unit - type internal Exported = Hidden - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation5.fs b/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation5.fs deleted file mode 100644 index d0d3b25100..0000000000 --- a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation5.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -// - -module Library = - type private Hidden = Hidden of unit - type private Exported = Hidden - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation6.fs b/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation6.fs deleted file mode 100644 index d179e5f20e..0000000000 --- a/tests/fsharpqa/Source/Warnings/AccessOfTypeAbbreviation6.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -// - -module Library = - type Hidden = Hidden of unit - type Exported = Hidden - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index f711b79a37..14b61a4649 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -13,12 +13,6 @@ SOURCE=WrongArity.fs # WrongArity.fs SOURCE=OverrideErrors.fs # OverrideErrors.fs SOURCE=MethodIsNotStatic.fs # MethodIsNotStatic.fs - SOURCE=AccessOfTypeAbbreviation.fs # AccessOfTypeAbbreviation.fs - SOURCE=AccessOfTypeAbbreviation2.fs # AccessOfTypeAbbreviation2.fs - SOURCE=AccessOfTypeAbbreviation3.fs # AccessOfTypeAbbreviation3.fs - SOURCE=AccessOfTypeAbbreviation4.fs # AccessOfTypeAbbreviation4.fs - SOURCE=AccessOfTypeAbbreviation5.fs # AccessOfTypeAbbreviation5.fs - SOURCE=AccessOfTypeAbbreviation6.fs # AccessOfTypeAbbreviation6.fs SOURCE=EqualsInsteadOfInInForLoop.fs # EqualsInsteadOfInInForLoop.fs SOURCE=DontWarnExternalFunctionAsUnused.fs SCFLAGS="--warnon:1182 --warnaserror+" # DontWarnExternalFunctionAsUnused.fs SOURCE=SuggestTypesInModule.fs # SuggestTypesInModule.fs From 75cef56a5bbba57b146c991db74791bddd41e211 Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Mon, 15 Jul 2019 21:11:55 +0300 Subject: [PATCH 172/286] Moving ConstructorTests over to NUnit (#7236) --- .../ErrorMessages/ConstructorTests.fs | 115 ++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + .../Source/Warnings/CommaInRecCtor.fs | 12 -- .../Source/Warnings/ExtraArgumentInCtor.fs | 10 -- .../Source/Warnings/ExtraArgumentInCtor2.fs | 11 -- .../fsharpqa/Source/Warnings/InvalidRecord.fs | 9 -- .../Source/Warnings/MissingCommaInCtor.fs | 11 -- .../Source/Warnings/MissingCtorValue.fs | 11 -- .../Source/Warnings/ValidCommaInRecCtor.fs | 9 -- tests/fsharpqa/Source/Warnings/env.lst | 7 -- 10 files changed, 116 insertions(+), 80 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/ConstructorTests.fs delete mode 100644 tests/fsharpqa/Source/Warnings/CommaInRecCtor.fs delete mode 100644 tests/fsharpqa/Source/Warnings/ExtraArgumentInCtor.fs delete mode 100644 tests/fsharpqa/Source/Warnings/ExtraArgumentInCtor2.fs delete mode 100644 tests/fsharpqa/Source/Warnings/InvalidRecord.fs delete mode 100644 tests/fsharpqa/Source/Warnings/MissingCommaInCtor.fs delete mode 100644 tests/fsharpqa/Source/Warnings/MissingCtorValue.fs delete mode 100644 tests/fsharpqa/Source/Warnings/ValidCommaInRecCtor.fs diff --git a/tests/fsharp/Compiler/ErrorMessages/ConstructorTests.fs b/tests/fsharp/Compiler/ErrorMessages/ConstructorTests.fs new file mode 100644 index 0000000000..97aa66e60a --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/ConstructorTests.fs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Constructor`` = + + [] + let ``Invalid Record``() = + CompilerAssert.TypeCheckWithErrors + """ +type Record = {field1:int; field2:int} +let doSomething (xs) = List.map (fun {field1=x} -> x) xs + +doSomething {Record.field1=0; field2=0} + """ + [| + FSharpErrorSeverity.Error, 1, (5, 13, 5, 40), "This expression was expected to have type\n 'Record list' \nbut here has type\n 'Record' " + FSharpErrorSeverity.Warning, 20, (5, 1, 5, 40), "The result of this expression has type 'int list' 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 ``Comma In Rec Ctor``() = + CompilerAssert.TypeCheckWithErrors + """ +type Person = { Name : string; Age : int; City : string } +let x = { Name = "Isaac", Age = 21, City = "London" } + """ + [| + FSharpErrorSeverity.Error, 1, (3, 18, 3, 52), "This expression was expected to have type\n 'string' \nbut here has type\n ''a * 'b * 'c' \r\nA ';' is used to separate field values in records. Consider replacing ',' with ';'." + FSharpErrorSeverity.Error, 764, (3, 9, 3, 54), "No assignment given for field 'Age' of type 'Test.Person'" + |] + + [] + let ``Missing Comma In Ctor``() = + CompilerAssert.TypeCheckWithErrors + """ +type Person() = + member val Name = "" with get,set + member val Age = 0 with get,set + +let p = + Person(Name = "Fred" + Age = 18) + """ + [| + FSharpErrorSeverity.Error, 39, (7, 12, 7, 16), "The value or constructor 'Name' is not defined." + FSharpErrorSeverity.Warning, 20, (7, 12, 7, 25), "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'." + FSharpErrorSeverity.Error, 39, (8, 12, 8, 15), "The value or constructor 'Age' is not defined." + FSharpErrorSeverity.Error, 501, (7, 5, 8, 21), "The object constructor 'Person' takes 0 argument(s) but is here given 1. The required signature is 'new : unit -> Person'. If some of the arguments are meant to assign values to properties, consider separating those arguments with a comma (',')." + |] + + [] + let ``Missing Ctor Value``() = + CompilerAssert.TypeCheckSingleError + """ +type Person(x:int) = + member val Name = "" with get,set + member val Age = x with get,set + +let p = + Person(Name = "Fred", + Age = 18) + """ + FSharpErrorSeverity.Error + 496 + (7, 5, 8, 21) + "The member or object constructor 'Person' requires 1 argument(s). The required signature is 'new : x:int -> Person'." + + [] + let ``Extra Argument In Ctor``() = + CompilerAssert.TypeCheckSingleError + """ +type Person() = + member val Name = "" with get,set + member val Age = 0 with get,set + +let p = + Person(1) + """ + FSharpErrorSeverity.Error + 501 + (7, 5, 7, 14) + "The object constructor 'Person' takes 0 argument(s) but is here given 1. The required signature is 'new : unit -> Person'." + + [] + let ``Extra Argument In Ctor2``() = + CompilerAssert.TypeCheckSingleError + """ +type Person() = + member val Name = "" with get,set + member val Age = 0 with get,set + +let b = 1 + +let p = + Person(1=b) + """ + FSharpErrorSeverity.Error + 501 + (9, 5, 9, 16) + "The object constructor 'Person' takes 0 argument(s) but is here given 1. The required signature is 'new : unit -> Person'." + + [] + let ``Valid Comma In Rec Ctor``() = + CompilerAssert.Pass + """ +type Person = { Name : string * bool * bool } +let Age = 22 +let City = "London" +let x = { Name = "Isaac", Age = 21, City = "London" } + """ diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 5976803c10..55fad20ad2 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -32,6 +32,7 @@ + diff --git a/tests/fsharpqa/Source/Warnings/CommaInRecCtor.fs b/tests/fsharpqa/Source/Warnings/CommaInRecCtor.fs deleted file mode 100644 index b14d6c6dc9..0000000000 --- a/tests/fsharpqa/Source/Warnings/CommaInRecCtor.fs +++ /dev/null @@ -1,12 +0,0 @@ -// #Warnings -//This expression was expected to have type -// 'string' -//but here has type -// ''a \* 'b \* 'c' -//A ';' is used to separate field values in records. Consider replacing ',' with ';'. - - -type Person = { Name : string; Age : int; City : string } -let x = { Name = "Isaac", Age = 21, City = "London" } - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/ExtraArgumentInCtor.fs b/tests/fsharpqa/Source/Warnings/ExtraArgumentInCtor.fs deleted file mode 100644 index 794245b450..0000000000 --- a/tests/fsharpqa/Source/Warnings/ExtraArgumentInCtor.fs +++ /dev/null @@ -1,10 +0,0 @@ -// #Warnings -//The object constructor 'Person' takes 0 argument\(s\) but is here given 1. The required signature is 'new : unit -> Person'.$ - -type Person() = - member val Name = "" with get,set - member val Age = 0 with get,set - - -let p = - Person(1) \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/ExtraArgumentInCtor2.fs b/tests/fsharpqa/Source/Warnings/ExtraArgumentInCtor2.fs deleted file mode 100644 index c73f250c55..0000000000 --- a/tests/fsharpqa/Source/Warnings/ExtraArgumentInCtor2.fs +++ /dev/null @@ -1,11 +0,0 @@ -// #Warnings -//The object constructor 'Person' takes 0 argument\(s\) but is here given 1. The required signature is 'new : unit -> Person'.$ - -type Person() = - member val Name = "" with get,set - member val Age = 0 with get,set - -let b = 1 - -let p = - Person(1=b) \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/InvalidRecord.fs b/tests/fsharpqa/Source/Warnings/InvalidRecord.fs deleted file mode 100644 index f04f24e457..0000000000 --- a/tests/fsharpqa/Source/Warnings/InvalidRecord.fs +++ /dev/null @@ -1,9 +0,0 @@ -// #Warnings -//This expression was expected to have type - -type Record = {field1:int; field2:int} -let doSomething (xs) = List.map (fun {field1=x} -> x) xs - -doSomething {Record.field1=0; field2=0} - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/MissingCommaInCtor.fs b/tests/fsharpqa/Source/Warnings/MissingCommaInCtor.fs deleted file mode 100644 index 6c407bc6c4..0000000000 --- a/tests/fsharpqa/Source/Warnings/MissingCommaInCtor.fs +++ /dev/null @@ -1,11 +0,0 @@ -// #Warnings -//The object constructor 'Person' takes 0 argument\(s\) but is here given 1. The required signature is 'new : unit -> Person'. If some of the arguments are meant to assign values to properties, consider separating those arguments with a comma \(','\). - -type Person() = - member val Name = "" with get,set - member val Age = 0 with get,set - - -let p = - Person(Name = "Fred" - Age = 18) \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/MissingCtorValue.fs b/tests/fsharpqa/Source/Warnings/MissingCtorValue.fs deleted file mode 100644 index c90377be50..0000000000 --- a/tests/fsharpqa/Source/Warnings/MissingCtorValue.fs +++ /dev/null @@ -1,11 +0,0 @@ -// #Warnings -//The member or object constructor 'Person' requires 1 argument\(s\). The required signature is 'new : x:int -> Person'. - -type Person(x:int) = - member val Name = "" with get,set - member val Age = x with get,set - - -let p = - Person(Name = "Fred", - Age = 18) \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/ValidCommaInRecCtor.fs b/tests/fsharpqa/Source/Warnings/ValidCommaInRecCtor.fs deleted file mode 100644 index 6cbee50f02..0000000000 --- a/tests/fsharpqa/Source/Warnings/ValidCommaInRecCtor.fs +++ /dev/null @@ -1,9 +0,0 @@ -// #Warnings -// - -type Person = { Name : string * bool * bool } -let Age = 22 -let City = "London" -let x = { Name = "Isaac", Age = 21, City = "London" } - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 14b61a4649..350dc92a0d 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -2,13 +2,6 @@ SOURCE=ReturnInsteadOfReturnBang.fs # ReturnInsteadOfReturnBang.fs SOURCE=YieldInsteadOfYieldBang.fs # YieldInsteadOfYieldBang.fs SOURCE=TupleInAbstractMethod.fs # TupleInAbstractMethod.fs - SOURCE=InvalidRecord.fs # InvalidRecord.fs - SOURCE=CommaInRecCtor.fs # CommaInRecCtor.fs - SOURCE=MissingCommaInCtor.fs # MissingCommaInCtor.fs - SOURCE=MissingCtorValue.fs # MissingCtorValue.fs - SOURCE=ExtraArgumentInCtor.fs # ExtraArgumentInCtor.fs - SOURCE=ExtraArgumentInCtor2.fs # ExtraArgumentInCtor2.fs - SOURCE=ValidCommaInRecCtor.fs # ValidCommaInRecCtor.fs SOURCE=FS0988AtEndOfFile.fs # FS0988AtEndOfFile.fs SOURCE=WrongArity.fs # WrongArity.fs SOURCE=OverrideErrors.fs # OverrideErrors.fs From c7cd220ada1fd4bfe784f5a3aa7ad8178512d5c2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 15 Jul 2019 11:12:26 -0700 Subject: [PATCH 173/286] [master] Update dependencies from dotnet/arcade (#7233) * Update dependencies from https://github.com/dotnet/arcade build 20190713.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19363.1 * Update dependencies from https://github.com/dotnet/arcade build 20190714.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19364.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 55da8d6499..119dfcd3a4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 15f50ca6a9d0b441c9927421657fb9dc91206cc9 + 0c81c2bbdc49749e9940bc8858ebd16026d51277 diff --git a/global.json b/global.json index a6d76946ba..81be3571ad 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19362.5", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19364.1", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 0f24b3ef42cae5d48cdafc0b80dee92de1db10b6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2019 10:23:25 -0700 Subject: [PATCH 174/286] Update dependencies from https://github.com/dotnet/arcade build 20190715.4 (#7240) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19365.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 119dfcd3a4..19eab0f3c7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 0c81c2bbdc49749e9940bc8858ebd16026d51277 + fb27fd4d8a2b67d4333e33d4b898c65171c9f3c1 diff --git a/global.json b/global.json index 81be3571ad..616ab02e47 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19364.1", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19365.4", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 863ec255f4345eb0622673414cdf3052494c5ab4 Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Tue, 16 Jul 2019 20:31:30 +0300 Subject: [PATCH 175/286] Moving UpcastDowncastTests over to NUnit (#7229) * Moving UpcastDowncastTests over to NUnit * missing new line --- .../ErrorMessages/UpcastDowncastTests.fs | 51 +++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + .../Warnings/DowncastInsteadOfUpcast.fs | 9 ---- .../UpcastFunctionInsteadOfDowncast.fs | 9 ---- .../Warnings/UpcastInsteadOfDowncast.fs | 9 ---- tests/fsharpqa/Source/Warnings/env.lst | 3 -- 6 files changed, 52 insertions(+), 30 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/UpcastDowncastTests.fs delete mode 100644 tests/fsharpqa/Source/Warnings/DowncastInsteadOfUpcast.fs delete mode 100644 tests/fsharpqa/Source/Warnings/UpcastFunctionInsteadOfDowncast.fs delete mode 100644 tests/fsharpqa/Source/Warnings/UpcastInsteadOfDowncast.fs diff --git a/tests/fsharp/Compiler/ErrorMessages/UpcastDowncastTests.fs b/tests/fsharp/Compiler/ErrorMessages/UpcastDowncastTests.fs new file mode 100644 index 0000000000..739f841bfc --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/UpcastDowncastTests.fs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Upcast and Downcast`` = + + [] + let ``Downcast Instead Of Upcast``() = + CompilerAssert.TypeCheckSingleError + """ +open System.Collections.Generic + +let orig = Dictionary() :> IDictionary +let c = orig :> Dictionary + """ + FSharpErrorSeverity.Error + 193 + (5, 9, 5, 36) + "Type constraint mismatch. The type \n 'IDictionary' \nis not compatible with type\n 'Dictionary' \n" + + [] + let ``Upcast Instead Of Downcast``() = + CompilerAssert.TypeCheckWithErrors + """ +open System.Collections.Generic + +let orig = Dictionary() +let c = orig :?> IDictionary + """ + [| + FSharpErrorSeverity.Warning, 67, (5, 9, 5, 38), "This type test or downcast will always hold" + FSharpErrorSeverity.Error, 3198, (5, 9, 5, 38), "The conversion from Dictionary to IDictionary is a compile-time safe upcast, not a downcast. Consider using the :> (upcast) operator instead of the :?> (downcast) operator." + |] + + [] + let ``Upcast Function Instead Of Downcast``() = + CompilerAssert.TypeCheckWithErrors + """ +open System.Collections.Generic + +let orig = Dictionary() +let c : IDictionary = downcast orig + """ + [| + FSharpErrorSeverity.Warning, 67, (5, 32, 5, 45), "This type test or downcast will always hold" + FSharpErrorSeverity.Error, 3198, (5, 32, 5, 45), "The conversion from Dictionary to IDictionary is a compile-time safe upcast, not a downcast. Consider using 'upcast' instead of 'downcast'." + |] diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 55fad20ad2..ec2a852b13 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -36,6 +36,7 @@ + diff --git a/tests/fsharpqa/Source/Warnings/DowncastInsteadOfUpcast.fs b/tests/fsharpqa/Source/Warnings/DowncastInsteadOfUpcast.fs deleted file mode 100644 index a815425e29..0000000000 --- a/tests/fsharpqa/Source/Warnings/DowncastInsteadOfUpcast.fs +++ /dev/null @@ -1,9 +0,0 @@ -// #Warnings -//Type constraint mismatch. The type - -open System.Collections.Generic - -let orig = Dictionary() :> IDictionary -let c = orig :> Dictionary - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/UpcastFunctionInsteadOfDowncast.fs b/tests/fsharpqa/Source/Warnings/UpcastFunctionInsteadOfDowncast.fs deleted file mode 100644 index 6bc8c54c12..0000000000 --- a/tests/fsharpqa/Source/Warnings/UpcastFunctionInsteadOfDowncast.fs +++ /dev/null @@ -1,9 +0,0 @@ -// #Warnings -//The conversion from Dictionary to IDictionary is a compile-time safe upcast, not a downcast. Consider using 'upcast' instead of 'downcast'. - -open System.Collections.Generic - -let orig = Dictionary() -let c : IDictionary = downcast orig - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/UpcastInsteadOfDowncast.fs b/tests/fsharpqa/Source/Warnings/UpcastInsteadOfDowncast.fs deleted file mode 100644 index 00962a1521..0000000000 --- a/tests/fsharpqa/Source/Warnings/UpcastInsteadOfDowncast.fs +++ /dev/null @@ -1,9 +0,0 @@ -// #Warnings -//The conversion from Dictionary to IDictionary is a compile-time safe upcast, not a downcast. - -open System.Collections.Generic - -let orig = Dictionary() -let c = orig :?> IDictionary - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 350dc92a0d..3a31070e07 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -38,9 +38,6 @@ SOURCE=SuggestToUseIndexer.fs # SuggestToUseIndexer.fs SOURCE=RefCellInsteadOfNot.fs # RefCellInsteadOfNot.fs SOURCE=RefCellInsteadOfNot2.fs # RefCellInsteadOfNot2.fs - SOURCE=UpcastInsteadOfDowncast.fs # UpcastInsteadOfDowncast.fs - SOURCE=UpcastFunctionInsteadOfDowncast.fs # UpcastFunctionInsteadOfDowncast.fs - SOURCE=DowncastInsteadOfUpcast.fs # DowncastInsteadOfUpcast.fs SOURCE=RuntimeTypeTestInPattern.fs # RuntimeTypeTestInPattern.fs SOURCE=RuntimeTypeTestInPattern2.fs # RuntimeTypeTestInPattern2.fs SOURCE=WarnIfExpressionResultUnused.fs # WarnIfExpressionResultUnused.fs From c8bac72813d88e048979dd7160d7edf82700d67a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2019 10:24:11 -0700 Subject: [PATCH 176/286] Update dependencies from https://github.com/dotnet/arcade build 20190716.4 (#7245) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19366.4 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 19eab0f3c7..86d49308d4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - fb27fd4d8a2b67d4333e33d4b898c65171c9f3c1 + 0dd5e2025f0049c133a8706f40e4463b193e5d17 diff --git a/global.json b/global.json index 616ab02e47..7d6048be9f 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19365.4", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19366.4", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 69805873b502337e8e3d2b1346796cc8ce8b7981 Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Wed, 17 Jul 2019 19:44:10 +0200 Subject: [PATCH 177/286] Move ErrorMessages/NameResolution Tests to NUnit (#7237) * Mark name resoltion error message tests for port to NUnit * Add Nunit tests for FieldNotInRecord, RecordFieldProposal, and GlobalQualifierAfterDot * Fix expected error message in FieldNotInRecord Compiler test * Change global Qualifier after dot test back to original fsharpqa version. Needs seperate assert function for parsing errors instead of typechecking * Remove unnecessary double ticks from NameResolution tests --- .../ErrorMessages/NameResolutionTests.fs | 45 +++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + .../NameResolution/E_FieldNotInRecord.fs | 13 ------ .../E_GlobalQualifierAfterDot.fs | 2 +- .../NameResolution/E_RecordFieldProposal.fs | 13 ------ .../ErrorMessages/NameResolution/env.lst | 4 +- 6 files changed, 48 insertions(+), 30 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/NameResolutionTests.fs delete mode 100644 tests/fsharpqa/Source/ErrorMessages/NameResolution/E_FieldNotInRecord.fs delete mode 100644 tests/fsharpqa/Source/ErrorMessages/NameResolution/E_RecordFieldProposal.fs diff --git a/tests/fsharp/Compiler/ErrorMessages/NameResolutionTests.fs b/tests/fsharp/Compiler/ErrorMessages/NameResolutionTests.fs new file mode 100644 index 0000000000..70def908d1 --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/NameResolutionTests.fs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module NameResolutionTests = + + [] + let FieldNotInRecord () = + CompilerAssert.TypeCheckSingleError + """ +type A = { Hello:string; World:string } +type B = { Size:int; Height:int } +type C = { Wheels:int } +type D = { Size:int; Height:int; Walls:int } +type E = { Unknown:string } +type F = { Wallis:int; Size:int; Height:int; } + +let r:F = { Size=3; Height=4; Wall=1 } + """ + FSharpErrorSeverity.Error + 1129 + (9, 31, 9, 35) + "The record type 'F' does not contain a label 'Wall'." + + [] + let RecordFieldProposal () = + CompilerAssert.TypeCheckSingleError + """ +type A = { Hello:string; World:string } +type B = { Size:int; Height:int } +type C = { Wheels:int } +type D = { Size:int; Height:int; Walls:int } +type E = { Unknown:string } +type F = { Wallis:int; Size:int; Height:int; } + +let r = { Size=3; Height=4; Wall=1 } + """ + FSharpErrorSeverity.Error + 39 + (9, 29, 9, 33) + "The record label 'Wall' is not defined." \ No newline at end of file diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index ec2a852b13..fe3d1656a9 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -36,6 +36,7 @@ + diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_FieldNotInRecord.fs b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_FieldNotInRecord.fs deleted file mode 100644 index 4a5361f8f6..0000000000 --- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_FieldNotInRecord.fs +++ /dev/null @@ -1,13 +0,0 @@ -// #ErrorMessages #NameResolution -//The record type 'F' does not contain a label 'Wall'\. - -type A = { Hello:string; World:string } -type B = { Size:int; Height:int } -type C = { Wheels:int } -type D = { Size:int; Height:int; Walls:int } -type E = { Unknown:string } -type F = { Wallis:int; Size:int; Height:int; } - -let r:F = { Size=3; Height=4; Wall=1 } - -exit 0 diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs index b369ffad37..9bde0edbc4 100644 --- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs +++ b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs @@ -3,4 +3,4 @@ let x = global.System.String.Empty.global.System.String.Empty -exit 0 +exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_RecordFieldProposal.fs b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_RecordFieldProposal.fs deleted file mode 100644 index ca73d5c1e5..0000000000 --- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_RecordFieldProposal.fs +++ /dev/null @@ -1,13 +0,0 @@ -// #ErrorMessages #NameResolution -//The record label 'Wall' is not defined\. - -type A = { Hello:string; World:string } -type B = { Size:int; Height:int } -type C = { Wheels:int } -type D = { Size:int; Height:int; Walls:int } -type E = { Unknown:string } -type F = { Wallis:int; Size:int; Height:int; } - -let r = { Size=3; Height=4; Wall=1 } - -exit 0 diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst b/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst index 42209ddd28..71bc0eb390 100644 --- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst +++ b/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst @@ -1,3 +1 @@ - SOURCE=E_RecordFieldProposal.fs # E_RecordFieldProposal - SOURCE=E_GlobalQualifierAfterDot.fs # E_GlobalQualifierAfterDot - SOURCE=E_FieldNotInRecord.fs # E_FieldNotInRecord \ No newline at end of file +SOURCE=E_GlobalQualifierAfterDot.fs # E_GlobalQualifierAfterDot \ No newline at end of file From 4cf7b5bc523d9701f7f0ca22711ed4165bf11afc Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Wed, 17 Jul 2019 21:11:31 +0300 Subject: [PATCH 178/286] Moving WarnExpressionTests over to NUnit (#7232) --- .../ErrorMessages/WarnExpressionTests.fs | 208 ++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + .../DontWarnIfPropertyWithoutSetter.fs | 14 -- .../Source/Warnings/WarnIfDiscardedInList.fs | 14 -- .../Source/Warnings/WarnIfDiscardedInList2.fs | 19 -- .../Source/Warnings/WarnIfDiscardedInList3.fs | 19 -- .../Warnings/WarnIfExpressionResultUnused.fs | 5 - .../Warnings/WarnIfImplicitlyDiscarded.fs | 11 - .../Warnings/WarnIfPossibleAssignment.fs | 11 - .../WarnIfPossibleAssignmentToMutable.fs | 11 - .../WarnIfPossibleDotNetPropertySetter.fs | 13 -- .../Warnings/WarnIfPossiblePropertySetter.fs | 15 -- .../Warnings/WarnOnlyOnLastExpression.fs | 10 - tests/fsharpqa/Source/Warnings/env.lst | 11 - 14 files changed, 209 insertions(+), 153 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs delete mode 100644 tests/fsharpqa/Source/Warnings/DontWarnIfPropertyWithoutSetter.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfExpressionResultUnused.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfImplicitlyDiscarded.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignment.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignmentToMutable.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfPossibleDotNetPropertySetter.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WarnIfPossiblePropertySetter.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WarnOnlyOnLastExpression.fs diff --git a/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs b/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs new file mode 100644 index 0000000000..557aa81a4d --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Warn Expression`` = + + [] + let ``Warn If Expression Result Unused``() = + CompilerAssert.TypeCheckSingleError + """ +1 + 2 +printfn "%d" 3 + """ + FSharpErrorSeverity.Warning + 20 + (2, 1, 2, 6) + "The result of this expression has type 'int' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'." + + [] + let ``Warn If Possible Assignment``() = + CompilerAssert.TypeCheckSingleError + """ +let x = 10 +let y = "hello" + +let changeX() = + x = 20 + y = "test" + """ + FSharpErrorSeverity.Warning + 20 + (6, 5, 6, 11) + "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. 'x <- expression'." + + [] + let ``Warn If Possible Assignment To Mutable``() = + CompilerAssert.TypeCheckSingleError + """ +let mutable x = 10 +let y = "hello" + +let changeX() = + x = 20 + y = "test" + """ + FSharpErrorSeverity.Warning + 20 + (6, 5, 6, 11) + "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. 'x <- expression'." + + [] + let ``Warn If Possible dotnet Property Setter``() = + CompilerAssert.TypeCheckWithErrors + """ +open System + +let z = System.Timers.Timer() +let y = "hello" + +let changeProperty() = + z.Enabled = true + y = "test" + """ + [| + FSharpErrorSeverity.Warning, 760, (4, 9, 4, 30), "It is recommended that objects supporting the IDisposable interface are created using the syntax 'new Type(args)', rather than 'Type(args)' or 'Type' as a function value representing the constructor, to indicate that resources may be owned by the generated value" + FSharpErrorSeverity.Warning, 20, (8, 5, 8, 21), "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. 'z.Enabled <- expression'." + |] + + [] + let ``Don't Warn If Property Without Setter``() = + CompilerAssert.TypeCheckSingleError + """ +type MyClass(property1 : int) = + member val Property2 = "" with get + +let x = MyClass(1) +let y = "hello" + +let changeProperty() = + x.Property2 = "22" + y = "test" + """ + FSharpErrorSeverity.Warning + 20 + (9, 5, 9, 23) + "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'." + + [] + let ``Warn If Implicitly Discarded``() = + CompilerAssert.TypeCheckSingleError + """ +let x = 10 +let y = 20 + +let changeX() = + y * x = 20 + y = 30 + """ + FSharpErrorSeverity.Warning + 20 + (6, 5, 6, 15) + "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'." + + [] + let ``Warn If Discarded In List``() = + CompilerAssert.TypeCheckSingleError + """ +let div _ _ = 1 +let subView _ _ = [1; 2] + +// elmish view +let view model dispatch = + [ + yield! subView model dispatch + div [] [] + ] + """ + FSharpErrorSeverity.Warning + 3221 + (9, 8, 9, 17) + "This expression returns a value of type 'int' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'." + + [] + let ``Warn If Discarded In List 2``() = + CompilerAssert.TypeCheckSingleError + """ +// stupid things to make the sample compile +let div _ _ = 1 +let subView _ _ = [1; 2] +let y = 1 + +// elmish view +let view model dispatch = + [ + div [] [ + match y with + | 1 -> yield! subView model dispatch + | _ -> subView model dispatch + ] + ] + """ + FSharpErrorSeverity.Warning + 3222 + (13, 19, 13, 41) + "This expression returns a value of type 'int list' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield!'." + + [] + let ``Warn If Discarded In List 3``() = + CompilerAssert.TypeCheckSingleError + """ +// stupid things to make the sample compile +let div _ _ = 1 +let subView _ _ = true +let y = 1 + +// elmish view +let view model dispatch = + [ + div [] [ + match y with + | 1 -> () + | _ -> subView model dispatch + ] + ] + """ + FSharpErrorSeverity.Warning + 20 + (13, 19, 13, 41) + "The result of this expression has type 'bool' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'." + + [] + let ``Warn Only On Last Expression``() = + CompilerAssert.TypeCheckSingleError + """ +let mutable x = 0 +while x < 1 do + printfn "unneeded" + x <- x + 1 + true + """ + FSharpErrorSeverity.Warning + 20 + (6, 5, 6, 9) + "The result of this expression has type 'bool' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'." + + [] + let ``Warn If Possible Property Setter``() = + CompilerAssert.TypeCheckSingleError + """ +type MyClass(property1 : int) = + member val Property1 = property1 + member val Property2 = "" with get, set + +let x = MyClass(1) +let y = "hello" + +let changeProperty() = + x.Property2 = "20" + y = "test" + """ + FSharpErrorSeverity.Warning + 20 + (10, 5, 10, 23) + "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. 'x.Property2 <- expression'." diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index fe3d1656a9..b1bb4c1e33 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -38,6 +38,7 @@ + diff --git a/tests/fsharpqa/Source/Warnings/DontWarnIfPropertyWithoutSetter.fs b/tests/fsharpqa/Source/Warnings/DontWarnIfPropertyWithoutSetter.fs deleted file mode 100644 index 4492e6338c..0000000000 --- a/tests/fsharpqa/Source/Warnings/DontWarnIfPropertyWithoutSetter.fs +++ /dev/null @@ -1,14 +0,0 @@ -// #Warnings -//The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - -type MyClass(property1 : int) = - member val Property2 = "" with get - -let x = MyClass(1) -let y = "hello" - -let changeProperty() = - x.Property2 = "22" - y = "test" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs b/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs deleted file mode 100644 index d47a4c1376..0000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList.fs +++ /dev/null @@ -1,14 +0,0 @@ -// #Warnings -// - -let div _ _ = 1 -let subView _ _ = [1; 2] - -// elmish view -let view model dispatch = - [ - yield! subView model dispatch - div [] [] - ] - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs b/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs deleted file mode 100644 index d360da4d66..0000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList2.fs +++ /dev/null @@ -1,19 +0,0 @@ -// #Warnings -// - -// stupid things to make the sample compile -let div _ _ = 1 -let subView _ _ = [1; 2] -let y = 1 - -// elmish view -let view model dispatch = - [ - div [] [ - match y with - | 1 -> yield! subView model dispatch - | _ -> subView model dispatch - ] - ] - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs b/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs deleted file mode 100644 index 238d4388f9..0000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfDiscardedInList3.fs +++ /dev/null @@ -1,19 +0,0 @@ -// #Warnings -// - -// stupid things to make the sample compile -let div _ _ = 1 -let subView _ _ = true -let y = 1 - -// elmish view -let view model dispatch = - [ - div [] [ - match y with - | 1 -> () - | _ -> subView model dispatch - ] - ] - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnIfExpressionResultUnused.fs b/tests/fsharpqa/Source/Warnings/WarnIfExpressionResultUnused.fs deleted file mode 100644 index 9480f35b6b..0000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfExpressionResultUnused.fs +++ /dev/null @@ -1,5 +0,0 @@ -// #Warnings -//The result of this expression has type 'int' and is implicitly ignored\. Consider using 'ignore' to discard this value explicitly, e\.g\. 'expr \|> ignore', or 'let' to bind the result to a name, e\.g\. 'let result = expr'.$ - -1 + 2 -printfn "%d" 3 diff --git a/tests/fsharpqa/Source/Warnings/WarnIfImplicitlyDiscarded.fs b/tests/fsharpqa/Source/Warnings/WarnIfImplicitlyDiscarded.fs deleted file mode 100644 index ad7f9deacd..0000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfImplicitlyDiscarded.fs +++ /dev/null @@ -1,11 +0,0 @@ -// #Warnings -//The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. - -let x = 10 -let y = 20 - -let changeX() = - y * x = 20 - y = 30 - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignment.fs b/tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignment.fs deleted file mode 100644 index b3fca3a0b9..0000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignment.fs +++ /dev/null @@ -1,11 +0,0 @@ -// #Warnings -//If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. 'x <- expression'. - -let x = 10 -let y = "hello" - -let changeX() = - x = 20 - y = "test" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignmentToMutable.fs b/tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignmentToMutable.fs deleted file mode 100644 index bd827ec4ad..0000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfPossibleAssignmentToMutable.fs +++ /dev/null @@ -1,11 +0,0 @@ -// #Warnings -//If you intended to mutate a value, then use the '<-' operator e.g. 'x <- expression'. - -let mutable x = 10 -let y = "hello" - -let changeX() = - x = 20 - y = "test" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnIfPossibleDotNetPropertySetter.fs b/tests/fsharpqa/Source/Warnings/WarnIfPossibleDotNetPropertySetter.fs deleted file mode 100644 index 7c461349ec..0000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfPossibleDotNetPropertySetter.fs +++ /dev/null @@ -1,13 +0,0 @@ -// #Warnings -//If you intended to set a value to a property, then use the '<-' operator e.g. 'z.Enabled <- expression' - -open System - -let z = System.Timers.Timer() -let y = "hello" - -let changeProperty() = - z.Enabled = true - y = "test" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnIfPossiblePropertySetter.fs b/tests/fsharpqa/Source/Warnings/WarnIfPossiblePropertySetter.fs deleted file mode 100644 index 7548d20468..0000000000 --- a/tests/fsharpqa/Source/Warnings/WarnIfPossiblePropertySetter.fs +++ /dev/null @@ -1,15 +0,0 @@ -// #Warnings -//If you intended to set a value to a property, then use the '<-' operator e.g. 'x.Property2 <- expression' - -type MyClass(property1 : int) = - member val Property1 = property1 - member val Property2 = "" with get, set - -let x = MyClass(1) -let y = "hello" - -let changeProperty() = - x.Property2 = "20" - y = "test" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WarnOnlyOnLastExpression.fs b/tests/fsharpqa/Source/Warnings/WarnOnlyOnLastExpression.fs deleted file mode 100644 index 7b0b968c23..0000000000 --- a/tests/fsharpqa/Source/Warnings/WarnOnlyOnLastExpression.fs +++ /dev/null @@ -1,10 +0,0 @@ -// #Warnings -//The result of this expression has type 'bool' and is implicitly ignored - -let mutable x = 0 -while x < 1 do - printfn "unneeded" - x <- x + 1 - true - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 3a31070e07..9b5fbffaeb 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -40,19 +40,8 @@ SOURCE=RefCellInsteadOfNot2.fs # RefCellInsteadOfNot2.fs SOURCE=RuntimeTypeTestInPattern.fs # RuntimeTypeTestInPattern.fs SOURCE=RuntimeTypeTestInPattern2.fs # RuntimeTypeTestInPattern2.fs - SOURCE=WarnIfExpressionResultUnused.fs # WarnIfExpressionResultUnused.fs SOURCE=MemberHasMultiplePossibleDispatchSlots.fs # MemberHasMultiplePossibleDispatchSlots.fs SOURCE=Repro1548.fs SCFLAGS="-r:Repro1548.dll" # Repro1548.fs - SOURCE=WarnIfPossibleAssignment.fs - SOURCE=WarnIfPossibleAssignmentToMutable.fs - SOURCE=WarnIfPossibleDotNetPropertySetter.fs - SOURCE=DontWarnIfPropertyWithoutSetter.fs - SOURCE=WarnIfImplicitlyDiscarded.fs - SOURCE=WarnIfDiscardedInList.fs - SOURCE=WarnIfDiscardedInList2.fs - SOURCE=WarnIfDiscardedInList3.fs - SOURCE=WarnOnlyOnLastExpression.fs - SOURCE=WarnIfPossiblePropertySetter.fs SOURCE=DoCannotHaveVisibilityDeclarations.fs SOURCE=ModuleAbbreviationsArePrivate.fs SOURCE=DontSuggestIntentionallyUnusedVariables.fs SCFLAGS="--vserrors" # DontSuggestIntentionallyUnusedVariables.fs From 650805b36840bd9ded0d4472a31bc756a42e8243 Mon Sep 17 00:00:00 2001 From: Sean McLemon Date: Wed, 17 Jul 2019 23:01:51 +0200 Subject: [PATCH 179/286] move some error and warning tests to NUnit (#7244) * move some error and warning tests to NUnit * CompilerAssert.ParseWithErrors now uses ParseFile instead of ParseAndCheckFileInProject * merge conflicts --- tests/fsharp/Compiler/CompilerAssert.fs | 19 +++ .../ErrorMessages/AssignmentErrorTests.fs | 23 ++++ .../Warnings/AssignmentWarningTests.fs | 108 ++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 2 + .../E_GlobalQualifierAfterDot.fs | 6 - .../ErrorMessages/NameResolution/env.lst | 1 - .../Source/Warnings/AssignmentOnImmutable.fs | 7 -- tests/fsharpqa/Source/Warnings/env.lst | 1 - tests/fsharpqa/Source/test.lst | 1 - 9 files changed, 152 insertions(+), 16 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/AssignmentErrorTests.fs create mode 100644 tests/fsharp/Compiler/Warnings/AssignmentWarningTests.fs delete mode 100644 tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs delete mode 100644 tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst delete mode 100644 tests/fsharpqa/Source/Warnings/AssignmentOnImmutable.fs diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index d5f93d7810..ade3ca8e4a 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -217,3 +217,22 @@ module CompilerAssert = Assert.AreEqual(expectedErrorMessage, errorMessage) ) + let ParseWithErrors (source: string) expectedParseErrors = + let parseResults = checker.ParseFile("test.fs", SourceText.ofString source, FSharpParsingOptions.Default) |> Async.RunSynchronously + + Assert.True(parseResults.ParseHadErrors) + + let errors = + parseResults.Errors + |> Array.distinctBy (fun e -> e.Severity, e.ErrorNumber, e.StartLineAlternate, e.StartColumn, e.EndLineAlternate, e.EndColumn, e.Message) + + Assert.AreEqual(Array.length expectedParseErrors, errors.Length, sprintf "Type check errors: %A" parseResults.Errors) + + Array.zip errors expectedParseErrors + |> Array.iter (fun (info, expectedError) -> + let (expectedServerity: FSharpErrorSeverity, expectedErrorNumber: int, expectedErrorRange: int * int * int * int, expectedErrorMsg: string) = expectedError + Assert.AreEqual(expectedServerity, info.Severity) + Assert.AreEqual(expectedErrorNumber, info.ErrorNumber, "expectedErrorNumber") + Assert.AreEqual(expectedErrorRange, (info.StartLineAlternate, info.StartColumn + 1, info.EndLineAlternate, info.EndColumn + 1), "expectedErrorRange") + Assert.AreEqual(expectedErrorMsg, info.Message, "expectedErrorMsg") + ) \ No newline at end of file diff --git a/tests/fsharp/Compiler/ErrorMessages/AssignmentErrorTests.fs b/tests/fsharp/Compiler/ErrorMessages/AssignmentErrorTests.fs new file mode 100644 index 0000000000..51b75dd87d --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/AssignmentErrorTests.fs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Errors assigning to mutable objects`` = + + [] + let ``Assign to immutable error``() = + CompilerAssert.TypeCheckSingleError + """ +let x = 10 +x <- 20 + +exit 0 + """ + FSharpErrorSeverity.Error + 27 + (3, 1, 3, 8) + "This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable x = expression'." \ No newline at end of file diff --git a/tests/fsharp/Compiler/Warnings/AssignmentWarningTests.fs b/tests/fsharp/Compiler/Warnings/AssignmentWarningTests.fs new file mode 100644 index 0000000000..2a0d15d8f8 --- /dev/null +++ b/tests/fsharp/Compiler/Warnings/AssignmentWarningTests.fs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Warnings assigning to mutable and immutable objects`` = + + [] + let ``Unused compare with immutable when assignment might be intended``() = + CompilerAssert.TypeCheckSingleError + """ +let x = 10 +let y = "hello" + +let changeX() = + x = 20 + y = "test" + +exit 0 + """ + FSharpErrorSeverity.Warning + 20 + (6, 5, 6, 11) + "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then mark the value 'mutable' and use the '<-' operator e.g. 'x <- expression'." + + [] + let ``Unused compare with mutable when assignment might be intended``() = + CompilerAssert.TypeCheckSingleError + """ +let mutable x = 10 +let y = "hello" + +let changeX() = + x = 20 + y = "test" + +exit 0 + """ + FSharpErrorSeverity.Warning + 20 + (6, 5, 6, 11) + "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to mutate a value, then use the '<-' operator e.g. 'x <- expression'." + + [] + let ``Unused comparison of property in dotnet object when assignment might be intended``() = + CompilerAssert.TypeCheckSingleError + """ +open System + +let z = new System.Timers.Timer() +let y = "hello" + +let changeProperty() = + z.Enabled = true + y = "test" + +exit 0 + """ + FSharpErrorSeverity.Warning + 20 + (8, 5, 8, 21) + "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. 'z.Enabled <- expression'." + + [] + let ``Unused comparison of property when assignment might be intended ``() = + CompilerAssert.TypeCheckSingleError + """ +type MyClass(property1 : int) = + member val Property1 = property1 + member val Property2 = "" with get, set + +let x = MyClass(1) +let y = "hello" + +let changeProperty() = + x.Property2 = "20" + y = "test" + +exit 0 + """ + FSharpErrorSeverity.Warning + 20 + (10, 5, 10, 23) + "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to set a value to a property, then use the '<-' operator e.g. 'x.Property2 <- expression'." + + [] + let ``Don't warn if assignment to property without setter ``() = + CompilerAssert.TypeCheckSingleError + """ +type MyClass(property1 : int) = + member val Property2 = "" with get + +let x = MyClass(1) +let y = "hello" + +let changeProperty() = + x.Property2 = "22" + y = "test" + +exit 0 + """ + FSharpErrorSeverity.Warning + 20 + (9, 5, 9, 23) + "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'." \ No newline at end of file diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index b1bb4c1e33..50e3e4f2d4 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -38,6 +38,7 @@ + @@ -45,6 +46,7 @@ + diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs deleted file mode 100644 index 9bde0edbc4..0000000000 --- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs +++ /dev/null @@ -1,6 +0,0 @@ -// #ErrorMessages #NameResolution -//'global' may only be used as the first name in a qualified path - -let x = global.System.String.Empty.global.System.String.Empty - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst b/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst deleted file mode 100644 index 71bc0eb390..0000000000 --- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst +++ /dev/null @@ -1 +0,0 @@ -SOURCE=E_GlobalQualifierAfterDot.fs # E_GlobalQualifierAfterDot \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/AssignmentOnImmutable.fs b/tests/fsharpqa/Source/Warnings/AssignmentOnImmutable.fs deleted file mode 100644 index a2e35c78a9..0000000000 --- a/tests/fsharpqa/Source/Warnings/AssignmentOnImmutable.fs +++ /dev/null @@ -1,7 +0,0 @@ -// #Warnings -//This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable x = expression'. - -let x = 10 -x <- 20 - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 9b5fbffaeb..a3d677bf0f 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -32,7 +32,6 @@ SOURCE=MatchingMethodWithSameNameIsNotAbstract.fs # MatchingMethodWithSameNameIsNotAbstract.fs SOURCE=NoMatchingAbstractMethodWithSameName.fs # NoMatchingAbstractMethodWithSameName.fs SOURCE=MissingExpressionAfterLet.fs # MissingExpressionAfterLet.fs - SOURCE=AssignmentOnImmutable.fs # AssignmentOnImmutable.fs SOURCE=SuggestFieldsInCtor.fs # SuggestFieldsInCtor.fs SOURCE=FieldSuggestion.fs # FieldSuggestion.fs SOURCE=SuggestToUseIndexer.fs # SuggestToUseIndexer.fs diff --git a/tests/fsharpqa/Source/test.lst b/tests/fsharpqa/Source/test.lst index f3d79d7a03..147475acc7 100644 --- a/tests/fsharpqa/Source/test.lst +++ b/tests/fsharpqa/Source/test.lst @@ -264,7 +264,6 @@ Misc01 Libraries\Core\Operators Misc01 Libraries\Core\Reflection Misc01 Libraries\Core\Unchecked Misc01 Warnings -Misc01 ErrorMessages\NameResolution Misc01 ErrorMessages\UnitGenericAbstractType Misc01 ErrorMessages\ConfusingTypeName From 375fd7c63f29d74d18c30c285d726107d8af301f Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Thu, 18 Jul 2019 12:51:28 +0000 Subject: [PATCH 180/286] Update dependencies from https://github.com/dotnet/arcade build 20190717.8 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19367.8 --- eng/Version.Details.xml | 4 ++-- eng/common/init-tools-native.sh | 2 +- .../templates/post-build/channels/internal-servicing.yml | 1 + eng/common/templates/post-build/channels/public-release.yml | 1 + eng/common/tools.ps1 | 2 +- global.json | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 86d49308d4..35196ac2a5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 0dd5e2025f0049c133a8706f40e4463b193e5d17 + 2359dc4184133defa27c8f3072622270b71b4ecf diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh index fc72d13948..5f2e77f448 100644 --- a/eng/common/init-tools-native.sh +++ b/eng/common/init-tools-native.sh @@ -71,7 +71,7 @@ function ReadGlobalJsonNativeTools { local native_tools_list=$(echo $native_tools_section | awk -F"[{}]" '{print $2}') native_tools_list=${native_tools_list//[\" ]/} native_tools_list=${native_tools_list//,/$'\n'} - native_tools_list="$(echo -e "${native_tools_list}" | tr -d '[:space:]')" + native_tools_list="$(echo -e "${native_tools_list}" | tr -d '[[:space:]]')" local old_IFS=$IFS while read -r line; do diff --git a/eng/common/templates/post-build/channels/internal-servicing.yml b/eng/common/templates/post-build/channels/internal-servicing.yml index 50ad724fc0..648e854e0e 100644 --- a/eng/common/templates/post-build/channels/internal-servicing.yml +++ b/eng/common/templates/post-build/channels/internal-servicing.yml @@ -84,6 +84,7 @@ stages: /p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName) /p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1) /p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url) + /p:StaticInternalFeed=$(dotnetfeed-internal-nonstable-feed-url) /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe /p:BARBuildId=$(BARBuildId) /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' diff --git a/eng/common/templates/post-build/channels/public-release.yml b/eng/common/templates/post-build/channels/public-release.yml index 574cb1c2b9..f6a7efdfe9 100644 --- a/eng/common/templates/post-build/channels/public-release.yml +++ b/eng/common/templates/post-build/channels/public-release.yml @@ -84,6 +84,7 @@ stages: /p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName) /p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1) /p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url) + /p:StaticInternalFeed=$(dotnetfeed-internal-nonstable-feed-url) /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe /p:BARBuildId=$(BARBuildId) /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 9abaac015f..8fe2b11ad2 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -169,7 +169,7 @@ function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $arc InstallDotNet $dotnetRoot $version $architecture } -function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $architecture = "", [string] $runtime = "", [bool] $skipNonVersionedFiles = $false) { $installScript = GetDotNetInstallScript $dotnetRoot +function InstallDotNet([string] $dotnetRoot, [string] $version, [string] $architecture = "", [string] $runtime = "", [bool] $skipNonVersionedFiles = $false) { $installScript = GetDotNetInstallScript $dotnetRoot $installParameters = @{ Version = $version diff --git a/global.json b/global.json index 7d6048be9f..b4297bf622 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19366.4", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19367.8", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From c423de9078db600cb0b95f48a518823417217b91 Mon Sep 17 00:00:00 2001 From: Faisal Alfaddaghi Date: Fri, 19 Jul 2019 20:36:19 +0300 Subject: [PATCH 181/286] Move UnitGenericAbstractType To Nunit (#7257) --- .../ErrorMessages/UnitGenericAbstactType.fs | 27 +++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + .../E_UnitGenericAbstractType1.fs | 9 ------- .../UnitGenericAbstractType/env.lst | 1 - 4 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/UnitGenericAbstactType.fs delete mode 100644 tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/E_UnitGenericAbstractType1.fs delete mode 100644 tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/env.lst diff --git a/tests/fsharp/Compiler/ErrorMessages/UnitGenericAbstactType.fs b/tests/fsharp/Compiler/ErrorMessages/UnitGenericAbstactType.fs new file mode 100644 index 0000000000..e9165a4cf6 --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/UnitGenericAbstactType.fs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Unit generic abstract Type`` = + + [] + let ``Unit can not be used as return type of abstract method paramete on return type``() = + CompilerAssert.TypeCheckSingleError + """ +type EDF<'S> = + abstract member Apply : int -> 'S +type SomeEDF () = + interface EDF with + member this.Apply d = + // [ERROR] The member 'Apply' does not have the correct type to override the corresponding abstract method. + () + """ + FSharpErrorSeverity.Error + 17 + (6, 21, 6, 26) + "The member 'Apply : int -> unit' is specialized with 'unit' but 'unit' can't be used as return type of an abstract method parameterized on return type." + diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 50e3e4f2d4..0c9578f219 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -36,6 +36,7 @@ + diff --git a/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/E_UnitGenericAbstractType1.fs b/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/E_UnitGenericAbstractType1.fs deleted file mode 100644 index 0b7f1d98a6..0000000000 --- a/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/E_UnitGenericAbstractType1.fs +++ /dev/null @@ -1,9 +0,0 @@ -// #ErrorMessages #UnitGenericAbstractType -//The member 'Apply : int -> unit' is specialized with 'unit' but 'unit' can't be used as return type of an abstract method parameterized on return type\. -type EDF<'S> = - abstract member Apply : int -> 'S -type SomeEDF () = - interface EDF with - member this.Apply d = - // [ERROR] The member 'Apply' does not have the correct type to override the corresponding abstract method. - () \ No newline at end of file diff --git a/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/env.lst b/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/env.lst deleted file mode 100644 index 26ae602bd6..0000000000 --- a/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/env.lst +++ /dev/null @@ -1 +0,0 @@ - SOURCE=E_UnitGenericAbstractType1.fs # E_UnitGenericAbstractType1 \ No newline at end of file From 4151eb23b521f74e3ec1292779c8ab47a9d8014a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 19 Jul 2019 10:38:48 -0700 Subject: [PATCH 182/286] Update dependencies from https://github.com/dotnet/arcade build 20190718.7 (#7256) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19368.7 --- eng/Version.Details.xml | 4 +- eng/common/pipeline-logging-functions.sh | 82 ++++++++++++++++++++++-- eng/common/tools.sh | 19 +++--- global.json | 2 +- 4 files changed, 87 insertions(+), 20 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 35196ac2a5..7a60463a0f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 2359dc4184133defa27c8f3072622270b71b4ecf + eecde8a8751dbe7fdb17ba4dfbd032e26f4cae7d diff --git a/eng/common/pipeline-logging-functions.sh b/eng/common/pipeline-logging-functions.sh index 6098f9a543..1c560a5061 100644 --- a/eng/common/pipeline-logging-functions.sh +++ b/eng/common/pipeline-logging-functions.sh @@ -39,11 +39,11 @@ function Write-PipelineTaskError { return fi - message_type="error" - sourcepath='' - linenumber='' - columnnumber='' - error_code='' + local message_type="error" + local sourcepath='' + local linenumber='' + local columnnumber='' + local error_code='' while [[ $# -gt 0 ]]; do opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" @@ -76,7 +76,7 @@ function Write-PipelineTaskError { shift done - message="##vso[task.logissue" + local message="##vso[task.logissue" message="$message type=$message_type" @@ -100,3 +100,73 @@ function Write-PipelineTaskError { echo "$message" } +function Write-PipelineSetVariable { + if [[ "$ci" != true ]]; then + return + fi + + local name='' + local value='' + local secret=false + local as_output=false + local is_multi_job_variable=true + + while [[ $# -gt 0 ]]; do + opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" + case "$opt" in + -name|-n) + name=$2 + shift + ;; + -value|-v) + value=$2 + shift + ;; + -secret|-s) + secret=true + ;; + -as_output|-a) + as_output=true + ;; + -is_multi_job_variable|-i) + is_multi_job_variable=$2 + shift + ;; + esac + shift + done + + value=${value/;/%3B} + value=${value/\\r/%0D} + value=${value/\\n/%0A} + value=${value/]/%5D} + + local message="##vso[task.setvariable variable=$name;isSecret=$secret;isOutput=$is_multi_job_variable]$value" + + if [[ "$as_output" == true ]]; then + $message + else + echo "$message" + fi +} + +function Write-PipelinePrependPath { + local prepend_path='' + + while [[ $# -gt 0 ]]; do + opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" + case "$opt" in + -path|-p) + prepend_path=$2 + shift + ;; + esac + shift + done + + export PATH="$prepend_path:$PATH" + + if [[ "$ci" == true ]]; then + echo "##vso[task.prependpath]$prepend_path" + fi +} \ No newline at end of file diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 70d92cf85a..0deb01c480 100644 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -146,14 +146,10 @@ function InitializeDotNetCli { # Add dotnet to PATH. This prevents any bare invocation of dotnet in custom # build steps from using anything other than what we've downloaded. - export PATH="$dotnet_root:$PATH" + Write-PipelinePrependPath -path "$dotnet_root" - if [[ $ci == true ]]; then - # Make Sure that our bootstrapped dotnet cli is available in future steps of the Azure Pipelines build - echo "##vso[task.prependpath]$dotnet_root" - echo "##vso[task.setvariable variable=DOTNET_MULTILEVEL_LOOKUP]0" - echo "##vso[task.setvariable variable=DOTNET_SKIP_FIRST_TIME_EXPERIENCE]1" - fi + Write-PipelineSetVariable -name "DOTNET_MULTILEVEL_LOOKUP" -value "0" + Write-PipelineSetVariable -name "DOTNET_SKIP_FIRST_TIME_EXPERIENCE" -value "1" # return value _InitializeDotNetCli="$dotnet_root" @@ -387,7 +383,8 @@ mkdir -p "$toolset_dir" mkdir -p "$temp_dir" mkdir -p "$log_dir" -if [[ $ci == true ]]; then - export TEMP="$temp_dir" - export TMP="$temp_dir" -fi +Write-PipelineSetVariable -name "Artifacts" -value "$artifacts_dir" +Write-PipelineSetVariable -name "Artifacts.Toolset" -value "$toolset_dir" +Write-PipelineSetVariable -name "Artifacts.Log" -value "$log_dir" +Write-PipelineSetVariable -name "Temp" -value "$temp_dir" +Write-PipelineSetVariable -name "TMP" -value "$temp_dir" diff --git a/global.json b/global.json index b4297bf622..78425fae2e 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19367.8", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19368.7", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From bdb2b79e06bcb1b515ba4243103a9ff3cfbb2ea2 Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Fri, 19 Jul 2019 21:02:07 +0300 Subject: [PATCH 183/286] Moving TypeMismatchTests over to NUnit (#7250) * Moving TypeMismatchTests over to NUnit * ci restart --- .../ErrorMessages/TypeMismatchTests.fs | 135 ++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + .../Source/Warnings/GuardHasWrongType.fs | 9 -- .../Source/Warnings/OverrideErrors.fs | 22 --- .../Source/Warnings/RefCellInsteadOfNot.fs | 9 -- .../Source/Warnings/RefCellInsteadOfNot2.fs | 8 -- .../Warnings/ReturnInsteadOfReturnBang.fs | 10 -- .../Warnings/RuntimeTypeTestInPattern.fs | 13 -- .../Warnings/RuntimeTypeTestInPattern2.fs | 13 -- .../Warnings/YieldInsteadOfYieldBang.fs | 13 -- tests/fsharpqa/Source/Warnings/env.lst | 8 -- 11 files changed, 136 insertions(+), 105 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/TypeMismatchTests.fs delete mode 100644 tests/fsharpqa/Source/Warnings/GuardHasWrongType.fs delete mode 100644 tests/fsharpqa/Source/Warnings/OverrideErrors.fs delete mode 100644 tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot.fs delete mode 100644 tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot2.fs delete mode 100644 tests/fsharpqa/Source/Warnings/ReturnInsteadOfReturnBang.fs delete mode 100644 tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern.fs delete mode 100644 tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern2.fs delete mode 100644 tests/fsharpqa/Source/Warnings/YieldInsteadOfYieldBang.fs diff --git a/tests/fsharp/Compiler/ErrorMessages/TypeMismatchTests.fs b/tests/fsharp/Compiler/ErrorMessages/TypeMismatchTests.fs new file mode 100644 index 0000000000..652361045c --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/TypeMismatchTests.fs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Type Mismatch`` = + + [] + let ``return Instead Of return!``() = + CompilerAssert.TypeCheckSingleError + """ +let rec foo() = async { return foo() } + """ + FSharpErrorSeverity.Error + 1 + (2, 32, 2, 37) + "Type mismatch. Expecting a\n ''a' \nbut given a\n 'Async<'a>' \nThe types ''a' and 'Async<'a>' cannot be unified. Consider using 'return!' instead of 'return'." + + [] + let ``yield Instead Of yield!``() = + CompilerAssert.TypeCheckSingleError + """ +type Foo() = + member this.Yield(x) = [x] + +let rec f () = Foo() { yield f ()} + """ + FSharpErrorSeverity.Error + 1 + (5, 30, 5, 34) + "Type mismatch. Expecting a\n ''a' \nbut given a\n ''a list' \nThe types ''a' and ''a list' cannot be unified. Consider using 'yield!' instead of 'yield'." + + [] + let ``Ref Cell Instead Of Not``() = + CompilerAssert.TypeCheckSingleError + """ +let x = true +if !x then + printfn "hello" + """ + FSharpErrorSeverity.Error + 1 + (3, 5, 3, 6) + "This expression was expected to have type\n 'bool ref' \nbut here has type\n 'bool' \r\nThe '!' operator is used to dereference a ref cell. Consider using 'not expr' here." + + [] + let ``Ref Cell Instead Of Not 2``() = + CompilerAssert.TypeCheckSingleError + """ +let x = true +let y = !x + """ + FSharpErrorSeverity.Error + 1 + (3, 10, 3, 11) + "This expression was expected to have type\n ''a ref' \nbut here has type\n 'bool' \r\nThe '!' operator is used to dereference a ref cell. Consider using 'not expr' here." + + [] + let ``Guard Has Wrong Type``() = + CompilerAssert.TypeCheckWithErrors + """ +let x = 1 +match x with +| 1 when "s" -> true +| _ -> false + """ + [| + FSharpErrorSeverity.Error, 1, (4, 10, 4, 13), "A pattern match guard must be of type 'bool', but this 'when' expression is of type 'string'." + FSharpErrorSeverity.Warning, 20, (3, 1, 5, 13), "The result of this expression has type 'bool' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'." + |] + + [] + let ``Runtime Type Test In Pattern``() = + CompilerAssert.TypeCheckWithErrors + """ +open System.Collections.Generic + +let orig = Dictionary() + +let c = + match orig with + | :? IDictionary -> "yes" + | _ -> "no" + """ + [| + FSharpErrorSeverity.Warning, 67, (8, 5, 8, 28), "This type test or downcast will always hold" + FSharpErrorSeverity.Error, 193, (8, 5, 8, 28), "Type constraint mismatch. The type \n 'IDictionary' \nis not compatible with type\n 'Dictionary' \n" + |] + + [] + let ``Runtime Type Test In Pattern 2``() = + CompilerAssert.TypeCheckWithErrors + """ +open System.Collections.Generic + +let orig = Dictionary() + +let c = + match orig with + | :? IDictionary as y -> "yes" + y.ToString() + | _ -> "no" + """ + [| + FSharpErrorSeverity.Warning, 67, (8, 5, 8, 28), "This type test or downcast will always hold" + FSharpErrorSeverity.Error, 193, (8, 5, 8, 28), "Type constraint mismatch. The type \n 'IDictionary' \nis not compatible with type\n 'Dictionary' \n" + |] + + [] + let ``Override Errors``() = + CompilerAssert.TypeCheckWithErrors + """ +type Base() = + abstract member Member: int * string -> string + default x.Member (i, s) = s + +type Derived1() = + inherit Base() + override x.Member() = 5 + +type Derived2() = + inherit Base() + override x.Member (i : int) = "Hello" + +type Derived3() = + inherit Base() + override x.Member (s : string, i : int) = sprintf "Hello %s" s + """ + [| + FSharpErrorSeverity.Error, 856, (8, 16, 8, 22), "This override takes a different number of arguments to the corresponding abstract member. The following abstract members were found:\r\n abstract member Base.Member : int * string -> string" + FSharpErrorSeverity.Error, 856, (12, 16, 12, 22), "This override takes a different number of arguments to the corresponding abstract member. The following abstract members were found:\r\n abstract member Base.Member : int * string -> string" + FSharpErrorSeverity.Error, 1, (16, 24, 16, 34), "This expression was expected to have type\n 'int' \nbut here has type\n 'string' " + |] diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 0c9578f219..9d80400c40 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -38,6 +38,7 @@ + diff --git a/tests/fsharpqa/Source/Warnings/GuardHasWrongType.fs b/tests/fsharpqa/Source/Warnings/GuardHasWrongType.fs deleted file mode 100644 index ac0c3cb4f3..0000000000 --- a/tests/fsharpqa/Source/Warnings/GuardHasWrongType.fs +++ /dev/null @@ -1,9 +0,0 @@ -// #Warnings -//A pattern match guard must be of type 'bool' - -let x = 1 -match x with -| 1 when "s" -> true -| _ -> false - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/OverrideErrors.fs b/tests/fsharpqa/Source/Warnings/OverrideErrors.fs deleted file mode 100644 index ff03ba6ed4..0000000000 --- a/tests/fsharpqa/Source/Warnings/OverrideErrors.fs +++ /dev/null @@ -1,22 +0,0 @@ -// #Warnings -//This override takes a different number of arguments to the corresponding abstract member. The following abstract members were found: -//abstract member Base.Member : int * string -> string -//This expression was expected to have type - -type Base() = - abstract member Member: int * string -> string - default x.Member (i, s) = s - -type Derived1() = - inherit Base() - override x.Member() = 5 - -type Derived2() = - inherit Base() - override x.Member (i : int) = "Hello" - -type Derived3() = - inherit Base() - override x.Member (s : string, i : int) = sprintf "Hello %s" s - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot.fs b/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot.fs deleted file mode 100644 index 1c6987bfa6..0000000000 --- a/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot.fs +++ /dev/null @@ -1,9 +0,0 @@ -// #Warnings -//This expression was expected to have type -//The '!' operator is used to dereference a ref cell. Consider using 'not expr' here. - -let x = true -if !x then - printfn "hello" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot2.fs b/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot2.fs deleted file mode 100644 index 090934d8f5..0000000000 --- a/tests/fsharpqa/Source/Warnings/RefCellInsteadOfNot2.fs +++ /dev/null @@ -1,8 +0,0 @@ -// #Warnings -//This expression was expected to have type -//The '!' operator is used to dereference a ref cell. Consider using 'not expr' here. - -let x = true -let y = !x - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/ReturnInsteadOfReturnBang.fs b/tests/fsharpqa/Source/Warnings/ReturnInsteadOfReturnBang.fs deleted file mode 100644 index d9f87c521b..0000000000 --- a/tests/fsharpqa/Source/Warnings/ReturnInsteadOfReturnBang.fs +++ /dev/null @@ -1,10 +0,0 @@ -// #Warnings -//Type mismatch. Expecting a -//''a' -//but given a -//'Async<'a>' -//The types ''a' and 'Async<'a>' cannot be unified. Consider using 'return!' instead of 'return'. - -let rec foo() = async { return foo() } - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern.fs b/tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern.fs deleted file mode 100644 index 67ae796376..0000000000 --- a/tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern.fs +++ /dev/null @@ -1,13 +0,0 @@ -// #Warnings -//Type constraint mismatch. The type - -open System.Collections.Generic - -let orig = Dictionary() - -let c = - match orig with - | :? IDictionary -> "yes" - | _ -> "no" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern2.fs b/tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern2.fs deleted file mode 100644 index 098969482c..0000000000 --- a/tests/fsharpqa/Source/Warnings/RuntimeTypeTestInPattern2.fs +++ /dev/null @@ -1,13 +0,0 @@ -// #Warnings -//Type constraint mismatch. The type - -open System.Collections.Generic - -let orig = Dictionary() - -let c = - match orig with - | :? IDictionary as y -> "yes" + y.ToString() - | _ -> "no" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/YieldInsteadOfYieldBang.fs b/tests/fsharpqa/Source/Warnings/YieldInsteadOfYieldBang.fs deleted file mode 100644 index bd547fa7b2..0000000000 --- a/tests/fsharpqa/Source/Warnings/YieldInsteadOfYieldBang.fs +++ /dev/null @@ -1,13 +0,0 @@ -// #Warnings -//Type mismatch. Expecting a -//''a' -//but given a -//''a list' -//The types ''a' and ''a list' cannot be unified. Consider using 'yield!' instead of 'yield'. - -type Foo() = - member this.Yield(x) = [x] - -let rec f () = Foo() { yield f ()} - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index a3d677bf0f..18ef811a2a 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -1,10 +1,7 @@ SOURCE=WrongNumericLiteral.fs # WrongNumericLiteral.fs - SOURCE=ReturnInsteadOfReturnBang.fs # ReturnInsteadOfReturnBang.fs - SOURCE=YieldInsteadOfYieldBang.fs # YieldInsteadOfYieldBang.fs SOURCE=TupleInAbstractMethod.fs # TupleInAbstractMethod.fs SOURCE=FS0988AtEndOfFile.fs # FS0988AtEndOfFile.fs SOURCE=WrongArity.fs # WrongArity.fs - SOURCE=OverrideErrors.fs # OverrideErrors.fs SOURCE=MethodIsNotStatic.fs # MethodIsNotStatic.fs SOURCE=EqualsInsteadOfInInForLoop.fs # EqualsInsteadOfInInForLoop.fs SOURCE=DontWarnExternalFunctionAsUnused.fs SCFLAGS="--warnon:1182 --warnaserror+" # DontWarnExternalFunctionAsUnused.fs @@ -28,17 +25,12 @@ SOURCE=DontSuggestWhenThingsAreOpen.fs SCFLAGS="--vserrors" # DontSuggestWhenThingsAreOpen.fs SOURCE=SuggestDoubleBacktickIdentifiers.fs SCFLAGS="--vserrors" # SuggestDoubleBacktickIdentifiers.fs SOURCE=SuggestDoubleBacktickUnions.fs SCFLAGS="--vserrors" # SuggestDoubleBacktickUnions.fs - SOURCE=GuardHasWrongType.fs # GuardHasWrongType.fs SOURCE=MatchingMethodWithSameNameIsNotAbstract.fs # MatchingMethodWithSameNameIsNotAbstract.fs SOURCE=NoMatchingAbstractMethodWithSameName.fs # NoMatchingAbstractMethodWithSameName.fs SOURCE=MissingExpressionAfterLet.fs # MissingExpressionAfterLet.fs SOURCE=SuggestFieldsInCtor.fs # SuggestFieldsInCtor.fs SOURCE=FieldSuggestion.fs # FieldSuggestion.fs SOURCE=SuggestToUseIndexer.fs # SuggestToUseIndexer.fs - SOURCE=RefCellInsteadOfNot.fs # RefCellInsteadOfNot.fs - SOURCE=RefCellInsteadOfNot2.fs # RefCellInsteadOfNot2.fs - SOURCE=RuntimeTypeTestInPattern.fs # RuntimeTypeTestInPattern.fs - SOURCE=RuntimeTypeTestInPattern2.fs # RuntimeTypeTestInPattern2.fs SOURCE=MemberHasMultiplePossibleDispatchSlots.fs # MemberHasMultiplePossibleDispatchSlots.fs SOURCE=Repro1548.fs SCFLAGS="-r:Repro1548.dll" # Repro1548.fs SOURCE=DoCannotHaveVisibilityDeclarations.fs From b0e59263c73f5194c514ec36d48b861527e7d65b Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Fri, 19 Jul 2019 14:44:36 -0700 Subject: [PATCH 184/286] publish pdbs in FSharp.Core.nupkg (#7255) Also publish native symbols so they can be archived later. --- .vsts-signed.yaml | 8 ++++++++ azure-pipelines.yml | 6 ++++++ src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec | 2 ++ 3 files changed, 16 insertions(+) diff --git a/.vsts-signed.yaml b/.vsts-signed.yaml index 3ec301bbe0..ed30cb74ef 100644 --- a/.vsts-signed.yaml +++ b/.vsts-signed.yaml @@ -105,6 +105,14 @@ jobs: continueOnError: true condition: succeeded() + # Publish native PDBs for archiving + - task: PublishBuildArtifacts@1 + displayName: Publish Artifact Symbols + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/SymStore/$(BuildConfiguration)' + ArtifactName: NativeSymbols + condition: succeeded() + # Execute cleanup tasks - task: ms-vseng.MicroBuildTasks.521a94ea-9e68-468a-8167-6dcf361ea776.MicroBuildCleanup@1 displayName: Execute cleanup tasks diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2207a4792e..87306e5c60 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -113,6 +113,12 @@ jobs: PathtoPublish: '$(Build.SourcesDirectory)\artifacts\VSSetup\$(_BuildConfig)\VisualFSharpFull.vsix' ArtifactName: 'Nightly' condition: succeeded() + - task: PublishBuildArtifacts@1 + displayName: Publish Artifact Symbols + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\SymStore\$(_BuildConfig)' + ArtifactName: 'NativeSymbols' + condition: succeeded() #---------------------------------------------------------------------------------------------------------------------# # PR builds # diff --git a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec index ee7a88b29d..750052c45d 100644 --- a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec +++ b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec @@ -38,11 +38,13 @@ + + From 3e7b66dcd0bb58c575eda182a0aee24819577942 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Fri, 19 Jul 2019 20:17:49 -0700 Subject: [PATCH 185/286] Enable hash algorithm selection (#7252) * Enable hash algorithm selection * Feedback * More feedback * Revert "Feedback" This reverts commit 6ab1b077b413712f552bad9b2562aeb63994ad4c. * feedback --- src/absil/ilwrite.fs | 127 ++++++++++------- src/absil/ilwrite.fsi | 10 +- src/absil/ilwritepdb.fs | 129 ++++++++++++------ src/absil/ilwritepdb.fsi | 12 +- src/fsharp/CompileOps.fs | 4 + src/fsharp/CompileOps.fsi | 3 + src/fsharp/CompileOptions.fs | 12 ++ src/fsharp/FSComp.txt | 2 + src/fsharp/FSharp.Build/Fsc.fs | 15 +- .../FSharp.Build/Microsoft.FSharp.Targets | 1 + .../FSharp.Compiler.Private.fsproj | 6 +- src/fsharp/fsc.fs | 1 + src/fsharp/xlf/FSComp.txt.cs.xlf | 10 ++ src/fsharp/xlf/FSComp.txt.de.xlf | 10 ++ src/fsharp/xlf/FSComp.txt.es.xlf | 10 ++ src/fsharp/xlf/FSComp.txt.fr.xlf | 10 ++ src/fsharp/xlf/FSComp.txt.it.xlf | 10 ++ src/fsharp/xlf/FSComp.txt.ja.xlf | 10 ++ src/fsharp/xlf/FSComp.txt.ko.xlf | 10 ++ src/fsharp/xlf/FSComp.txt.pl.xlf | 10 ++ src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 10 ++ src/fsharp/xlf/FSComp.txt.ru.xlf | 10 ++ src/fsharp/xlf/FSComp.txt.tr.xlf | 10 ++ src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 10 ++ src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 10 ++ .../ProvidedTypes/ProvidedTypes.fs | 2 +- tests/fsharp/.gitignore | 3 +- .../fsc/dumpAllCommandLineOptions/dummy.fs | 1 + .../fsc/help/help40.437.1033.bsl | 4 + 29 files changed, 359 insertions(+), 103 deletions(-) diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index 5d6bfd3ee0..66d2dd9a66 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -3025,7 +3025,8 @@ let generateIL requiredDataFixups (desiredMetadataVersion, generatePdb, ilg : IL //===================================================================== // TABLES+BLOBS --> PHYSICAL METADATA+BLOBS //===================================================================== -let chunk sz next = ({addr=next; size=sz}, next + sz) +let chunk sz next = ({addr=next; size=sz}, next + sz) +let emptychunk next = ({addr=next; size=0}, next) let nochunk next = ({addr= 0x0;size= 0x0; }, next) let count f arr = @@ -3516,7 +3517,7 @@ let writeBytes (os: BinaryWriter) (chunk: byte[]) = os.Write(chunk, 0, chunk.Len let writeBinaryAndReportMappings (outfile, ilg: ILGlobals, pdbfile: string option, signer: ILStrongNameSigner option, portablePDB, embeddedPDB, - embedAllSource, embedSourceList, sourceLink, emitTailcalls, deterministic, showTimes, dumpDebugInfo, pathMap) + embedAllSource, embedSourceList, sourceLink, checksumAlgorithm, emitTailcalls, deterministic, showTimes, dumpDebugInfo, pathMap) modul normalizeAssemblyRefs = // Store the public key from the signer into the manifest. This means it will be written // to the binary and also acts as an indicator to leave space for delay sign @@ -3565,7 +3566,7 @@ let writeBinaryAndReportMappings (outfile, with e -> failwith ("Could not open file for writing (binary mode): " + outfile) - let pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugEmbeddedPdbChunk, textV2P, mappings = + let pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugChecksumPdbChunk, debugEmbeddedPdbChunk, debugDeterministicPdbChunk, textV2P, mappings = try let imageBaseReal = modul.ImageBase // FIXED CHOICE @@ -3670,42 +3671,61 @@ let writeBinaryAndReportMappings (outfile, let pdbOpt = match portablePDB with | true -> - let (uncompressedLength, contentId, stream) as pdbStream = - generatePortablePdb embedAllSource embedSourceList sourceLink showTimes pdbData deterministic pathMap + let (uncompressedLength, contentId, stream, algorithmName, checkSum) as pdbStream = + generatePortablePdb embedAllSource embedSourceList sourceLink checksumAlgorithm showTimes pdbData pathMap - if embeddedPDB then Some (compressPortablePdbStream uncompressedLength contentId stream) + if embeddedPDB then + let uncompressedLength, contentId, stream = compressPortablePdbStream uncompressedLength contentId stream + Some (uncompressedLength, contentId, stream, algorithmName, checkSum) else Some pdbStream | _ -> None - let debugDirectoryChunk, next = - chunk (if pdbfile = None then - 0x0 - else if embeddedPDB && portablePDB then - sizeof_IMAGE_DEBUG_DIRECTORY * 2 + let debugDirectoryChunk, next = + chunk (if pdbfile = None then + 0x0 else - sizeof_IMAGE_DEBUG_DIRECTORY + sizeof_IMAGE_DEBUG_DIRECTORY * 2 + + (if embeddedPDB then sizeof_IMAGE_DEBUG_DIRECTORY else 0) + + (if deterministic then sizeof_IMAGE_DEBUG_DIRECTORY else 0) ) next + // The debug data is given to us by the PDB writer and appears to // typically be the type of the data plus the PDB file name. We fill // this in after we've written the binary. We approximate the size according // to what PDB writers seem to require and leave extra space just in case... let debugDataJustInCase = 40 - let debugDataChunk, next = + let debugDataChunk, next = chunk (align 0x4 (match pdbfile with | None -> 0 | Some f -> (24 + System.Text.Encoding.Unicode.GetByteCount f // See bug 748444 + debugDataJustInCase))) next - let debugEmbeddedPdbChunk, next = - let streamLength = - match pdbOpt with - | Some (_, _, stream) -> int stream.Length - | None -> 0 - chunk (align 0x4 (match embeddedPDB with - | true -> 8 + streamLength - | _ -> 0 )) next + let debugChecksumPdbChunk, next = + chunk (align 0x4 (match pdbOpt with + | Some (_, _, _, algorithmName, checkSum) -> + let alg = System.Text.Encoding.UTF8.GetBytes(algorithmName) + let size = alg.Length + 1 + checkSum.Length + size + | None -> 0)) next + + let debugEmbeddedPdbChunk, next = + if embeddedPDB then + let streamLength = + match pdbOpt with + | Some (_, _, stream, _, _) -> int stream.Length + | None -> 0 + chunk (align 0x4 (match embeddedPDB with + | true -> 8 + streamLength + | _ -> 0 )) next + else + nochunk next + + let debugDeterministicPdbChunk, next = + if deterministic then emptychunk next + else nochunk next + let textSectionSize = next - textSectionAddr let nextPhys = align alignPhys (textSectionPhysLoc + textSectionSize) @@ -3804,35 +3824,39 @@ let writeBinaryAndReportMappings (outfile, if pCurrent <> pExpected then failwith ("warning: "+chunkName+" not where expected, pCurrent = "+string pCurrent+", p.addr = "+string pExpected) writeBytes os chunk - + let writePadding (os: BinaryWriter) _comment sz = if sz < 0 then failwith "writePadding: size < 0" for i = 0 to sz - 1 do os.Write 0uy - + // Now we've computed all the offsets, write the image - + write (Some msdosHeaderChunk.addr) os "msdos header" msdosHeader - + write (Some peSignatureChunk.addr) os "pe signature" [| |] - + writeInt32 os 0x4550 - + write (Some peFileHeaderChunk.addr) os "pe file header" [| |] - + if (modul.Platform = Some AMD64) then writeInt32AsUInt16 os 0x8664 // Machine - IMAGE_FILE_MACHINE_AMD64 elif isItanium then writeInt32AsUInt16 os 0x200 else writeInt32AsUInt16 os 0x014c // Machine - IMAGE_FILE_MACHINE_I386 - + writeInt32AsUInt16 os numSections - let pdbData = + let pdbData = + // Hash code, data and metadata if deterministic then - // Hash code, data and metadata - use sha = System.Security.Cryptography.SHA1.Create() // IncrementalHash is core only + use sha = + match checksumAlgorithm with + | HashAlgorithm.Sha1 -> System.Security.Cryptography.SHA1.Create() :> System.Security.Cryptography.HashAlgorithm + | HashAlgorithm.Sha256 -> System.Security.Cryptography.SHA256.Create() :> System.Security.Cryptography.HashAlgorithm + let hCode = sha.ComputeHash code let hData = sha.ComputeHash data let hMeta = sha.ComputeHash metadata @@ -3848,6 +3872,7 @@ let writeBinaryAndReportMappings (outfile, // Use last 4 bytes for timestamp - High bit set, to stop tool chains becoming confused let timestamp = int final.[16] ||| (int final.[17] <<< 8) ||| (int final.[18] <<< 16) ||| (int (final.[19] ||| 128uy) <<< 24) writeInt32 os timestamp + // Update pdbData with new guid and timestamp. Portable and embedded PDBs don't need the ModuleID // Full and PdbOnly aren't supported under deterministic builds currently, they rely on non-determinsitic Windows native code { pdbData with ModuleID = final.[0..15] ; Timestamp = timestamp } @@ -4133,10 +4158,14 @@ let writeBinaryAndReportMappings (outfile, if pdbfile.IsSome then write (Some (textV2P debugDirectoryChunk.addr)) os "debug directory" (Array.create debugDirectoryChunk.size 0x0uy) write (Some (textV2P debugDataChunk.addr)) os "debug data" (Array.create debugDataChunk.size 0x0uy) + write (Some (textV2P debugChecksumPdbChunk.addr)) os "debug checksum" (Array.create debugChecksumPdbChunk.size 0x0uy) if embeddedPDB then write (Some (textV2P debugEmbeddedPdbChunk.addr)) os "debug data" (Array.create debugEmbeddedPdbChunk.size 0x0uy) + if deterministic then + write (Some (textV2P debugDeterministicPdbChunk.addr)) os "debug deterministic" Array.empty + writePadding os "end of .text" (dataSectionPhysLoc - textSectionPhysLoc - textSectionSize) // DATA SECTION @@ -4182,7 +4211,7 @@ let writeBinaryAndReportMappings (outfile, FileSystemUtilites.setExecutablePermission outfile with _ -> () - pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugEmbeddedPdbChunk, textV2P, mappings + pdbData, pdbOpt, debugDirectoryChunk, debugDataChunk, debugChecksumPdbChunk, debugEmbeddedPdbChunk, debugDeterministicPdbChunk, textV2P, mappings // Looks like a finally with e -> @@ -4207,11 +4236,11 @@ let writeBinaryAndReportMappings (outfile, try let idd = match pdbOpt with - | Some (originalLength, contentId, stream) -> + | Some (originalLength, contentId, stream, algorithmName, checkSum) -> if embeddedPDB then - embedPortablePdbInfo originalLength contentId stream showTimes fpdb debugDataChunk debugEmbeddedPdbChunk + embedPortablePdbInfo originalLength contentId stream showTimes fpdb debugDataChunk debugEmbeddedPdbChunk debugDeterministicPdbChunk debugChecksumPdbChunk algorithmName checkSum embeddedPDB deterministic else - writePortablePdbInfo contentId stream showTimes fpdb pathMap debugDataChunk + writePortablePdbInfo contentId stream showTimes fpdb pathMap debugDataChunk debugDeterministicPdbChunk debugChecksumPdbChunk algorithmName checkSum embeddedPDB deterministic | None -> #if FX_NO_PDB_WRITER Array.empty @@ -4232,16 +4261,17 @@ let writeBinaryAndReportMappings (outfile, writeInt32AsUInt16 os2 i.iddMajorVersion writeInt32AsUInt16 os2 i.iddMinorVersion writeInt32 os2 i.iddType - writeInt32 os2 i.iddData.Length // IMAGE_DEBUG_DIRECTORY.SizeOfData - writeInt32 os2 i.iddChunk.addr // IMAGE_DEBUG_DIRECTORY.AddressOfRawData - writeInt32 os2 (textV2P i.iddChunk.addr) // IMAGE_DEBUG_DIRECTORY.PointerToRawData + writeInt32 os2 i.iddData.Length // IMAGE_DEBUG_DIRECTORY.SizeOfData + writeInt32 os2 i.iddChunk.addr // IMAGE_DEBUG_DIRECTORY.AddressOfRawData + writeInt32 os2 (textV2P i.iddChunk.addr) // IMAGE_DEBUG_DIRECTORY.PointerToRawData // Write the Debug Data for i in idd do - // write the debug raw data as given us by the PDB writer - os2.BaseStream.Seek (int64 (textV2P i.iddChunk.addr), SeekOrigin.Begin) |> ignore - if i.iddChunk.size < i.iddData.Length then failwith "Debug data area is not big enough. Debug info may not be usable" - writeBytes os2 i.iddData + if i.iddChunk.size <> 0 then + // write the debug raw data as given us by the PDB writer + os2.BaseStream.Seek (int64 (textV2P i.iddChunk.addr), SeekOrigin.Begin) |> ignore + if i.iddChunk.size < i.iddData.Length then failwith "Debug data area is not big enough. Debug info may not be usable" + writeBytes os2 i.iddData os2.Dispose() with e -> failwith ("Error while writing debug directory entry: "+e.Message) @@ -4250,9 +4280,7 @@ let writeBinaryAndReportMappings (outfile, with e -> reraise() - end - ignore debugDataChunk - ignore debugEmbeddedPdbChunk + end reportTime showTimes "Finalize PDB" /// Sign the binary. No further changes to binary allowed past this point! @@ -4280,9 +4308,10 @@ type options = embedAllSource: bool embedSourceList: string list sourceLink: string + checksumAlgorithm: HashAlgorithm signer: ILStrongNameSigner option - emitTailcalls : bool - deterministic : bool + emitTailcalls: bool + deterministic: bool showTimes: bool dumpDebugInfo: bool pathMap: PathMap } @@ -4290,5 +4319,5 @@ type options = let WriteILBinary (outfile, (args: options), modul, normalizeAssemblyRefs) = writeBinaryAndReportMappings (outfile, args.ilg, args.pdbfile, args.signer, args.portablePDB, args.embeddedPDB, args.embedAllSource, - args.embedSourceList, args.sourceLink, args.emitTailcalls, args.deterministic, args.showTimes, args.dumpDebugInfo, args.pathMap) modul normalizeAssemblyRefs + args.embedSourceList, args.sourceLink, args.checksumAlgorithm, args.emitTailcalls, args.deterministic, args.showTimes, args.dumpDebugInfo, args.pathMap) modul normalizeAssemblyRefs |> ignore diff --git a/src/absil/ilwrite.fsi b/src/absil/ilwrite.fsi index f1955f82a2..9dba89c9b6 100644 --- a/src/absil/ilwrite.fsi +++ b/src/absil/ilwrite.fsi @@ -1,12 +1,13 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. /// The IL Binary writer. -module internal FSharp.Compiler.AbstractIL.ILBinaryWriter +module internal FSharp.Compiler.AbstractIL.ILBinaryWriter open Internal.Utilities -open FSharp.Compiler.AbstractIL -open FSharp.Compiler.AbstractIL.Internal -open FSharp.Compiler.AbstractIL.IL +open FSharp.Compiler.AbstractIL +open FSharp.Compiler.AbstractIL.Internal +open FSharp.Compiler.AbstractIL.IL +open FSharp.Compiler.AbstractIL.ILPdbWriter [] type ILStrongNameSigner = @@ -24,6 +25,7 @@ type options = embedAllSource: bool embedSourceList: string list sourceLink: string + checksumAlgorithm: HashAlgorithm signer : ILStrongNameSigner option emitTailcalls: bool deterministic: bool diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index 2a992ed485..c1ffd69224 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -11,8 +11,9 @@ open System.Reflection open System.Reflection.Metadata open System.Reflection.Metadata.Ecma335 open System.Reflection.PortableExecutable +open System.Text open Internal.Utilities -open FSharp.Compiler.AbstractIL.IL +open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.AbstractIL.Internal.Support open FSharp.Compiler.AbstractIL.Internal.Library @@ -125,6 +126,27 @@ type idd = iddData: byte[] iddChunk: BinaryChunk } +/// The specified Hash algorithm to use on portable pdb files. +type HashAlgorithm = + | Sha1 + | Sha256 + +// Document checksum algorithms +let guidSha1 = Guid("ff1816ec-aa5e-4d10-87f7-6f4963833460") +let guidSha2 = Guid("8829d00f-11b8-4213-878b-770e8597ac16") + +let checkSum (url: string) (checksumAlgorithm: HashAlgorithm) = + try + use file = FileSystem.FileStreamReadShim url + let guid, alg = + match checksumAlgorithm with + | HashAlgorithm.Sha1 -> guidSha1, System.Security.Cryptography.SHA1.Create() :> System.Security.Cryptography.HashAlgorithm + | HashAlgorithm.Sha256 -> guidSha2, System.Security.Cryptography.SHA256.Create() :> System.Security.Cryptography.HashAlgorithm + + let checkSum = alg.ComputeHash file + Some (guid, checkSum) + with _ -> None + //--------------------------------------------------------------------- // Portable PDB Writer //--------------------------------------------------------------------- @@ -153,7 +175,7 @@ let pdbGetCvDebugInfo (mvid: byte[]) (timestamp: int32) (filepath: string) (cvCh } let pdbMagicNumber= 0x4244504dL -let pdbGetPdbDebugInfo (embeddedPDBChunk: BinaryChunk) (uncompressedLength: int64) (stream: MemoryStream) = +let pdbGetEmbeddedPdbDebugInfo (embeddedPdbChunk: BinaryChunk) (uncompressedLength: int64) (stream: MemoryStream) = let iddPdbBuffer = let buffer = Array.zeroCreate (sizeof + sizeof + int(stream.Length)) let (offset, size) = (0, sizeof) // Magic Number dword: 0x4244504dL @@ -169,28 +191,52 @@ let pdbGetPdbDebugInfo (embeddedPDBChunk: BinaryChunk) (uncompressedLength: int6 iddType = 17 // IMAGE_DEBUG_TYPE_EMBEDDEDPDB iddTimestamp = 0 iddData = iddPdbBuffer // Path name to the pdb file when built - iddChunk = embeddedPDBChunk + iddChunk = embeddedPdbChunk } -let pdbGetDebugInfo (mvid: byte[]) (timestamp: int32) (filepath: string) (cvChunk: BinaryChunk) (embeddedPDBChunk: BinaryChunk option) (uncompressedLength: int64) (stream: MemoryStream option) = - match stream, embeddedPDBChunk with - | None, _ | _, None -> [| pdbGetCvDebugInfo mvid timestamp filepath cvChunk |] - | Some s, Some chunk -> [| pdbGetCvDebugInfo mvid timestamp filepath cvChunk; pdbGetPdbDebugInfo chunk uncompressedLength s |] +let pdbChecksumDebugInfo timestamp (checksumPdbChunk: BinaryChunk) (algorithmName:string) (checksum: byte[]) = + let iddBuffer = + let alg = Encoding.UTF8.GetBytes(algorithmName) + let buffer = Array.zeroCreate (alg.Length + 1 + checksum.Length) + Buffer.BlockCopy(alg, 0, buffer, 0, alg.Length) + Buffer.BlockCopy(checksum, 0, buffer, alg.Length + 1, checksum.Length) + buffer + { iddCharacteristics = 0 // Reserved + iddMajorVersion = 1 // VersionMajor should be 1 + iddMinorVersion = 0x0100 // VersionMinor should be 0x0100 + iddType = 19 // IMAGE_DEBUG_TYPE_CHECKSUMPDB + iddTimestamp = timestamp + iddData = iddBuffer // Path name to the pdb file when built + iddChunk = checksumPdbChunk + } -// Document checksum algorithms -let guidSourceHashMD5 = System.Guid(0x406ea660u, 0x64cfus, 0x4c82us, 0xb6uy, 0xf0uy, 0x42uy, 0xd4uy, 0x81uy, 0x72uy, 0xa7uy, 0x99uy) //406ea660-64cf-4c82-b6f0-42d48172a799 -let hashSizeOfMD5 = 16 +let pdbGetPdbDebugDeterministicInfo (deterministicPdbChunk: BinaryChunk) = + { iddCharacteristics = 0 // Reserved + iddMajorVersion = 0 // VersionMajor should be 0 + iddMinorVersion = 0 // VersionMinor should be 00 + iddType = 16 // IMAGE_DEBUG_TYPE_DETERMINISTIC + iddTimestamp = 0 + iddData = Array.empty // No DATA + iddChunk = deterministicPdbChunk + } -// If the FIPS algorithm policy is enabled on the computer (e.g., for US government employees and contractors) -// then obtaining the MD5 implementation in BCL will throw. -// In this case, catch the failure, and not set a checksum. -let checkSum (url: string) = - try - use file = FileSystem.FileStreamReadShim url - use md5 = System.Security.Cryptography.MD5.Create() - let checkSum = md5.ComputeHash file - Some (guidSourceHashMD5, checkSum) - with _ -> None +let pdbGetDebugInfo (contentId: byte[]) (timestamp: int32) (filepath: string) + (cvChunk: BinaryChunk) + (embeddedPdbChunk: BinaryChunk option) + (deterministicPdbChunk: BinaryChunk) + (checksumPdbChunk: BinaryChunk) (algorithmName:string) (checksum: byte []) + (uncompressedLength: int64) (stream: MemoryStream option) + (embeddedPdb: bool) (deterministic: bool) = + [| yield pdbGetCvDebugInfo contentId timestamp filepath cvChunk + yield pdbChecksumDebugInfo timestamp checksumPdbChunk algorithmName checksum + if embeddedPdb then + match stream, embeddedPdbChunk with + | None, _ | _, None -> () + | Some s, Some chunk -> + yield pdbGetEmbeddedPdbDebugInfo chunk uncompressedLength s + if deterministic then + yield pdbGetPdbDebugDeterministicInfo deterministicPdbChunk + |] //------------------------------------------------------------------------------ // PDB Writer. The function [WritePdbInfo] abstracts the @@ -219,7 +265,7 @@ let getRowCounts tableRowCounts = tableRowCounts |> Seq.iter(fun x -> builder.Add x) builder.MoveToImmutable() -let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (sourceLink: string) showTimes (info: PdbData) isDeterministic (pathMap: PathMap) = +let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (sourceLink: string) checksumAlgorithm showTimes (info: PdbData) (pathMap: PathMap) = sortMethods showTimes info let externalRowCounts = getRowCounts info.TableRowCounts let docs = @@ -286,7 +332,7 @@ let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (s metadata.SetCapacity(TableIndex.Document, docLength) for doc in docs do let handle = - match checkSum doc.File with + match checkSum doc.File checksumAlgorithm with | Some (hashAlg, checkSum) -> let dbgInfo = (serializeDocumentName doc.File, @@ -481,25 +527,28 @@ let generatePortablePdb (embedAllSource: bool) (embedSourceList: string list) (s | None -> MetadataTokens.MethodDefinitionHandle 0 | Some x -> MetadataTokens.MethodDefinitionHandle x - let deterministicIdProvider isDeterministic : System.Func, BlobContentId> = - match isDeterministic with - | false -> null - | true -> - let convert (content: IEnumerable) = - use sha = System.Security.Cryptography.SHA1.Create() // IncrementalHash is core only - let hash = content - |> Seq.collect (fun c -> c.GetBytes().Array |> sha.ComputeHash) - |> Array.ofSeq |> sha.ComputeHash - BlobContentId.FromHash hash - System.Func, BlobContentId>( convert ) - - let serializer = PortablePdbBuilder(metadata, externalRowCounts, entryPoint, deterministicIdProvider isDeterministic) + // Compute the contentId for the pdb. Always do it deterministically, since we have to compute the anyway. + // The contentId is the hash of the ID using whichever algorithm has been specified to the compiler + let mutable contentHash = Array.empty + + let algorithmName, hashAlgorithm = + match checksumAlgorithm with + | HashAlgorithm.Sha1 -> "SHA1", System.Security.Cryptography.SHA1.Create() :> System.Security.Cryptography.HashAlgorithm + | HashAlgorithm.Sha256 -> "SHA256", System.Security.Cryptography.SHA256.Create() :> System.Security.Cryptography.HashAlgorithm + let idProvider: System.Func, BlobContentId> = + let convert (content: IEnumerable) = + let contentBytes = content |> Seq.collect (fun c -> c.GetBytes()) |> Array.ofSeq + contentHash <- contentBytes |> hashAlgorithm.ComputeHash + BlobContentId.FromHash contentHash + System.Func, BlobContentId>(convert) + + let serializer = PortablePdbBuilder(metadata, externalRowCounts, entryPoint, idProvider) let blobBuilder = new BlobBuilder() let contentId= serializer.Serialize blobBuilder let portablePdbStream = new MemoryStream() blobBuilder.WriteContentTo portablePdbStream reportTime showTimes "PDB: Created" - (portablePdbStream.Length, contentId, portablePdbStream) + (portablePdbStream.Length, contentId, portablePdbStream, algorithmName, contentHash) let compressPortablePdbStream (uncompressedLength: int64) (contentId: BlobContentId) (stream: MemoryStream) = let compressedStream = new MemoryStream() @@ -507,17 +556,17 @@ let compressPortablePdbStream (uncompressedLength: int64) (contentId: BlobConten stream.WriteTo compressionStream (uncompressedLength, contentId, compressedStream) -let writePortablePdbInfo (contentId: BlobContentId) (stream: MemoryStream) showTimes fpdb pathMap cvChunk = +let writePortablePdbInfo (contentId: BlobContentId) (stream: MemoryStream) showTimes fpdb pathMap cvChunk deterministicPdbChunk checksumPdbChunk algName checksum embeddedPdb deterministicPdb = try FileSystem.FileDelete fpdb with _ -> () use pdbFile = new FileStream(fpdb, FileMode.Create, FileAccess.ReadWrite) stream.WriteTo pdbFile reportTime showTimes "PDB: Closed" - pdbGetDebugInfo (contentId.Guid.ToByteArray()) (int32 (contentId.Stamp)) (PathMap.apply pathMap fpdb) cvChunk None 0L None + pdbGetDebugInfo (contentId.Guid.ToByteArray()) (int32 (contentId.Stamp)) (PathMap.apply pathMap fpdb) cvChunk None deterministicPdbChunk checksumPdbChunk algName checksum 0L None embeddedPdb deterministicPdb -let embedPortablePdbInfo (uncompressedLength: int64) (contentId: BlobContentId) (stream: MemoryStream) showTimes fpdb cvChunk pdbChunk = +let embedPortablePdbInfo (uncompressedLength: int64) (contentId: BlobContentId) (stream: MemoryStream) showTimes fpdb cvChunk pdbChunk deterministicPdbChunk checksumPdbChunk algName checksum embeddedPdb deterministicPdb = reportTime showTimes "PDB: Closed" let fn = Path.GetFileName fpdb - pdbGetDebugInfo (contentId.Guid.ToByteArray()) (int32 (contentId.Stamp)) fn cvChunk (Some pdbChunk) uncompressedLength (Some stream) + pdbGetDebugInfo (contentId.Guid.ToByteArray()) (int32 (contentId.Stamp)) fn cvChunk (Some pdbChunk) deterministicPdbChunk checksumPdbChunk algName checksum uncompressedLength (Some stream) embeddedPdb deterministicPdb #if !FX_NO_PDB_WRITER //--------------------------------------------------------------------- diff --git a/src/absil/ilwritepdb.fsi b/src/absil/ilwritepdb.fsi index 2713d9769b..748e178a46 100644 --- a/src/absil/ilwritepdb.fsi +++ b/src/absil/ilwritepdb.fsi @@ -4,7 +4,7 @@ module internal FSharp.Compiler.AbstractIL.ILPdbWriter open Internal.Utilities -open FSharp.Compiler.AbstractIL.IL +open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.ErrorLogger open FSharp.Compiler.Range open System.Collections.Generic @@ -83,10 +83,14 @@ type idd = iddData: byte[]; iddChunk: BinaryChunk } -val generatePortablePdb : embedAllSource:bool -> embedSourceList:string list -> sourceLink: string -> showTimes:bool -> info:PdbData -> isDeterministic:bool -> pathMap:PathMap -> (int64 * BlobContentId * MemoryStream) +type HashAlgorithm = + | Sha1 + | Sha256 + +val generatePortablePdb : embedAllSource: bool -> embedSourceList: string list -> sourceLink: string -> checksumAlgorithm: HashAlgorithm -> showTimes: bool -> info: PdbData -> pathMap:PathMap -> (int64 * BlobContentId * MemoryStream * string * byte[]) val compressPortablePdbStream : uncompressedLength:int64 -> contentId:BlobContentId -> stream:MemoryStream -> (int64 * BlobContentId * MemoryStream) -val embedPortablePdbInfo : uncompressedLength:int64 -> contentId:BlobContentId -> stream:MemoryStream -> showTimes:bool -> fpdb:string -> cvChunk:BinaryChunk -> pdbChunk:BinaryChunk -> idd[] -val writePortablePdbInfo : contentId:BlobContentId -> stream:MemoryStream -> showTimes:bool -> fpdb:string -> pathMap:PathMap -> cvChunk:BinaryChunk -> idd[] +val embedPortablePdbInfo: uncompressedLength: int64 -> contentId: BlobContentId -> stream: MemoryStream -> showTimes: bool -> fpdb: string -> cvChunk: BinaryChunk -> pdbChunk: BinaryChunk -> deterministicPdbChunk: BinaryChunk -> checksumPdbChunk: BinaryChunk -> algorithmName: string -> checksum: byte[] -> embeddedPDB: bool -> deterministic: bool -> idd[] +val writePortablePdbInfo: contentId: BlobContentId -> stream: MemoryStream -> showTimes: bool -> fpdb: string -> pathMap: PathMap -> cvChunk: BinaryChunk -> deterministicPdbChunk: BinaryChunk -> checksumPdbChunk: BinaryChunk -> algorithmName: string -> checksum: byte[] -> embeddedPDB: bool -> deterministic: bool -> idd[] #if !FX_NO_PDB_WRITER val writePdbInfo : showTimes:bool -> f:string -> fpdb:string -> info:PdbData -> cvChunk:BinaryChunk -> idd[] diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 85728909cf..5b75cf1077 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -17,6 +17,7 @@ open Internal.Utilities.Text open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.ILBinaryReader +open FSharp.Compiler.AbstractIL.ILPdbWriter open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.AbstractIL.Extensions.ILX @@ -2100,6 +2101,7 @@ type TcConfigBuilder = mutable maxErrors: int mutable abortOnError: bool (* intended for fsi scripts that should exit on first error *) mutable baseAddress: int32 option + mutable checksumAlgorithm: HashAlgorithm #if DEBUG mutable showOptimizationData: bool #endif @@ -2231,6 +2233,7 @@ type TcConfigBuilder = maxErrors = 100 abortOnError = false baseAddress = None + checksumAlgorithm = HashAlgorithm.Sha256 delaysign = false publicsign = false @@ -2740,6 +2743,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = member x.flatErrors = data.flatErrors member x.maxErrors = data.maxErrors member x.baseAddress = data.baseAddress + member x.checksumAlgorithm = data.checksumAlgorithm #if DEBUG member x.showOptimizationData = data.showOptimizationData #endif diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 71bb7c6f8b..1262542cd9 100644 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -10,6 +10,7 @@ open Internal.Utilities open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.IL open FSharp.Compiler.AbstractIL.ILBinaryReader +open FSharp.Compiler.AbstractIL.ILPdbWriter open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler open FSharp.Compiler.TypeChecker @@ -337,6 +338,7 @@ type TcConfigBuilder = mutable maxErrors: int mutable abortOnError: bool mutable baseAddress: int32 option + mutable checksumAlgorithm: HashAlgorithm #if DEBUG mutable showOptimizationData: bool #endif @@ -497,6 +499,7 @@ type TcConfig = member maxErrors: int member baseAddress: int32 option + member checksumAlgorithm: HashAlgorithm #if DEBUG member showOptimizationData: bool #endif diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index 0c385cc367..e548a49e71 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -9,6 +9,7 @@ open System open FSharp.Compiler open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.IL +open FSharp.Compiler.AbstractIL.ILPdbWriter open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.AbstractIL.Extensions.ILX open FSharp.Compiler.AbstractIL.Diagnostics @@ -522,6 +523,7 @@ let tagFullPDBOnlyPortable = "{full|pdbonly|portable|embedded}" let tagWarnList = "" let tagSymbolList = "" let tagAddress = "
    " +let tagAlgorithm = "{SHA1|SHA256}" let tagInt = "" let tagPathMap = "" let tagNone = "" @@ -933,6 +935,16 @@ let advancedFlagsFsc tcConfigB = OptionString (fun s -> tcConfigB.baseAddress <- Some(int32 s)), None, Some (FSComp.SR.optsBaseaddress())) + yield CompilerOption + ("checksumalgorithm", tagAlgorithm, + OptionString (fun s -> + tcConfigB.checksumAlgorithm <- + match s.ToUpperInvariant() with + | "SHA1" -> HashAlgorithm.Sha1 + | "SHA256" -> HashAlgorithm.Sha256 + | _ -> error(Error(FSComp.SR.optsUnknownChecksumAlgorithm s, rangeCmdArgs))), None, + Some (FSComp.SR.optsChecksumAlgorithm())) + yield noFrameworkFlag true tcConfigB yield CompilerOption diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index ee2b41f2e9..831597c031 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -878,6 +878,7 @@ optsUtf8output,"Output messages in UTF-8 encoding" optsFullpaths,"Output messages with fully qualified paths" optsLib,"Specify a directory for the include path which is used to resolve source files and assemblies (Short form: -I)" optsBaseaddress,"Base address for the library to be built" +optsChecksumAlgorithm,"Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default)" optsNoframework,"Do not reference the default CLI assemblies by default" optsStandalone,"Statically link the F# library and all referenced DLLs that depend on it into the assembly being generated" optsStaticlink,"Statically link the given assembly and all referenced DLLs that depend on this assembly. Use an assembly name e.g. mylib, not a DLL name." @@ -900,6 +901,7 @@ optsHelpBannerLanguage,"- LANGUAGE -" optsHelpBannerErrsAndWarns,"- ERRORS AND WARNINGS -" 1063,optsUnknownArgumentToTheTestSwitch,"Unknown --test argument: '%s'" 1064,optsUnknownPlatform,"Unrecognized platform '%s', valid values are 'x86', 'x64', 'Itanium', 'anycpu32bitpreferred', and 'anycpu'" +1065,optsUnknownChecksumAlgorithm,"Algorithm '%s' is not supported" optsInternalNoDescription,"The command-line option '%s' is for test purposes only" optsDCLONoDescription,"The command-line option '%s' has been deprecated" optsDCLODeprecatedSuggestAlternative,"The command-line option '%s' has been deprecated. Use '%s' instead." diff --git a/src/fsharp/FSharp.Build/Fsc.fs b/src/fsharp/FSharp.Build/Fsc.fs index 19d8cd171f..8080637fcd 100644 --- a/src/fsharp/FSharp.Build/Fsc.fs +++ b/src/fsharp/FSharp.Build/Fsc.fs @@ -24,6 +24,7 @@ type public Fsc () as this = let mutable baseAddress : string = null let mutable capturedArguments : string list = [] // list of individual args, to pass to HostObject Compile() let mutable capturedFilenames : string list = [] // list of individual source filenames, to pass to HostObject Compile() + let mutable checksumAlgorithm: string = null let mutable codePage : string = null let mutable commandLineArgs : ITaskItem list = [] let mutable debugSymbols = false @@ -135,7 +136,7 @@ type public Fsc () as this = builder.AppendSwitch("--tailcalls-") // PdbFile builder.AppendSwitchIfNotNull("--pdb:", pdbFile) - // Platform +// Platform builder.AppendSwitchIfNotNull("--platform:", let ToUpperInvariant (s:string) = if s = null then null else s.ToUpperInvariant() match ToUpperInvariant(platform), prefer32bit, ToUpperInvariant(targetType) with @@ -145,6 +146,13 @@ type public Fsc () as this = | "X86", _, _ -> "x86" | "X64", _, _ -> "x64" | _ -> null) + // checksumAlgorithm + builder.AppendSwitchIfNotNull("--checksumalgorithm:", + let ToUpperInvariant (s:string) = if s = null then null else s.ToUpperInvariant() + match ToUpperInvariant(checksumAlgorithm) with + | "SHA1" -> "Sha1" + | "SHA256" -> "Sha256" + | _ -> null) // Resources if resources <> null then for item in resources do @@ -258,6 +266,11 @@ type public Fsc () as this = with get() = baseAddress and set(s) = baseAddress <- s + // --checksumalgorithm + member fsc.ChecksumAlgorithm + with get() = checksumAlgorithm + and set(s) = checksumAlgorithm <- s + // --codepage : Specify the codepage to use when opening source files member fsc.CodePage with get() = codePage diff --git a/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets b/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets index c36ce52c50..a5d036b885 100644 --- a/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets +++ b/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets @@ -276,6 +276,7 @@ this file. AbsIL\ilread.fs - - AbsIL\ilwrite.fsi - AbsIL\ilwritepdb.fsi AbsIL\ilwritepdb.fs + + AbsIL\ilwrite.fsi + AbsIL\ilwrite.fs diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index e4e693e99c..7799d409e5 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -2145,6 +2145,7 @@ let main4 dynamicAssemblyCreator (Args (ctok, tcConfig, tcImports: TcImports, t embedAllSource = tcConfig.embedAllSource embedSourceList = tcConfig.embedSourceList sourceLink = tcConfig.sourceLink + checksumAlgorithm = tcConfig.checksumAlgorithm signer = GetStrongNameSigner signingInfo dumpDebugInfo = tcConfig.dumpDebugInfo pathMap = tcConfig.pathMap }, diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index 3354ee57b5..883582e5e6 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -7,6 +7,16 @@ {0} for F# {1} + + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + + + + Algorithm '{0}' is not supported + Algorithm '{0}' is not supported + + The namespace '{0}' is not defined. Není definovaný obor názvů {0}. diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index 320acf4e03..12791db46f 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -7,6 +7,16 @@ {0} for F# {1} + + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + + + + Algorithm '{0}' is not supported + Algorithm '{0}' is not supported + + The namespace '{0}' is not defined. Der Namespace "{0}" ist nicht definiert. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index b08960e486..e4096bec53 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -7,6 +7,16 @@ {0} for F# {1} + + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + + + + Algorithm '{0}' is not supported + Algorithm '{0}' is not supported + + The namespace '{0}' is not defined. El espacio de nombres "{0}" no está definido. diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index f23037f6a8..1a0d745e9f 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -7,6 +7,16 @@ {0} for F# {1} + + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + + + + Algorithm '{0}' is not supported + Algorithm '{0}' is not supported + + The namespace '{0}' is not defined. L'espace de noms '{0}' n'est pas défini. diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 32637f988d..baec2ba7fd 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -7,6 +7,16 @@ {0} for F# {1} + + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + + + + Algorithm '{0}' is not supported + Algorithm '{0}' is not supported + + The namespace '{0}' is not defined. Lo spazio dei nomi '{0}' non è definito. diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 8157060c9d..a2a18f153a 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -7,6 +7,16 @@ {0} for F# {1} + + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + + + + Algorithm '{0}' is not supported + Algorithm '{0}' is not supported + + The namespace '{0}' is not defined. 名前空間 '{0}' が定義されていません。 diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index f642d6b444..92ead77838 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -7,6 +7,16 @@ {0} for F# {1} + + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + + + + Algorithm '{0}' is not supported + Algorithm '{0}' is not supported + + The namespace '{0}' is not defined. '{0}' 네임스페이스가 정의되지 않았습니다. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index b9749bedda..0187c22d01 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -7,6 +7,16 @@ {0} for F# {1} + + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + + + + Algorithm '{0}' is not supported + Algorithm '{0}' is not supported + + The namespace '{0}' is not defined. Nie zdefiniowano przestrzeni nazw „{0}”. diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 39537bc8cd..1ed97eb22d 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -7,6 +7,16 @@ {0} for F# {1} + + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + + + + Algorithm '{0}' is not supported + Algorithm '{0}' is not supported + + The namespace '{0}' is not defined. O namespace '{0}' não está definido. diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index fcd4c723f7..bdeac0f959 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -7,6 +7,16 @@ {0} for F# {1} + + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + + + + Algorithm '{0}' is not supported + Algorithm '{0}' is not supported + + The namespace '{0}' is not defined. Пространство имен "{0}" не определено. diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index 8092970883..de62c337f5 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -7,6 +7,16 @@ {0} for F# {1} + + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + + + + Algorithm '{0}' is not supported + Algorithm '{0}' is not supported + + The namespace '{0}' is not defined. '{0}' ad alanı tanımlı değil. diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index 1a7945d712..b0264288fb 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -7,6 +7,16 @@ {0} for F# {1} + + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + + + + Algorithm '{0}' is not supported + Algorithm '{0}' is not supported + + The namespace '{0}' is not defined. 未定义命名空间“{0}”。 diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 0f67d46dbc..ab73b60a7f 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -7,6 +7,16 @@ {0} for F# {1} + + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + + + + Algorithm '{0}' is not supported + Algorithm '{0}' is not supported + + The namespace '{0}' is not defined. 未定義命名空間 '{0}'。 diff --git a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs index 4597451990..f6395b91c4 100644 --- a/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs +++ b/tests/EndToEndBuildTests/ProvidedTypes/ProvidedTypes.fs @@ -12495,7 +12495,7 @@ namespace ProviderImplementation.ProvidedTypes let pdbOpt = match portablePDB with | true -> - let (uncompressedLength, contentId, stream) as pdbStream = generatePortablePdb embedAllSource embedSourceList sourceLink showTimes pdbData deterministic + let (uncompressedLength, contentId, stream) as pdbStream = generatePortablePdb embedAllSource embedSourceList sourceLink showTimes pdbData if embeddedPDB then Some (compressPortablePdbStream uncompressedLength contentId stream) else Some (pdbStream) | _ -> None diff --git a/tests/fsharp/.gitignore b/tests/fsharp/.gitignore index 0493c88179..ea4771517d 100644 --- a/tests/fsharp/.gitignore +++ b/tests/fsharp/.gitignore @@ -13,4 +13,5 @@ Library1.dll cd.tmp - +*.err +*.vserr diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fs b/tests/fsharpqa/Source/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fs index 65d7f3ba86..0c3c619c33 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fs +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fs @@ -39,6 +39,7 @@ //section='- ADVANCED - ' ! option=fullpaths kind=OptionUnit //section='- ADVANCED - ' ! option=lib kind=OptionStringList //section='- ADVANCED - ' ! option=baseaddress kind=OptionString +//section='- ADVANCED - ' ! option=checksumalgorithm kind=OptionString //section='- ADVANCED - ' ! option=noframework kind=OptionUnit //section='- ADVANCED - ' ! option=standalone kind=OptionUnit //section='- ADVANCED - ' ! option=staticlink kind=OptionString diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl index b0fd674681..9309a03e5e 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl @@ -133,6 +133,10 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. Default - mscorlib --baseaddress:
    Base address for the library to be built +--checksumalgorithm:{SHA1|SHA256} Specify algorithm for calculating + source file checksum stored in PDB. + Supported values are: SHA1 or SHA256 + (default) --noframework Do not reference the default CLI assemblies by default --standalone Statically link the F# library and From c70ead8048a2dd7865195bd90edfd64a260dc1e9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 20 Jul 2019 10:04:05 -0700 Subject: [PATCH 186/286] Update dependencies from https://github.com/dotnet/arcade build 20190719.2 (#7260) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19369.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7a60463a0f..7228968c11 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - eecde8a8751dbe7fdb17ba4dfbd032e26f4cae7d + a190d4865fe3c86a168ec49c4fc61c90c96ae051 diff --git a/global.json b/global.json index 78425fae2e..c8c5b12939 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19368.7", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19369.2", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From ff7b8ff392cee40388a08e377138030784c7cc35 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Mon, 22 Jul 2019 12:24:18 -0700 Subject: [PATCH 187/286] Improve netcore reference selection (#7263) * Improve netcore reference selection * Update baselines --- tests/fsharp/Compiler/CompilerAssert.fs | 87 ++++++++++-- .../Language/SpanOptimizationTests.fs | 124 +++++++++--------- 2 files changed, 136 insertions(+), 75 deletions(-) diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index ade3ca8e4a..52ec325df8 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -32,6 +32,76 @@ module CompilerAssert = let private config = TestFramework.initializeSuite () + +// Do a one time dotnet sdk build to compute the proper set of reference assemblies to pass to the compiler +#if !NETCOREAPP +#else + let projectFile = """ + + + + Exe + netcoreapp2.1 + + + + + + + + +""" + + let programFs = """ +open System + +[] +let main argv = 0""" + + let getNetCoreAppReferences = + let mutable output = "" + let mutable errors = "" + let mutable cleanUp = true + let projectDirectory = Path.Combine(Path.GetTempPath(), "netcoreapp2.1", Path.GetRandomFileName()) + try + try + Directory.CreateDirectory(projectDirectory) |> ignore + let projectFileName = Path.Combine(projectDirectory, "ProjectFile.fsproj") + let programFsFileName = Path.Combine(projectDirectory, "Program.fs") + let frameworkReferencesFileName = Path.Combine(projectDirectory, "FrameworkReferences.txt") + + File.WriteAllText(projectFileName, projectFile) + File.WriteAllText(programFsFileName, programFs) + + let pInfo = ProcessStartInfo () + + pInfo.FileName <- config.DotNetExe + pInfo.Arguments <- "build" + pInfo.WorkingDirectory <- projectDirectory + pInfo.RedirectStandardOutput <- true + pInfo.RedirectStandardError <- true + pInfo.UseShellExecute <- false + + let p = Process.Start(pInfo) + p.WaitForExit() + + output <- p.StandardOutput.ReadToEnd () + errors <- p.StandardError.ReadToEnd () + if not (String.IsNullOrWhiteSpace errors) then Assert.Fail errors + + if p.ExitCode <> 0 then Assert.Fail(sprintf "Program exited with exit code %d" p.ExitCode) + + File.ReadLines(frameworkReferencesFileName) |> Seq.toArray + with | e -> + cleanUp <- false + printfn "%s" output + printfn "%s" errors + raise (new Exception (sprintf "An error occured getting netcoreapp references: %A" e)) + finally + if cleanUp then + try Directory.Delete(projectDirectory) with | _ -> () +#endif + let private defaultProjectOptions = { ProjectFileName = "Z:\\test.fsproj" @@ -41,14 +111,7 @@ module CompilerAssert = OtherOptions = [|"--preferreduilang:en-US";|] #else OtherOptions = - // Hack: Currently a hack to get the runtime assemblies for netcore in order to compile. - let assemblies = - typeof.Assembly.Location - |> Path.GetDirectoryName - |> Directory.EnumerateFiles - |> Seq.toArray - |> Array.filter (fun x -> x.ToLowerInvariant().Contains("system.")) - |> Array.map (fun x -> sprintf "-r:%s" x) + let assemblies = getNetCoreAppReferences |> Array.map (fun x -> sprintf "-r:%s" x) Array.append [|"--preferreduilang:en-US"; "--targetprofile:netcore"; "--noframework"|] assemblies #endif ReferencedProjects = [||] @@ -60,7 +123,7 @@ module CompilerAssert = ExtraProjectInfo = None Stamp = None } - + let private gate = obj () let private compile isExe source f = @@ -110,8 +173,6 @@ module CompilerAssert = Assert.IsEmpty(typeCheckResults.Errors, sprintf "Type Check errors: %A" typeCheckResults.Errors) - - let TypeCheckWithErrors (source: string) expectedTypeErrors = lock gate <| fun () -> let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, defaultProjectOptions) |> Async.RunSynchronously @@ -141,7 +202,7 @@ module CompilerAssert = TypeCheckWithErrors (source: string) [| expectedServerity, expectedErrorNumber, expectedErrorRange, expectedErrorMsg |] let CompileExe (source: string) = - compile true source (fun (errors, _) -> + compile true source (fun (errors, _) -> if errors.Length > 0 then Assert.Fail (sprintf "Compile had warnings and/or errors: %A" errors)) @@ -216,7 +277,7 @@ module CompilerAssert = ||> Seq.iter2 (fun expectedErrorMessage errorMessage -> Assert.AreEqual(expectedErrorMessage, errorMessage) ) - + let ParseWithErrors (source: string) expectedParseErrors = let parseResults = checker.ParseFile("test.fs", SourceText.ofString source, FSharpParsingOptions.Default) |> Async.RunSynchronously diff --git a/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs b/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs index efcea68afd..c5fd682e99 100644 --- a/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs +++ b/tests/fsharp/Compiler/Language/SpanOptimizationTests.fs @@ -27,45 +27,45 @@ let test () = verifier.VerifyIL [ """.method public static void test() cil managed -{ - - .maxstack 5 - .locals init (valuetype [System.Private.CoreLib]System.Span`1 V_0, - int32 V_1, - valuetype [System.Private.CoreLib]System.Int32 V_2, - class [System.Private.CoreLib]System.Object& V_3) - IL_0000: call valuetype [System.Private.CoreLib]System.Span`1 valuetype [System.Private.CoreLib]System.Span`1::get_Empty() - IL_0005: stloc.0 - IL_0006: ldc.i4.0 - IL_0007: stloc.2 - IL_0008: ldloca.s V_0 - IL_000a: call instance int32 valuetype [System.Private.CoreLib]System.Span`1::get_Length() - IL_000f: ldc.i4.1 - IL_0010: sub - IL_0011: stloc.1 - IL_0012: ldloc.1 - IL_0013: ldloc.2 - IL_0014: blt.s IL_0034 - - IL_0016: ldloca.s V_0 - IL_0018: ldloc.2 - IL_0019: call instance !0& valuetype [System.Private.CoreLib]System.Span`1::get_Item(int32) - IL_001e: stloc.3 - IL_001f: ldloc.3 - IL_0020: ldobj [System.Private.CoreLib]System.Object - IL_0025: call void [System.Console]System.Console::WriteLine(object) - IL_002a: ldloc.2 - IL_002b: ldc.i4.1 - IL_002c: add - IL_002d: stloc.2 - IL_002e: ldloc.2 - IL_002f: ldloc.1 - IL_0030: ldc.i4.1 - IL_0031: add - IL_0032: bne.un.s IL_0016 - - IL_0034: ret -} """ + { + + .maxstack 5 + .locals init (valuetype [System.Runtime]System.Span`1 V_0, + int32 V_1, + int32 V_2, + object& V_3) + IL_0000: call valuetype [System.Runtime]System.Span`1 valuetype [System.Runtime]System.Span`1::get_Empty() + IL_0005: stloc.0 + IL_0006: ldc.i4.0 + IL_0007: stloc.2 + IL_0008: ldloca.s V_0 + IL_000a: call instance int32 valuetype [System.Runtime]System.Span`1::get_Length() + IL_000f: ldc.i4.1 + IL_0010: sub + IL_0011: stloc.1 + IL_0012: ldloc.1 + IL_0013: ldloc.2 + IL_0014: blt.s IL_0034 + + IL_0016: ldloca.s V_0 + IL_0018: ldloc.2 + IL_0019: call instance !0& valuetype [System.Runtime]System.Span`1::get_Item(int32) + IL_001e: stloc.3 + IL_001f: ldloc.3 + IL_0020: ldobj [System.Runtime]System.Object + IL_0025: call void [System.Console]System.Console::WriteLine(object) + IL_002a: ldloc.2 + IL_002b: ldc.i4.1 + IL_002c: add + IL_002d: stloc.2 + IL_002e: ldloc.2 + IL_002f: ldloc.1 + IL_0030: ldc.i4.1 + IL_0031: add + IL_0032: bne.un.s IL_0016 + + IL_0034: ret + }""" ]) [] @@ -88,18 +88,18 @@ let test () = [ """.method public static void test() cil managed { - + .maxstack 5 - .locals init (valuetype [System.Private.CoreLib]System.ReadOnlySpan`1 V_0, + .locals init (valuetype [System.Runtime]System.ReadOnlySpan`1 V_0, int32 V_1, - valuetype [System.Private.CoreLib]System.Int32 V_2, - class [System.Private.CoreLib]System.Object& V_3) - IL_0000: call valuetype [System.Private.CoreLib]System.ReadOnlySpan`1 valuetype [System.Private.CoreLib]System.ReadOnlySpan`1::get_Empty() + int32 V_2, + object& V_3) + IL_0000: call valuetype [System.Runtime]System.ReadOnlySpan`1 valuetype [System.Runtime]System.ReadOnlySpan`1::get_Empty() IL_0005: stloc.0 IL_0006: ldc.i4.0 IL_0007: stloc.2 IL_0008: ldloca.s V_0 - IL_000a: call instance int32 valuetype [System.Private.CoreLib]System.ReadOnlySpan`1::get_Length() + IL_000a: call instance int32 valuetype [System.Runtime]System.ReadOnlySpan`1::get_Length() IL_000f: ldc.i4.1 IL_0010: sub IL_0011: stloc.1 @@ -109,10 +109,10 @@ let test () = IL_0016: ldloca.s V_0 IL_0018: ldloc.2 - IL_0019: call instance !0& modreq([System.Private.CoreLib]System.Runtime.InteropServices.InAttribute) valuetype [System.Private.CoreLib]System.ReadOnlySpan`1::get_Item(int32) + IL_0019: call instance !0& modreq([System.Runtime]System.Runtime.InteropServices.InAttribute) valuetype [System.Runtime]System.ReadOnlySpan`1::get_Item(int32) IL_001e: stloc.3 IL_001f: ldloc.3 - IL_0020: ldobj [System.Private.CoreLib]System.Object + IL_0020: ldobj [System.Runtime]System.Object IL_0025: call void [System.Console]System.Console::WriteLine(object) IL_002a: ldloc.2 IL_002b: ldc.i4.1 @@ -176,29 +176,29 @@ module Test = [ """.method public static void test() cil managed { - + .maxstack 3 - .locals init (valuetype System.Span`1 V_0, - class [System.Private.CoreLib]System.Collections.IEnumerator V_1, + .locals init (valuetype System.Span`1 V_0, + class [System.Runtime]System.Collections.IEnumerator V_1, class [FSharp.Core]Microsoft.FSharp.Core.Unit V_2, - class [System.Private.CoreLib]System.IDisposable V_3) + class [System.Runtime]System.IDisposable V_3) IL_0000: ldc.i4.0 - IL_0001: newarr [System.Private.CoreLib]System.Object - IL_0006: newobj instance void valuetype System.Span`1::.ctor(!0[]) + IL_0001: newarr [System.Runtime]System.Object + IL_0006: newobj instance void valuetype System.Span`1::.ctor(!0[]) IL_000b: stloc.0 IL_000c: ldloc.0 - IL_000d: box valuetype System.Span`1 - IL_0012: unbox.any [System.Private.CoreLib]System.Collections.IEnumerable - IL_0017: callvirt instance class [System.Private.CoreLib]System.Collections.IEnumerator [System.Private.CoreLib]System.Collections.IEnumerable::GetEnumerator() + IL_000d: box valuetype System.Span`1 + IL_0012: unbox.any [System.Runtime]System.Collections.IEnumerable + IL_0017: callvirt instance class [System.Runtime]System.Collections.IEnumerator [System.Runtime]System.Collections.IEnumerable::GetEnumerator() IL_001c: stloc.1 .try { IL_001d: ldloc.1 - IL_001e: callvirt instance bool [System.Private.CoreLib]System.Collections.IEnumerator::MoveNext() + IL_001e: callvirt instance bool [System.Runtime]System.Collections.IEnumerator::MoveNext() IL_0023: brfalse.s IL_0032 IL_0025: ldloc.1 - IL_0026: callvirt instance object [System.Private.CoreLib]System.Collections.IEnumerator::get_Current() + IL_0026: callvirt instance object [System.Runtime]System.Collections.IEnumerator::get_Current() IL_002b: call void [System.Console]System.Console::WriteLine(object) IL_0030: br.s IL_001d @@ -206,24 +206,24 @@ module Test = IL_0033: stloc.2 IL_0034: leave.s IL_004c - } + } finally { IL_0036: ldloc.1 - IL_0037: isinst [System.Private.CoreLib]System.IDisposable + IL_0037: isinst [System.Runtime]System.IDisposable IL_003c: stloc.3 IL_003d: ldloc.3 IL_003e: brfalse.s IL_0049 IL_0040: ldloc.3 - IL_0041: callvirt instance void [System.Private.CoreLib]System.IDisposable::Dispose() + IL_0041: callvirt instance void [System.Runtime]System.IDisposable::Dispose() IL_0046: ldnull IL_0047: pop IL_0048: endfinally IL_0049: ldnull IL_004a: pop IL_004b: endfinally - } + } IL_004c: ldloc.2 IL_004d: pop IL_004e: ret From d53a38c019b361a1f5b72362f199c86e829adc7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Chassaing?= Date: Tue, 23 Jul 2019 00:57:02 +0200 Subject: [PATCH 188/286] Moving Libraries Control tests to NUnit (#7234) * Moving Libraries Control tests to NUnit * Names tests as Async instead of Control --- tests/fsharp/FSharpSuite.Tests.fsproj | 1 + tests/fsharp/Libraries/Async/AsyncTests.fs | 168 ++++++++++++++++++ .../Control/ExecuteAsyncMultipleTimes01.fs | 17 -- .../Libraries/Control/JoiningStartChild01.fs | 25 --- .../Control/MailboxAsyncNoStackOverflow01.fs | 78 -------- .../StartChildNoObjectDisposedException01.fs | 12 -- .../StartChildTestTrampolineHijackLimit01.fs | 19 -- .../fsharpqa/Source/Libraries/Control/env.lst | 6 - 8 files changed, 169 insertions(+), 157 deletions(-) create mode 100644 tests/fsharp/Libraries/Async/AsyncTests.fs delete mode 100644 tests/fsharpqa/Source/Libraries/Control/ExecuteAsyncMultipleTimes01.fs delete mode 100644 tests/fsharpqa/Source/Libraries/Control/JoiningStartChild01.fs delete mode 100644 tests/fsharpqa/Source/Libraries/Control/MailboxAsyncNoStackOverflow01.fs delete mode 100644 tests/fsharpqa/Source/Libraries/Control/StartChildNoObjectDisposedException01.fs delete mode 100644 tests/fsharpqa/Source/Libraries/Control/StartChildTestTrampolineHijackLimit01.fs delete mode 100644 tests/fsharpqa/Source/Libraries/Control/env.lst diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 9d80400c40..9291db2f74 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -48,6 +48,7 @@ + diff --git a/tests/fsharp/Libraries/Async/AsyncTests.fs b/tests/fsharp/Libraries/Async/AsyncTests.fs new file mode 100644 index 0000000000..04a82a9716 --- /dev/null +++ b/tests/fsharp/Libraries/Async/AsyncTests.fs @@ -0,0 +1,168 @@ +namespace FSharp.Libraries.UnitTests + +open System +open NUnit.Framework +open FSharp.Compiler.UnitTests + +[] +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 + """ +module M + +let a = async { + let! a = Async.StartChild( + async { + do! Async.Sleep(1) + return 27 + }) + let! result = Async.Parallel [ a; a; a; a ] + return result + } |> Async.RunSynchronously + +exit 0 + """ + + + // Regression for FSHARP1.0:5970 + // Async.StartChild: race in implementation of ResultCell in FSharp.Core + [] + let ``Joining StartChild``() = + CompilerAssert.CompileExeAndRun + """ +module M + +let Join (a1: Async<'a>) (a2: Async<'b>) = async { + let! task1 = a1 |> Async.StartChild + let! task2 = a2 |> Async.StartChild + + let! res1 = task1 + let! res2 = task2 + return (res1,res2) } + +let r = + try + Async.RunSynchronously (Join (async { do! Async.Sleep(30) + failwith "fail" + return 3+3 }) + (async { do! Async.Sleep(30) + return 2 + 2 } )) + with _ -> + (0,0) + +exit 0 + + """ + + // Regression test for FSHARP1.0:6086 + [] + let ``Mailbox Async dot not StackOverflow``() = + CompilerAssert.CompileExeAndRun + """ +open Microsoft.FSharp.Control + +type Color = Blue | Red | Yellow +let complement = function + | (Red, Yellow) | (Yellow, Red) -> Blue + | (Red, Blue) | (Blue, Red) -> Yellow + | (Yellow, Blue) | (Blue, Yellow) -> Red + | (Blue, Blue) -> Blue + | (Red, Red) -> Red + | (Yellow, Yellow) -> Yellow + +type Message = Color * AsyncReplyChannel + +let chameleon (meetingPlace : MailboxProcessor) initial = + let rec loop c meets = async { + let replyMessage = meetingPlace.PostAndReply(fun reply -> c, reply) + match replyMessage with + | Some(newColor) -> return! loop newColor (meets + 1) + | None -> return meets + } + loop initial 0 + +let meetingPlace chams n = MailboxProcessor.Start(fun (processor : MailboxProcessor)-> + let rec fadingLoop total = + async { + if total <> 0 then + let! (_, reply) = processor.Receive() + reply.Reply None + return! fadingLoop (total - 1) + else + printfn "Done" + } + let rec mainLoop curr = + async { + if (curr > 0) then + let! (color1, reply1) = processor.Receive() + let! (color2, reply2) = processor.Receive() + let newColor = complement (color1, color2) + reply1.Reply <| Some(newColor) + reply2.Reply <| Some(newColor) + return! mainLoop (curr - 1) + else + return! fadingLoop chams + } + mainLoop n + ) + +open System +open System.Diagnostics + +let meetings = 100000 + +let colors = [Blue; Red; Yellow; Blue] +let mp = meetingPlace (colors.Length) meetings +let watch = Stopwatch.StartNew() +let meets = + colors + |> List.map (chameleon mp) + |> Async.Parallel + |> Async.RunSynchronously +watch.Stop() +for meet in meets do + printfn "%d" meet +printfn "Total: %d in %O" (Seq.sum meets) (watch.Elapsed) + +exit 0 + """ + + // Regression for FSHARP1.0:5971 + [] + let ``StartChild do not throw ObjectDisposedException``() = + CompilerAssert.CompileExeAndRun + """ +module M + +let b = async {return 5} |> Async.StartChild +printfn "%A" (b |> Async.RunSynchronously |> Async.RunSynchronously) + +exit 0 + """ + + + [] + let ``StartChild test Trampoline HijackLimit``() = + CompilerAssert.CompileExeAndRun + """ +module M + +let r = + async { + let! a = Async.StartChild( + async { + do! Async.Sleep(1) + return 5 + } + ) + let! _ = a + for __ in 1..10000 do // 10000 > bindHijackLimit + () + } |> Async.RunSynchronously + +exit 0 + """ diff --git a/tests/fsharpqa/Source/Libraries/Control/ExecuteAsyncMultipleTimes01.fs b/tests/fsharpqa/Source/Libraries/Control/ExecuteAsyncMultipleTimes01.fs deleted file mode 100644 index e042c6f02d..0000000000 --- a/tests/fsharpqa/Source/Libraries/Control/ExecuteAsyncMultipleTimes01.fs +++ /dev/null @@ -1,17 +0,0 @@ -// #Regression #Libraries #Async -// Regression for FSHARP1.0:5969 -// Async.StartChild: error when wait async is executed more than once - -module M - -let a = async { - let! a = Async.StartChild( - async { - do! Async.Sleep(500) - return 27 - }) - let! result = Async.Parallel [ a; a; a; a ] - return result - } |> Async.RunSynchronously - -exit 0 diff --git a/tests/fsharpqa/Source/Libraries/Control/JoiningStartChild01.fs b/tests/fsharpqa/Source/Libraries/Control/JoiningStartChild01.fs deleted file mode 100644 index 692bb58384..0000000000 --- a/tests/fsharpqa/Source/Libraries/Control/JoiningStartChild01.fs +++ /dev/null @@ -1,25 +0,0 @@ -// #Regression #Libraries #Async -// Regression for FSHARP1.0:5970 -// Async.StartChild: race in implementation of ResultCell in FSharp.Core - -module M - -let Join (a1: Async<'a>) (a2: Async<'b>) = async { - let! task1 = a1 |> Async.StartChild - let! task2 = a2 |> Async.StartChild - - let! res1 = task1 - let! res2 = task2 - return (res1,res2) } - -let r = - try - Async.RunSynchronously (Join (async { do! Async.Sleep(30) - failwith "fail" - return 3+3 }) - (async { do! Async.Sleep(30) - return 2 + 2 } )) - with _ -> - (0,0) - -exit 0 diff --git a/tests/fsharpqa/Source/Libraries/Control/MailboxAsyncNoStackOverflow01.fs b/tests/fsharpqa/Source/Libraries/Control/MailboxAsyncNoStackOverflow01.fs deleted file mode 100644 index 33e0e590a7..0000000000 --- a/tests/fsharpqa/Source/Libraries/Control/MailboxAsyncNoStackOverflow01.fs +++ /dev/null @@ -1,78 +0,0 @@ -// #Regression #Libraries #Async -// Regression test for FSHARP1.0:6086 -// This is a bit of duplication because the same/similar test -// can also be found under the FSHARP suite. Yet, I like to have -// it here... - -// The interesting thing about this test is that is used to throw -// an exception when executed on 64bit (FSharp.Core 2.0) - -open Microsoft.FSharp.Control - -type Color = Blue | Red | Yellow -let complement = function - | (Red, Yellow) | (Yellow, Red) -> Blue - | (Red, Blue) | (Blue, Red) -> Yellow - | (Yellow, Blue) | (Blue, Yellow) -> Red - | (Blue, Blue) -> Blue - | (Red, Red) -> Red - | (Yellow, Yellow) -> Yellow - -type Message = Color * AsyncReplyChannel - -let chameleon (meetingPlace : MailboxProcessor) initial = - let rec loop c meets = async { - let replyMessage = meetingPlace.PostAndReply(fun reply -> c, reply) - match replyMessage with - | Some(newColor) -> return! loop newColor (meets + 1) - | None -> return meets - } - loop initial 0 - -let meetingPlace chams n = MailboxProcessor.Start(fun (processor : MailboxProcessor)-> - let rec fadingLoop total = - async { - if total <> 0 then - let! (_, reply) = processor.Receive() - reply.Reply None - return! fadingLoop (total - 1) - else - printfn "Done" - } - let rec mainLoop curr = - async { - if (curr > 0) then - let! (color1, reply1) = processor.Receive() - let! (color2, reply2) = processor.Receive() - let newColor = complement (color1, color2) - reply1.Reply <| Some(newColor) - reply2.Reply <| Some(newColor) - return! mainLoop (curr - 1) - else - return! fadingLoop chams - } - mainLoop n - ) - -open System -open System.Diagnostics - -[] -let main(args : string[]) = - printfn "CommandLine : %s" (String.concat ", " args) - let meetings = if args.Length > 0 then Int32.Parse(args.[0]) else 100000 - - let colors = [Blue; Red; Yellow; Blue] - let mp = meetingPlace (colors.Length) meetings - let watch = Stopwatch.StartNew() - let meets = - colors - |> List.map (chameleon mp) - |> Async.Parallel - |> Async.RunSynchronously - watch.Stop() - for meet in meets do - printfn "%d" meet - printfn "Total: %d in %O" (Seq.sum meets) (watch.Elapsed) - 0 - diff --git a/tests/fsharpqa/Source/Libraries/Control/StartChildNoObjectDisposedException01.fs b/tests/fsharpqa/Source/Libraries/Control/StartChildNoObjectDisposedException01.fs deleted file mode 100644 index 5186548c79..0000000000 --- a/tests/fsharpqa/Source/Libraries/Control/StartChildNoObjectDisposedException01.fs +++ /dev/null @@ -1,12 +0,0 @@ -// #Regression #Libraries #Async -// Regression for FSHARP1.0:5971 -// Async.StartChild: ObjectDisposedException - -module M - -let shortVersion(args: string []) = - let b = async {return 5} |> Async.StartChild - printfn "%A" (b |> Async.RunSynchronously |> Async.RunSynchronously) - (0) - -exit 0 diff --git a/tests/fsharpqa/Source/Libraries/Control/StartChildTestTrampolineHijackLimit01.fs b/tests/fsharpqa/Source/Libraries/Control/StartChildTestTrampolineHijackLimit01.fs deleted file mode 100644 index 46cfeb5937..0000000000 --- a/tests/fsharpqa/Source/Libraries/Control/StartChildTestTrampolineHijackLimit01.fs +++ /dev/null @@ -1,19 +0,0 @@ -// #Regression #Libraries #Async -// Regression for FSHARP1.0:5972 -// Async.StartChild: fails to install trampolines properly -module M - -let r = - async { - let! a = Async.StartChild( - async { - do! Async.Sleep(500) - return 5 - } - ) - let! b = a - for i in 1..10000 do // 10000 > bindHijackLimit - () - } |> Async.RunSynchronously - -exit 0 diff --git a/tests/fsharpqa/Source/Libraries/Control/env.lst b/tests/fsharpqa/Source/Libraries/Control/env.lst deleted file mode 100644 index 6c034ca5b4..0000000000 --- a/tests/fsharpqa/Source/Libraries/Control/env.lst +++ /dev/null @@ -1,6 +0,0 @@ - SOURCE=MailboxAsyncNoStackOverflow01.fs # MailboxAsyncNoStackOverflow01.fs - - SOURCE=ExecuteAsyncMultipleTimes01.fs # ExecuteAsyncMultipleTimes01.fs - SOURCE=JoiningStartChild01.fs # JoiningStartChild01.fs - SOURCE=StartChildNoObjectDisposedException01.fs # StartChildNoObjectDisposedException01.fs - SOURCE=StartChildTestTrampolineHijackLimit01.fs # StartChildTestTrampolineHijackLimit01.fs \ No newline at end of file From 5efa8a7ba0bd4e3d62515f14d0b48c8a0edd5c58 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Tue, 23 Jul 2019 01:00:28 +0200 Subject: [PATCH 189/286] Member constraints and PrimitiveConstraints (#7210) --- tests/fsharp/Compiler/CompilerAssert.fs | 18 ++- .../ConstraintSolver/MemberConstraints.fs | 45 ++++++++ .../ConstraintSolver/PrimitiveConstraints.fs | 109 ++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 2 + .../E_MemberConstraints01.fs | 6 - .../ConstraintSolving/E_PrimConstraint04.fs | 16 --- .../ConstraintSolving/MemberConstraints01.fs | 24 ---- .../ConstraintSolving/PrimConstraint01.fs | 26 ----- .../ConstraintSolving/PrimConstraint02.fs | 33 ------ .../ConstraintSolving/PrimConstraint03.fs | 23 ---- .../ConstraintSolving/env.lst | 8 -- 11 files changed, 171 insertions(+), 139 deletions(-) create mode 100644 tests/fsharp/Compiler/ConstraintSolver/MemberConstraints.fs create mode 100644 tests/fsharp/Compiler/ConstraintSolver/PrimitiveConstraints.fs delete mode 100644 tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/E_MemberConstraints01.fs delete mode 100644 tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/E_PrimConstraint04.fs delete mode 100644 tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/MemberConstraints01.fs delete mode 100644 tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/PrimConstraint01.fs delete mode 100644 tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/PrimConstraint02.fs delete mode 100644 tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/PrimConstraint03.fs diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index 52ec325df8..9f64824bb4 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -173,9 +173,15 @@ let main argv = 0""" Assert.IsEmpty(typeCheckResults.Errors, sprintf "Type Check errors: %A" typeCheckResults.Errors) - let TypeCheckWithErrors (source: string) expectedTypeErrors = + let TypeCheckWithErrorsAndOptions options (source: string) expectedTypeErrors = lock gate <| fun () -> - let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, defaultProjectOptions) |> Async.RunSynchronously + let parseResults, fileAnswer = + checker.ParseAndCheckFileInProject( + "test.fs", + 0, + SourceText.ofString source, + { defaultProjectOptions with OtherOptions = Array.append options defaultProjectOptions.OtherOptions}) + |> Async.RunSynchronously Assert.IsEmpty(parseResults.Errors, sprintf "Parse errors: %A" parseResults.Errors) @@ -198,8 +204,14 @@ let main argv = 0""" Assert.AreEqual(expectedErrorMsg, info.Message, "expectedErrorMsg") ) + let TypeCheckWithErrors (source: string) expectedTypeErrors = + TypeCheckWithErrorsAndOptions [||] source expectedTypeErrors + + let TypeCheckSingleErrorWithOptions options (source: string) (expectedServerity: FSharpErrorSeverity) (expectedErrorNumber: int) (expectedErrorRange: int * int * int * int) (expectedErrorMsg: string) = + TypeCheckWithErrorsAndOptions options source [| expectedServerity, expectedErrorNumber, expectedErrorRange, expectedErrorMsg |] + let TypeCheckSingleError (source: string) (expectedServerity: FSharpErrorSeverity) (expectedErrorNumber: int) (expectedErrorRange: int * int * int * int) (expectedErrorMsg: string) = - TypeCheckWithErrors (source: string) [| expectedServerity, expectedErrorNumber, expectedErrorRange, expectedErrorMsg |] + TypeCheckWithErrors source [| expectedServerity, expectedErrorNumber, expectedErrorRange, expectedErrorMsg |] let CompileExe (source: string) = compile true source (fun (errors, _) -> diff --git a/tests/fsharp/Compiler/ConstraintSolver/MemberConstraints.fs b/tests/fsharp/Compiler/ConstraintSolver/MemberConstraints.fs new file mode 100644 index 0000000000..d422c9b31f --- /dev/null +++ b/tests/fsharp/Compiler/ConstraintSolver/MemberConstraints.fs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module MemberConstraints = + + [] + let ``we can overload operators on a type and not add all the extra jazz such as inlining and the ^ operator.``() = + CompilerAssert.CompileExeAndRun + """ +type Foo(x : int) = + member this.Val = x + + static member (-->) ((src : Foo), (target : Foo)) = new Foo(src.Val + target.Val) + static member (-->) ((src : Foo), (target : int)) = new Foo(src.Val + target) + + static member (+) ((src : Foo), (target : Foo)) = new Foo(src.Val + target.Val) + static member (+) ((src : Foo), (target : int)) = new Foo(src.Val + target) + +let x = Foo(3) --> 4 +let y = Foo(3) --> Foo(4) +let x2 = Foo(3) + 4 +let y2 = Foo(3) + Foo(4) + +if x.Val <> 7 then exit 1 +if y.Val <> 7 then exit 1 +if x2.Val <> 7 then exit 1 +if y2.Val <> 7 then exit 1 + """ + + [] + let ``Invalid member constraint with ErrorRanges``() = // Regression test for FSharp1.0:2262 + CompilerAssert.TypeCheckSingleErrorWithOptions + [| "--test:ErrorRanges" |] + """ +let inline length (x: ^a) : int = (^a : (member Length : int with get, set) (x, ())) + """ + FSharpErrorSeverity.Error + 697 + (2, 42, 2, 75) + "Invalid constraint" diff --git a/tests/fsharp/Compiler/ConstraintSolver/PrimitiveConstraints.fs b/tests/fsharp/Compiler/ConstraintSolver/PrimitiveConstraints.fs new file mode 100644 index 0000000000..fbfedfb550 --- /dev/null +++ b/tests/fsharp/Compiler/ConstraintSolver/PrimitiveConstraints.fs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module PrimitiveConstraints = + + [] + let ``Test primitive : constraints``() = + CompilerAssert.CompileExeAndRun + """ +#light + +type Foo(x : int) = + member this.Value = x + override this.ToString() = "Foo" + +type Bar(x : int) = + inherit Foo(-1) + member this.Value2 = x + override this.ToString() = "Bar" + +let test1 (x : Foo) = x.Value +let test2 (x : Bar) = (x.Value, x.Value2) + +let f = new Foo(128) +let b = new Bar(256) + +if test1 f <> 128 then exit 1 +if test2 b <> (-1, 256) then exit 1 +""" + + [] + let ``Test primitive :> constraints``() = + CompilerAssert.CompileExeAndRun + """ +#light +type Foo(x : int) = + member this.Value = x + override this.ToString() = "Foo" + +type Bar(x : int) = + inherit Foo(-1) + member this.Value2 = x + override this.ToString() = "Bar" + +type Ram(x : int) = + inherit Foo(10) + member this.ValueA = x + override this.ToString() = "Ram" + +let test (x : Foo) = (x.Value, x.ToString()) + +let f = new Foo(128) +let b = new Bar(256) +let r = new Ram(314) + +if test f <> (128, "Foo") then exit 1 +if test b <> (-1, "Bar") then exit 1 +if test r <> (10, "Ram") then exit 1 +""" + + [] + let ``Test primitive : null constraint``() = + CompilerAssert.CompileExeAndRun + """ +let inline isNull<'a when 'a : null> (x : 'a) = + match x with + | null -> "is null" + | _ -> (x :> obj).ToString() + +let runTest = + // Wrapping in try block to work around FSB 1989 + try + if isNull null <> "is null" then exit 1 + if isNull "F#" <> "F#" then exit 1 + true + with _ -> exit 1 + +if runTest <> true then exit 1 + +exit 0 +""" + + [] + /// Title: Type checking oddity + /// + /// This suggestion was resolved as by design, + /// so the test makes sure, we're emitting error message about 'not being a valid object construction expression' + let ``Invalid object constructor``() = // Regression test for FSharp1.0:4189 + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--test:ErrorRanges" |] + """ +type ImmutableStack<'a> private(items: 'a list) = + + member this.Push item = ImmutableStack(item::items) + member this.Pop = match items with | [] -> failwith "No elements in stack" | x::xs -> x,ImmutableStack(xs) + + // Notice type annotation is commented out, which results in an error + new(col (*: seq<'a>*)) = ImmutableStack(List.ofSeq col) + + """ + [| FSharpErrorSeverity.Error, 41, (4, 29, 4, 56), "A unique overload for method 'ImmutableStack`1' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: new : col:'b -> ImmutableStack<'a>, private new : items:'a list -> ImmutableStack<'a>" + FSharpErrorSeverity.Error, 41, (5, 93, 5, 111), "A unique overload for method 'ImmutableStack`1' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: new : col:'b -> ImmutableStack<'a>, private new : items:'a list -> ImmutableStack<'a>" + FSharpErrorSeverity.Error, 41, (8, 30, 8, 60), "A unique overload for method 'ImmutableStack`1' could not be determined based on type information prior to this program point. A type annotation may be needed. Candidates: new : col:'b -> ImmutableStack<'a> when 'b :> seq<'c>, private new : items:'a list -> ImmutableStack<'a>" + FSharpErrorSeverity.Error, 696, (8, 30, 8, 60), "This is not a valid object construction expression. Explicit object constructors must either call an alternate constructor or initialize all fields of the object and specify a call to a super class constructor." |] \ No newline at end of file diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 9291db2f74..2be8d09cd7 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -35,6 +35,8 @@ + + diff --git a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/E_MemberConstraints01.fs b/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/E_MemberConstraints01.fs deleted file mode 100644 index 643ec7f7db..0000000000 --- a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/E_MemberConstraints01.fs +++ /dev/null @@ -1,6 +0,0 @@ -// #Regression #Conformance #TypeInference #TypeConstraints -// Regression test for FSharp1.0:2262 -// We should emit an error, not ICE -//Invalid constraint - -let inline length (x: ^a) : int = (^a : (member Length : int with get, set) (x, ())) diff --git a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/E_PrimConstraint04.fs b/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/E_PrimConstraint04.fs deleted file mode 100644 index 08dcbfde12..0000000000 --- a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/E_PrimConstraint04.fs +++ /dev/null @@ -1,16 +0,0 @@ -// #Regression #Conformance #TypeInference #TypeConstraints -// Regression test for FSharp1.0:4189 -// Title: Type checking oddity - -// This suggestion was resolved as by design, -// so the test makes sure, we're emitting error message about 'not being avalid object construction expression' - -//This is not a valid object construction expression\. Explicit object constructors must either call an alternate constructor or initialize all fields of the object and specify a call to a super class constructor\.$ - -type ImmutableStack<'a> private(items: 'a list) = - - member this.Push item = ImmutableStack(item::items) - member this.Pop = match items with | [] -> failwith "No elements in stack" | x::xs -> x,ImmutableStack(xs) - - // Notice type annotation is commented out, which results in an error - new(col (*: seq<'a>*)) = ImmutableStack(List.ofSeq col) diff --git a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/MemberConstraints01.fs b/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/MemberConstraints01.fs deleted file mode 100644 index af26314245..0000000000 --- a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/MemberConstraints01.fs +++ /dev/null @@ -1,24 +0,0 @@ -// #Conformance #TypeInference #TypeConstraints -// Verify you can overload operators on a type and not add all the extra jazz -// such as inlining and the ^ operator. - -type Foo(x : int) = - member this.Val = x - - static member (-->) ((src : Foo), (target : Foo)) = new Foo(src.Val + target.Val) - static member (-->) ((src : Foo), (target : int)) = new Foo(src.Val + target) - - static member (+) ((src : Foo), (target : Foo)) = new Foo(src.Val + target.Val) - static member (+) ((src : Foo), (target : int)) = new Foo(src.Val + target) - -let x = Foo(3) --> 4 -let y = Foo(3) --> Foo(4) -let x2 = Foo(3) + 4 -let y2 = Foo(3) + Foo(4) - -if x.Val <> 7 then exit 1 -if y.Val <> 7 then exit 1 -if x2.Val <> 7 then exit 1 -if y2.Val <> 7 then exit 1 - -exit 0 diff --git a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/PrimConstraint01.fs b/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/PrimConstraint01.fs deleted file mode 100644 index e9b11b1c99..0000000000 --- a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/PrimConstraint01.fs +++ /dev/null @@ -1,26 +0,0 @@ -// #Conformance #TypeInference #TypeConstraints -#light - -// Test primitive constraints - -// Test ':' constraints - -type Foo(x : int) = - member this.Value = x - override this.ToString() = "Foo" - -type Bar(x : int) = - inherit Foo(-1) - member this.Value2 = x - override this.ToString() = "Bar" - -let test1 (x : Foo) = x.Value -let test2 (x : Bar) = (x.Value, x.Value2) - -let f = new Foo(128) -let b = new Bar(256) - -if test1 f <> 128 then exit 1 -if test2 b <> (-1, 256) then exit 1 - -exit 0 diff --git a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/PrimConstraint02.fs b/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/PrimConstraint02.fs deleted file mode 100644 index b410f4e528..0000000000 --- a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/PrimConstraint02.fs +++ /dev/null @@ -1,33 +0,0 @@ -// #Conformance #TypeInference #TypeConstraints - -#light - -// Test primitive constraints - -// Test ':>' constraints - -type Foo(x : int) = - member this.Value = x - override this.ToString() = "Foo" - -type Bar(x : int) = - inherit Foo(-1) - member this.Value2 = x - override this.ToString() = "Bar" - -type Ram(x : int) = - inherit Foo(10) - member this.ValueA = x - override this.ToString() = "Ram" - -let test (x : Foo) = (x.Value, x.ToString()) - -let f = new Foo(128) -let b = new Bar(256) -let r = new Ram(314) - -if test f <> (128, "Foo") then exit 1 -if test b <> (-1, "Bar") then exit 1 -if test r <> (10, "Ram") then exit 1 - -exit 0 diff --git a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/PrimConstraint03.fs b/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/PrimConstraint03.fs deleted file mode 100644 index 7f9a072fd6..0000000000 --- a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/PrimConstraint03.fs +++ /dev/null @@ -1,23 +0,0 @@ -// #Conformance #TypeInference #TypeConstraints -#light - -// Test primitive constraints - -// Test ': null' constraints - -let inline isNull<'a when 'a : null> (x : 'a) = - match x with - | null -> "is null" - | _ -> (x :> obj).ToString() - -let runTest = - // Wrapping in try block to work around FSB 1989 - try - if isNull null <> "is null" then exit 1 - if isNull "F#" <> "F#" then exit 1 - true - with _ -> exit 1 - -if runTest <> true then exit 1 - -exit 0 diff --git a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/env.lst b/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/env.lst index 4b89bcc2ba..041ba830d0 100644 --- a/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/env.lst +++ b/tests/fsharpqa/Source/Conformance/InferenceProcedures/ConstraintSolving/env.lst @@ -1,10 +1,5 @@ SOURCE=E_NoImplicitDowncast01.fs SCFLAGS="--test:ErrorRanges --flaterrors" # E_NoImplicitDowncast01.fs - SOURCE=PrimConstraint01.fs # PrimConstraint01.fs - SOURCE=PrimConstraint02.fs # PrimConstraint02.fs - SOURCE=PrimConstraint03.fs # PrimConstraint03.fs - SOURCE=E_PrimConstraint04.fs SCFLAGS="--test:ErrorRanges" # E_PrimConstraint04.fs - SOURCE=E_TypeFuncDeclaredExplicit01.fs # E_TypeFuncDeclaredExplicit01.fs SOURCE=ValueRestriction01.fs # ValueRestriction01.fs @@ -16,7 +11,4 @@ SOURCE=DelegateConstraint01.fs # DelegateConstraint01.fs SOURCE=E_DelegateConstraint01.fs # E_DelegateConstraint01.fs - SOURCE=MemberConstraints01.fs # MemberConstraints01.fs - SOURCE=E_MemberConstraints01.fs SCFLAGS="--test:ErrorRanges" # E_MemberConstraints01.fs - SOURCE=ConstructorConstraint01.fs # ConstructorConstraint01.fs \ No newline at end of file From a7c68c3aed7980a6220a40738b718a7196de017a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2019 09:48:39 -0700 Subject: [PATCH 190/286] Update dependencies from https://github.com/dotnet/arcade build 20190722.10 (#7268) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19372.10 --- eng/Version.Details.xml | 4 ++-- eng/common/init-tools-native.ps1 | 8 +++++++- global.json | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7228968c11..e278bed29a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - a190d4865fe3c86a168ec49c4fc61c90c96ae051 + 0793e2df782efc9ccae387bc779b2549208fa4a1 diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index 9d18645f45..eaa05880c5 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -103,7 +103,13 @@ try { if ($LASTEXITCODE -Ne "0") { $errMsg = "$ToolName installation failed" if ((Get-Variable 'DoNotAbortNativeToolsInstallationOnFailure' -ErrorAction 'SilentlyContinue') -and $DoNotAbortNativeToolsInstallationOnFailure) { - Write-Warning $errMsg + $showNativeToolsWarning = $true + if ((Get-Variable 'DoNotDisplayNativeToolsInstallationWarnings' -ErrorAction 'SilentlyContinue') -and $DoNotDisplayNativeToolsInstallationWarnings) { + $showNativeToolsWarning = $false + } + if ($showNativeToolsWarning) { + Write-Warning $errMsg + } $toolInstallationFailure = $true } else { Write-Error $errMsg diff --git a/global.json b/global.json index c8c5b12939..1d496dc84b 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19369.2", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19372.10", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 37970b41db5c858411fc42876233e608844c9f58 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Wed, 24 Jul 2019 18:08:15 -0700 Subject: [PATCH 191/286] fixes issue #6832 (#7259) * fixes issue #6832 * Fix comment * Forgot to remove pdbs from fsharp.compiler.nuget * Rename Program.fs and exclude FSharpSdk from checks * Embedded doesn't need to verify tmp or obj directories. * typo * typo * Don't check FSharpSdk for hash * Make comment match code * Empty commit to force rebuild --- FSharpBuild.Directory.Build.props | 3 +- eng/Build.ps1 | 11 ++-- eng/build-utils.ps1 | 3 +- src/absil/ilwritepdb.fs | 2 +- .../buildtools/AssemblyCheck/AssemblyCheck.fs | 66 +++++++++++++++---- .../AssemblyCheck/AssemblyCheck.fsproj | 17 +++++ src/buildtools/buildtools.proj | 1 + .../Microsoft.FSharp.Compiler.nuspec | 14 +--- .../FSharp.Core.nuget/FSharp.Core.nuspec | 2 - 9 files changed, 86 insertions(+), 33 deletions(-) rename scripts/AssemblyVersionCheck.fsx => src/buildtools/AssemblyCheck/AssemblyCheck.fs (51%) create mode 100644 src/buildtools/AssemblyCheck/AssemblyCheck.fsproj diff --git a/FSharpBuild.Directory.Build.props b/FSharpBuild.Directory.Build.props index 515de9bbdc..6687fb4088 100644 --- a/FSharpBuild.Directory.Build.props +++ b/FSharpBuild.Directory.Build.props @@ -75,6 +75,7 @@ https://github.com/Microsoft/visualfsharp git + <_DotGitDir>$(RepoRoot).git <_HeadFileContent Condition="Exists('$(_DotGitDir)/HEAD')">$([System.IO.File]::ReadAllText('$(_DotGitDir)/HEAD').Trim()) @@ -87,7 +88,7 @@ $(NoWarn);FS2003 true - portable + embedded fs false true diff --git a/eng/Build.ps1 b/eng/Build.ps1 index f329cba02a..8011827a64 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -224,13 +224,14 @@ function UpdatePath() { TestAndAddToPath "$ArtifactsDir\bin\fsiAnyCpu\$configuration\net472" } -function VerifyAssemblyVersions() { - $fsiPath = Join-Path $ArtifactsDir "bin\fsi\Proto\net472\publish\fsi.exe" +function VerifyAssemblyVersionsAndSymbols() { + $assemblyVerCheckPath = Join-Path $ArtifactsDir "Bootstrap\AssemblyCheck\AssemblyCheck.dll" # Only verify versions on CI or official build if ($ci -or $official) { - $asmVerCheckPath = "$RepoRoot\scripts" - Exec-Console $fsiPath """$asmVerCheckPath\AssemblyVersionCheck.fsx"" -- ""$ArtifactsDir""" + $dotnetPath = InitializeDotNetCli + $dotnetExe = Join-Path $dotnetPath "dotnet.exe" + Exec-Console $dotnetExe """$assemblyVerCheckPath"" ""$ArtifactsDir""" } } @@ -307,7 +308,7 @@ try { } if ($build) { - VerifyAssemblyVersions + VerifyAssemblyVersionsAndSymbols } $desktopTargetFramework = "net472" diff --git a/eng/build-utils.ps1 b/eng/build-utils.ps1 index fcda1a58e2..772de110ca 100644 --- a/eng/build-utils.ps1 +++ b/eng/build-utils.ps1 @@ -236,10 +236,11 @@ function Make-BootstrapBuild() { Remove-Item -re $dir -ErrorAction SilentlyContinue Create-Directory $dir - # prepare FsLex and Fsyacc + # prepare FsLex and Fsyacc and AssemblyCheck Run-MSBuild "$RepoRoot\src\buildtools\buildtools.proj" "/restore /t:Publish" -logFileName "BuildTools" -configuration $bootstrapConfiguration Copy-Item "$ArtifactsDir\bin\fslex\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\fslex" -Force -Recurse Copy-Item "$ArtifactsDir\bin\fsyacc\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\fsyacc" -Force -Recurse + Copy-Item "$ArtifactsDir\bin\AssemblyCheck\$bootstrapConfiguration\netcoreapp2.1\publish" -Destination "$dir\AssemblyCheck" -Force -Recurse # prepare compiler $projectPath = "$RepoRoot\proto.proj" diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index c1ffd69224..86b7ee9224 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -186,7 +186,7 @@ let pdbGetEmbeddedPdbDebugInfo (embeddedPdbChunk: BinaryChunk) (uncompressedLeng Buffer.BlockCopy(stream.ToArray(), 0, buffer, offset, size) buffer { iddCharacteristics = 0 // Reserved - iddMajorVersion = 0 // VersionMajor should be 0 + iddMajorVersion = 0x0100 // VersionMajor should be 0x0100 iddMinorVersion = 0x0100 // VersionMinor should be 0x0100 iddType = 17 // IMAGE_DEBUG_TYPE_EMBEDDEDPDB iddTimestamp = 0 diff --git a/scripts/AssemblyVersionCheck.fsx b/src/buildtools/AssemblyCheck/AssemblyCheck.fs similarity index 51% rename from scripts/AssemblyVersionCheck.fsx rename to src/buildtools/AssemblyCheck/AssemblyCheck.fs index 0f3816a2e6..c6bd035a67 100644 --- a/scripts/AssemblyVersionCheck.fsx +++ b/src/buildtools/AssemblyCheck/AssemblyCheck.fs @@ -1,22 +1,50 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. open System open System.Diagnostics open System.IO open System.Reflection +open System.Reflection.PortableExecutable open System.Text.RegularExpressions -module AssemblyVersionCheck = +module AssemblyCheck = let private versionZero = Version(0, 0, 0, 0) let private versionOne = Version(1, 0, 0, 0) let private commitHashPattern = new Regex(@"Commit Hash: ()|([0-9a-fA-F]{40})", RegexOptions.Compiled) let private devVersionPattern = new Regex(@"-(ci|dev)", RegexOptions.Compiled) - let verifyAssemblyVersions (binariesPath:string) = + let verifyEmbeddedPdb (filename:string) = + use fileStream = File.OpenRead(filename) + let reader = new PEReader(fileStream) + let mutable hasEmbeddedPdb = false + + try + for entry in reader.ReadDebugDirectory() do + match entry.Type with + | DebugDirectoryEntryType.CodeView -> + let _ = reader.ReadCodeViewDebugDirectoryData(entry) + () + + | DebugDirectoryEntryType.EmbeddedPortablePdb -> + let _ = reader.ReadEmbeddedPortablePdbDebugDirectoryData(entry) + hasEmbeddedPdb <- true + () + + | DebugDirectoryEntryType.PdbChecksum -> + let _ = reader.ReadPdbChecksumDebugDirectoryData(entry) + () + + | _ -> () + with | e -> printfn "Error validating assembly %s\nMessage: %s" filename (e.ToString()) + hasEmbeddedPdb + + let verifyAssemblies (binariesPath:string) = + let excludedAssemblies = [ "FSharp.Data.TypeProviders.dll" ] |> Set.ofList + let fsharpAssemblies = [ "FSharp*.dll" "fsc.exe" @@ -28,12 +56,17 @@ module AssemblyVersionCheck = |> List.ofSeq |> List.filter (fun p -> (Set.contains (Path.GetFileName(p)) excludedAssemblies) |> not) + let fsharpExecutingWithEmbeddedPdbs = + fsharpAssemblies + |> List.filter (fun p -> not (p.Contains(@"\Proto\") || p.Contains(@"\Bootstrap\") || p.Contains(@".resources.") || p.Contains(@"\FSharpSdk\") || p.Contains(@"\tmp\") || p.Contains(@"\obj\"))) + // verify that all assemblies have a version number other than 0.0.0.0 or 1.0.0.0 let failedVersionCheck = fsharpAssemblies |> List.filter (fun a -> let assemblyVersion = AssemblyName.GetAssemblyName(a).Version assemblyVersion = versionZero || assemblyVersion = versionOne) + if failedVersionCheck.Length > 0 then printfn "The following assemblies had a version of %A or %A" versionZero versionOne printfn "%s\r\n" <| String.Join("\r\n", failedVersionCheck) @@ -43,27 +76,36 @@ module AssemblyVersionCheck = // verify that all assemblies have a commit hash let failedCommitHash = fsharpAssemblies + |> List.filter (fun p -> not (p.Contains(@"\FSharpSdk\"))) |> List.filter (fun a -> let fileProductVersion = FileVersionInfo.GetVersionInfo(a).ProductVersion not (commitHashPattern.IsMatch(fileProductVersion) || devVersionPattern.IsMatch(fileProductVersion))) + if failedCommitHash.Length > 0 then printfn "The following assemblies don't have a commit hash set" printfn "%s\r\n" <| String.Join("\r\n", failedCommitHash) else printfn "All shipping assemblies had an appropriate commit hash." + // verify that all assemblies have an embedded pdb + let failedVerifyEmbeddedPdb = + fsharpExecutingWithEmbeddedPdbs + |> List.filter (fun a -> not (verifyEmbeddedPdb a)) + + if failedVerifyEmbeddedPdb.Length > 0 then + printfn "The following assemblies don't have an embedded pdb" + printfn "%s\r\n" <| String.Join("\r\n", failedVerifyEmbeddedPdb) + else + printfn "All shipping assemblies had an embedded PDB." + // return code is the number of failures - failedVersionCheck.Length + failedCommitHash.Length + failedVersionCheck.Length + failedCommitHash.Length + failedVerifyEmbeddedPdb.Length + +[] let main (argv:string array) = if argv.Length <> 1 then - printfn "Usage: fsi.exe AssemblyVersionCheck.fsx -- path/to/binaries" + printfn "Usage: dotnet AssemblyCheck.dll -- path/to/binaries" 1 else - AssemblyVersionCheck.verifyAssemblyVersions argv.[0] - -Environment.GetCommandLineArgs() -|> Seq.skipWhile ((<>) "--") -|> Seq.skip 1 -|> Array.ofSeq -|> main + AssemblyCheck.verifyAssemblies argv.[0] diff --git a/src/buildtools/AssemblyCheck/AssemblyCheck.fsproj b/src/buildtools/AssemblyCheck/AssemblyCheck.fsproj new file mode 100644 index 0000000000..72f79d02f9 --- /dev/null +++ b/src/buildtools/AssemblyCheck/AssemblyCheck.fsproj @@ -0,0 +1,17 @@ + + + + Exe + netcoreapp2.1 + true + + + + + + + + + + + diff --git a/src/buildtools/buildtools.proj b/src/buildtools/buildtools.proj index 630bb67856..7ac48ba2a3 100644 --- a/src/buildtools/buildtools.proj +++ b/src/buildtools/buildtools.proj @@ -8,6 +8,7 @@ + diff --git a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec index d3756ebc39..a82fbb1ac3 100644 --- a/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec +++ b/src/fsharp/FSharp.Compiler.nuget/Microsoft.FSharp.Compiler.nuspec @@ -49,15 +49,7 @@ - - - - - - - + target="lib\netcoreapp2.1" /> @@ -69,9 +61,9 @@ + target="lib\netcoreapp2.1" /> + target="lib\netcoreapp2.1" /> diff --git a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec index 750052c45d..ee7a88b29d 100644 --- a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec +++ b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuspec @@ -38,13 +38,11 @@ - - From d979174576545840bdc5098c4dd66f9ad3a4b98d Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Thu, 25 Jul 2019 10:43:49 -0700 Subject: [PATCH 192/286] Color nameof as intrinsic (#7273) --- src/fsharp/service/FSharpCheckerResults.fs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/fsharp/service/FSharpCheckerResults.fs b/src/fsharp/service/FSharpCheckerResults.fs index 9a5c778db3..6b493ca332 100644 --- a/src/fsharp/service/FSharpCheckerResults.fs +++ b/src/fsharp/service/FSharpCheckerResults.fs @@ -1282,9 +1282,8 @@ type internal TypeCheckInfo valRefEq g g.reraise_vref vref || valRefEq g g.typeof_vref vref || valRefEq g g.typedefof_vref vref || - valRefEq g g.sizeof_vref vref - // TODO uncomment this after `nameof` operator is implemented - // || valRefEq g g.nameof_vref vref + valRefEq g g.sizeof_vref vref || + valRefEq g g.nameof_vref vref then Some() else None From 8e843ae254c7c1e2fd29dbe23e0b45e5fbf514d2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 25 Jul 2019 17:47:38 -0700 Subject: [PATCH 193/286] [master] Update dependencies from dotnet/arcade (#7269) * Update dependencies from https://github.com/dotnet/arcade build 20190723.6 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19373.6 * Update dependencies from https://github.com/dotnet/arcade build 20190724.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19374.2 * Update dependencies from https://github.com/dotnet/arcade build 20190725.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19375.2 --- eng/Version.Details.xml | 4 +-- eng/common/build.sh | 0 eng/common/cibuild.sh | 0 eng/common/cross/armel/tizen-build-rootfs.sh | 0 eng/common/cross/armel/tizen-fetch.sh | 0 eng/common/cross/build-android-rootfs.sh | 0 eng/common/cross/build-rootfs.sh | 0 eng/common/darc-init.sh | 0 eng/common/dotnet-install.sh | 0 eng/common/init-tools-native.sh | 0 eng/common/internal-feed-operations.sh | 0 eng/common/msbuild.sh | 0 eng/common/native/common-library.sh | 0 eng/common/native/install-cmake.sh | 0 eng/common/performance/performance-setup.sh | 0 eng/common/pipeline-logging-functions.sh | 0 eng/common/post-build/darc-gather-drop.ps1 | 36 +++++++++++++++++++ .../channels/internal-servicing.yml | 23 ------------ .../channels/public-dev-release.yml | 24 ++----------- .../post-build/channels/public-release.yml | 23 ------------ .../channels/public-validation-release.yml | 26 ++------------ .../templates/post-build/darc-gather-drop.yml | 22 ++++++++++++ .../post-build/trigger-subscription.yml | 2 +- eng/common/tools.sh | 0 global.json | 2 +- 25 files changed, 68 insertions(+), 94 deletions(-) mode change 100644 => 100755 eng/common/build.sh mode change 100644 => 100755 eng/common/cibuild.sh mode change 100644 => 100755 eng/common/cross/armel/tizen-build-rootfs.sh mode change 100644 => 100755 eng/common/cross/armel/tizen-fetch.sh mode change 100644 => 100755 eng/common/cross/build-android-rootfs.sh mode change 100644 => 100755 eng/common/cross/build-rootfs.sh mode change 100644 => 100755 eng/common/darc-init.sh mode change 100644 => 100755 eng/common/dotnet-install.sh mode change 100644 => 100755 eng/common/init-tools-native.sh mode change 100644 => 100755 eng/common/internal-feed-operations.sh mode change 100644 => 100755 eng/common/msbuild.sh mode change 100644 => 100755 eng/common/native/common-library.sh mode change 100644 => 100755 eng/common/native/install-cmake.sh mode change 100644 => 100755 eng/common/performance/performance-setup.sh mode change 100644 => 100755 eng/common/pipeline-logging-functions.sh create mode 100644 eng/common/post-build/darc-gather-drop.ps1 create mode 100644 eng/common/templates/post-build/darc-gather-drop.yml mode change 100644 => 100755 eng/common/tools.sh diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e278bed29a..1ed95d393a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 0793e2df782efc9ccae387bc779b2549208fa4a1 + 3dfa62fddcde597959c323d17426f215384e773a diff --git a/eng/common/build.sh b/eng/common/build.sh old mode 100644 new mode 100755 diff --git a/eng/common/cibuild.sh b/eng/common/cibuild.sh old mode 100644 new mode 100755 diff --git a/eng/common/cross/armel/tizen-build-rootfs.sh b/eng/common/cross/armel/tizen-build-rootfs.sh old mode 100644 new mode 100755 diff --git a/eng/common/cross/armel/tizen-fetch.sh b/eng/common/cross/armel/tizen-fetch.sh old mode 100644 new mode 100755 diff --git a/eng/common/cross/build-android-rootfs.sh b/eng/common/cross/build-android-rootfs.sh old mode 100644 new mode 100755 diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh old mode 100644 new mode 100755 diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh old mode 100644 new mode 100755 diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh old mode 100644 new mode 100755 diff --git a/eng/common/init-tools-native.sh b/eng/common/init-tools-native.sh old mode 100644 new mode 100755 diff --git a/eng/common/internal-feed-operations.sh b/eng/common/internal-feed-operations.sh old mode 100644 new mode 100755 diff --git a/eng/common/msbuild.sh b/eng/common/msbuild.sh old mode 100644 new mode 100755 diff --git a/eng/common/native/common-library.sh b/eng/common/native/common-library.sh old mode 100644 new mode 100755 diff --git a/eng/common/native/install-cmake.sh b/eng/common/native/install-cmake.sh old mode 100644 new mode 100755 diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh old mode 100644 new mode 100755 diff --git a/eng/common/pipeline-logging-functions.sh b/eng/common/pipeline-logging-functions.sh old mode 100644 new mode 100755 diff --git a/eng/common/post-build/darc-gather-drop.ps1 b/eng/common/post-build/darc-gather-drop.ps1 new file mode 100644 index 0000000000..9cc2f1a009 --- /dev/null +++ b/eng/common/post-build/darc-gather-drop.ps1 @@ -0,0 +1,36 @@ +param( + [Parameter(Mandatory=$true)][string] $BarBuildId, # ID of the build which assets should be downloaded + [Parameter(Mandatory=$true)][string] $MaestroAccessToken, # Token used to access Maestro API + [Parameter(Mandatory=$true)][string] $DropLocation # Where the assets should be downloaded to +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 + +. $PSScriptRoot\..\tools.ps1 + +try { + Write-Host "Installing DARC ..." + + . $PSScriptRoot\..\darc-init.ps1 + $exitCode = $LASTEXITCODE + + if ($exitCode -ne 0) { + Write-PipelineTaskError "Something failed while running 'darc-init.ps1'. Check for errors above. Exiting now..." + ExitWithExitCode $exitCode + } + + darc gather-drop --non-shipping ` + --continue-on-error ` + --id $BarBuildId ` + --output-dir $DropLocation ` + --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ ` + --password $MaestroAccessToken ` + --latest-location +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} diff --git a/eng/common/templates/post-build/channels/internal-servicing.yml b/eng/common/templates/post-build/channels/internal-servicing.yml index 648e854e0e..5c07b66926 100644 --- a/eng/common/templates/post-build/channels/internal-servicing.yml +++ b/eng/common/templates/post-build/channels/internal-servicing.yml @@ -143,29 +143,6 @@ stages: filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - job: - displayName: Gather Drop - dependsOn: setupMaestroVars - variables: - BARBuildId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.InternalServicing_30_Channel_Id) - pool: - vmImage: 'windows-2019' - steps: - - task: PowerShell@2 - displayName: Setup Darc CLI - inputs: - targetType: filePath - filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1' - - - task: PowerShell@2 - displayName: Run Darc gather-drop - inputs: - targetType: inline - script: | - darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) --latest-location - enabled: false - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml index bdc631016b..b46b069923 100644 --- a/eng/common/templates/post-build/channels/public-dev-release.yml +++ b/eng/common/templates/post-build/channels/public-dev-release.yml @@ -140,27 +140,9 @@ stages: filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - job: - displayName: Gather Drop - dependsOn: setupMaestroVars - variables: - BARBuildId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicDevRelease_30_Channel_Id) - pool: - vmImage: 'windows-2019' - steps: - - task: PowerShell@2 - displayName: Setup Darc CLI - inputs: - targetType: filePath - filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1' - - - task: PowerShell@2 - displayName: Run Darc gather-drop - inputs: - targetType: inline - script: | - darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) --latest-location + - template: ../darc-gather-drop.yml + parameters: + ChannelId: ${{ variables.PublicDevRelease_30_Channel_Id }} - template: ../promote-build.yml parameters: diff --git a/eng/common/templates/post-build/channels/public-release.yml b/eng/common/templates/post-build/channels/public-release.yml index f6a7efdfe9..a31d37139b 100644 --- a/eng/common/templates/post-build/channels/public-release.yml +++ b/eng/common/templates/post-build/channels/public-release.yml @@ -143,29 +143,6 @@ stages: filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - job: - displayName: Gather Drop - dependsOn: setupMaestroVars - variables: - BARBuildId: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicRelease_30_Channel_Id) - pool: - vmImage: 'windows-2019' - steps: - - task: PowerShell@2 - displayName: Setup Darc CLI - inputs: - targetType: filePath - filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1' - - - task: PowerShell@2 - displayName: Run Darc gather-drop - inputs: - targetType: inline - script: | - darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) --latest-location - enabled: false - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.PublicRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index f12f402ad9..02dae0937d 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -91,29 +91,9 @@ stages: jobs: - template: ../setup-maestro-vars.yml - - job: - displayName: Gather Drop - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], variables.PublicValidationRelease_30_Channel_Id) - variables: - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - - group: Publish-Build-Assets - pool: - vmImage: 'windows-2019' - steps: - - task: PowerShell@2 - displayName: Setup Darc CLI - inputs: - targetType: filePath - filePath: '$(Build.SourcesDirectory)/eng/common/darc-init.ps1' - - - task: PowerShell@2 - displayName: Run Darc gather-drop - inputs: - targetType: inline - script: | - darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com --password $(MaestroAccessToken) --latest-location + - template: ../darc-gather-drop.yml + parameters: + ChannelId: ${{ variables.PublicValidationRelease_30_Channel_Id }} - template: ../promote-build.yml parameters: diff --git a/eng/common/templates/post-build/darc-gather-drop.yml b/eng/common/templates/post-build/darc-gather-drop.yml new file mode 100644 index 0000000000..e0a9f0a6d2 --- /dev/null +++ b/eng/common/templates/post-build/darc-gather-drop.yml @@ -0,0 +1,22 @@ +parameters: + ChannelId: 0 + +jobs: +- job: gatherDrop + displayName: Gather Drop + dependsOn: setupMaestroVars + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], ${{ parameters.ChannelId }}) + variables: + - group: Publish-Build-Assets + - name: BARBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + pool: + vmImage: 'windows-2019' + steps: + - task: PowerShell@2 + displayName: Darc gather-drop + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/darc-gather-drop.ps1 + arguments: -BarBuildId $(BARBuildId) + -DropLocation $(Agent.BuildDirectory)/Temp/Drop/ + -MaestroAccessToken $(MaestroAccessToken) diff --git a/eng/common/templates/post-build/trigger-subscription.yml b/eng/common/templates/post-build/trigger-subscription.yml index 65259d4e68..3915cdcd1a 100644 --- a/eng/common/templates/post-build/trigger-subscription.yml +++ b/eng/common/templates/post-build/trigger-subscription.yml @@ -8,4 +8,4 @@ steps: filePath: $(Build.SourcesDirectory)/eng/common/post-build/trigger-subscriptions.ps1 arguments: -SourceRepo $(Build.Repository.Uri) -ChannelId ${{ parameters.ChannelId }} - -BarToken $(MaestroAccessTokenInt) \ No newline at end of file + -BarToken $(MaestroAccessToken) diff --git a/eng/common/tools.sh b/eng/common/tools.sh old mode 100644 new mode 100755 diff --git a/global.json b/global.json index 1d496dc84b..ef694a9855 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19372.10", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19375.2", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From ce483c0e01625949a49aeb45c97d87d0549773c5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 26 Jul 2019 12:37:13 -0700 Subject: [PATCH 194/286] Update dependencies from https://github.com/dotnet/arcade build 20190725.15 (#7282) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19375.15 --- eng/Version.Details.xml | 4 +-- eng/common/init-tools-native.ps1 | 2 +- eng/common/native/CommonLibrary.psm1 | 33 +++++++++++++++++-- .../channels/public-dev-release.yml | 2 +- .../channels/public-validation-release.yml | 2 +- eng/common/tools.sh | 4 +-- global.json | 2 +- 7 files changed, 39 insertions(+), 10 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1ed95d393a..7a0a634b41 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 3dfa62fddcde597959c323d17426f215384e773a + ef1c110152df0d500fffb87878a86f88d1ca5295 diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index eaa05880c5..8cf18bcfeb 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -98,7 +98,7 @@ try { } Write-Verbose "Installing $ToolName version $ToolVersion" - Write-Verbose "Executing '$InstallerPath $LocalInstallerArguments'" + Write-Verbose "Executing '$InstallerPath $($LocalInstallerArguments.Keys.ForEach({"-$_ '$($LocalInstallerArguments.$_)'"}) -join ' ')'" & $InstallerPath @LocalInstallerArguments if ($LASTEXITCODE -Ne "0") { $errMsg = "$ToolName installation failed" diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 index 7a34c7e8a4..2a08d5246e 100644 --- a/eng/common/native/CommonLibrary.psm1 +++ b/eng/common/native/CommonLibrary.psm1 @@ -59,9 +59,38 @@ function DownloadAndExtract { -Verbose:$Verbose if ($UnzipStatus -Eq $False) { - Write-Error "Unzip failed" - return $False + # Retry Download one more time with Force=true + $DownloadRetryStatus = CommonLibrary\Get-File -Uri $Uri ` + -Path $TempToolPath ` + -DownloadRetries 1 ` + -RetryWaitTimeInSeconds $RetryWaitTimeInSeconds ` + -Force:$True ` + -Verbose:$Verbose + + if ($DownloadRetryStatus -Eq $False) { + Write-Error "Last attempt of download failed as well" + return $False + } + + # Retry unzip again one more time with Force=true + $UnzipRetryStatus = CommonLibrary\Expand-Zip -ZipPath $TempToolPath ` + -OutputDirectory $InstallDirectory ` + -Force:$True ` + -Verbose:$Verbose + if ($UnzipRetryStatus -Eq $False) + { + Write-Error "Last attempt of unzip failed as well" + # Clean up partial zips and extracts + if (Test-Path $TempToolPath) { + Remove-Item $TempToolPath -Force + } + if (Test-Path $InstallDirectory) { + Remove-Item $InstallDirectory -Force -Recurse + } + return $False + } } + return $True } diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml index b46b069923..4eaa6e4ff0 100644 --- a/eng/common/templates/post-build/channels/public-dev-release.yml +++ b/eng/common/templates/post-build/channels/public-dev-release.yml @@ -77,7 +77,7 @@ stages: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ChannelId=$(PublicDevRelease_30_Channel_Id) - /p:ArtifactsCategory=.NetCore + /p:ArtifactsCategory=$(_DotNetArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index 02dae0937d..8c4d8f6ef3 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -48,7 +48,7 @@ stages: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ChannelId=$(PublicValidationRelease_30_Channel_Id) - /p:ArtifactsCategory=.NetCoreValidation + /p:ArtifactsCategory=$(_DotNetArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 0deb01c480..738bb5669d 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -77,7 +77,7 @@ function ReadGlobalVersion { local pattern="\"$key\" *: *\"(.*)\"" if [[ ! $line =~ $pattern ]]; then - Write-PipelineTelemetryError -category 'InitializeTools' "Error: Cannot find \"$key\" in $global_json_file" + Write-PipelineTelemetryError -category 'InitializeToolset' "Error: Cannot find \"$key\" in $global_json_file" ExitWithExitCode 1 fi @@ -245,7 +245,7 @@ function InitializeNativeTools() { then local nativeArgs="" if [[ "$ci" == true ]]; then - nativeArgs="-InstallDirectory $tools_dir" + nativeArgs="--installDirectory $tools_dir" fi "$_script_dir/init-tools-native.sh" $nativeArgs fi diff --git a/global.json b/global.json index ef694a9855..67df8eb153 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19375.2", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19375.15", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 969a9c4661b277093aedf804e92d68532f991b92 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Fri, 26 Jul 2019 15:42:35 -0700 Subject: [PATCH 195/286] Fix test assert (#7283) --- tests/fsharp/Compiler/CompilerAssert.fs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index 9f64824bb4..c663e9b9c2 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -290,8 +290,10 @@ let main argv = 0""" Assert.AreEqual(expectedErrorMessage, errorMessage) ) - let ParseWithErrors (source: string) expectedParseErrors = - let parseResults = checker.ParseFile("test.fs", SourceText.ofString source, FSharpParsingOptions.Default) |> Async.RunSynchronously + let ParseWithErrors (source: string) expectedParseErrors = + let sourceFileName = "test.fs" + let parsingOptions = { FSharpParsingOptions.Default with SourceFiles = [| sourceFileName |] } + let parseResults = checker.ParseFile(sourceFileName, SourceText.ofString source, parsingOptions) |> Async.RunSynchronously Assert.True(parseResults.ParseHadErrors) From c03755fa47fe9660b40394b3e45779b9e02e409b Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Fri, 26 Jul 2019 21:31:00 -0700 Subject: [PATCH 196/286] disablewarningtests --- .../ErrorMessages/WarnExpressionTests.fs | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs b/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs index 557aa81a4d..7bf6cc211c 100644 --- a/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs +++ b/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs @@ -105,9 +105,10 @@ let changeX() = (6, 5, 6, 15) "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'." - [] + // [] // Disable this test until we refactor tcImports and tcGlobals let ``Warn If Discarded In List``() = - CompilerAssert.TypeCheckSingleError + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:4.6" |] """ let div _ _ = 1 let subView _ _ = [1; 2] @@ -119,14 +120,17 @@ let view model dispatch = div [] [] ] """ - FSharpErrorSeverity.Warning - 3221 - (9, 8, 9, 17) - "This expression returns a value of type 'int' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'." + [| + FSharpErrorSeverity.Warning, + 3221, + (9, 8, 9, 17), + "This expression returns a value of type 'int' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'." + |] - [] + // [] // Disable this test until we refactor tcImports and tcGlobals let ``Warn If Discarded In List 2``() = - CompilerAssert.TypeCheckSingleError + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:4.6" |] """ // stupid things to make the sample compile let div _ _ = 1 @@ -143,14 +147,17 @@ let view model dispatch = ] ] """ - FSharpErrorSeverity.Warning - 3222 - (13, 19, 13, 41) - "This expression returns a value of type 'int list' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield!'." + [| + FSharpErrorSeverity.Warning, + 3222, + (13, 19, 13, 41), + "This expression returns a value of type 'int list' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield!'." + |] - [] + // [] // Disable this test until we refactor tcImports and tcGlobals let ``Warn If Discarded In List 3``() = - CompilerAssert.TypeCheckSingleError + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:4.6" |] """ // stupid things to make the sample compile let div _ _ = 1 @@ -167,10 +174,12 @@ let view model dispatch = ] ] """ - FSharpErrorSeverity.Warning - 20 - (13, 19, 13, 41) - "The result of this expression has type 'bool' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'." + [| + FSharpErrorSeverity.Warning, + 20, + (13, 19, 13, 41), + "The result of this expression has type 'bool' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'." + |] [] let ``Warn Only On Last Expression``() = From cc60ed6fca25126b856db939afc43c4ca3cfe48d Mon Sep 17 00:00:00 2001 From: Don Syme Date: Sat, 27 Jul 2019 19:25:06 +0100 Subject: [PATCH 197/286] code cleanup prior to optional interop improvements (#7276) * add test cases we need to make work * cleanup method call argument processing --- src/fsharp/ConstraintSolver.fs | 2 +- src/fsharp/MethodCalls.fs | 451 +++++++++++--- src/fsharp/TastOps.fs | 35 +- src/fsharp/TastOps.fsi | 11 +- src/fsharp/TypeChecker.fs | 553 +++++------------- src/fsharp/xlf/FSComp.txt.es.xlf | 2 +- tests/fsharp/core/fsfromfsviacs/lib3.cs | 26 + tests/fsharp/core/fsfromfsviacs/test.fsx | 63 +- ...osoft.VisualStudio.Editors.Designer.cs.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.de.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.es.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.fr.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.it.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.ja.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.ko.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.pl.xlf | 3 +- ...ft.VisualStudio.Editors.Designer.pt-BR.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.ru.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.tr.xlf | 3 +- ....VisualStudio.Editors.Designer.zh-Hans.xlf | 3 +- ....VisualStudio.Editors.Designer.zh-Hant.xlf | 3 +- 21 files changed, 664 insertions(+), 518 deletions(-) diff --git a/src/fsharp/ConstraintSolver.fs b/src/fsharp/ConstraintSolver.fs index 586b91c41b..4f00fd73ed 100644 --- a/src/fsharp/ConstraintSolver.fs +++ b/src/fsharp/ConstraintSolver.fs @@ -1931,7 +1931,7 @@ and SolveTypeIsNonNullableValueType (csenv: ConstraintSolverEnv) ndeep m2 trace | _ -> let underlyingTy = stripTyEqnsAndMeasureEqns g ty if isStructTy g underlyingTy then - if isAppTy g underlyingTy && tyconRefEq g g.system_Nullable_tcref (tcrefOfAppTy g underlyingTy) then + if isNullableTy g underlyingTy then return! ErrorD (ConstraintSolverError(FSComp.SR.csTypeParameterCannotBeNullable(), m, m)) else return! ErrorD (ConstraintSolverError(FSComp.SR.csGenericConstructRequiresStructType(NicePrint.minimalStringOfType denv ty), m, m2)) diff --git a/src/fsharp/MethodCalls.fs b/src/fsharp/MethodCalls.fs index 5a8d66c875..895f2d1f72 100644 --- a/src/fsharp/MethodCalls.fs +++ b/src/fsharp/MethodCalls.fs @@ -20,6 +20,7 @@ open FSharp.Compiler.Tastops.DebugPrint open FSharp.Compiler.TcGlobals open FSharp.Compiler.TypeRelations open FSharp.Compiler.AttributeChecking +open Internal.Utilities #if !NO_EXTENSIONTYPING open FSharp.Compiler.ExtensionTyping @@ -151,7 +152,9 @@ let AdjustCalledArgType (infoReader: InfoReader) isConstraint (calledArg: Called mkRefCellTy g (destByrefTy g calledArgTy) else - // If the called method argument is a delegate type, then the caller may provide a function + // If the called method argument is a delegate type, and the caller is known to be a function type, then the caller may provide a function + // If the called method argument is an Expression type, and the caller is known to be a function type, then the caller may provide a T + // If the called method argument is an [] Quotations.Expr, and the caller is not known to be a quoted expression type, then the caller may provide a T let calledArgTy = let adjustDelegateTy calledTy = let (SigOfFunctionForDelegate(_, delArgTys, _, fty)) = GetSigOfFunctionForDelegate infoReader calledTy m AccessibleFromSomewhere @@ -178,14 +181,18 @@ let AdjustCalledArgType (infoReader: InfoReader) isConstraint (calledArg: Called else calledArgTy // Adjust the called argument type to take into account whether the caller's argument is M(?arg=Some(3)) or M(arg=1) - // If the called method argument is optional with type Option, then the caller may provide a T, unless their argument is propagating-optional (i.e. isOptCallerArg) + // If the called method argument is Callee-side optional with type Option, and the caller argument is not explicitly optional (callerArg.IsOptional), then the caller may provide a T + // If the called method argument is Caller-side optional with type Nullable, and the caller argument is not explicitly optional (callerArg.IsOptional), then the caller may provide a T let calledArgTy = match calledArg.OptArgInfo with - | NotOptional -> calledArgTy + | NotOptional -> calledArgTy | CalleeSide when not callerArg.IsOptional && isOptionTy g calledArgTy -> destOptionTy g calledArgTy - | CalleeSide | CallerSide _ -> calledArgTy - calledArgTy - + // This will be added in https://github.com/dotnet/fsharp/pull/7276 + //| CallerSide _ when not callerArg.IsOptional && isNullableTy g calledArgTy -> destNullableTy g calledArgTy + | CalleeSide + | CallerSide _ -> calledArgTy + + calledArgTy //------------------------------------------------------------------------- // CalledMeth @@ -540,6 +547,351 @@ let ExamineMethodForLambdaPropagation (x: CalledMeth) = else None +//------------------------------------------------------------------------- +// Adjust caller arguments as part of building a method call +//------------------------------------------------------------------------- + +/// Build a call to the System.Object constructor taking no arguments, +let BuildObjCtorCall (g: TcGlobals) m = + let ilMethRef = (mkILCtorMethSpecForTy(g.ilg.typ_Object, [])).MethodRef + Expr.Op (TOp.ILCall (false, false, false, false, CtorValUsedAsSuperInit, false, true, ilMethRef, [], [], [g.obj_ty]), [], [], m) + +/// Implements the elaborated form of adhoc conversions from functions to delegates at member callsites +let BuildNewDelegateExpr (eventInfoOpt: EventInfo option, g, amap, delegateTy, invokeMethInfo: MethInfo, delArgTys, f, fty, m) = + let slotsig = invokeMethInfo.GetSlotSig(amap, m) + let delArgVals, expr = + let topValInfo = ValReprInfo([], List.replicate (max 1 (List.length delArgTys)) ValReprInfo.unnamedTopArg, ValReprInfo.unnamedRetVal) + + // Try to pull apart an explicit lambda and use it directly + // Don't do this in the case where we're adjusting the arguments of a function used to build a .NET-compatible event handler + let lambdaContents = + if Option.isSome eventInfoOpt then + None + else + tryDestTopLambda g amap topValInfo (f, fty) + + match lambdaContents with + | None -> + + if List.exists (isByrefTy g) delArgTys then + error(Error(FSComp.SR.tcFunctionRequiresExplicitLambda(List.length delArgTys), m)) + + let delArgVals = delArgTys |> List.mapi (fun i argty -> fst (mkCompGenLocal m ("delegateArg" + string i) argty)) + let expr = + let args = + match eventInfoOpt with + | Some einfo -> + match delArgVals with + | [] -> error(nonStandardEventError einfo.EventName m) + | h :: _ when not (isObjTy 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 + mkApps g ((f, fty), [], args, m) + delArgVals, expr + + | Some _ -> + let _, _, _, vsl, body, _ = IteratedAdjustArityOfLambda g amap topValInfo f + List.concat vsl, body + + let meth = TObjExprMethod(slotsig, [], [], [delArgVals], expr, m) + mkObjExpr(delegateTy, None, BuildObjCtorCall g m, [meth], [], m) + +let CoerceFromFSharpFuncToDelegate g amap infoReader ad callerArgTy m callerArgExpr delegateTy = + let (SigOfFunctionForDelegate(invokeMethInfo, delArgTys, _, _)) = GetSigOfFunctionForDelegate infoReader delegateTy m ad + BuildNewDelegateExpr (None, g, amap, delegateTy, invokeMethInfo, delArgTys, callerArgExpr, callerArgTy, m) + +// Handle adhoc argument conversions +let AdjustCallerArgExprForCoercions (g: TcGlobals) amap infoReader ad isOutArg calledArgTy (reflArgInfo: ReflectedArgInfo) callerArgTy m callerArgExpr = + + if isByrefTy g calledArgTy && isRefCellTy g callerArgTy then + None, Expr.Op (TOp.RefAddrGet false, [destRefCellTy g callerArgTy], [callerArgExpr], m) + +#if IMPLICIT_ADDRESS_OF + elif isInByrefTy g calledArgTy && not (isByrefTy g callerArgTy) then + let wrap, callerArgExprAddress, _readonly, _writeonly = mkExprAddrOfExpr g true false NeverMutates callerArgExpr None m + Some wrap, callerArgExprAddress +#endif + + elif isDelegateTy g calledArgTy && isFunTy g callerArgTy then + None, CoerceFromFSharpFuncToDelegate g amap infoReader ad callerArgTy m callerArgExpr calledArgTy + + elif isLinqExpressionTy g calledArgTy && isDelegateTy g (destLinqExpressionTy g calledArgTy) && isFunTy g callerArgTy then + let delegateTy = destLinqExpressionTy g calledArgTy + let expr = CoerceFromFSharpFuncToDelegate g amap infoReader ad callerArgTy m callerArgExpr delegateTy + None, mkCallQuoteToLinqLambdaExpression g m delegateTy (Expr.Quote (expr, ref None, false, m, mkQuotedExprTy g delegateTy)) + + // auto conversions to quotations (to match auto conversions to LINQ expressions) + elif reflArgInfo.AutoQuote && isQuotedExprTy g calledArgTy && not (isQuotedExprTy g callerArgTy) then + match reflArgInfo with + | ReflectedArgInfo.Quote true -> + None, mkCallLiftValueWithDefn g m calledArgTy callerArgExpr + | ReflectedArgInfo.Quote false -> + None, Expr.Quote (callerArgExpr, ref None, false, m, calledArgTy) + | ReflectedArgInfo.None -> failwith "unreachable" // unreachable due to reflArgInfo.AutoQuote condition + + // Note: out args do not need to be coerced + elif isOutArg then + None, callerArgExpr + + // Note: not all these casts are reported in quotations + else + None, mkCoerceIfNeeded g calledArgTy callerArgTy callerArgExpr + +// Handle CallerSide optional arguments. +// +// CallerSide optional arguments are largely for COM interop, e.g. to PIA assemblies for Word etc. +// As a result we follow the VB and C# behavior here. +// +// "1. If the parameter is statically typed as System.Object and does not have a value, then there are four cases: +// a. The parameter is marked with MarshalAs(IUnknown), MarshalAs(Interface), or MarshalAs(IDispatch). In this case we pass null. +// b. Else if the parameter is marked with IUnknownConstantAttribute. In this case we pass new System.Runtime.InteropServices.UnknownWrapper(null) +// c. Else if the parameter is marked with IDispatchConstantAttribute. In this case we pass new System.Runtime.InteropServices.DispatchWrapper(null) +// d. Else, we will pass Missing.Value. +// 2. Otherwise, if there is a value attribute, then emit the default value. +// 3. Otherwise, we emit default(T). +// 4. Finally, we apply conversions from the value to the parameter type. This is where the nullable conversions take place for VB. +// - VB allows you to mark ref parameters as optional. The semantics of this is that we create a temporary +// with type = type of parameter, load the optional value to it, and call the method. +// - VB also allows you to mark arrays with Nothing as the optional value. +// - VB also allows you to pass intrinsic values as optional values to parameters +// typed as Object. What we do in this case is we box the intrinsic value." +// +let AdjustOptionalCallerArgExprs tcFieldInit eCallerMemberName g (calledMeth: CalledMeth<_>) mItem mMethExpr = + + let assignedNamedArgs = calledMeth.ArgSets |> List.collect (fun argSet -> argSet.AssignedNamedArgs) + let unnamedCalledArgs = calledMeth.ArgSets |> List.collect (fun argSet -> argSet.UnnamedCalledArgs) + let unnamedCallerArgs = calledMeth.ArgSets |> List.collect (fun argSet -> argSet.UnnamedCallerArgs) + let unnamedArgs = + (unnamedCalledArgs, unnamedCallerArgs) ||> List.map2 (fun called caller -> + { NamedArgIdOpt = None; CalledArg=called; CallerArg=caller }) + + let emptyPreBinder (e: Expr) = e + + // Adjust all the optional arguments that require a default value to be inserted into the call + let optArgs, optArgPreBinder = + (emptyPreBinder, calledMeth.UnnamedCalledOptArgs) ||> List.mapFold (fun wrapper calledArg -> + let calledArgTy = calledArg.CalledArgumentType + let wrapper2, expr = + match calledArg.OptArgInfo with + | NotOptional -> + error(InternalError("Unexpected NotOptional", mItem)) + + | CallerSide dfltVal -> + + let rec build currCalledArgTy currDfltVal = + match currDfltVal with + | MissingValue -> + // Add an I_nop if this is an initonly field to make sure we never recognize it as an lvalue. See mkExprAddrOfExpr. + emptyPreBinder, mkAsmExpr ([ mkNormalLdsfld (fspec_Missing_Value g); AI_nop ], [], [], [currCalledArgTy], mMethExpr) + + | DefaultValue -> + emptyPreBinder, mkDefault(mMethExpr, currCalledArgTy) + + | Constant fieldInit -> + match currCalledArgTy with + | NullableTy g inst when fieldInit <> ILFieldInit.Null -> + let nullableTy = mkILNonGenericBoxedTy(g.FindSysILTypeRef "System.Nullable`1") + let ctor = mkILCtorMethSpecForTy(nullableTy, [ILType.TypeVar 0us]).MethodRef + let ctorArgs = [Expr.Const (tcFieldInit mMethExpr fieldInit, mMethExpr, inst)] + emptyPreBinder, Expr.Op (TOp.ILCall (false, false, true, true, NormalValUse, false, false, ctor, [inst], [], [currCalledArgTy]), [], ctorArgs, mMethExpr) + | ByrefTy g inst -> + build inst (PassByRef(inst, currDfltVal)) + | _ -> + match calledArg.CallerInfo, eCallerMemberName with + | CallerLineNumber, _ when typeEquiv g currCalledArgTy g.int_ty -> + emptyPreBinder, Expr.Const (Const.Int32(mMethExpr.StartLine), mMethExpr, currCalledArgTy) + | CallerFilePath, _ when typeEquiv g currCalledArgTy g.string_ty -> + let fileName = mMethExpr.FileName |> FileSystem.GetFullPathShim |> PathMap.apply g.pathMap + emptyPreBinder, Expr.Const (Const.String fileName, mMethExpr, currCalledArgTy) + | CallerMemberName, Some callerName when (typeEquiv g currCalledArgTy g.string_ty) -> + emptyPreBinder, Expr.Const (Const.String callerName, mMethExpr, currCalledArgTy) + | _ -> + emptyPreBinder, Expr.Const (tcFieldInit mMethExpr fieldInit, mMethExpr, currCalledArgTy) + + | WrapperForIDispatch -> + match g.TryFindSysILTypeRef "System.Runtime.InteropServices.DispatchWrapper" with + | None -> error(Error(FSComp.SR.fscSystemRuntimeInteropServicesIsRequired(), mMethExpr)) + | Some tref -> + let ty = mkILNonGenericBoxedTy tref + let mref = mkILCtorMethSpecForTy(ty, [g.ilg.typ_Object]).MethodRef + let expr = Expr.Op (TOp.ILCall (false, false, false, true, NormalValUse, false, false, mref, [], [], [g.obj_ty]), [], [mkDefault(mMethExpr, currCalledArgTy)], mMethExpr) + emptyPreBinder, expr + + | WrapperForIUnknown -> + match g.TryFindSysILTypeRef "System.Runtime.InteropServices.UnknownWrapper" with + | None -> error(Error(FSComp.SR.fscSystemRuntimeInteropServicesIsRequired(), mMethExpr)) + | Some tref -> + let ty = mkILNonGenericBoxedTy tref + let mref = mkILCtorMethSpecForTy(ty, [g.ilg.typ_Object]).MethodRef + let expr = Expr.Op (TOp.ILCall (false, false, false, true, NormalValUse, false, false, mref, [], [], [g.obj_ty]), [], [mkDefault(mMethExpr, currCalledArgTy)], mMethExpr) + emptyPreBinder, expr + + | PassByRef (ty, dfltVal2) -> + let v, _ = mkCompGenLocal mMethExpr "defaultByrefArg" ty + let wrapper2, rhs = build currCalledArgTy dfltVal2 + (wrapper2 >> mkCompGenLet mMethExpr v rhs), mkValAddr mMethExpr false (mkLocalValRef v) + build calledArgTy dfltVal + + | CalleeSide -> + let calledNonOptTy = + if isOptionTy g calledArgTy then + destOptionTy g calledArgTy + else + calledArgTy // should be unreachable + + match calledArg.CallerInfo, eCallerMemberName with + | CallerLineNumber, _ when typeEquiv g calledNonOptTy g.int_ty -> + let lineExpr = Expr.Const(Const.Int32 mMethExpr.StartLine, mMethExpr, calledNonOptTy) + emptyPreBinder, mkSome g calledNonOptTy lineExpr mMethExpr + | CallerFilePath, _ when typeEquiv g calledNonOptTy g.string_ty -> + let fileName = mMethExpr.FileName |> FileSystem.GetFullPathShim |> PathMap.apply g.pathMap + let filePathExpr = Expr.Const (Const.String(fileName), mMethExpr, calledNonOptTy) + emptyPreBinder, mkSome g calledNonOptTy filePathExpr mMethExpr + | CallerMemberName, Some(callerName) when typeEquiv g calledNonOptTy g.string_ty -> + let memberNameExpr = Expr.Const (Const.String callerName, mMethExpr, calledNonOptTy) + emptyPreBinder, mkSome g calledNonOptTy memberNameExpr mMethExpr + | _ -> + emptyPreBinder, mkNone g calledNonOptTy mMethExpr + + // Combine the variable allocators (if any) + let wrapper = (wrapper >> wrapper2) + let callerArg = CallerArg(calledArgTy, mMethExpr, false, expr) + { NamedArgIdOpt = None; CalledArg = calledArg; CallerArg = callerArg }, wrapper) + + // Adjust all the optional arguments + let wrapOptionalArg (assignedArg: AssignedCalledArg<_>) = + let (CallerArg(callerArgTy, m, isOptCallerArg, callerArgExpr)) = assignedArg.CallerArg + match assignedArg.CalledArg.OptArgInfo with + | NotOptional -> + if isOptCallerArg then errorR(Error(FSComp.SR.tcFormalArgumentIsNotOptional(), m)) + assignedArg + | _ -> + let callerArgExpr2 = + match assignedArg.CalledArg.OptArgInfo with + | CallerSide _ -> + if isOptCallerArg then + // M(?x=bopt) when M(A) --> M(?x=bopt.Value) for caller-side + // STRUCT OPTIONS: if we allow struct options as optional arguments then we should take + // the address correctly. + mkUnionCaseFieldGetUnprovenViaExprAddr (callerArgExpr, mkSomeCase g, [destOptionTy g callerArgTy], 0, m) + else + // M(x=b) when M(A) --> M(?x=b) for caller-side + callerArgExpr + + | CalleeSide -> + if isOptCallerArg then + // M(?x=bopt) when M(A) --> M(?x=Some(bopt.Value)) + callerArgExpr + else + // M(x=b) when M(A) --> M(?x=Some(b :> A)) + let calledArgTy = assignedArg.CalledArg.CalledArgumentType + if isOptionTy g calledArgTy then + let calledNonOptTy = destOptionTy g calledArgTy + mkSome g calledNonOptTy (mkCoerceIfNeeded g calledNonOptTy callerArgTy callerArgExpr) m + else + callerArgExpr // should be unreachable + + | _ -> failwith "Unreachable" + { assignedArg with CallerArg=CallerArg(tyOfExpr g callerArgExpr2, m, isOptCallerArg, callerArgExpr2) } + + let adjustedNormalUnnamedArgs = List.map wrapOptionalArg unnamedArgs + let adjustedAssignedNamedArgs = List.map wrapOptionalArg assignedNamedArgs + + optArgs, optArgPreBinder, adjustedNormalUnnamedArgs, adjustedAssignedNamedArgs + +/// Adjust any 'out' arguments, passing in the address of a mutable local +let AdjustOutCallerArgExprs g (calledMeth: CalledMeth<_>) mMethExpr = + calledMeth.UnnamedCalledOutArgs |> List.map (fun calledArg -> + let calledArgTy = calledArg.CalledArgumentType + let outArgTy = destByrefTy g calledArgTy + let outv, outArgExpr = mkMutableCompGenLocal mMethExpr PrettyNaming.outArgCompilerGeneratedName outArgTy // mutable! + let expr = mkDefault (mMethExpr, outArgTy) + let callerArg = CallerArg (calledArgTy, mMethExpr, false, mkValAddr mMethExpr false (mkLocalValRef outv)) + let outArg = { NamedArgIdOpt=None;CalledArg=calledArg;CallerArg=callerArg } + outArg, outArgExpr, mkCompGenBind outv expr) + |> List.unzip3 + +let AdjustParamArrayCallerArgExprs g amap infoReader ad (calledMeth: CalledMeth<_>) mMethExpr = + let argSets = calledMeth.ArgSets + + let paramArrayCallerArgs = argSets |> List.collect (fun argSet -> argSet.ParamArrayCallerArgs) + match calledMeth.ParamArrayCalledArgOpt with + | None -> + [], [] + | Some paramArrayCalledArg -> + let paramArrayCalledArgElementType = destArrayTy g paramArrayCalledArg.CalledArgumentType + + let paramArrayPreBinders, es = + paramArrayCallerArgs + |> List.map (fun callerArg -> + let (CallerArg(callerArgTy, m, isOutArg, callerArgExpr)) = callerArg + AdjustCallerArgExprForCoercions g amap infoReader ad isOutArg paramArrayCalledArgElementType paramArrayCalledArg.ReflArgInfo callerArgTy m callerArgExpr) + |> List.unzip + + let arg = + [ { NamedArgIdOpt = None + CalledArg=paramArrayCalledArg + CallerArg=CallerArg(paramArrayCalledArg.CalledArgumentType, mMethExpr, false, Expr.Op (TOp.Array, [paramArrayCalledArgElementType], es, mMethExpr)) } ] + paramArrayPreBinders, arg + +/// Build the argument list for a method call. Adjust for param array, optional arguments, byref arguments and coercions. +/// For example, if you pass an F# reference cell to a byref then we must get the address of the +/// contents of the ref. Likewise lots of adjustments are made for optional arguments etc. +let AdjustCallerArgExprs tcFieldInit eCallerMemberName g amap infoReader ad (calledMeth: CalledMeth<_>) objArgs lambdaVars mItem mMethExpr = + let calledMethInfo = calledMeth.Method + + // Some of the code below must allocate temporary variables or bind other variables to particular values. + // As usual we represent variable allocators by expr -> expr functions + // which we then use to wrap the whole expression. These will either do nothing or pre-bind a variable. It doesn't + // matter what order they are applied in as long as they are all composed together. + let emptyPreBinder (e: Expr) = e + + // For unapplied 'e.M' we first evaluate 'e' outside the lambda, i.e. 'let v = e in (fun arg -> v.M(arg))' + let objArgPreBinder, objArgs = + match objArgs, lambdaVars with + | [objArg], Some _ -> + if calledMethInfo.IsExtensionMember && calledMethInfo.ObjArgNeedsAddress(amap, mMethExpr) then + error(Error(FSComp.SR.tcCannotPartiallyApplyExtensionMethodForByref(calledMethInfo.DisplayName), mMethExpr)) + let objArgTy = tyOfExpr g objArg + let v, ve = mkCompGenLocal mMethExpr "objectArg" objArgTy + (fun body -> mkCompGenLet mMethExpr v objArg body), [ve] + | _ -> + emptyPreBinder, objArgs + + // Handle param array and optional arguments + let paramArrayPreBinders, paramArrayArgs = + AdjustParamArrayCallerArgExprs g amap infoReader ad calledMeth mMethExpr + + let optArgs, optArgPreBinder, adjustedNormalUnnamedArgs, adjustedFinalAssignedNamedArgs = + AdjustOptionalCallerArgExprs tcFieldInit eCallerMemberName g calledMeth mItem mMethExpr + + let outArgs, outArgExprs, outArgTmpBinds = + AdjustOutCallerArgExprs g calledMeth mMethExpr + + let allArgs = + adjustedNormalUnnamedArgs @ + adjustedFinalAssignedNamedArgs @ + paramArrayArgs @ + optArgs @ + outArgs + + let allArgs = + allArgs |> List.sortBy (fun x -> x.Position) + + let allArgsPreBinders, allArgsCoerced = + allArgs + |> List.map (fun assignedArg -> + let isOutArg = assignedArg.CalledArg.IsOutArg + let reflArgInfo = assignedArg.CalledArg.ReflArgInfo + let calledArgTy = assignedArg.CalledArg.CalledArgumentType + let (CallerArg(callerArgTy, m, _, e)) = assignedArg.CallerArg + + AdjustCallerArgExprForCoercions g amap infoReader ad isOutArg calledArgTy reflArgInfo callerArgTy m e) + |> List.unzip + + objArgPreBinder, objArgs, allArgsPreBinders, allArgs, allArgsCoerced, optArgPreBinder, paramArrayPreBinders, outArgExprs, outArgTmpBinds + //------------------------------------------------------------------------- // Additional helpers for building method calls and doing TAST generation //------------------------------------------------------------------------- @@ -573,27 +925,30 @@ let ComputeConstrainedCallInfo g amap m (objArgs, minfo: MethInfo) = | _ -> None - /// Adjust the 'this' pointer before making a call /// Take the address of a struct, and coerce to an interface/base/constraint type if necessary let TakeObjAddrForMethodCall g amap (minfo: MethInfo) isMutable m objArgs f = let ccallInfo = ComputeConstrainedCallInfo g amap m (objArgs, minfo) let wrap, objArgs = + match objArgs with | [objArgExpr] -> + let hasCallInfo = ccallInfo.IsSome let mustTakeAddress = hasCallInfo || minfo.ObjArgNeedsAddress(amap, m) let objArgTy = tyOfExpr g objArgExpr - let wrap, objArgExpr', isReadOnly, _isWriteOnly = mkExprAddrOfExpr g mustTakeAddress hasCallInfo isMutable objArgExpr None m + + let wrap, objArgExprAddr, isReadOnly, _isWriteOnly = + mkExprAddrOfExpr g mustTakeAddress hasCallInfo isMutable objArgExpr None m // Extension members and calls to class constraints may need a coercion for their object argument - let objArgExpr' = + let objArgExprCoerced = if not hasCallInfo && not (TypeDefinitelySubsumesTypeNoCoercion 0 g amap m minfo.ApparentEnclosingType objArgTy) then - mkCoerceExpr(objArgExpr', minfo.ApparentEnclosingType, m, objArgTy) + mkCoerceExpr(objArgExprAddr, minfo.ApparentEnclosingType, m, objArgTy) else - objArgExpr' + objArgExprAddr // Check to see if the extension member uses the extending type as a byref. // If so, make sure we don't allow readonly/immutable values to be passed byref from an extension member. @@ -605,7 +960,7 @@ let TakeObjAddrForMethodCall g amap (minfo: MethInfo) isMutable m objArgs f = errorR(Error(FSComp.SR.tcCannotCallExtensionMethodInrefToByref(minfo.DisplayName), m))) - wrap, [objArgExpr'] + wrap, [objArgExprCoerced] | _ -> id, objArgs @@ -616,11 +971,6 @@ let TakeObjAddrForMethodCall g amap (minfo: MethInfo) isMutable m objArgs f = // Build method calls. //------------------------------------------------------------------------- -//------------------------------------------------------------------------- -// Build calls -//------------------------------------------------------------------------- - - /// Build an expression node that is a call to a .NET method. let BuildILMethInfoCall g amap m isProp (minfo: ILMethInfo) valUseFlags minst direct args = let valu = isStructTy g minfo.ApparentEnclosingType @@ -638,11 +988,6 @@ let BuildILMethInfoCall g amap m isProp (minfo: ILMethInfo) valUseFlags minst di Expr.Op (TOp.ILCall (useCallvirt, isProtected, valu, newobj, valUseFlags, isProp, isDllImport, ilMethRef, minfo.DeclaringTypeInst, minst, retTy), [], args, m), exprTy -/// Build a call to the System.Object constructor taking no arguments, -let BuildObjCtorCall (g: TcGlobals) m = - let ilMethRef = (mkILCtorMethSpecForTy(g.ilg.typ_Object, [])).MethodRef - Expr.Op (TOp.ILCall (false, false, false, false, CtorValUsedAsSuperInit, false, true, ilMethRef, [], [], [g.obj_ty]), [], [], m) - /// Build a call to an F# method. /// @@ -825,55 +1170,6 @@ let BuildMethodCall tcVal g amap isMutable m isProp minfo valUseFlags minst objA errorR(Error(FSComp.SR.tcDefaultStructConstructorCall(), m)) mkDefault (m, ty), ty) -//------------------------------------------------------------------------- -// Build delegate constructions (lambdas/functions to delegates) -//------------------------------------------------------------------------- - -/// Implements the elaborated form of adhoc conversions from functions to delegates at member callsites -let BuildNewDelegateExpr (eventInfoOpt: EventInfo option, g, amap, delegateTy, invokeMethInfo: MethInfo, delArgTys, f, fty, m) = - let slotsig = invokeMethInfo.GetSlotSig(amap, m) - let delArgVals, expr = - let topValInfo = ValReprInfo([], List.replicate (max 1 (List.length delArgTys)) ValReprInfo.unnamedTopArg, ValReprInfo.unnamedRetVal) - - // Try to pull apart an explicit lambda and use it directly - // Don't do this in the case where we're adjusting the arguments of a function used to build a .NET-compatible event handler - let lambdaContents = - if Option.isSome eventInfoOpt then - None - else - tryDestTopLambda g amap topValInfo (f, fty) - - match lambdaContents with - | None -> - - if List.exists (isByrefTy g) delArgTys then - error(Error(FSComp.SR.tcFunctionRequiresExplicitLambda(List.length delArgTys), m)) - - let delArgVals = delArgTys |> List.mapi (fun i argty -> fst (mkCompGenLocal m ("delegateArg" + string i) argty)) - let expr = - let args = - match eventInfoOpt with - | Some einfo -> - match delArgVals with - | [] -> error(nonStandardEventError einfo.EventName m) - | h :: _ when not (isObjTy 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 - mkApps g ((f, fty), [], args, m) - delArgVals, expr - - | Some _ -> - let _, _, _, vsl, body, _ = IteratedAdjustArityOfLambda g amap topValInfo f - List.concat vsl, body - - let meth = TObjExprMethod(slotsig, [], [], [delArgVals], expr, m) - mkObjExpr(delegateTy, None, BuildObjCtorCall g m, [meth], [], m) - -let CoerceFromFSharpFuncToDelegate g amap infoReader ad callerArgTy m callerArgExpr delegateTy = - let (SigOfFunctionForDelegate(invokeMethInfo, delArgTys, _, _)) = GetSigOfFunctionForDelegate infoReader delegateTy m ad - BuildNewDelegateExpr (None, g, amap, delegateTy, invokeMethInfo, delArgTys, callerArgExpr, callerArgTy, m) - //------------------------------------------------------------------------- // Import provided expressions @@ -972,11 +1268,14 @@ module ProvidedMethodCalls = st loop inputType - let convertProvidedExpressionToExprAndWitness tcVal (thisArg: Expr option, - allArgs: Exprs, - paramVars: Tainted[], - g, amap, mut, isProp, isSuperInit, m, - expr: Tainted) = + let convertProvidedExpressionToExprAndWitness + tcVal + (thisArg: Expr option, + allArgs: Exprs, + paramVars: Tainted[], + g, amap, mut, isProp, isSuperInit, m, + expr: Tainted) = + let varConv = // note: using paramVars.Length as assumed initial size, but this might not // be the optimal value; this wasn't checked before obsoleting Dictionary.ofList diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 00fb9a0827..c638d9a864 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -839,16 +839,6 @@ let tryNiceEntityRefOfTyOption ty = | TType_app (tcref, _) -> Some tcref | TType_measure (Measure.Con tcref) -> Some tcref | _ -> None - -let (|NullableTy|_|) g ty = - match tryAppTy g ty with - | ValueSome (tcref, [tyarg]) when tyconRefEq g tcref g.system_Nullable_tcref -> Some tyarg - | _ -> None - -let (|StripNullableTy|) g ty = - match tryAppTy g ty with - | ValueSome (tcref, [tyarg]) when tyconRefEq g tcref g.system_Nullable_tcref -> tyarg - | _ -> ty let mkInstForAppTy g ty = match tryAppTy g ty with @@ -3125,6 +3115,31 @@ let destOptionTy g ty = | ValueSome ty -> ty | ValueNone -> failwith "destOptionTy: not an option type" +let isNullableTy (g: TcGlobals) ty = + match tryDestAppTy g ty with + | ValueNone -> false + | ValueSome tcref -> tyconRefEq g g.system_Nullable_tcref tcref + +let tryDestNullableTy g ty = + match argsOfAppTy g ty with + | [ty1] when isNullableTy g ty -> ValueSome ty1 + | _ -> ValueNone + +let destNullableTy g ty = + match tryDestNullableTy g ty with + | ValueSome ty -> ty + | ValueNone -> failwith "destNullableTy: not a Nullable type" + +let (|NullableTy|_|) g ty = + match tryAppTy g ty with + | ValueSome (tcref, [tyarg]) when tyconRefEq g tcref g.system_Nullable_tcref -> Some tyarg + | _ -> None + +let (|StripNullableTy|) g ty = + match tryDestNullableTy g ty with + | ValueSome tyarg -> tyarg + | _ -> ty + let isLinqExpressionTy g ty = match tryDestAppTy g ty with | ValueNone -> false diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 8c71736a84..b0743de853 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -1388,7 +1388,7 @@ val mkVoidPtrTy : TcGlobals -> TType /// Build a single-dimensional array type val mkArrayType : TcGlobals -> TType -> TType -/// Determine is a type is an option type +/// Determine if a type is an option type val isOptionTy : TcGlobals -> TType -> bool /// Take apart an option type @@ -1397,6 +1397,15 @@ val destOptionTy : TcGlobals -> TType -> TType /// Try to take apart an option type val tryDestOptionTy : TcGlobals -> TType -> ValueOption +/// Determine is a type is a System.Nullable type +val isNullableTy : TcGlobals -> TType -> bool + +/// Try to take apart a System.Nullable type +val tryDestNullableTy: TcGlobals -> TType -> ValueOption + +/// Take apart a System.Nullable type +val destNullableTy: TcGlobals -> TType -> TType + /// Determine if a type is a System.Linq.Expression type val isLinqExpressionTy : TcGlobals -> TType -> bool diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index ae464f1575..70bb0f6b21 100644 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -9671,75 +9671,74 @@ and TcMethodApplication // In one case (the second "single named item" rule) we delay the application of a // argument until we've produced a lambda that detuples an input tuple let curriedCallerArgsOpt, unnamedDelayedCallerArgExprOpt, exprTy = - match curriedCallerArgs with - | [] -> - None, None, exprTy - | _ -> - let unnamedCurriedCallerArgs, namedCurriedCallerArgs = curriedCallerArgs |> List.map GetMethodArgs |> List.unzip + match curriedCallerArgs with + | [] -> + None, None, exprTy + | _ -> + let unnamedCurriedCallerArgs, namedCurriedCallerArgs = curriedCallerArgs |> List.map GetMethodArgs |> List.unzip - // There is an mismatch when _uses_ of indexed property setters in the tc.fs code that calls this function. - // The arguments are passed as if they are curried with arity [numberOfIndexParameters;1], however in the TAST, indexed property setters - // are uncurried and have arity [numberOfIndexParameters+1]. - // - // Here we work around this mismatch by crunching all property argument lists to uncirred form. - // Ideally the problem needs to be solved at its root cause at the callsites to this function - let unnamedCurriedCallerArgs, namedCurriedCallerArgs = - if isProp then - [List.concat unnamedCurriedCallerArgs], [List.concat namedCurriedCallerArgs] - else - unnamedCurriedCallerArgs, namedCurriedCallerArgs + // There is an mismatch when _uses_ of indexed property setters in the tc.fs code that calls this function. + // The arguments are passed as if they are curried with arity [numberOfIndexParameters;1], however in the TAST, indexed property setters + // are uncurried and have arity [numberOfIndexParameters+1]. + // + // Here we work around this mismatch by crunching all property argument lists to uncirred form. + // Ideally the problem needs to be solved at its root cause at the callsites to this function + let unnamedCurriedCallerArgs, namedCurriedCallerArgs = + if isProp then + [List.concat unnamedCurriedCallerArgs], [List.concat namedCurriedCallerArgs] + else + unnamedCurriedCallerArgs, namedCurriedCallerArgs - let MakeUnnamedCallerArgInfo x = (x, GetNewInferenceTypeForMethodArg cenv env tpenv x, x.Range) - - // "single named item" rule. This is where we have a single accessible method - // member x.M(arg1) - // being used with - // x.M (x, y) - // Without this rule this requires - // x.M ((x, y)) - match candidates with - | [calledMeth] - when (namedCurriedCallerArgs |> List.forall isNil && - let curriedCalledArgs = calledMeth.GetParamAttribs(cenv.amap, mItem) - curriedCalledArgs.Length = 1 && - curriedCalledArgs.Head.Length = 1 && - curriedCalledArgs.Head.Head |> isSimpleFormalArg) -> - let unnamedCurriedCallerArgs = curriedCallerArgs |> List.map (MakeUnnamedCallerArgInfo >> List.singleton) - let namedCurriedCallerArgs = namedCurriedCallerArgs |> List.map (fun _ -> []) - (Some (unnamedCurriedCallerArgs, namedCurriedCallerArgs), None, exprTy) - - // "single named item" rule. This is where we have a single accessible method - // member x.M(arg1, arg2) - // being used with - // x.M p - // We typecheck this as if it has been written "(fun (v1, v2) -> x.M(v1, v2)) p" - // Without this rule this requires - // x.M (fst p, snd p) - | [calledMeth] - when (namedCurriedCallerArgs |> List.forall isNil && - unnamedCurriedCallerArgs.Length = 1 && - unnamedCurriedCallerArgs.Head.Length = 1 && - let curriedCalledArgs = calledMeth.GetParamAttribs(cenv.amap, mItem) - curriedCalledArgs.Length = 1 && - curriedCalledArgs.Head.Length > 1 && - curriedCalledArgs.Head |> List.forall isSimpleFormalArg) -> - - // The call lambda has function type - let exprTy = mkFunTy (NewInferenceType ()) exprTy + let MakeUnnamedCallerArgInfo x = (x, GetNewInferenceTypeForMethodArg cenv env tpenv x, x.Range) + + // "single named item" rule. This is where we have a single accessible method + // member x.M(arg1) + // being used with + // x.M (x, y) + // Without this rule this requires + // x.M ((x, y)) + match candidates with + | [calledMeth] + when (namedCurriedCallerArgs |> List.forall isNil && + let curriedCalledArgs = calledMeth.GetParamAttribs(cenv.amap, mItem) + curriedCalledArgs.Length = 1 && + curriedCalledArgs.Head.Length = 1 && + curriedCalledArgs.Head.Head |> isSimpleFormalArg) -> + let unnamedCurriedCallerArgs = curriedCallerArgs |> List.map (MakeUnnamedCallerArgInfo >> List.singleton) + let namedCurriedCallerArgs = namedCurriedCallerArgs |> List.map (fun _ -> []) + (Some (unnamedCurriedCallerArgs, namedCurriedCallerArgs), None, exprTy) + + // "single named item" rule. This is where we have a single accessible method + // member x.M(arg1, arg2) + // being used with + // x.M p + // We typecheck this as if it has been written "(fun (v1, v2) -> x.M(v1, v2)) p" + // Without this rule this requires + // x.M (fst p, snd p) + | [calledMeth] + when (namedCurriedCallerArgs |> List.forall isNil && + unnamedCurriedCallerArgs.Length = 1 && + unnamedCurriedCallerArgs.Head.Length = 1 && + let curriedCalledArgs = calledMeth.GetParamAttribs(cenv.amap, mItem) + curriedCalledArgs.Length = 1 && + curriedCalledArgs.Head.Length > 1 && + curriedCalledArgs.Head |> List.forall isSimpleFormalArg) -> + + // The call lambda has function type + let exprTy = mkFunTy (NewInferenceType ()) exprTy - (None, Some unnamedCurriedCallerArgs.Head.Head, exprTy) + (None, Some unnamedCurriedCallerArgs.Head.Head, exprTy) - | _ -> - let unnamedCurriedCallerArgs = unnamedCurriedCallerArgs |> List.mapSquared MakeUnnamedCallerArgInfo - let namedCurriedCallerArgs = namedCurriedCallerArgs |> List.mapSquared (fun (isOpt, nm, x) -> - let ty = GetNewInferenceTypeForMethodArg cenv env tpenv x - // #435263: compiler crash with .net optional parameters and F# optional syntax - // named optional arguments should always have option type - let ty = if isOpt then mkOptionTy denv.g ty else ty - nm, isOpt, x, ty, x.Range - ) - - (Some (unnamedCurriedCallerArgs, namedCurriedCallerArgs), None, exprTy) + | _ -> + let unnamedCurriedCallerArgs = unnamedCurriedCallerArgs |> List.mapSquared MakeUnnamedCallerArgInfo + let namedCurriedCallerArgs = namedCurriedCallerArgs |> List.mapSquared (fun (isOpt, nm, x) -> + let ty = GetNewInferenceTypeForMethodArg cenv env tpenv x + // #435263: compiler crash with .net optional parameters and F# optional syntax + // named optional arguments should always have option type + let ty = if isOpt then mkOptionTy denv.g ty else ty + nm, isOpt, x, ty, x.Range) + + (Some (unnamedCurriedCallerArgs, namedCurriedCallerArgs), None, exprTy) let CalledMethHasSingleArgumentGroupOfThisLength n (calledMeth: MethInfo) = @@ -9983,21 +9982,12 @@ and TcMethodApplication let finalCalledMethInfo = finalCalledMeth.Method let finalCalledMethInst = finalCalledMeth.CalledTyArgs - let finalArgSets = finalCalledMeth.ArgSets let finalAssignedItemSetters = finalCalledMeth.AssignedItemSetters - let finalCalledPropInfoOpt = finalCalledMeth.AssociatedPropertyInfo let finalAttributeAssignedNamedItems = finalCalledMeth.AttributeAssignedNamedArgs - let finalUnnamedCalledOptArgs = finalCalledMeth.UnnamedCalledOptArgs - let finalUnnamedCalledOutArgs = finalCalledMeth.UnnamedCalledOutArgs - let finalAssignedNamedArgs = finalArgSets |> List.collect (fun argSet -> argSet.AssignedNamedArgs) - let finalParamArrayCallerArgs = finalArgSets |> List.collect (fun argSet -> argSet.ParamArrayCallerArgs) - let finalUnnamedCalledArgs = finalArgSets |> List.collect (fun argSet -> argSet.UnnamedCalledArgs) - let finalUnnamedCallerArgs = finalArgSets |> List.collect (fun argSet -> argSet.UnnamedCallerArgs) - // STEP 4. Check the attributes on the method and the corresponding event/property, if any - finalCalledPropInfoOpt |> Option.iter (fun pinfo -> CheckPropInfoAttributes pinfo mItem |> CommitOperationResult) + finalCalledMeth.AssociatedPropertyInfo |> Option.iter (fun pinfo -> CheckPropInfoAttributes pinfo mItem |> CommitOperationResult) let isInstance = not (isNil objArgs) MethInfoChecks cenv.g cenv.amap isInstance tyargsOpt objArgs ad mItem finalCalledMethInfo @@ -10026,266 +10016,13 @@ and TcMethodApplication | _ -> () end - if (finalArgSets |> List.existsi (fun i argSet -> argSet.UnnamedCalledArgs |> List.existsi (fun j ca -> ca.Position <> (i, j)))) then + if (finalCalledMeth.ArgSets |> List.existsi (fun i argSet -> argSet.UnnamedCalledArgs |> List.existsi (fun j ca -> ca.Position <> (i, j)))) then errorR(Deprecated(FSComp.SR.tcUnnamedArgumentsDoNotFormPrefix(), mMethExpr)) + /// STEP 5. Build the argument list. Adjust for optional arguments, byref arguments and coercions. - // STEP 5. Build the argument list. Adjust for optional arguments, byref arguments and coercions. - // For example, if you pass an F# reference cell to a byref then we must get the address of the - // contents of the ref. Likewise lots of adjustments are made for optional arguments etc. - - // Some of the code below must allocate temporary variables or bind other variables to particular values. - // As usual we represent variable allocators by expr -> expr functions - // which we then use to wrap the whole expression. These will either do nothing or pre-bind a variable. It doesn't - // matter what order they are applied in as long as they are all composed together. - let emptyPreBinder (e: Expr) = e - - // For unapplied 'e.M' we first evaluate 'e' outside the lambda, i.e. 'let v = e in (fun arg -> v.M(arg))' - let objArgPreBinder, objArgs = - match objArgs, lambdaVars with - | [objArg], Some _ -> - if finalCalledMethInfo.IsExtensionMember && finalCalledMethInfo.ObjArgNeedsAddress(cenv.amap, mMethExpr) then - error(Error(FSComp.SR.tcCannotPartiallyApplyExtensionMethodForByref(finalCalledMethInfo.DisplayName), mMethExpr)) - let objArgTy = tyOfExpr cenv.g objArg - let v, ve = mkCompGenLocal mMethExpr "objectArg" objArgTy - (fun body -> mkCompGenLet mMethExpr v objArg body), [ve] - | _ -> - emptyPreBinder, objArgs - - // Handle adhoc argument conversions - let coerceExpr isOutArg calledArgTy (reflArgInfo: ReflectedArgInfo) callerArgTy m callerArgExpr = - let g = cenv.g - - if isByrefTy g calledArgTy && isRefCellTy g callerArgTy then - None, Expr.Op (TOp.RefAddrGet false, [destRefCellTy g callerArgTy], [callerArgExpr], m) - -#if IMPLICIT_ADDRESS_OF - elif isInByrefTy g calledArgTy && not (isByrefTy cenv.g callerArgTy) then - let wrap, callerArgExprAddress, _readonly, _writeonly = mkExprAddrOfExpr g true false NeverMutates callerArgExpr None m - Some wrap, callerArgExprAddress -#endif - - elif isDelegateTy cenv.g calledArgTy && isFunTy cenv.g callerArgTy then - None, CoerceFromFSharpFuncToDelegate cenv.g cenv.amap cenv.infoReader ad callerArgTy m callerArgExpr calledArgTy - - elif isLinqExpressionTy cenv.g calledArgTy && isDelegateTy cenv.g (destLinqExpressionTy cenv.g calledArgTy) && isFunTy cenv.g callerArgTy then - let delegateTy = destLinqExpressionTy cenv.g calledArgTy - let expr = CoerceFromFSharpFuncToDelegate cenv.g cenv.amap cenv.infoReader ad callerArgTy m callerArgExpr delegateTy - None, mkCallQuoteToLinqLambdaExpression cenv.g m delegateTy (Expr.Quote (expr, ref None, false, m, mkQuotedExprTy cenv.g delegateTy)) - - // auto conversions to quotations (to match auto conversions to LINQ expressions) - elif reflArgInfo.AutoQuote && isQuotedExprTy cenv.g calledArgTy && not (isQuotedExprTy cenv.g callerArgTy) then - match reflArgInfo with - | ReflectedArgInfo.Quote true -> - None, mkCallLiftValueWithDefn cenv.g m calledArgTy callerArgExpr - | ReflectedArgInfo.Quote false -> - None, Expr.Quote (callerArgExpr, ref None, false, m, calledArgTy) - | ReflectedArgInfo.None -> failwith "unreachable" // unreachable due to reflArgInfo.AutoQuote condition - - // Note: out args do not need to be coerced - elif isOutArg then - None, callerArgExpr - - // Note: not all these casts are reported in quotations - else - None, mkCoerceIfNeeded cenv.g calledArgTy callerArgTy callerArgExpr - - // Handle param array and optional arguments - let optArgPreBinder, paramArrayPreBinders, allArgs, outArgExprs, outArgTmpBinds = - - let normalUnnamedArgs = - (finalUnnamedCalledArgs, finalUnnamedCallerArgs) ||> List.map2 (fun called caller -> { NamedArgIdOpt = None; CalledArg=called; CallerArg=caller }) - - let paramArrayPreBinders, paramArrayArgs = - match finalCalledMeth.ParamArrayCalledArgOpt with - | None -> - [], [] - | Some paramArrayCalledArg -> - let paramArrayCalledArgElementType = destArrayTy cenv.g paramArrayCalledArg.CalledArgumentType - - let paramArrayPreBinders, es = - finalParamArrayCallerArgs - |> List.map (fun callerArg -> - let (CallerArg(callerArgTy, m, isOutArg, callerArgExpr)) = callerArg - coerceExpr isOutArg paramArrayCalledArgElementType paramArrayCalledArg.ReflArgInfo callerArgTy m callerArgExpr) - |> List.unzip - - let arg = - [ { NamedArgIdOpt = None - CalledArg=paramArrayCalledArg - CallerArg=CallerArg(paramArrayCalledArg.CalledArgumentType, mMethExpr, false, Expr.Op (TOp.Array, [paramArrayCalledArgElementType], es, mMethExpr)) } ] - paramArrayPreBinders, arg - - // CLEANUP: Move all this code into some isolated file, e.g. "optional.fs" - // - // Handle CallerSide optional arguments. - // - // CallerSide optional arguments are largely for COM interop, e.g. to PIA assemblies for Word etc. - // As a result we follow the VB and C# behavior here. - // - // "1. If the parameter is statically typed as System.Object and does not have a value, then there are four cases: - // a. The parameter is marked with MarshalAs(IUnknown), MarshalAs(Interface), or MarshalAs(IDispatch). In this case we pass null. - // b. Else if the parameter is marked with IUnknownConstantAttribute. In this case we pass new System.Runtime.InteropServices.UnknownWrapper(null) - // c. Else if the parameter is marked with IDispatchConstantAttribute. In this case we pass new System.Runtime.InteropServices.DispatchWrapper(null) - // d. Else, we will pass Missing.Value. - // 2. Otherwise, if there is a value attribute, then emit the default value. - // 3. Otherwise, we emit default(T). - // 4. Finally, we apply conversions from the value to the parameter type. This is where the nullable conversions take place for VB. - // - VB allows you to mark ref parameters as optional. The semantics of this is that we create a temporary - // with type = type of parameter, load the optional value to it, and call the method. - // - VB also allows you to mark arrays with Nothing as the optional value. - // - VB also allows you to pass intrinsic values as optional values to parameters - // typed as Object. What we do in this case is we box the intrinsic value." - // - let optArgs, optArgPreBinder = - (emptyPreBinder, finalUnnamedCalledOptArgs) ||> List.mapFold (fun wrapper calledArg -> - let calledArgTy = calledArg.CalledArgumentType - let wrapper2, expr = - match calledArg.OptArgInfo with - | NotOptional -> - error(InternalError("Unexpected NotOptional", mItem)) - | CallerSide dfltVal -> - let rec build currCalledArgTy currDfltVal = - match currDfltVal with - | MissingValue -> - // Add an I_nop if this is an initonly field to make sure we never recognize it as an lvalue. See mkExprAddrOfExpr. - emptyPreBinder, mkAsmExpr ([ mkNormalLdsfld (fspec_Missing_Value cenv.g); AI_nop ], [], [], [currCalledArgTy], mMethExpr) - | DefaultValue -> - emptyPreBinder, mkDefault(mMethExpr, currCalledArgTy) - | Constant fieldInit -> - match currCalledArgTy with - | NullableTy cenv.g inst when fieldInit <> ILFieldInit.Null -> - let nullableTy = mkILNonGenericBoxedTy(cenv.g.FindSysILTypeRef "System.Nullable`1") - let ctor = mkILCtorMethSpecForTy(nullableTy, [ILType.TypeVar 0us]).MethodRef - let ctorArgs = [Expr.Const (TcFieldInit mMethExpr fieldInit, mMethExpr, inst)] - emptyPreBinder, Expr.Op (TOp.ILCall (false, false, true, true, NormalValUse, false, false, ctor, [inst], [], [currCalledArgTy]), [], ctorArgs, mMethExpr) - | ByrefTy cenv.g inst -> - build inst (PassByRef(inst, currDfltVal)) - | _ -> - match calledArg.CallerInfo, env.eCallerMemberName with - | CallerLineNumber, _ when typeEquiv cenv.g currCalledArgTy cenv.g.int_ty -> - emptyPreBinder, Expr.Const (Const.Int32(mMethExpr.StartLine), mMethExpr, currCalledArgTy) - | CallerFilePath, _ when typeEquiv cenv.g currCalledArgTy cenv.g.string_ty -> - let fileName = mMethExpr.FileName |> FileSystem.GetFullPathShim |> PathMap.apply cenv.g.pathMap - emptyPreBinder, Expr.Const (Const.String fileName, mMethExpr, currCalledArgTy) - | CallerMemberName, Some callerName when (typeEquiv cenv.g currCalledArgTy cenv.g.string_ty) -> - emptyPreBinder, Expr.Const (Const.String callerName, mMethExpr, currCalledArgTy) - | _ -> - emptyPreBinder, Expr.Const (TcFieldInit mMethExpr fieldInit, mMethExpr, currCalledArgTy) - - | WrapperForIDispatch -> - match cenv.g.TryFindSysILTypeRef "System.Runtime.InteropServices.DispatchWrapper" with - | None -> error(Error(FSComp.SR.fscSystemRuntimeInteropServicesIsRequired(), mMethExpr)) - | Some tref -> - let ty = mkILNonGenericBoxedTy tref - let mref = mkILCtorMethSpecForTy(ty, [cenv.g.ilg.typ_Object]).MethodRef - let expr = Expr.Op (TOp.ILCall (false, false, false, true, NormalValUse, false, false, mref, [], [], [cenv.g.obj_ty]), [], [mkDefault(mMethExpr, currCalledArgTy)], mMethExpr) - emptyPreBinder, expr - | WrapperForIUnknown -> - match cenv.g.TryFindSysILTypeRef "System.Runtime.InteropServices.UnknownWrapper" with - | None -> error(Error(FSComp.SR.fscSystemRuntimeInteropServicesIsRequired(), mMethExpr)) - | Some tref -> - let ty = mkILNonGenericBoxedTy tref - let mref = mkILCtorMethSpecForTy(ty, [cenv.g.ilg.typ_Object]).MethodRef - let expr = Expr.Op (TOp.ILCall (false, false, false, true, NormalValUse, false, false, mref, [], [], [cenv.g.obj_ty]), [], [mkDefault(mMethExpr, currCalledArgTy)], mMethExpr) - emptyPreBinder, expr - | PassByRef (ty, dfltVal2) -> - let v, _ = mkCompGenLocal mMethExpr "defaultByrefArg" ty - let wrapper2, rhs = build currCalledArgTy dfltVal2 - (wrapper2 >> mkCompGenLet mMethExpr v rhs), mkValAddr mMethExpr false (mkLocalValRef v) - build calledArgTy dfltVal - | CalleeSide -> - let calledNonOptTy = - if isOptionTy cenv.g calledArgTy then - destOptionTy cenv.g calledArgTy - else - calledArgTy // should be unreachable - - match calledArg.CallerInfo, env.eCallerMemberName with - | CallerLineNumber, _ when typeEquiv cenv.g calledNonOptTy cenv.g.int_ty -> - let lineExpr = Expr.Const(Const.Int32 mMethExpr.StartLine, mMethExpr, calledNonOptTy) - emptyPreBinder, mkSome cenv.g calledNonOptTy lineExpr mMethExpr - | CallerFilePath, _ when typeEquiv cenv.g calledNonOptTy cenv.g.string_ty -> - let fileName = mMethExpr.FileName |> FileSystem.GetFullPathShim |> PathMap.apply cenv.g.pathMap - let filePathExpr = Expr.Const (Const.String(fileName), mMethExpr, calledNonOptTy) - emptyPreBinder, mkSome cenv.g calledNonOptTy filePathExpr mMethExpr - | CallerMemberName, Some(callerName) when typeEquiv cenv.g calledNonOptTy cenv.g.string_ty -> - let memberNameExpr = Expr.Const (Const.String callerName, mMethExpr, calledNonOptTy) - emptyPreBinder, mkSome cenv.g calledNonOptTy memberNameExpr mMethExpr - | _ -> - emptyPreBinder, mkNone cenv.g calledNonOptTy mMethExpr - - // Combine the variable allocators (if any) - let wrapper = (wrapper >> wrapper2) - let callerArg = CallerArg(calledArgTy, mMethExpr, false, expr) - { NamedArgIdOpt = None; CalledArg = calledArg; CallerArg = callerArg }, wrapper) - - - // Handle optional arguments - let wrapOptionalArg (assignedArg: AssignedCalledArg<_>) = - let (CallerArg(callerArgTy, m, isOptCallerArg, expr)) = assignedArg.CallerArg - match assignedArg.CalledArg.OptArgInfo with - | NotOptional -> - if isOptCallerArg then errorR(Error(FSComp.SR.tcFormalArgumentIsNotOptional(), m)) - assignedArg - | _ -> - let expr = - match assignedArg.CalledArg.OptArgInfo with - | CallerSide _ -> - if isOptCallerArg then - // STRUCT OPTIONS: if we allow struct options as optional arguments then we should take - // the address correctly. - mkUnionCaseFieldGetUnprovenViaExprAddr (expr, mkSomeCase cenv.g, [destOptionTy cenv.g callerArgTy], 0, m) - else - expr - | CalleeSide -> - if isOptCallerArg then - // M(?x=bopt) when M(A) --> M(?x=Some(b.Value)) - expr - else - // M(x=b) when M(A) --> M(?x=Some(b :> A)) - let calledArgTy = assignedArg.CalledArg.CalledArgumentType - if isOptionTy cenv.g calledArgTy then - let calledNonOptTy = destOptionTy cenv.g calledArgTy - mkSome cenv.g calledNonOptTy (mkCoerceIfNeeded cenv.g calledNonOptTy callerArgTy expr) m - else - expr // should be unreachable - - | _ -> failwith "Unreachable" - { assignedArg with CallerArg=CallerArg((tyOfExpr cenv.g expr), m, isOptCallerArg, expr) } - - let outArgsAndExprs, outArgTmpBinds = - finalUnnamedCalledOutArgs |> List.map (fun calledArg -> - let calledArgTy = calledArg.CalledArgumentType - let outArgTy = destByrefTy cenv.g calledArgTy - let outv, outArgExpr = mkMutableCompGenLocal mMethExpr PrettyNaming.outArgCompilerGeneratedName outArgTy // mutable! - let expr = mkDefault(mMethExpr, outArgTy) - let callerArg = CallerArg(calledArgTy, mMethExpr, false, mkValAddr mMethExpr false (mkLocalValRef outv)) - let outArg = { NamedArgIdOpt=None;CalledArg=calledArg;CallerArg=callerArg } - (outArg, outArgExpr), mkCompGenBind outv expr) - |> List.unzip - - let outArgs, outArgExprs = List.unzip outArgsAndExprs - - let allArgs = - List.map wrapOptionalArg normalUnnamedArgs @ - List.map wrapOptionalArg finalAssignedNamedArgs @ - paramArrayArgs @ - optArgs @ - outArgs - - let allArgs = - allArgs |> List.sortBy (fun x -> x.Position) - - optArgPreBinder, paramArrayPreBinders, allArgs, outArgExprs, outArgTmpBinds - - let coerce (assignedArg: AssignedCalledArg<_>) = - let isOutArg = assignedArg.CalledArg.IsOutArg - let reflArgInfo = assignedArg.CalledArg.ReflArgInfo - let calledArgTy = assignedArg.CalledArg.CalledArgumentType - let (CallerArg(callerArgTy, m, _, e)) = assignedArg.CallerArg - - coerceExpr isOutArg calledArgTy reflArgInfo callerArgTy m e + let objArgPreBinder, objArgs, allArgsPreBinders, allArgs, allArgsCoerced, optArgPreBinder, paramArrayPreBinders, outArgExprs, outArgTmpBinds = + AdjustCallerArgExprs TcFieldInit env.eCallerMemberName cenv.g cenv.amap cenv.infoReader ad finalCalledMeth objArgs lambdaVars mItem mMethExpr // Record the resolution of the named argument for the Language Service allArgs |> List.iter (fun assignedArg -> @@ -10295,84 +10032,61 @@ and TcMethodApplication let item = Item.ArgName (defaultArg assignedArg.CalledArg.NameOpt id, assignedArg.CalledArg.CalledArgumentType, Some(ArgumentContainer.Method finalCalledMethInfo)) CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, item, emptyTyparInst, ItemOccurence.Use, env.DisplayEnv, ad)) - let allArgsPreBinders, allArgsCoerced = List.map coerce allArgs |> List.unzip - // Make the call expression - let expr, exprty = + /// STEP 6. Build the call expression, then adjust for byref-returns, out-parameters-as-tuples, post-hoc property assignments, methods-as-first-class-value, + /// + + let callExpr0, exprty = BuildPossiblyConditionalMethodCall cenv env mut mMethExpr isProp finalCalledMethInfo isSuperInit finalCalledMethInst objArgs allArgsCoerced // Handle byref returns - let expr = + let callExpr1 = // byref-typed returns get implicitly dereferenced - let vty = tyOfExpr cenv.g expr + let vty = tyOfExpr cenv.g callExpr0 if isByrefTy cenv.g vty then let v, _ = mkCompGenLocal mMethExpr "byrefReturn" vty - mkCompGenLet mMethExpr v expr (mkAddrGet mMethExpr (mkLocalValRef v)) + mkCompGenLet mMethExpr v callExpr0 (mkAddrGet mMethExpr (mkLocalValRef v)) else - expr + callExpr0 // Bind "out" parameters as part of the result tuple - let expr, exprty = + let callExpr2, exprty = + let expr = callExpr1 if isNil outArgTmpBinds then expr, exprty else let outArgTys = outArgExprs |> List.map (tyOfExpr cenv.g) - let expr = if isUnitTy cenv.g exprty then mkCompGenSequential mMethExpr expr (mkRefTupled cenv.g mMethExpr outArgExprs outArgTys) - else mkRefTupled cenv.g mMethExpr (expr :: outArgExprs) (exprty :: outArgTys) + let expr = + if isUnitTy cenv.g exprty then + mkCompGenSequential mMethExpr expr (mkRefTupled cenv.g mMethExpr outArgExprs outArgTys) + else + mkRefTupled cenv.g mMethExpr (expr :: outArgExprs) (exprty :: outArgTys) let expr = mkLetsBind mMethExpr outArgTmpBinds expr expr, tyOfExpr cenv.g expr // Handle post-hoc property assignments - let setterExprPrebinders, expr = - if isCheckingAttributeCall then - [], expr - elif isNil finalAssignedItemSetters then - [], expr - else - // This holds the result of the call - let objv, objExpr = mkMutableCompGenLocal mMethExpr "returnVal" exprty // mutable in case it's a struct - // This expression mutates the properties on the result of the call - let setterExprPrebinders, propSetExpr = - (mkUnit cenv.g mMethExpr, finalAssignedItemSetters) ||> List.mapFold (fun acc (AssignedItemSetter(id, setter, CallerArg(callerArgTy, m, isOptCallerArg, argExpr))) -> - if isOptCallerArg then error(Error(FSComp.SR.tcInvalidOptionalAssignmentToPropertyOrField(), m)) - - let argExprPrebinder, action, defnItem = - match setter with - | AssignedPropSetter (pinfo, pminfo, pminst) -> - MethInfoChecks cenv.g cenv.amap true None [objExpr] ad m pminfo - let calledArgTy = List.head (List.head (pminfo.GetParamTypes(cenv.amap, m, pminst))) - let argExprPrebinder, argExpr = coerceExpr false calledArgTy ReflectedArgInfo.None callerArgTy m argExpr - let mut = (if isStructTy cenv.g (tyOfExpr cenv.g objExpr) then DefinitelyMutates else PossiblyMutates) - let action = BuildPossiblyConditionalMethodCall cenv env mut m true pminfo NormalValUse pminst [objExpr] [argExpr] |> fst - argExprPrebinder, action, Item.Property (pinfo.PropertyName, [pinfo]) - - | AssignedILFieldSetter finfo -> - // Get or set instance IL field - ILFieldInstanceChecks cenv.g cenv.amap ad m finfo - let calledArgTy = finfo.FieldType (cenv.amap, m) - let argExprPrebinder, argExpr = coerceExpr false calledArgTy ReflectedArgInfo.None callerArgTy m argExpr - let action = BuildILFieldSet cenv.g m objExpr finfo argExpr - argExprPrebinder, action, Item.ILField finfo - - | AssignedRecdFieldSetter rfinfo -> - RecdFieldInstanceChecks cenv.g cenv.amap ad m rfinfo - let calledArgTy = rfinfo.FieldType - CheckRecdFieldMutation m denv rfinfo - let argExprPrebinder, argExpr = coerceExpr false calledArgTy ReflectedArgInfo.None callerArgTy m argExpr - let action = BuildRecdFieldSet cenv.g m objExpr rfinfo argExpr - argExprPrebinder, action, Item.RecdField rfinfo - - // Record the resolution for the Language Service - let item = Item.SetterArg (id, defnItem) - CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, item, emptyTyparInst, ItemOccurence.Use, env.DisplayEnv, ad) - - argExprPrebinder, mkCompGenSequential m acc action) - - // now put them together - let expr = mkCompGenLet mMethExpr objv expr (mkCompGenSequential mMethExpr propSetExpr objExpr) - setterExprPrebinders, expr - - // Build the lambda expression if any - let expr = + let setterExprPrebinders, callExpr3 = + let expr = callExpr2 + if isCheckingAttributeCall then + [], expr + elif isNil finalAssignedItemSetters then + [], expr + else + // This holds the result of the call + let objv, objExpr = mkMutableCompGenLocal mMethExpr "returnVal" exprty // mutable in case it's a struct + + // Build the expression that mutates the properties on the result of the call + let setterExprPrebinders, propSetExpr = + (mkUnit cenv.g mMethExpr, finalAssignedItemSetters) ||> List.mapFold (fun acc assignedItemSetter -> + let argExprPrebinder, action, m = TcSetterArgExpr cenv env denv objExpr ad assignedItemSetter + argExprPrebinder, mkCompGenSequential m acc action) + + // now put them together + let expr = mkCompGenLet mMethExpr objv expr (mkCompGenSequential mMethExpr propSetExpr objExpr) + setterExprPrebinders, expr + + // Build the lambda expression if any, if the method is used as a first-class value + let callExpr4 = + let expr = callExpr3 match lambdaVars with | None -> expr | Some curriedLambdaVars -> @@ -10382,7 +10096,8 @@ and TcMethodApplication | _ -> mkMultiLambda mMethExpr vs (expr, tyOfExpr cenv.g expr) List.foldBack mkLambda curriedLambdaVars expr - let expr, tpenv = + let callExpr5, tpenv = + let expr = callExpr4 match unnamedDelayedCallerArgExprOpt with | Some synArgExpr -> match lambdaVars with @@ -10395,15 +10110,53 @@ and TcMethodApplication expr, tpenv // Apply the PreBinders, if any - let expr = (expr, setterExprPrebinders) ||> List.fold (fun expr argPreBinder -> match argPreBinder with None -> expr | Some f -> f expr) - let expr = (expr, paramArrayPreBinders) ||> List.fold (fun expr argPreBinder -> match argPreBinder with None -> expr | Some f -> f expr) - let expr = (expr, allArgsPreBinders) ||> List.fold (fun expr argPreBinder -> match argPreBinder with None -> expr | Some f -> f expr) + let callExpr6 = + let expr = callExpr5 + let expr = (expr, setterExprPrebinders) ||> List.fold (fun expr argPreBinder -> match argPreBinder with None -> expr | Some f -> f expr) + let expr = (expr, paramArrayPreBinders) ||> List.fold (fun expr argPreBinder -> match argPreBinder with None -> expr | Some f -> f expr) + let expr = (expr, allArgsPreBinders) ||> List.fold (fun expr argPreBinder -> match argPreBinder with None -> expr | Some f -> f expr) - let expr = optArgPreBinder expr - let expr = objArgPreBinder expr + let expr = optArgPreBinder expr + let expr = objArgPreBinder expr + expr - (expr, finalAttributeAssignedNamedItems, delayed), tpenv + (callExpr6, finalAttributeAssignedNamedItems, delayed), tpenv +and TcSetterArgExpr cenv env denv objExpr ad (AssignedItemSetter(id, setter, CallerArg(callerArgTy, m, isOptCallerArg, argExpr))) = + if isOptCallerArg then error(Error(FSComp.SR.tcInvalidOptionalAssignmentToPropertyOrField(), m)) + + let argExprPrebinder, action, defnItem = + match setter with + | AssignedPropSetter (pinfo, pminfo, pminst) -> + MethInfoChecks cenv.g cenv.amap true None [objExpr] ad m pminfo + let calledArgTy = List.head (List.head (pminfo.GetParamTypes(cenv.amap, m, pminst))) + let argExprPrebinder, argExpr = MethodCalls.AdjustCallerArgExprForCoercions cenv.g cenv.amap cenv.infoReader ad false calledArgTy ReflectedArgInfo.None callerArgTy m argExpr + let mut = (if isStructTy cenv.g (tyOfExpr cenv.g objExpr) then DefinitelyMutates else PossiblyMutates) + let action = BuildPossiblyConditionalMethodCall cenv env mut m true pminfo NormalValUse pminst [objExpr] [argExpr] |> fst + argExprPrebinder, action, Item.Property (pinfo.PropertyName, [pinfo]) + + | AssignedILFieldSetter finfo -> + // Get or set instance IL field + ILFieldInstanceChecks cenv.g cenv.amap ad m finfo + let calledArgTy = finfo.FieldType (cenv.amap, m) + let argExprPrebinder, argExpr = MethodCalls.AdjustCallerArgExprForCoercions cenv.g cenv.amap cenv.infoReader ad false calledArgTy ReflectedArgInfo.None callerArgTy m argExpr + let action = BuildILFieldSet cenv.g m objExpr finfo argExpr + argExprPrebinder, action, Item.ILField finfo + + | AssignedRecdFieldSetter rfinfo -> + RecdFieldInstanceChecks cenv.g cenv.amap ad m rfinfo + let calledArgTy = rfinfo.FieldType + CheckRecdFieldMutation m denv rfinfo + let argExprPrebinder, argExpr = MethodCalls.AdjustCallerArgExprForCoercions cenv.g cenv.amap cenv.infoReader ad false calledArgTy ReflectedArgInfo.None callerArgTy m argExpr + let action = BuildRecdFieldSet cenv.g m objExpr rfinfo argExpr + argExprPrebinder, action, Item.RecdField rfinfo + + // Record the resolution for the Language Service + let item = Item.SetterArg (id, defnItem) + CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, item, emptyTyparInst, ItemOccurence.Use, env.DisplayEnv, ad) + + argExprPrebinder, action, m + and TcUnnamedMethodArgs cenv env lambdaPropagationInfo tpenv args = List.mapiFoldSquared (TcUnnamedMethodArg cenv env) (lambdaPropagationInfo, tpenv) args diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index 56f087fb38..279d16a7c9 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -124,7 +124,7 @@ All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. - Todas las ramas de una expresión de coincidencia de patrón deben devolver valores del mismo tipo. La primera rama devolvió un valor de tipo "{0}", pero esta rama devolvió un valor de tipo "\{1 \}". + All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. diff --git a/tests/fsharp/core/fsfromfsviacs/lib3.cs b/tests/fsharp/core/fsfromfsviacs/lib3.cs index b688b710bc..91a3dffe4b 100644 --- a/tests/fsharp/core/fsfromfsviacs/lib3.cs +++ b/tests/fsharp/core/fsfromfsviacs/lib3.cs @@ -24,3 +24,29 @@ public static void SomeMethod() { } } } +namespace CSharpOptionalParameters +{ + // This should be preferred over the same type in lib2.cs + public class SomeClass + { + public SomeClass() { } + public static int MethodTakingOptionals(int x = 3, string y = "abc", double d = 5.0) + { + return x + y.Length + (int) d; + } + public static int MethodTakingNullableOptionalsWithDefaults(int? x = 3, string y = "abc", double? d = 5.0) + { + return (x.HasValue ? x.Value : -100) + y.Length + (int) (d.HasValue ? d.Value : 0.0); + } + public static int MethodTakingNullableOptionals(int? x = null, string y = null, double? d = null) + { + int length; + if (y == null) + length = -1; + else + length = y.Length; + return (x.HasValue ? x.Value : -1) + length + (int) (d.HasValue ? d.Value : -1.0); + } + } + +} diff --git a/tests/fsharp/core/fsfromfsviacs/test.fsx b/tests/fsharp/core/fsfromfsviacs/test.fsx index 76ec203112..072a896c1e 100644 --- a/tests/fsharp/core/fsfromfsviacs/test.fsx +++ b/tests/fsharp/core/fsfromfsviacs/test.fsx @@ -71,22 +71,53 @@ let _ = test "structunion394b36" (Lib.NestedStructUnionsTests.testPattern3mut(u2 // F# option implicit converter tests -let testFsOpt() = - let testOpt (t : 'T option) = - test (sprintf "fsimplicitconv (%A)" t) (ApiWrapper.ConsumeOptionalParam<'T>(t) = t) - - testOpt(Option.None) - testOpt(Some 42) - - // check that implicit conversion of optionals does - // differentiate between 'null' and 'Some null' - testOpt(Option.None) - testOpt(Option.Some null) - testOpt(Some "") - testOpt(Some "test") - -testFsOpt() - +module TestConsumeOptionalParameter = + let testFsOpt() = + let testOpt (t : 'T option) = + test (sprintf "fsimplicitconv (%A)" t) (ApiWrapper.ConsumeOptionalParam<'T>(t) = t) + + testOpt(Option.None) + testOpt(Some 42) + + // check that implicit conversion of optionals does + // differentiate between 'null' and 'Some null' + testOpt(Option.None) + testOpt(Option.Some null) + testOpt(Some "") + testOpt(Some "test") + + testFsOpt() + +module TestConsumeCSharpOptionalParameter = + open System + open CSharpOptionalParameters + check "csoptional23982f31" (SomeClass.MethodTakingOptionals()) 11 + check "csoptional23982f32" (SomeClass.MethodTakingOptionals(x = 6)) 14 + check "csoptional23982f33" (SomeClass.MethodTakingOptionals(y = "aaaaaa")) 14 + check "csoptional23982f34" (SomeClass.MethodTakingOptionals(d = 8.0)) 14 + + check "csoptional23982f41" (SomeClass.MethodTakingNullableOptionalsWithDefaults()) 11 + check "csoptional23982f42" (SomeClass.MethodTakingNullableOptionalsWithDefaults(x = Nullable 6)) 14 + check "csoptional23982f43" (SomeClass.MethodTakingNullableOptionalsWithDefaults(y = "aaaaaa")) 14 + check "csoptional23982f44" (SomeClass.MethodTakingNullableOptionalsWithDefaults(d = Nullable 8.0)) 14 + + check "csoptional23982f51" (SomeClass.MethodTakingNullableOptionals()) -3 + check "csoptional23982f52" (SomeClass.MethodTakingNullableOptionals(x = Nullable 6)) 4 + check "csoptional23982f53" (SomeClass.MethodTakingNullableOptionals(y = "aaaaaa")) 4 + check "csoptional23982f54" (SomeClass.MethodTakingNullableOptionals(d = Nullable 8.0)) 6 + + // These require https://github.com/fsharp/fslang-suggestions/issues/774 to be implemented + //check "csoptional23982f3no" (SomeClass.SomeMethod(?x = Some 6)) 14 + //check "csoptional23982f3no" (SomeClass.SomeMethod(?y = Some "aaaaaa")) 14 + //check "csoptional23982f3no" (SomeClass.SomeMethod(?d = Some 8.0)) 14 + //check "csoptional23982f3no" (SomeClass.SomeMethod(?x = None)) 11 + //check "csoptional23982f3no" (SomeClass.SomeMethod(?y = None)) 11 + //check "csoptional23982f3no" (SomeClass.SomeMethod(?d = None)) 11 + + //check "csoptional23982f42" (SomeClass.MethodTakingNullableOptionalsWithDefaults(x = 6)) 14 + //check "csoptional23982f44" (SomeClass.MethodTakingNullableOptionalsWithDefaults(d = 8.0)) 14 + //check "csoptional23982f52" (SomeClass.MethodTakingNullableOptionals(x = 6)) 4 + //check "csoptional23982f54" (SomeClass.MethodTakingNullableOptionals(d = 8.0)) 6 module NestedStructPatternMatchingAcrossAssemblyBoundaries = open Lib.NestedStructUnionsTests diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf index a678a4bcfe..860555f344 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf index 662133483e..65b4328fdc 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf index 41dbc88f0b..1153755c3d 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf index 0f1e16e95f..cd60e9f07e 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf index 8902030751..dd58cb9a11 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf index a39e49dfa0..bdb896a5c8 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf index e7191ac3c4..6f540b5425 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf index d0675bd2fc..73bef853b9 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf index acfade8884..3e8a169348 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf index 355d363084..2b5303d91d 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf index 86ac32f4b3..73a72b806a 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf index 0537632d5f..474f99a3dc 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf index 17c64ffefb..16b7339b2a 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" From e72ded1638bf17f7310c2b0080dc38edceedea1f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 27 Jul 2019 11:26:05 -0700 Subject: [PATCH 198/286] Update dependencies from https://github.com/dotnet/arcade build 20190726.18 (#7285) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19376.18 --- eng/Version.Details.xml | 4 +- eng/common/post-build/darc-gather-drop.ps1 | 17 ++-- eng/common/post-build/nuget-validation.ps1 | 5 +- eng/common/post-build/post-build-utils.ps1 | 90 +++++++++++++++++++ eng/common/post-build/promote-build.ps1 | 37 ++++---- eng/common/post-build/setup-maestro-vars.ps1 | 26 ++++++ .../post-build/sourcelink-validation.ps1 | 31 ++++--- eng/common/post-build/symbols-validation.ps1 | 29 +++--- .../post-build/trigger-subscriptions.ps1 | 48 ++++------ .../channels/internal-servicing.yml | 5 +- .../channels/public-dev-release.yml | 5 +- .../post-build/channels/public-release.yml | 5 +- .../channels/public-validation-release.yml | 9 +- .../templates/post-build/common-variables.yml | 34 +++++-- .../templates/post-build/darc-gather-drop.yml | 5 +- .../templates/post-build/post-build.yml | 5 +- .../templates/post-build/promote-build.yml | 5 +- .../post-build/setup-maestro-vars.yml | 21 +---- .../post-build/trigger-subscription.yml | 4 +- global.json | 2 +- 20 files changed, 246 insertions(+), 141 deletions(-) create mode 100644 eng/common/post-build/post-build-utils.ps1 create mode 100644 eng/common/post-build/setup-maestro-vars.ps1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7a0a634b41..0893278ac1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - ef1c110152df0d500fffb87878a86f88d1ca5295 + 316481e57ee5e6acbbf2401eb6778a1d3d48d25b diff --git a/eng/common/post-build/darc-gather-drop.ps1 b/eng/common/post-build/darc-gather-drop.ps1 index 9cc2f1a009..93a0bd8328 100644 --- a/eng/common/post-build/darc-gather-drop.ps1 +++ b/eng/common/post-build/darc-gather-drop.ps1 @@ -1,13 +1,12 @@ param( - [Parameter(Mandatory=$true)][string] $BarBuildId, # ID of the build which assets should be downloaded - [Parameter(Mandatory=$true)][string] $MaestroAccessToken, # Token used to access Maestro API - [Parameter(Mandatory=$true)][string] $DropLocation # Where the assets should be downloaded to + [Parameter(Mandatory=$true)][int] $BarBuildId, # ID of the build which assets should be downloaded + [Parameter(Mandatory=$true)][string] $DropLocation, # Where the assets should be downloaded to + [Parameter(Mandatory=$true)][string] $MaestroApiAccessToken, # Token used to access Maestro API + [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = "https://maestro-prod.westus2.cloudapp.azure.com", # Maestro API URL + [Parameter(Mandatory=$false)][string] $MaestroApiVersion = "2019-01-16" # Version of Maestro API to use ) -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 - -. $PSScriptRoot\..\tools.ps1 +. $PSScriptRoot\post-build-utils.ps1 try { Write-Host "Installing DARC ..." @@ -24,8 +23,8 @@ try { --continue-on-error ` --id $BarBuildId ` --output-dir $DropLocation ` - --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ ` - --password $MaestroAccessToken ` + --bar-uri $MaestroApiEndpoint ` + --password $MaestroApiAccessToken ` --latest-location } catch { diff --git a/eng/common/post-build/nuget-validation.ps1 b/eng/common/post-build/nuget-validation.ps1 index 1bdced1e30..78ed0d540f 100644 --- a/eng/common/post-build/nuget-validation.ps1 +++ b/eng/common/post-build/nuget-validation.ps1 @@ -6,10 +6,7 @@ param( [Parameter(Mandatory=$true)][string] $ToolDestinationPath # Where the validation tool should be downloaded to ) -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 - -. $PSScriptRoot\..\tools.ps1 +. $PSScriptRoot\post-build-utils.ps1 try { $url = "https://raw.githubusercontent.com/NuGet/NuGetGallery/jver-verify/src/VerifyMicrosoftPackage/verify.ps1" diff --git a/eng/common/post-build/post-build-utils.ps1 b/eng/common/post-build/post-build-utils.ps1 new file mode 100644 index 0000000000..551ae113f8 --- /dev/null +++ b/eng/common/post-build/post-build-utils.ps1 @@ -0,0 +1,90 @@ +# Most of the functions in this file require the variables `MaestroApiEndPoint`, +# `MaestroApiVersion` and `MaestroApiAccessToken` to be globally available. + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 2.0 + +# `tools.ps1` checks $ci to perform some actions. Since the post-build +# scripts don't necessarily execute in the same agent that run the +# build.ps1/sh script this variable isn't automatically set. +$ci = $true +. $PSScriptRoot\..\tools.ps1 + +function Create-MaestroApiRequestHeaders([string]$ContentType = "application/json") { + Validate-MaestroVars + + $headers = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' + $headers.Add('Accept', $ContentType) + $headers.Add('Authorization',"Bearer $MaestroApiAccessToken") + return $headers +} + +function Get-MaestroChannel([int]$ChannelId) { + Validate-MaestroVars + + $apiHeaders = Create-MaestroApiRequestHeaders + $apiEndpoint = "$MaestroApiEndPoint/api/channels/${ChannelId}?api-version=$MaestroApiVersion" + + $result = try { Invoke-WebRequest -Method Get -Uri $apiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } + return $result +} + +function Get-MaestroBuild([int]$BuildId) { + Validate-MaestroVars + + $apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken + $apiEndpoint = "$MaestroApiEndPoint/api/builds/${BuildId}?api-version=$MaestroApiVersion" + + $result = try { return Invoke-WebRequest -Method Get -Uri $apiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } + return $result +} + +function Get-MaestroSubscriptions([string]$SourceRepository, [int]$ChannelId) { + Validate-MaestroVars + + $SourceRepository = [System.Web.HttpUtility]::UrlEncode($SourceRepository) + $apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken + $apiEndpoint = "$MaestroApiEndPoint/api/subscriptions?sourceRepository=$SourceRepository&channelId=$ChannelId&api-version=$MaestroApiVersion" + + $result = try { Invoke-WebRequest -Method Get -Uri $apiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } + return $result +} + +function Trigger-Subscription([string]$SubscriptionId) { + Validate-MaestroVars + + $apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken + $apiEndpoint = "$MaestroApiEndPoint/api/subscriptions/$SubscriptionId/trigger?api-version=$MaestroApiVersion" + Invoke-WebRequest -Uri $apiEndpoint -Headers $apiHeaders -Method Post | Out-Null +} + +function Assign-BuildToChannel([int]$BuildId, [int]$ChannelId) { + Validate-MaestroVars + + $apiHeaders = Create-MaestroApiRequestHeaders -AuthToken $MaestroApiAccessToken + $apiEndpoint = "$MaestroApiEndPoint/api/channels/${ChannelId}/builds/${BuildId}?api-version=$MaestroApiVersion" + Invoke-WebRequest -Method Post -Uri $apiEndpoint -Headers $apiHeaders | Out-Null +} + +function Validate-MaestroVars { + try { + Get-Variable MaestroApiEndPoint -Scope Global | Out-Null + Get-Variable MaestroApiVersion -Scope Global | Out-Null + Get-Variable MaestroApiAccessToken -Scope Global | Out-Null + + if (!($MaestroApiEndPoint -Match "^http[s]?://maestro-(int|prod).westus2.cloudapp.azure.com$")) { + Write-PipelineTaskError "MaestroApiEndPoint is not a valid Maestro URL. '$MaestroApiEndPoint'" + ExitWithExitCode 1 + } + + if (!($MaestroApiVersion -Match "^[0-9]{4}-[0-9]{2}-[0-9]{2}$")) { + Write-PipelineTaskError "MaestroApiVersion does not match a version string in the format yyyy-MM-DD. '$MaestroApiVersion'" + ExitWithExitCode 1 + } + } + catch { + Write-PipelineTaskError "Error: Variables `MaestroApiEndPoint`, `MaestroApiVersion` and `MaestroApiAccessToken` are required while using this script." + Write-Host $_ + ExitWithExitCode 1 + } +} diff --git a/eng/common/post-build/promote-build.ps1 b/eng/common/post-build/promote-build.ps1 index 84a608fa56..e5ae85f251 100644 --- a/eng/common/post-build/promote-build.ps1 +++ b/eng/common/post-build/promote-build.ps1 @@ -1,30 +1,25 @@ param( [Parameter(Mandatory=$true)][int] $BuildId, [Parameter(Mandatory=$true)][int] $ChannelId, - [Parameter(Mandatory=$true)][string] $BarToken, - [string] $MaestroEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com", - [string] $ApiVersion = "2019-01-16" + [Parameter(Mandatory=$true)][string] $MaestroApiAccessToken, + [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = "https://maestro-prod.westus2.cloudapp.azure.com", + [Parameter(Mandatory=$false)][string] $MaestroApiVersion = "2019-01-16" ) -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 - -. $PSScriptRoot\..\tools.ps1 - -function Get-Headers([string]$accept, [string]$barToken) { - $headers = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' - $headers.Add('Accept',$accept) - $headers.Add('Authorization',"Bearer $barToken") - return $headers -} +. $PSScriptRoot\post-build-utils.ps1 try { - $maestroHeaders = Get-Headers 'application/json' $BarToken + # Check that the channel we are going to promote the build to exist + $channelInfo = Get-MaestroChannel -ChannelId $ChannelId - # Get info about which channels the build has already been promoted to - $getBuildApiEndpoint = "$MaestroEndpoint/api/builds/${BuildId}?api-version=$ApiVersion" - $buildInfo = Invoke-WebRequest -Method Get -Uri $getBuildApiEndpoint -Headers $maestroHeaders | ConvertFrom-Json + if (!$channelInfo) { + Write-Host "Channel with BAR ID $ChannelId was not found in BAR!" + ExitWithExitCode 1 + } + # Get info about which channels the build has already been promoted to + $buildInfo = Get-MaestroBuild -BuildId $BuildId + if (!$buildInfo) { Write-Host "Build with BAR ID $BuildId was not found in BAR!" ExitWithExitCode 1 @@ -40,10 +35,10 @@ try { } } - Write-Host "Build not present in channel $ChannelId. Promoting build ... " + Write-Host "Promoting build '$BuildId' to channel '$ChannelId'." + + Assign-BuildToChannel -BuildId $BuildId -ChannelId $ChannelId - $promoteBuildApiEndpoint = "$maestroEndpoint/api/channels/${ChannelId}/builds/${BuildId}?api-version=$ApiVersion" - Invoke-WebRequest -Method Post -Uri $promoteBuildApiEndpoint -Headers $maestroHeaders Write-Host "done." } catch { diff --git a/eng/common/post-build/setup-maestro-vars.ps1 b/eng/common/post-build/setup-maestro-vars.ps1 new file mode 100644 index 0000000000..d7f64dc63c --- /dev/null +++ b/eng/common/post-build/setup-maestro-vars.ps1 @@ -0,0 +1,26 @@ +param( + [Parameter(Mandatory=$true)][string] $ReleaseConfigsPath # Full path to ReleaseConfigs.txt asset +) + +. $PSScriptRoot\post-build-utils.ps1 + +try { + $Content = Get-Content $ReleaseConfigsPath + + $BarId = $Content | Select -Index 0 + + $Channels = "" + $Content | Select -Index 1 | ForEach-Object { $Channels += "$_ ," } + + $IsStableBuild = $Content | Select -Index 2 + + Write-PipelineSetVariable -Name 'BARBuildId' -Value $BarId + Write-PipelineSetVariable -Name 'InitialChannels' -Value "$Channels" + Write-PipelineSetVariable -Name 'IsStableBuild' -Value $IsStableBuild +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + ExitWithExitCode 1 +} diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 index 8abd684e9e..41e01ae6e6 100644 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -6,10 +6,7 @@ param( [Parameter(Mandatory=$true)][string] $SourcelinkCliVersion # Version of SourceLink CLI to use ) -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 - -. $PSScriptRoot\..\tools.ps1 +. $PSScriptRoot\post-build-utils.ps1 # Cache/HashMap (File -> Exist flag) used to consult whether a file exist # in the repository at a specific commit point. This is populated by inserting @@ -200,21 +197,27 @@ function ValidateSourceLinkLinks { } } -function CheckExitCode ([string]$stage) { - $exitCode = $LASTEXITCODE - if ($exitCode -ne 0) { - Write-PipelineTaskError "Something failed while '$stage'. Check for errors above. Exiting now..." - ExitWithExitCode $exitCode +function InstallSourcelinkCli { + $sourcelinkCliPackageName = "sourcelink" + + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + $toolList = & "$dotnet" tool list --global + + if (($toolList -like "*$sourcelinkCliPackageName*") -and ($toolList -like "*$sourcelinkCliVersion*")) { + Write-Host "SourceLink CLI version $sourcelinkCliVersion is already installed." + } + else { + Write-Host "Installing SourceLink CLI version $sourcelinkCliVersion..." + Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." + & "$dotnet" tool install $sourcelinkCliPackageName --version $sourcelinkCliVersion --verbosity "minimal" --global } } try { - Write-Host "Installing SourceLink CLI..." - Get-Location - . $PSScriptRoot\sourcelink-cli-init.ps1 -sourcelinkCliVersion $SourcelinkCliVersion - CheckExitCode "Running sourcelink-cli-init" + InstallSourcelinkCli - Measure-Command { ValidateSourceLinkLinks } + ValidateSourceLinkLinks } catch { Write-Host $_ diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1 index 69456854e0..d5ec51b150 100644 --- a/eng/common/post-build/symbols-validation.ps1 +++ b/eng/common/post-build/symbols-validation.ps1 @@ -4,10 +4,7 @@ param( [Parameter(Mandatory=$true)][string] $DotnetSymbolVersion # Version of dotnet symbol to use ) -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 - -. $PSScriptRoot\..\tools.ps1 +. $PSScriptRoot\post-build-utils.ps1 Add-Type -AssemblyName System.IO.Compression.FileSystem @@ -162,19 +159,25 @@ function CheckSymbolsAvailable { } } -function CheckExitCode ([string]$stage) { - $exitCode = $LASTEXITCODE - if ($exitCode -ne 0) { - Write-PipelineTaskError "Something failed while '$stage'. Check for errors above. Exiting now..." - ExitWithExitCode $exitCode +function Installdotnetsymbol { + $dotnetsymbolPackageName = "dotnet-symbol" + + $dotnetRoot = InitializeDotNetCli -install:$true + $dotnet = "$dotnetRoot\dotnet.exe" + $toolList = & "$dotnet" tool list --global + + if (($toolList -like "*$dotnetsymbolPackageName*") -and ($toolList -like "*$dotnetsymbolVersion*")) { + Write-Host "dotnet-symbol version $dotnetsymbolVersion is already installed." + } + else { + Write-Host "Installing dotnet-symbol version $dotnetsymbolVersion..." + Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." + & "$dotnet" tool install $dotnetsymbolPackageName --version $dotnetsymbolVersion --verbosity "minimal" --global } } try { - Write-Host "Installing dotnet symbol ..." - Get-Location - . $PSScriptRoot\dotnetsymbol-init.ps1 -dotnetsymbolVersion $DotnetSymbolVersion - CheckExitCode "Running dotnetsymbol-init" + Installdotnetsymbol CheckSymbolsAvailable } diff --git a/eng/common/post-build/trigger-subscriptions.ps1 b/eng/common/post-build/trigger-subscriptions.ps1 index 1a91dab037..926d5b4551 100644 --- a/eng/common/post-build/trigger-subscriptions.ps1 +++ b/eng/common/post-build/trigger-subscriptions.ps1 @@ -1,33 +1,20 @@ -param( +param( [Parameter(Mandatory=$true)][string] $SourceRepo, [Parameter(Mandatory=$true)][int] $ChannelId, - [string] $MaestroEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com", - [string] $BarToken, - [string] $ApiVersion = "2019-01-16" + [Parameter(Mandatory=$true)][string] $MaestroApiAccessToken, + [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = "https://maestro-prod.westus2.cloudapp.azure.com", + [Parameter(Mandatory=$false)][string] $MaestroApiVersion = "2019-01-16" ) -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 - -. $PSScriptRoot\..\tools.ps1 - -function Get-Headers([string]$accept, [string]$barToken) { - $headers = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' - $headers.Add('Accept',$accept) - $headers.Add('Authorization',"Bearer $barToken") - return $headers -} +. $PSScriptRoot\post-build-utils.ps1 # Get all the $SourceRepo subscriptions $normalizedSourceRepo = $SourceRepo.Replace('dnceng@', '') -$getSubscriptionsApiEndpoint = "$maestroEndpoint/api/subscriptions?sourceRepository=$normalizedSourceRepo&api-version=$apiVersion" -$headers = Get-Headers 'application/json' $barToken - -$subscriptions = Invoke-WebRequest -Uri $getSubscriptionsApiEndpoint -Headers $headers | ConvertFrom-Json +$subscriptions = Get-MaestroSubscriptions -SourceRepository $normalizedSourceRepo -ChannelId $ChannelId if (!$subscriptions) { Write-Host "No subscriptions found for source repo '$normalizedSourceRepo' in channel '$ChannelId'" - return + ExitWithExitCode 0 } $subscriptionsToTrigger = New-Object System.Collections.Generic.List[string] @@ -36,21 +23,18 @@ $failedTriggeredSubscription = $false # Get all enabled subscriptions that need dependency flow on 'everyBuild' foreach ($subscription in $subscriptions) { if ($subscription.enabled -and $subscription.policy.updateFrequency -like 'everyBuild' -and $subscription.channel.id -eq $ChannelId) { - Write-Host "$subscription.id" + Write-Host "Should trigger this subscription: $subscription.id" [void]$subscriptionsToTrigger.Add($subscription.id) } } foreach ($subscriptionToTrigger in $subscriptionsToTrigger) { try { - $triggerSubscriptionApiEndpoint = "$maestroEndpoint/api/subscriptions/$subscriptionToTrigger/trigger?api-version=$apiVersion" - $headers = Get-Headers 'application/json' $BarToken - - Write-Host "Triggering subscription '$subscriptionToTrigger'..." + Write-Host "Triggering subscription '$subscriptionToTrigger'." - Invoke-WebRequest -Uri $triggerSubscriptionApiEndpoint -Headers $headers -Method Post + Trigger-Subscription -SubscriptionId $subscriptionToTrigger - Write-Host "Subscription '$subscriptionToTrigger' triggered!" + Write-Host "done." } catch { @@ -61,9 +45,13 @@ foreach ($subscriptionToTrigger in $subscriptionsToTrigger) { } } -if ($failedTriggeredSubscription) { +if ($subscriptionsToTrigger.Count -eq 0) { + Write-Host "No subscription matched source repo '$normalizedSourceRepo' and channel ID '$ChannelId'." +} +elseif ($failedTriggeredSubscription) { Write-Host "At least one subscription failed to be triggered..." ExitWithExitCode 1 } - -Write-Host "All subscriptions were triggered successfully!" +else { + Write-Host "All subscriptions were triggered successfully!" +} diff --git a/eng/common/templates/post-build/channels/internal-servicing.yml b/eng/common/templates/post-build/channels/internal-servicing.yml index 5c07b66926..12fd2b4653 100644 --- a/eng/common/templates/post-build/channels/internal-servicing.yml +++ b/eng/common/templates/post-build/channels/internal-servicing.yml @@ -41,7 +41,6 @@ stages: dependsOn: setupMaestroVars variables: - group: DotNet-Blob-Feed - - group: Publish-Build-Assets - group: AzureDevOps-Artifact-Feeds-Pats - name: BARBuildId value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] @@ -87,8 +86,8 @@ stages: /p:StaticInternalFeed=$(dotnetfeed-internal-nonstable-feed-url) /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' - /p:BuildAssetRegistryToken='$(MaestroAccessToken)' + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml index 4eaa6e4ff0..b0f085b142 100644 --- a/eng/common/templates/post-build/channels/public-dev-release.yml +++ b/eng/common/templates/post-build/channels/public-dev-release.yml @@ -41,7 +41,6 @@ stages: dependsOn: setupMaestroVars variables: - group: DotNet-Blob-Feed - - group: Publish-Build-Assets - group: AzureDevOps-Artifact-Feeds-Pats - name: BARBuildId value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] @@ -87,8 +86,8 @@ stages: /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' - /p:BuildAssetRegistryToken='$(MaestroAccessToken)' + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' diff --git a/eng/common/templates/post-build/channels/public-release.yml b/eng/common/templates/post-build/channels/public-release.yml index a31d37139b..4c63fb43f0 100644 --- a/eng/common/templates/post-build/channels/public-release.yml +++ b/eng/common/templates/post-build/channels/public-release.yml @@ -41,7 +41,6 @@ stages: dependsOn: setupMaestroVars variables: - group: DotNet-Blob-Feed - - group: Publish-Build-Assets - group: AzureDevOps-Artifact-Feeds-Pats - name: BARBuildId value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] @@ -87,8 +86,8 @@ stages: /p:StaticInternalFeed=$(dotnetfeed-internal-nonstable-feed-url) /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' - /p:BuildAssetRegistryToken='$(MaestroAccessToken)' + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index 8c4d8f6ef3..1089ac5fa6 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -12,7 +12,6 @@ stages: dependsOn: setupMaestroVars variables: - group: DotNet-Blob-Feed - - group: Publish-Build-Assets - group: AzureDevOps-Artifact-Feeds-Pats - name: BARBuildId value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] @@ -48,7 +47,7 @@ stages: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ChannelId=$(PublicValidationRelease_30_Channel_Id) - /p:ArtifactsCategory=$(_DotNetArtifactsCategory) + /p:ArtifactsCategory=$(_DotNetValidationArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) @@ -58,13 +57,13 @@ stages: /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='https://maestro-prod.westus2.cloudapp.azure.com' - /p:BuildAssetRegistryToken='$(MaestroAccessToken)' + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' /p:Configuration=Release - + - task: NuGetCommand@2 displayName: Publish Packages to AzDO Feed condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index 42df4ae77e..bd0bc5e4da 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -1,21 +1,39 @@ variables: + - group: Publish-Build-Assets + # .NET Core 3 Dev - PublicDevRelease_30_Channel_Id: 3 + - name: PublicDevRelease_30_Channel_Id + value: 3 # .NET Tools - Validation - PublicValidationRelease_30_Channel_Id: 9 + - name: PublicValidationRelease_30_Channel_Id + value: 9 # .NET Core 3.0 Internal Servicing - InternalServicing_30_Channel_Id: 184 + - name: InternalServicing_30_Channel_Id + value: 184 # .NET Core 3.0 Release - PublicRelease_30_Channel_Id: 19 + - name: PublicRelease_30_Channel_Id + value: 19 # Whether the build is internal or not - IsInternalBuild: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} + - name: IsInternalBuild + value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} # Storage account name for proxy-backed feeds - ProxyBackedFeedsAccountName: dotnetfeed + - name: ProxyBackedFeedsAccountName + value: dotnetfeed + + # Default Maestro++ API Endpoint and API Version + - name: MaestroApiEndPoint + value: "https://maestro-prod.westus2.cloudapp.azure.com" + - name: MaestroApiAccessToken + value: $(MaestroAccessToken) + - name: MaestroApiVersion + value: "2019-01-16" - SourceLinkCLIVersion: 3.0.0 - SymbolToolVersion: 1.0.1 + - name: SourceLinkCLIVersion + value: 3.0.0 + - name: SymbolToolVersion + value: 1.0.1 diff --git a/eng/common/templates/post-build/darc-gather-drop.yml b/eng/common/templates/post-build/darc-gather-drop.yml index e0a9f0a6d2..f4e3bfcf5c 100644 --- a/eng/common/templates/post-build/darc-gather-drop.yml +++ b/eng/common/templates/post-build/darc-gather-drop.yml @@ -7,7 +7,6 @@ jobs: dependsOn: setupMaestroVars condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], ${{ parameters.ChannelId }}) variables: - - group: Publish-Build-Assets - name: BARBuildId value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] pool: @@ -19,4 +18,6 @@ jobs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/darc-gather-drop.ps1 arguments: -BarBuildId $(BARBuildId) -DropLocation $(Agent.BuildDirectory)/Temp/Drop/ - -MaestroAccessToken $(MaestroAccessToken) + -MaestroApiAccessToken $(MaestroApiAccessToken) + -MaestroApiEndPoint $(MaestroApiEndPoint) + -MaestroApiVersion $(MaestroApiVersion) diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index daa799259c..0872db4ed9 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -7,9 +7,12 @@ parameters: enable: false params: '' + # Which stages should finish execution before post-build stages start + dependsOn: [build] + stages: - stage: validate - dependsOn: build + dependsOn: ${{ parameters.dependsOn }} displayName: Validate jobs: - ${{ if eq(parameters.enableNugetValidation, 'true') }}: diff --git a/eng/common/templates/post-build/promote-build.yml b/eng/common/templates/post-build/promote-build.yml index af48b0b339..9387c583b3 100644 --- a/eng/common/templates/post-build/promote-build.yml +++ b/eng/common/templates/post-build/promote-build.yml @@ -11,7 +11,6 @@ jobs: value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - name: ChannelId value: ${{ parameters.ChannelId }} - - group: Publish-Build-Assets pool: vmImage: 'windows-2019' steps: @@ -21,4 +20,6 @@ jobs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/promote-build.ps1 arguments: -BuildId $(BARBuildId) -ChannelId $(ChannelId) - -BarToken $(MaestroAccessToken) + -MaestroApiAccessToken $(MaestroApiAccessToken) + -MaestroApiEndPoint $(MaestroApiEndPoint) + -MaestroApiVersion $(MaestroApiVersion) diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml index f6120dc1e1..56242b068e 100644 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -14,22 +14,5 @@ jobs: name: setReleaseVars displayName: Set Release Configs Vars inputs: - targetType: inline - script: | - # This is needed to make Write-PipelineSetVariable works in this context - $ci = $true - - . "$(Build.SourcesDirectory)/eng/common/tools.ps1" - - $Content = Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt" - - $BarId = $Content | Select -Index 0 - - $Channels = "" - $Content | Select -Index 1 | ForEach-Object { $Channels += "$_ ," } - - $IsStableBuild = $Content | Select -Index 2 - - Write-PipelineSetVariable -Name 'BARBuildId' -Value $BarId - Write-PipelineSetVariable -Name 'InitialChannels' -Value "$Channels" - Write-PipelineSetVariable -Name 'IsStableBuild' -Value $IsStableBuild + filePath: $(Build.SourcesDirectory)/eng/common/post-build/setup-maestro-vars.ps1 + arguments: -ReleaseConfigsPath '$(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt' diff --git a/eng/common/templates/post-build/trigger-subscription.yml b/eng/common/templates/post-build/trigger-subscription.yml index 3915cdcd1a..da669030da 100644 --- a/eng/common/templates/post-build/trigger-subscription.yml +++ b/eng/common/templates/post-build/trigger-subscription.yml @@ -8,4 +8,6 @@ steps: filePath: $(Build.SourcesDirectory)/eng/common/post-build/trigger-subscriptions.ps1 arguments: -SourceRepo $(Build.Repository.Uri) -ChannelId ${{ parameters.ChannelId }} - -BarToken $(MaestroAccessToken) + -MaestroApiAccessToken $(MaestroAccessToken) + -MaestroApiEndPoint $(MaestroApiEndPoint) + -MaestroApiVersion $(MaestroApiVersion) diff --git a/global.json b/global.json index 67df8eb153..2e6618dad5 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19375.15", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19376.18", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From bdb229c3da0edec3e2c03d604f35be2ac31029d5 Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Sat, 27 Jul 2019 21:58:59 +0300 Subject: [PATCH 199/286] Moving ClassesTests over to NUnit (#7264) * Moving ClassesTests over to NUnit * Fixed assertion for ParseWithErrors test --- .../Compiler/ErrorMessages/ClassesTests.fs | 127 ++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + .../DoCannotHaveVisibilityDeclarations.fs | 11 -- ...MatchingMethodWithSameNameIsNotAbstract.fs | 14 -- .../MemberHasMultiplePossibleDispatchSlots.fs | 15 --- .../Source/Warnings/MethodIsNotStatic.fs | 9 -- .../NoMatchingAbstractMethodWithSameName.fs | 14 -- .../Source/Warnings/TupleInAbstractMethod.fs | 13 -- tests/fsharpqa/Source/Warnings/WrongArity.fs | 11 -- tests/fsharpqa/Source/Warnings/env.lst | 7 - 10 files changed, 128 insertions(+), 94 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/ClassesTests.fs delete mode 100644 tests/fsharpqa/Source/Warnings/DoCannotHaveVisibilityDeclarations.fs delete mode 100644 tests/fsharpqa/Source/Warnings/MatchingMethodWithSameNameIsNotAbstract.fs delete mode 100644 tests/fsharpqa/Source/Warnings/MemberHasMultiplePossibleDispatchSlots.fs delete mode 100644 tests/fsharpqa/Source/Warnings/MethodIsNotStatic.fs delete mode 100644 tests/fsharpqa/Source/Warnings/NoMatchingAbstractMethodWithSameName.fs delete mode 100644 tests/fsharpqa/Source/Warnings/TupleInAbstractMethod.fs delete mode 100644 tests/fsharpqa/Source/Warnings/WrongArity.fs diff --git a/tests/fsharp/Compiler/ErrorMessages/ClassesTests.fs b/tests/fsharp/Compiler/ErrorMessages/ClassesTests.fs new file mode 100644 index 0000000000..1ce10cb708 --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/ClassesTests.fs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Classes`` = + + [] + let ``Tuple In Abstract Method``() = + CompilerAssert.TypeCheckWithErrors + """ +type IInterface = + abstract Function : (int32 * int32) -> unit + +let x = + { new IInterface with + member this.Function (i, j) = () + } + """ + [| + FSharpErrorSeverity.Error, 768, (7, 16, 7, 36), "The member 'Function' does not accept the correct number of arguments. 1 argument(s) are expected, but 2 were given. The required signature is 'member IInterface.Function : (int32 * int32) -> unit'.\nA tuple type is required for one or more arguments. Consider wrapping the given arguments in additional parentheses or review the definition of the interface." + FSharpErrorSeverity.Error, 17, (7, 21, 7, 29), "The member 'Function : 'a * 'b -> unit' does not have the correct type to override the corresponding abstract method. The required signature is 'Function : (int32 * int32) -> unit'." + FSharpErrorSeverity.Error, 783, (6, 9, 6, 19), "At least one override did not correctly implement its corresponding abstract member" + |] + + [] + let ``Wrong Arity``() = + CompilerAssert.TypeCheckSingleError + """ +type MyType() = + static member MyMember(arg1, arg2:int ) = () + static member MyMember(arg1, arg2:byte) = () + + +MyType.MyMember("", 0, 0) + """ + FSharpErrorSeverity.Error + 503 + (7, 1, 7, 26) + "A member or object constructor 'MyMember' taking 3 arguments is not accessible from this code location. All accessible versions of method 'MyMember' take 2 arguments." + + [] + let ``Method Is Not Static``() = + CompilerAssert.TypeCheckSingleError + """ +type Class1() = + member this.X() = "F#" + +let x = Class1.X() + """ + FSharpErrorSeverity.Error + 3214 + (5, 9, 5, 17) + "Method or object constructor 'X' is not static" + + [] + let ``Matching Method With Same Name Is Not Abstract``() = + CompilerAssert.TypeCheckWithErrors + """ +type Foo(x : int) = + member v.MyX() = x + +let foo = + { new Foo(3) + with + member v.MyX() = 4 } + """ + [| + FSharpErrorSeverity.Error, 767, (8, 16, 8, 23), "The type Foo contains the member 'MyX' but it is not a virtual or abstract method that is available to override or implement." + FSharpErrorSeverity.Error, 17, (8, 18, 8, 21), "The member 'MyX : unit -> int' does not have the correct type to override any given virtual method" + FSharpErrorSeverity.Error, 783, (6, 11, 6, 14), "At least one override did not correctly implement its corresponding abstract member" + |] + + [] + let ``No Matching Abstract Method With Same Name``() = + CompilerAssert.TypeCheckWithErrors + """ +type IInterface = + abstract MyFunction : int32 * int32 -> unit + abstract SomeOtherFunction : int32 * int32 -> unit + +let x = + { new IInterface with + member this.Function (i, j) = () + } + """ + [| + FSharpErrorSeverity.Error, 767, (8, 14, 8, 34), "The member 'Function' does not correspond to any abstract or virtual method available to override or implement." + FSharpErrorSeverity.Error, 17, (8, 19, 8, 27), "The member 'Function : 'a * 'b -> unit' does not have the correct type to override any given virtual method" + FSharpErrorSeverity.Error, 366, (7, 3, 9, 4), "No implementation was given for those members: \r\n\t'abstract member IInterface.MyFunction : int32 * int32 -> unit'\r\n\t'abstract member IInterface.SomeOtherFunction : int32 * int32 -> unit'\r\nNote that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'." + FSharpErrorSeverity.Error, 783, (7, 9, 7, 19), "At least one override did not correctly implement its corresponding abstract member" + |] + + [] + let ``Member Has Multiple Possible Dispatch Slots``() = + CompilerAssert.TypeCheckWithErrors + """ +type IOverload = + abstract member Bar : int -> int + abstract member Bar : double -> int + +type Overload = + interface IOverload with + override __.Bar _ = 1 + """ + [| + FSharpErrorSeverity.Error, 366, (7, 15, 7, 24), "No implementation was given for those members: \r\n\t'abstract member IOverload.Bar : double -> int'\r\n\t'abstract member IOverload.Bar : int -> int'\r\nNote that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'." + FSharpErrorSeverity.Error, 3213, (8, 21, 8, 24), "The member 'Bar<'a0> : 'a0 -> int' matches multiple overloads of the same method.\nPlease restrict it to one of the following:\r\n Bar : double -> int\r\n Bar : int -> int." + |] + + [] + let ``Do Cannot Have Visibility Declarations``() = + CompilerAssert.ParseWithErrors + """ +type X() = + do () + private do () + static member Y() = 1 + """ + [| + FSharpErrorSeverity.Error, 531, (4, 5, 4, 12), "Accessibility modifiers should come immediately prior to the identifier naming a construct" + FSharpErrorSeverity.Error, 512, (4, 13, 4, 18), "Accessibility modifiers are not permitted on 'do' bindings, but 'Private' was given." + FSharpErrorSeverity.Error, 222, (2, 1, 3, 1), "Files in libraries or multiple-file applications must begin with a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'. Only the last source file of an application may omit such a declaration." + |] diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 9f3aeee1e4..651f0363ae 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -33,6 +33,7 @@ + diff --git a/tests/fsharpqa/Source/Warnings/DoCannotHaveVisibilityDeclarations.fs b/tests/fsharpqa/Source/Warnings/DoCannotHaveVisibilityDeclarations.fs deleted file mode 100644 index b57356ee9a..0000000000 --- a/tests/fsharpqa/Source/Warnings/DoCannotHaveVisibilityDeclarations.fs +++ /dev/null @@ -1,11 +0,0 @@ -// #Warnings -//Accessibility -//Accessibility modifiers are not permitted on 'do' bindings, but 'Private' was given. - -type X() = - do () - private do () - static member Y() = 1 - - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/MatchingMethodWithSameNameIsNotAbstract.fs b/tests/fsharpqa/Source/Warnings/MatchingMethodWithSameNameIsNotAbstract.fs deleted file mode 100644 index 36275ff0e9..0000000000 --- a/tests/fsharpqa/Source/Warnings/MatchingMethodWithSameNameIsNotAbstract.fs +++ /dev/null @@ -1,14 +0,0 @@ -// #Warnings -//The type Foo contains the member 'MyX' but it is not a virtual or abstract method that is available to override or implement. -//ToString - -type Foo(x : int) = - member v.MyX() = x - -let foo = - { new Foo(3) - with - member v.MyX() = 4 } - - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/MemberHasMultiplePossibleDispatchSlots.fs b/tests/fsharpqa/Source/Warnings/MemberHasMultiplePossibleDispatchSlots.fs deleted file mode 100644 index ae6738208b..0000000000 --- a/tests/fsharpqa/Source/Warnings/MemberHasMultiplePossibleDispatchSlots.fs +++ /dev/null @@ -1,15 +0,0 @@ -// #Warnings -//The member 'Bar -//Please restrict it to one of the following: -//Bar : double -> int -//Bar : int -> int - -type IOverload = - abstract member Bar : int -> int - abstract member Bar : double -> int - -type Overload = - interface IOverload with - override __.Bar _ = 1 - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/MethodIsNotStatic.fs b/tests/fsharpqa/Source/Warnings/MethodIsNotStatic.fs deleted file mode 100644 index 299a88abc3..0000000000 --- a/tests/fsharpqa/Source/Warnings/MethodIsNotStatic.fs +++ /dev/null @@ -1,9 +0,0 @@ -// #Warnings -//Method or object constructor 'X' is not static - -type Class1() = - member this.X() = "F#" - -let x = Class1.X() - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/NoMatchingAbstractMethodWithSameName.fs b/tests/fsharpqa/Source/Warnings/NoMatchingAbstractMethodWithSameName.fs deleted file mode 100644 index a59f863a77..0000000000 --- a/tests/fsharpqa/Source/Warnings/NoMatchingAbstractMethodWithSameName.fs +++ /dev/null @@ -1,14 +0,0 @@ -// #Warnings -//The member 'Function' does not correspond to any abstract or virtual method available to override or implement. -//MyFunction - -type IInterface = - abstract MyFunction : int32 * int32 -> unit - abstract SomeOtherFunction : int32 * int32 -> unit - -let x = - { new IInterface with - member this.Function (i, j) = () - } - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/TupleInAbstractMethod.fs b/tests/fsharpqa/Source/Warnings/TupleInAbstractMethod.fs deleted file mode 100644 index 0ed439073e..0000000000 --- a/tests/fsharpqa/Source/Warnings/TupleInAbstractMethod.fs +++ /dev/null @@ -1,13 +0,0 @@ -// #Warnings -//The member 'Function' does not accept the correct number of arguments. -//A tuple type is required for one or more arguments - -type IInterface = - abstract Function : (int32 * int32) -> unit - -let x = - { new IInterface with - member this.Function (i, j) = () - } - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/WrongArity.fs b/tests/fsharpqa/Source/Warnings/WrongArity.fs deleted file mode 100644 index 459f9a5c7a..0000000000 --- a/tests/fsharpqa/Source/Warnings/WrongArity.fs +++ /dev/null @@ -1,11 +0,0 @@ -// #Warnings -//A member or object constructor 'MyMember' taking 3 - -type MyType() = - static member MyMember(arg1, arg2:int ) = () - static member MyMember(arg1, arg2:byte) = () - - -MyType.MyMember("", 0, 0) - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 18ef811a2a..2daa6d3168 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -1,8 +1,5 @@ SOURCE=WrongNumericLiteral.fs # WrongNumericLiteral.fs - SOURCE=TupleInAbstractMethod.fs # TupleInAbstractMethod.fs SOURCE=FS0988AtEndOfFile.fs # FS0988AtEndOfFile.fs - SOURCE=WrongArity.fs # WrongArity.fs - SOURCE=MethodIsNotStatic.fs # MethodIsNotStatic.fs SOURCE=EqualsInsteadOfInInForLoop.fs # EqualsInsteadOfInInForLoop.fs SOURCE=DontWarnExternalFunctionAsUnused.fs SCFLAGS="--warnon:1182 --warnaserror+" # DontWarnExternalFunctionAsUnused.fs SOURCE=SuggestTypesInModule.fs # SuggestTypesInModule.fs @@ -25,14 +22,10 @@ SOURCE=DontSuggestWhenThingsAreOpen.fs SCFLAGS="--vserrors" # DontSuggestWhenThingsAreOpen.fs SOURCE=SuggestDoubleBacktickIdentifiers.fs SCFLAGS="--vserrors" # SuggestDoubleBacktickIdentifiers.fs SOURCE=SuggestDoubleBacktickUnions.fs SCFLAGS="--vserrors" # SuggestDoubleBacktickUnions.fs - SOURCE=MatchingMethodWithSameNameIsNotAbstract.fs # MatchingMethodWithSameNameIsNotAbstract.fs - SOURCE=NoMatchingAbstractMethodWithSameName.fs # NoMatchingAbstractMethodWithSameName.fs SOURCE=MissingExpressionAfterLet.fs # MissingExpressionAfterLet.fs SOURCE=SuggestFieldsInCtor.fs # SuggestFieldsInCtor.fs SOURCE=FieldSuggestion.fs # FieldSuggestion.fs SOURCE=SuggestToUseIndexer.fs # SuggestToUseIndexer.fs - SOURCE=MemberHasMultiplePossibleDispatchSlots.fs # MemberHasMultiplePossibleDispatchSlots.fs SOURCE=Repro1548.fs SCFLAGS="-r:Repro1548.dll" # Repro1548.fs - SOURCE=DoCannotHaveVisibilityDeclarations.fs SOURCE=ModuleAbbreviationsArePrivate.fs SOURCE=DontSuggestIntentionallyUnusedVariables.fs SCFLAGS="--vserrors" # DontSuggestIntentionallyUnusedVariables.fs From 8370ef62ebca160bfb677f6a8a367cd941b6227b Mon Sep 17 00:00:00 2001 From: Faisal Alfaddaghi Date: Sun, 28 Jul 2019 00:23:42 +0300 Subject: [PATCH 200/286] Move Basic Constants to NUnit (#7262) * Move BasicConstants.fs Tests To Nunit * fix typo * Another typo --- .../BasicGrammarElements/BasicConstants.fs | 177 ++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + .../Constants/BasicConstants.fs | 99 ---------- .../BasicGrammarElements/Constants/env.lst | 1 - 4 files changed, 178 insertions(+), 100 deletions(-) create mode 100644 tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstants.fs delete mode 100644 tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/BasicConstants.fs diff --git a/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstants.fs b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstants.fs new file mode 100644 index 0000000000..9bae494656 --- /dev/null +++ b/tests/fsharp/Compiler/Conformance/BasicGrammarElements/BasicConstants.fs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Basic Grammar Element Constants`` = + + [] + let `` Basic constants compile `` () = + CompilerAssert.Pass + """ +let sbyteConst = 1y +let int16Const = 1us +let int32Const = 1ul +let int64Const = 1UL + +let byteConst = 1uy +let uint16Const = 1us +let uint32Const = 1ul +let uint64Const = 1uL + +let ieee32Const1 = 1.0f +let ieee32Const2 = 1.0F +let ieee32Const3 = 0x0000000000000001lf + +let ieee64Const1 = 1.0 +let ieee64Const2 = 0x0000000000000001LF + +let bigintConst = 1I + +// let bignumConst = 1N - you need a reference to PowerPack.dll now + +let decimalConst1 = 1.0M +let decimalConst2 = 1.0m + +let charConst = '1' + +let stringConst = "1" + +let bytestringConst = "1"B + +let bytecharConst = '1'B + +let boolConst1 = true +let boolConst2 = false + +let unitConst = () + """ + + [] + let ``Long with underscores``() = + CompilerAssert.CompileExeAndRun + """ +let creditCardNumber = 1234_5678_9012_3456L +let socialSecurityNumber = 999_99_9999L + +if socialSecurityNumber <> 999999999L then failwith "Wrong parsing" +if creditCardNumber <> 1234567890123456L then failwith "Wrong parsing" +exit 0 + """ + + [] + let ``float 32 with underscores``() = + CompilerAssert.CompileExeAndRun + """ +let pi = 3.14_15F +if pi <> 3.1415F then failwith "Wrong parsing" +exit 0 + """ + + [] + let ``int with underscores hexBytes``() = + CompilerAssert.CompileExeAndRun + """ +let hexBytes = 0xFF_EC_DE_5E +if hexBytes <> 0xFFECDE5E then failwith "Wrong parsing" +exit 0 + """ + + + [] + let ``int with underscore hexWords``() = + CompilerAssert.CompileExeAndRun + """ +let hexWords = 0xCAFE_BABE +if hexWords <> 0xCAFEBABE then failwith "Wrong parsing" +exit 0 + """ + + [] + let ``Long with underscores maxLong``() = + CompilerAssert.CompileExeAndRun + """ +let maxLong = 0x7fff_ffff_ffff_ffffL +if maxLong <> 0x7fffffffffffffffL then failwith "Wrong parsing" +exit 0 + """ + + [] + let ``int with underscore nybbles``() = + CompilerAssert.CompileExeAndRun + """ +let nybbles = 0b0010_0101 +if nybbles <> 0b00100101 then failwith "Wrong parsing" +exit 0 + """ + + [] + let ``int with underscores bytes``() = + CompilerAssert.CompileExeAndRun + """ +let bytes = 0b11010010_01101001_10010100_10010010 +if bytes <> 0b11010010011010011001010010010010 then failwith "Wrong parsing" +exit 0 + """ + + [] + let ``int with single underscore literal``() = + CompilerAssert.CompileExeAndRun + """ +let x2 = 5_2 +if x2 <> 52 then failwith "Wrong parsing" +exit 0 + """ + + [] + let ``int with multiple underscores literal``() = + CompilerAssert.CompileExeAndRun + """ +let x4 = 5_______2 +if x4 <> 52 then failwith "Wrong parsing" +exit 0 + """ + + [] + let ``int with single underscore Hex literal``() = + CompilerAssert.CompileExeAndRun + """ +let x7 = 0x5_2 +if x7 <> 0x52 then + failwith "Wrong parsing" +exit 0 + """ + + [] + let ``int with single underscore after leading zero literal``() = + CompilerAssert.CompileExeAndRun + """ +let x9 = 0_52 +if x9 <> 052 then failwith "Wrong parsing" +exit 0 + """ + + [] + let ``int with single underscore after leteral with leading zero ``() = + CompilerAssert.CompileExeAndRun + """ +let x10 = 05_2 +if x10 <> 052 then failwith "Wrong parsing" +exit 0 + """ + + [] + let ``int with single underscore after octo leteral ``() = + CompilerAssert.CompileExeAndRun + """ +let x14 = 0o5_2 +if x14 <> 0o52 then failwith "Wrong parsing" +exit 0 + """ + + + + diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 651f0363ae..71fd78680a 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -32,6 +32,7 @@ + diff --git a/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/BasicConstants.fs b/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/BasicConstants.fs deleted file mode 100644 index 78303d2713..0000000000 --- a/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/BasicConstants.fs +++ /dev/null @@ -1,99 +0,0 @@ -// #Conformance #BasicGrammarElements #Constants -#light - -// Verify the ability to specify basic constants - -let sbyteConst = 1y -let int16Const = 1us -let int32Const = 1ul -let int64Const = 1UL - -let byteConst = 1uy -let uint16Const = 1us -let uint32Const = 1ul -let uint64Const = 1uL - -let ieee32Const1 = 1.0f -let ieee32Const2 = 1.0F -let ieee32Const3 = 0x0000000000000001lf - -let ieee64Const1 = 1.0 -let ieee64Const2 = 0x0000000000000001LF - -let bigintConst = 1I - -// let bignumConst = 1N - you need a reference to PowerPack.dll now - -let decimalConst1 = 1.0M -let decimalConst2 = 1.0m - -let charConst = '1' - -let stringConst = "1" - -let bytestringConst = "1"B - -let bytecharConst = '1'B - -let boolConst1 = true -let boolConst2 = false - -let unitConst = () - -let creditCardNumber = 1234_5678_9012_3456L -if creditCardNumber <> 1234567890123456L then - failwith "Wrong parsing" - -let socialSecurityNumber = 999_99_9999L -if socialSecurityNumber <> 999999999L then - failwith "Wrong parsing" - -let pi = 3.14_15F -if pi <> 3.1415F then - failwith "Wrong parsing" - -let hexBytes = 0xFF_EC_DE_5E -if hexBytes <> 0xFFECDE5E then - failwith "Wrong parsing" - -let hexWords = 0xCAFE_BABE -if hexWords <> 0xCAFEBABE then - failwith "Wrong parsing" - -let maxLong = 0x7fff_ffff_ffff_ffffL -if maxLong <> 0x7fffffffffffffffL then - failwith "Wrong parsing" - -let nybbles = 0b0010_0101 -if nybbles <> 0b00100101 then - failwith "Wrong parsing" - -let bytes = 0b11010010_01101001_10010100_10010010 -if bytes <> 0b11010010011010011001010010010010 then - failwith "Wrong parsing" - -let x2 = 5_2 -if x2 <> 52 then - failwith "Wrong parsing" - -let x4 = 5_______2 -if x4 <> 52 then - failwith "Wrong parsing" - -let x7 = 0x5_2 -if x7 <> 0x52 then - failwith "Wrong parsing" - -let x9 = 0_52 -if x9 <> 052 then - failwith "Wrong parsing" - -let x10 = 05_2 -if x10 <> 052 then - failwith "Wrong parsing" - -let x14 = 0o5_2 -if x14 <> 0o52 then - failwith "Wrong parsing" - -exit 0 diff --git a/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/env.lst b/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/env.lst index 500d42d77e..97183b4978 100644 --- a/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/env.lst +++ b/tests/fsharpqa/Source/Conformance/BasicGrammarElements/Constants/env.lst @@ -1,4 +1,3 @@ - SOURCE=BasicConstants.fs # BasicConstants.fs NOMONO,NoMT SOURCE=E_BasicConstantsBigNum40.fsx SCFLAGS="--test:ErrorRanges" # E_BasicConstantsBigNum40.fsx From 3ce8eb1b2a4f8cfa29bb614ef8bb12e6a2fa67e0 Mon Sep 17 00:00:00 2001 From: Sergey Tihon Date: Mon, 29 Jul 2019 06:34:39 +0300 Subject: [PATCH 201/286] Moved Don't Suggest Tests over to NUnit (#7288) --- .../ErrorMessages/DontSuggestTests.fs | 48 +++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + .../DontSuggestCompletelyWrongStuff.fs | 7 --- ...DontSuggestIntentionallyUnusedVariables.fs | 8 ---- .../Warnings/DontSuggestWhenThingsAreOpen.fs | 13 ----- tests/fsharpqa/Source/Warnings/env.lst | 3 -- 6 files changed, 49 insertions(+), 31 deletions(-) create mode 100644 tests/fsharp/Compiler/ErrorMessages/DontSuggestTests.fs delete mode 100644 tests/fsharpqa/Source/Warnings/DontSuggestCompletelyWrongStuff.fs delete mode 100644 tests/fsharpqa/Source/Warnings/DontSuggestIntentionallyUnusedVariables.fs delete mode 100644 tests/fsharpqa/Source/Warnings/DontSuggestWhenThingsAreOpen.fs diff --git a/tests/fsharp/Compiler/ErrorMessages/DontSuggestTests.fs b/tests/fsharp/Compiler/ErrorMessages/DontSuggestTests.fs new file mode 100644 index 0000000000..0e5a4f1955 --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/DontSuggestTests.fs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Don't Suggest`` = + + [] + let ``Dont Suggest Completely Wrong Stuff``() = + CompilerAssert.TypeCheckSingleError + """ +let _ = Path.GetFullPath "images" + """ + FSharpErrorSeverity.Error + 39 + (2, 9, 2, 13) + "The value, namespace, type or module 'Path' is not defined." + + [] + let ``Dont Suggest When Things Are Open``() = + CompilerAssert.ParseWithErrors + """ +module N = + let name = "hallo" + +type T = + static member myMember = 1 + +let x = N. + """ + [| + FSharpErrorSeverity.Error, 599, (8, 10, 8, 11), "Missing qualification after '.'" + FSharpErrorSeverity.Error, 222, (2, 1, 3, 1), "Files in libraries or multiple-file applications must begin with a namespace or module declaration. When using a module declaration at the start of a file the '=' sign is not allowed. If this is a top-level module, consider removing the = to resolve this error." + |] + + [] + let ``Dont Suggest Intentionally Unused Variables``() = + CompilerAssert.TypeCheckSingleError + """ +let hober xy _xyz = xyz + """ + FSharpErrorSeverity.Error + 39 + (2, 21, 2, 24) + "The value or constructor 'xyz' is not defined." diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 71fd78680a..21b9367ec3 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -46,6 +46,7 @@ + diff --git a/tests/fsharpqa/Source/Warnings/DontSuggestCompletelyWrongStuff.fs b/tests/fsharpqa/Source/Warnings/DontSuggestCompletelyWrongStuff.fs deleted file mode 100644 index 68b6d6dcb7..0000000000 --- a/tests/fsharpqa/Source/Warnings/DontSuggestCompletelyWrongStuff.fs +++ /dev/null @@ -1,7 +0,0 @@ -// #Warnings -//The value, namespace, type or module 'Path' is not defined. -//Maybe you want one of the following:\s+Math - -let _ = Path.GetFullPath "images" - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/DontSuggestIntentionallyUnusedVariables.fs b/tests/fsharpqa/Source/Warnings/DontSuggestIntentionallyUnusedVariables.fs deleted file mode 100644 index 602d459d51..0000000000 --- a/tests/fsharpqa/Source/Warnings/DontSuggestIntentionallyUnusedVariables.fs +++ /dev/null @@ -1,8 +0,0 @@ -//The value or constructor 'xyz' is not defined. -//Maybe you want one of the following: -//\s+xy -//\s+_xyz - -let hober xy _xyz = xyz - -exit 0 diff --git a/tests/fsharpqa/Source/Warnings/DontSuggestWhenThingsAreOpen.fs b/tests/fsharpqa/Source/Warnings/DontSuggestWhenThingsAreOpen.fs deleted file mode 100644 index dad90178a5..0000000000 --- a/tests/fsharpqa/Source/Warnings/DontSuggestWhenThingsAreOpen.fs +++ /dev/null @@ -1,13 +0,0 @@ -// #Warnings -//Missing qualification after '.' - -module N = - let name = "hallo" - -type T = - static member myMember = 1 - -let x = N. - - -exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/Warnings/env.lst b/tests/fsharpqa/Source/Warnings/env.lst index 2daa6d3168..275959c695 100644 --- a/tests/fsharpqa/Source/Warnings/env.lst +++ b/tests/fsharpqa/Source/Warnings/env.lst @@ -16,10 +16,8 @@ SOURCE=SuggestUnionCases.fs SCFLAGS="--vserrors" # SuggestUnionCases.fs SOURCE=SuggestArrayModuleFunctions.fs SCFLAGS="--vserrors" # SuggestArrayModuleFunctions.fs SOURCE=SuggestTypesInNamespace.fs # SuggestTypesInNamespace.fs - SOURCE=DontSuggestCompletelyWrongStuff.fs SCFLAGS="--vserrors" # DontSuggestCompletelyWrongStuff.fs SOURCE=SuggestTypesInNamespaceVS.fs SCFLAGS="--vserrors" # SuggestTypesInNamespaceVS.fs SOURCE=SuggestAsyncModule.fs SCFLAGS="--vserrors" # SuggestAsyncModule.fs - SOURCE=DontSuggestWhenThingsAreOpen.fs SCFLAGS="--vserrors" # DontSuggestWhenThingsAreOpen.fs SOURCE=SuggestDoubleBacktickIdentifiers.fs SCFLAGS="--vserrors" # SuggestDoubleBacktickIdentifiers.fs SOURCE=SuggestDoubleBacktickUnions.fs SCFLAGS="--vserrors" # SuggestDoubleBacktickUnions.fs SOURCE=MissingExpressionAfterLet.fs # MissingExpressionAfterLet.fs @@ -28,4 +26,3 @@ SOURCE=SuggestToUseIndexer.fs # SuggestToUseIndexer.fs SOURCE=Repro1548.fs SCFLAGS="-r:Repro1548.dll" # Repro1548.fs SOURCE=ModuleAbbreviationsArePrivate.fs - SOURCE=DontSuggestIntentionallyUnusedVariables.fs SCFLAGS="--vserrors" # DontSuggestIntentionallyUnusedVariables.fs From 868b76a743fad667e0a398475a88a63522cfd787 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 29 Jul 2019 10:42:20 -0700 Subject: [PATCH 202/286] [master] Update dependencies from dotnet/arcade (#7287) * Update dependencies from https://github.com/dotnet/arcade build 20190727.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19377.2 * Update dependencies from https://github.com/dotnet/arcade build 20190728.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19378.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0893278ac1..8a78856321 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 316481e57ee5e6acbbf2401eb6778a1d3d48d25b + a8e982d3bac01d8f4f91a4c57191147570079448 diff --git a/global.json b/global.json index 2e6618dad5..fe2ea05490 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19376.18", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19378.1", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 9c1a0d12bcdf114a9b1844ef194ea1e18f03c36e Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Mon, 29 Jul 2019 20:05:36 -0700 Subject: [PATCH 203/286] Fix langversion with multiple projects (#7293) --- src/fsharp/CompileOps.fsi | 1 + src/fsharp/LanguageFeatures.fs | 3 + src/fsharp/LanguageFeatures.fsi | 3 + src/fsharp/service/IncrementalBuild.fs | 13 +- .../Compiler/Language/OpenStaticClasses.fs | 173 ++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + .../fsharp/core/longnames/version46/test.bsl | 39 ---- tests/fsharp/core/longnames/version46/test.fs | 84 --------- .../fsharp/core/longnames/version47/test.fsx | 91 --------- tests/fsharp/tests.fs | 15 -- 10 files changed, 188 insertions(+), 235 deletions(-) create mode 100644 tests/fsharp/Compiler/Language/OpenStaticClasses.fs delete mode 100644 tests/fsharp/core/longnames/version46/test.bsl delete mode 100644 tests/fsharp/core/longnames/version46/test.fs delete mode 100644 tests/fsharp/core/longnames/version47/test.fsx diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 68abd98ac8..0b5f9cb083 100644 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -552,6 +552,7 @@ type TcConfig = member copyFSharpCore: CopyFSharpCoreFlag member shadowCopyReferences: bool member useSdkRefs: bool + member langVersion: LanguageVersion static member Create: TcConfigBuilder * validate: bool -> TcConfig diff --git a/src/fsharp/LanguageFeatures.fs b/src/fsharp/LanguageFeatures.fs index 8894fb1fc1..c4c46e4b66 100644 --- a/src/fsharp/LanguageFeatures.fs +++ b/src/fsharp/LanguageFeatures.fs @@ -93,3 +93,6 @@ type LanguageVersion (specifiedVersion) = let label = if v = defaultVersion then " (Default)" else "" yield sprintf "%M%s" v label |] + + /// Get the specified LanguageVersion + member __.SpecifiedVerson = specified diff --git a/src/fsharp/LanguageFeatures.fsi b/src/fsharp/LanguageFeatures.fsi index bda44fe171..d1d190d3f9 100644 --- a/src/fsharp/LanguageFeatures.fsi +++ b/src/fsharp/LanguageFeatures.fsi @@ -34,3 +34,6 @@ type LanguageVersion = /// Get the list of valid options member ValidOptions: string array + + /// Get the specified LanguageVersion + member SpecifiedVerson: decimal diff --git a/src/fsharp/service/IncrementalBuild.fs b/src/fsharp/service/IncrementalBuild.fs index 4099b59c80..96e81e3214 100755 --- a/src/fsharp/service/IncrementalBuild.fs +++ b/src/fsharp/service/IncrementalBuild.fs @@ -1052,7 +1052,7 @@ type TypeCheckAccumulator = /// Global service state -type FrameworkImportsCacheKey = (*resolvedpath*)string list * string * (*TargetFrameworkDirectories*)string list* (*fsharpBinaries*)string +type FrameworkImportsCacheKey = (*resolvedpath*)string list * string * (*TargetFrameworkDirectories*)string list * (*fsharpBinaries*)string * (*langVersion*)decimal /// Represents a cache of 'framework' references that can be shared betweeen multiple incremental builds type FrameworkImportsCache(keepStrongly) = @@ -1083,12 +1083,13 @@ type FrameworkImportsCache(keepStrongly) = // The data elements in this key are very important. There should be nothing else in the TcConfig that logically affects // the import of a set of framework DLLs into F# CCUs. That is, the F# CCUs that result from a set of DLLs (including // FSharp.Core.dll and mscorlib.dll) must be logically invariant of all the other compiler configuration parameters. - let key = (frameworkDLLsKey, - tcConfig.primaryAssembly.Name, - tcConfig.GetTargetFrameworkDirectories(), - tcConfig.fsharpBinariesDir) + let key = (frameworkDLLsKey, + tcConfig.primaryAssembly.Name, + tcConfig.GetTargetFrameworkDirectories(), + tcConfig.fsharpBinariesDir, + tcConfig.langVersion.SpecifiedVerson) - match frameworkTcImportsCache.TryGet (ctok, key) with + match frameworkTcImportsCache.TryGet (ctok, key) with | Some res -> return res | None -> let tcConfigP = TcConfigProvider.Constant tcConfig diff --git a/tests/fsharp/Compiler/Language/OpenStaticClasses.fs b/tests/fsharp/Compiler/Language/OpenStaticClasses.fs new file mode 100644 index 0000000000..bd036d3a10 --- /dev/null +++ b/tests/fsharp/Compiler/Language/OpenStaticClasses.fs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open FSharp.Compiler.SourceCodeServices +open NUnit.Framework + + +(* + Tests in this file evaluate whether the language supports accessing functions on static classes using open + The feature was added in FSharp4.7, the test cases ensure that the original errors are reproduced when the langversion:4.6 is specified +*) + +[] +module OpenStaticClassesTests = + + let baseModule = """ +module Core_OpenStaticClasses + +[] +type MyMath() = + static member Min(a: double, b: double) = System.Math.Min(a, b) + static member Min(a: int, b: int) = System.Math.Min(a, b) + +[] +type AutoOpenMyMath() = + static member AutoMin(a: double, b: double) = System.Math.Min(a, b) + static member AutoMin(a: int, b: int) = System.Math.Min(a, b) + +[] +type NotAllowedToOpen() = + static member QualifiedMin(a: double, b: double) = System.Math.Min(a, b) + static member QualifiedMin(a: int, b: int) = System.Math.Min(a, b) + +""" + + [] + let ``OpenStaticClassesTests - OpenSystemMathOnce - langversion:v4.6`` () = + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:4.6" |] + (baseModule + """ +module OpenSystemMathOnce = + + open System.Math + let x = Min(1.0, 2.0)""") + [| + (FSharpErrorSeverity.Error, 39, (22,28,22,32), "The namespace 'Math' is not defined."); + (FSharpErrorSeverity.Error, 39, (23,24,23,27), "The value or constructor 'Min' is not defined.") + |] + + [] + let ``OpenStaticClassesTests - OpenSystemMathOnce - langversion:v4.7`` () = + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:4.7" |] + (baseModule + """ +module OpenSystemMathOnce = + + open System.Math + let x = Min(1.0, 2.0)""") + [| |] + + [] + let ``OpenStaticClassesTests - OpenSystemMathTwice - langversion:v4.6`` () = + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:4.6" |] + (baseModule + """ +module OpenSystemMathTwice = + + open System.Math + let x = Min(1.0, 2.0) + + open System.Math + let x2 = Min(2.0, 1.0)""") + [| + (FSharpErrorSeverity.Error, 39, (22,17,22,21), "The namespace 'Math' is not defined."); + (FSharpErrorSeverity.Error, 39, (23,13,23,16), "The value or constructor 'Min' is not defined.") + (FSharpErrorSeverity.Error, 39, (25,17,25,21), "The namespace 'Math' is not defined."); + (FSharpErrorSeverity.Error, 39, (26,14,26,17), "The value or constructor 'Min' is not defined.") + |] + + [] + let ``OpenStaticClassesTests - OpenSystemMathTwice - langversion:v4.7`` () = + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:4.7" |] + (baseModule + """ +module OpenSystemMathOnce = + + open System.Math + let x = Min(1.0, 2.0)""") + [| |] + + [] + let ``OpenStaticClassesTests - OpenMyMathOnce - langversion:v4.6`` () = + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:4.6" |] + (baseModule + """ +module OpenMyMathOnce = + + open MyMath + let x = Min(1.0, 2.0) + let x2 = Min(1, 2)""") + [| + (FSharpErrorSeverity.Error, 39, (22,10,22,16), "The namespace or module 'MyMath' is not defined."); + (FSharpErrorSeverity.Error, 39, (23,13,23,16), "The value or constructor 'Min' is not defined.") + (FSharpErrorSeverity.Error, 39, (24,14,24,17), "The value or constructor 'Min' is not defined.") + |] + + [] + let ``OpenStaticClassesTests - OpenMyMathOnce - langversion:v4.7`` () = + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:4.7" |] + (baseModule + """ +module OpenMyMathOnce = + + open MyMath + let x = Min(1.0, 2.0) + let x2 = Min(1, 2)""") + [| |] + + [] + let ``OpenStaticClassesTests - DontOpenAutoMath - langversion:v4.6`` () = + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:4.6" |] + (baseModule + """ +module DontOpenAutoMath = + + let x = AutoMin(1.0, 2.0) + let x2 = AutoMin(1, 2)""") + [| + (FSharpErrorSeverity.Error, 39, (22,13,22,20), "The value or constructor 'AutoMin' is not defined."); + (FSharpErrorSeverity.Error, 39, (23,14,23,21), "The value or constructor 'AutoMin' is not defined.") + |] + + [] + let ``OpenStaticClassesTests - DontOpenAutoMath - langversion:v4.7`` () = + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:4.7" |] + (baseModule + """ +module DontOpenAutoMath = + + let x = AutoMin(1.0, 2.0) + let x2 = AutoMin(1, 2)""") + [| |] + + [] + let ``OpenStaticClassesTests - OpenAutoMath - langversion:v4.6`` () = + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:4.6" |] + (baseModule + """ +module OpenAutoMath = + open AutoOpenMyMath + //open NotAllowedToOpen + + let x = AutoMin(1.0, 2.0) + let x2 = AutoMin(1, 2)""") + [| + (FSharpErrorSeverity.Error, 39, (21,10,21,24), "The namespace or module 'AutoOpenMyMath' is not defined."); + (FSharpErrorSeverity.Error, 39, (24,13,24,20), "The value or constructor 'AutoMin' is not defined.") + (FSharpErrorSeverity.Error, 39, (25,14,25,21), "The value or constructor 'AutoMin' is not defined.") + |] + + [] + let ``OpenStaticClassesTests - OpenAutoMath - langversion:v4.7`` () = + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:4.7" |] + (baseModule + """ +module OpenAutoMath = + open AutoOpenMyMath + //open NotAllowedToOpen + + let x = AutoMin(1.0, 2.0) + let x2 = AutoMin(1, 2)""") + [| |] diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 8883e8aabe..438f7c58b1 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -47,6 +47,7 @@ + diff --git a/tests/fsharp/core/longnames/version46/test.bsl b/tests/fsharp/core/longnames/version46/test.bsl deleted file mode 100644 index 70f110197b..0000000000 --- a/tests/fsharp/core/longnames/version46/test.bsl +++ /dev/null @@ -1,39 +0,0 @@ - -test.fs(34,17,34,21): typecheck error FS0039: The namespace 'Math' is not defined. - -test.fs(35,13,35,16): typecheck error FS0039: The value or constructor 'Min' is not defined. Maybe you want one of the following: - min - sin - -test.fs(41,17,41,21): typecheck error FS0039: The namespace 'Math' is not defined. - -test.fs(42,13,42,16): typecheck error FS0039: The value or constructor 'Min' is not defined. Maybe you want one of the following: - min - sin - -test.fs(44,17,44,21): typecheck error FS0039: The namespace 'Math' is not defined. - -test.fs(45,14,45,17): typecheck error FS0039: The value or constructor 'Min' is not defined. Maybe you want one of the following: - min - sin - -test.fs(51,10,51,16): typecheck error FS0039: The namespace or module 'MyMath' is not defined. Maybe you want one of the following: - Math - -test.fs(52,13,52,16): typecheck error FS0039: The value or constructor 'Min' is not defined. Maybe you want one of the following: - min - sin - -test.fs(53,14,53,17): typecheck error FS0039: The value or constructor 'Min' is not defined. Maybe you want one of the following: - min - sin - -test.fs(60,13,60,20): typecheck error FS0039: The value or constructor 'AutoMin' is not defined. - -test.fs(61,14,61,21): typecheck error FS0039: The value or constructor 'AutoMin' is not defined. - -test.fs(67,10,67,24): typecheck error FS0039: The namespace or module 'AutoOpenMyMath' is not defined. - -test.fs(70,13,70,20): typecheck error FS0039: The value or constructor 'AutoMin' is not defined. - -test.fs(71,14,71,21): typecheck error FS0039: The value or constructor 'AutoMin' is not defined. diff --git a/tests/fsharp/core/longnames/version46/test.fs b/tests/fsharp/core/longnames/version46/test.fs deleted file mode 100644 index 8c41fdc81f..0000000000 --- a/tests/fsharp/core/longnames/version46/test.fs +++ /dev/null @@ -1,84 +0,0 @@ -module Core_longnames -let failures = ref [] - -let report_failure (s : string) = - stderr.Write" NO: " - stderr.WriteLine s - failures := !failures @ [s] - -let test (s : string) b = - stderr.Write(s) - if b then stderr.WriteLine " OK" - else report_failure (s) - -let check s b1 b2 = test s (b1 = b2) - -(* Some test expressions *) -[] -type MyMath() = - static member Min(a: double, b: double) = System.Math.Min(a, b) - static member Min(a: int, b: int) = System.Math.Min(a, b) - -[] -type AutoOpenMyMath() = - static member AutoMin(a: double, b: double) = System.Math.Min(a, b) - static member AutoMin(a: int, b: int) = System.Math.Min(a, b) - -[] -type NotAllowedToOpen() = - static member QualifiedMin(a: double, b: double) = System.Math.Min(a, b) - static member QualifiedMin(a: int, b: int) = System.Math.Min(a, b) - -module OpenSystemMathOnce = - - open System.Math - let x = Min(1.0, 2.0) - test "vwejhweoiu" (x = 1.0) - - -module OpenSystemMathTwice = - - open System.Math - let x = Min(1.0, 2.0) - - open System.Math - let x2 = Min(2.0, 1.0) - - test "vwejhweoiu2" (x2 = 1.0) - -module OpenMyMathOnce = - - open MyMath - let x = Min(1.0, 2.0) - let x2 = Min(1, 2) - - test "vwejhweoiu2" (x = 1.0) - test "vwejhweoiu3" (x2 = 1) - -module DontOpenAutoMath = - - let x = AutoMin(1.0, 2.0) - let x2 = AutoMin(1, 2) - - test "vwejhweoiu2" (x = 1.0) - test "vwejhweoiu3" (x2 = 1) - -module OpenAutoMath = - open AutoOpenMyMath - //open NotAllowedToOpen - - let x = AutoMin(1.0, 2.0) - let x2 = AutoMin(1, 2) - - test "vwejhweoiu2" (x = 1.0) - test "vwejhweoiu3" (x2 = 1) - -let RUN() = - match !failures with - | [] -> - stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") - exit 0 - | _ -> - stdout.WriteLine "Test Failed" - exit 1 diff --git a/tests/fsharp/core/longnames/version47/test.fsx b/tests/fsharp/core/longnames/version47/test.fsx deleted file mode 100644 index 03702cb996..0000000000 --- a/tests/fsharp/core/longnames/version47/test.fsx +++ /dev/null @@ -1,91 +0,0 @@ -// #Conformance #ObjectConstructors -#if TESTS_AS_APP -module Core_longnames -#endif -let failures = ref [] - -let report_failure (s : string) = - stderr.Write" NO: " - stderr.WriteLine s - failures := !failures @ [s] - -let test (s : string) b = - stderr.Write(s) - if b then stderr.WriteLine " OK" - else report_failure (s) - -let check s b1 b2 = test s (b1 = b2) - -(* Some test expressions *) -[] -type MyMath() = - static member Min(a: double, b: double) = System.Math.Min(a, b) - static member Min(a: int, b: int) = System.Math.Min(a, b) - -[] -type AutoOpenMyMath() = - static member AutoMin(a: double, b: double) = System.Math.Min(a, b) - static member AutoMin(a: int, b: int) = System.Math.Min(a, b) - -[] -type NotAllowedToOpen() = - static member QualifiedMin(a: double, b: double) = System.Math.Min(a, b) - static member QualifiedMin(a: int, b: int) = System.Math.Min(a, b) - -module OpenSystemMathOnce = - - open System.Math - let x = Min(1.0, 2.0) - test "vwejhweoiu" (x = 1.0) - - -module OpenSystemMathTwice = - - open System.Math - let x = Min(1.0, 2.0) - - open System.Math - let x2 = Min(2.0, 1.0) - - test "vwejhweoiu2" (x2 = 1.0) - -module OpenMyMathOnce = - - open MyMath - let x = Min(1.0, 2.0) - let x2 = Min(1, 2) - - test "vwejhweoiu2" (x = 1.0) - test "vwejhweoiu3" (x2 = 1) - -module DontOpenAutoMath = - - let x = AutoMin(1.0, 2.0) - let x2 = AutoMin(1, 2) - - test "vwejhweoiu2" (x = 1.0) - test "vwejhweoiu3" (x2 = 1) - -module OpenAutoMath = - open AutoOpenMyMath - //open NotAllowedToOpen - - let x = AutoMin(1.0, 2.0) - let x2 = AutoMin(1, 2) - - test "vwejhweoiu2" (x = 1.0) - test "vwejhweoiu3" (x2 = 1) - -#if TESTS_AS_APP -let RUN() = !failures -#else -let aa = - match !failures with - | [] -> - stdout.WriteLine "Test Passed" - System.IO.File.WriteAllText("test.ok","ok") - exit 0 - | _ -> - stdout.WriteLine "Test Failed" - exit 1 -#endif diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index fab4a5fa84..94c46a1dce 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -1302,21 +1302,6 @@ module CoreTests = [] let ``longnames-FSI_BASIC`` () = singleTestBuildAndRun "core/longnames" FSI_BASIC -#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS - [] - let ``longnames-version46`` () = - let cfg = testConfig "core/longnames/version46" - // For some reason this warning is off by default in the test framework but in this case we are testing for it - let cfg = { cfg with fsc_flags = cfg.fsc_flags.Replace("--nowarn:20", "") } - singleVersionedNegTest cfg "4.6" "test" -#endif - - [] - let ``longnames-version47-FSC_BASIC`` () = singleTestBuildAndRunVersion "core/longnames/version47" FSC_BASIC "preview" - - [] - let ``longnames-version47-FSI_BASIC`` () = singleTestBuildAndRunVersion "core/longnames/version47" FSI_BASIC "preview" - [] let ``math-numbersVS2008-FSC_BASIC`` () = singleTestBuildAndRun "core/math/numbersVS2008" FSC_BASIC From 2e1727479d38bfcd394bf9ac3940b241cb215636 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Wed, 31 Jul 2019 14:54:36 -0600 Subject: [PATCH 204/286] exclude FSharp.Compiler.LanguageServer from source build (#7304) --- .../FSharp.Compiler.LanguageServer.fsproj | 1 + .../FSharp.Compiler.LanguageServer.UnitTests.fsproj | 1 + 2 files changed, 2 insertions(+) diff --git a/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.fsproj b/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.fsproj index 3180a0a52f..48e2c5104a 100644 --- a/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.fsproj +++ b/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.fsproj @@ -8,6 +8,7 @@ netcoreapp2.1 true Implements the Language Server Protocol (LSP) for F#. + true diff --git a/tests/FSharp.Compiler.LanguageServer.UnitTests/FSharp.Compiler.LanguageServer.UnitTests.fsproj b/tests/FSharp.Compiler.LanguageServer.UnitTests/FSharp.Compiler.LanguageServer.UnitTests.fsproj index 78c2689eb2..a9df8d199e 100644 --- a/tests/FSharp.Compiler.LanguageServer.UnitTests/FSharp.Compiler.LanguageServer.UnitTests.fsproj +++ b/tests/FSharp.Compiler.LanguageServer.UnitTests/FSharp.Compiler.LanguageServer.UnitTests.fsproj @@ -7,6 +7,7 @@ Library true nunit + true From e1c5ca2a675dafafb65cdbce8b0b2972b37f24c3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 31 Jul 2019 13:55:30 -0700 Subject: [PATCH 205/286] [master] Update dependencies from dotnet/arcade (#7295) * Update dependencies from https://github.com/dotnet/arcade build 20190729.29 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19379.29 * Update dependencies from https://github.com/dotnet/arcade build 20190730.3 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19380.3 --- eng/Version.Details.xml | 4 ++-- eng/common/sdl/packages.config | 2 +- eng/common/templates/job/execute-sdl.yml | 2 +- global.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8a78856321..92b380533f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - a8e982d3bac01d8f4f91a4c57191147570079448 + def377f94747dac91482aad67b33a1c011ffc770 diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config index fb9b712863..3f97ac2f16 100644 --- a/eng/common/sdl/packages.config +++ b/eng/common/sdl/packages.config @@ -1,4 +1,4 @@  - + diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index 5837f3d56d..f657a4dc91 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -46,7 +46,7 @@ jobs: continueOnError: ${{ parameters.continueOnError }} - ${{ if eq(parameters.overrideParameters, '') }}: - powershell: eng/common/sdl/execute-all-sdl-tools.ps1 - -GuardianPackageName Microsoft.Guardian.Cli.0.6.0 + -GuardianPackageName Microsoft.Guardian.Cli.0.7.1 -NugetPackageDirectory $(Build.SourcesDirectory)\.packages -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) ${{ parameters.additionalParameters }} diff --git a/global.json b/global.json index fe2ea05490..341cf08499 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19378.1", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19380.3", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From a2137384d20eb7deb3f7c15c3f5218e62cdd0b72 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Thu, 1 Aug 2019 08:33:23 +0200 Subject: [PATCH 206/286] Activate hanging test file (#7298) --- tests/fsharp/FSharpSuite.Tests.fsproj | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 21b9367ec3..c2548d3b17 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -47,6 +47,7 @@ + From b62bb71ef8af2cfa2466fa7cc30168ba2d13fa58 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 1 Aug 2019 17:03:12 -0700 Subject: [PATCH 207/286] Added some utilities that will be helpful for testing (#7321) --- eng/Build.ps1 | 20 ++++ eng/Versions.props | 5 +- tests/fsharp/Compiler/ILChecker.fs | 5 + tests/fsharp/Compiler/Utilities.fs | 142 ++++++++++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 5 + tests/fsharp/test-framework.fs | 15 ++- 6 files changed, 188 insertions(+), 4 deletions(-) create mode 100644 tests/fsharp/Compiler/Utilities.fs diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 8011827a64..1372df4e5f 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -277,6 +277,25 @@ function Prepare-TempDir() { Copy-Item (Join-Path $RepoRoot "tests\Resources\Directory.Build.targets") $TempDir } +function EnablePreviewSdks() { + if (Test-Path variable:global:_MSBuildExe) { + return + } + $vsInfo = LocateVisualStudio + if ($vsInfo -eq $null) { + # Preview SDKs are allowed when no Visual Studio instance is installed + return + } + + $vsId = $vsInfo.instanceId + $vsMajorVersion = $vsInfo.installationVersion.Split('.')[0] + + $instanceDir = Join-Path ${env:USERPROFILE} "AppData\Local\Microsoft\VisualStudio\$vsMajorVersion.0_$vsId" + Create-Directory $instanceDir + $sdkFile = Join-Path $instanceDir "sdk.txt" + 'UsePreviews=True' | Set-Content $sdkFile +} + try { Process-Arguments @@ -288,6 +307,7 @@ try { if ($ci) { Prepare-TempDir + EnablePreviewSdks # enable us to build netcoreapp2.1 binaries $global:_DotNetInstallDir = Join-Path $RepoRoot ".dotnet" diff --git a/eng/Versions.props b/eng/Versions.props index 0a5dd52ef0..4a8ca4fbc4 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -100,6 +100,8 @@ $(RoslynVersion) $(RoslynVersion) $(RoslynVersion) + $(RoslynVersion) + 2.0.17 $(RoslynVersion) 16.0.461 @@ -166,7 +168,8 @@ 1.0.30 8.0.0-alpha 2.7.0 - 2.0.3 + 3.0.0-preview-27318-01 + 3.0.0-preview-27318-01 15.8.0 1.0.0 4.3.0 diff --git a/tests/fsharp/Compiler/ILChecker.fs b/tests/fsharp/Compiler/ILChecker.fs index 200206f861..ac6873942c 100644 --- a/tests/fsharp/Compiler/ILChecker.fs +++ b/tests/fsharp/Compiler/ILChecker.fs @@ -95,3 +95,8 @@ module ILChecker = let checkIL dllFilePath expectedIL = checkILAux [] dllFilePath expectedIL + + let reassembleIL ilFilePath dllFilePath = + let ilasmPath = config.ILASM + let errors, _ = exec ilasmPath ([ sprintf "%s /output=%s /dll" ilFilePath dllFilePath ]) + errors diff --git a/tests/fsharp/Compiler/Utilities.fs b/tests/fsharp/Compiler/Utilities.fs new file mode 100644 index 0000000000..29de21ad3e --- /dev/null +++ b/tests/fsharp/Compiler/Utilities.fs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +module FSharp.Compiler.UnitTests.Utilities + +open System +open System.IO +open System.Collections.Immutable +open Microsoft.CodeAnalysis +open Microsoft.CodeAnalysis.CSharp + +// This file mimics how Roslyn handles their compilation references for compilation testing + +[] +type TargetFramework = + | NetStandard20 + | NetCoreApp30 + +module private TestReferences = + + [] + module NetStandard20 = + + let netStandard = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.netstandard).GetReference(display = "netstandard.dll (netstandard 2.0 ref)") + + let mscorlibRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.mscorlib).GetReference(display = "mscorlib.dll (netstandard 2.0 ref)") + + let systemRuntimeRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.System_Runtime).GetReference(display = "System.Runtime.dll (netstandard 2.0 ref)") + + let systemCoreRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.System_Core).GetReference(display = "System.Core.dll (netstandard 2.0 ref)") + + let systemDynamicRuntimeRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netstandard20.System_Dynamic_Runtime).GetReference(display = "System.Dynamic.Runtime.dll (netstandard 2.0 ref)") + + [] + module NetCoreApp30 = + + let netStandard = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netcoreapp30.netstandard).GetReference(display = "netstandard.dll (netcoreapp 3.0 ref)") + + let mscorlibRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netcoreapp30.mscorlib).GetReference(display = "mscorlib.dll (netcoreapp 3.0 ref)") + + let systemRuntimeRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netcoreapp30.System_Runtime).GetReference(display = "System.Runtime.dll (netcoreapp 3.0 ref)") + + let systemCoreRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netcoreapp30.System_Core).GetReference(display = "System.Core.dll (netcoreapp 3.0 ref)") + + let systemDynamicRuntimeRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netcoreapp30.System_Dynamic_Runtime).GetReference(display = "System.Dynamic.Runtime.dll (netcoreapp 3.0 ref)") + + let systemConsoleRef = lazy AssemblyMetadata.CreateFromImage(TestResources.NetFX.netcoreapp30.System_Console).GetReference(display = "System.Console.dll (netcoreapp 3.0 ref)") + + +[] +module private TargetFrameworkUtil = + + open TestReferences + + let private netStandard20References = + lazy ImmutableArray.Create(NetStandard20.netStandard.Value, NetStandard20.mscorlibRef.Value, NetStandard20.systemRuntimeRef.Value, NetStandard20.systemCoreRef.Value, NetStandard20.systemDynamicRuntimeRef.Value) + + let private netCoreApp30References = + lazy ImmutableArray.Create(NetCoreApp30.netStandard.Value, NetCoreApp30.mscorlibRef.Value, NetCoreApp30.systemRuntimeRef.Value, NetCoreApp30.systemCoreRef.Value, NetCoreApp30.systemDynamicRuntimeRef.Value, NetCoreApp30.systemConsoleRef.Value) + + let getReferences tf = + match tf with + | TargetFramework.NetStandard20 -> netStandard20References.Value + | TargetFramework.NetCoreApp30 -> netCoreApp30References.Value + +type RoslynLanguageVersion = LanguageVersion + +[] +type CSharpCompilationFlags = + | None = 0x0 + | InternalsVisibleTo = 0x1 + +[] +type TestCompilation = + | CSharp of CSharpCompilation * CSharpCompilationFlags + | IL of ilSource: string * result: Lazy + + member this.AssertNoErrorsOrWarnings () = + match this with + | TestCompilation.CSharp (c, _) -> + 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 (+))) + + | TestCompilation.IL (_, result) -> + let errors, _ = result.Value + if errors.Length > 0 then + NUnit.Framework.Assert.Fail ("IL source errors: " + errors) + + member this.EmitAsFile (outputPath: string) = + match this with + | TestCompilation.CSharp (c, _) -> + let emitResult = c.Emit outputPath + if not emitResult.Success then + failwithf "Unable to emit C# compilation.\n%A" emitResult.Diagnostics + + | TestCompilation.IL (_, result) -> + let (_, data) = result.Value + File.WriteAllBytes (outputPath, data) + +type CSharpLanguageVersion = + | CSharp8 = 0 + +[] +type CompilationUtil private () = + + static member CreateCSharpCompilation (source: string, lv: CSharpLanguageVersion, ?tf, ?additionalReferences, ?flags) = + let lv = + match lv with + | CSharpLanguageVersion.CSharp8 -> LanguageVersion.CSharp8 + | _ -> LanguageVersion.Default + + let tf = defaultArg tf TargetFramework.NetStandard20 + let additionalReferences = defaultArg additionalReferences ImmutableArray.Empty + let flags = defaultArg flags CSharpCompilationFlags.None + let references = TargetFrameworkUtil.getReferences tf + let c = + CSharpCompilation.Create( + Guid.NewGuid().ToString (), + [ CSharpSyntaxTree.ParseText (source, CSharpParseOptions lv) ], + references.As().AddRange additionalReferences, + CSharpCompilationOptions (OutputKind.DynamicallyLinkedLibrary)) + Some (TestCompilation.CSharp (c, flags)) + + static member CreateILCompilation (source: string) = + let compute = + lazy + let ilFilePath = Path.GetTempFileName () + let tmp = Path.GetTempFileName() + let dllFilePath = Path.ChangeExtension (tmp, ".dll") + try + File.WriteAllText (ilFilePath, source) + let errors = ILChecker.reassembleIL ilFilePath dllFilePath + try + (errors, File.ReadAllBytes dllFilePath) + with + | _ -> (errors, [||]) + finally + try File.Delete ilFilePath with | _ -> () + try File.Delete tmp with | _ -> () + try File.Delete dllFilePath with | _ -> () + Some (TestCompilation.IL (source, compute)) \ No newline at end of file diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index c2548d3b17..f15dc14585 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -31,6 +31,7 @@ + @@ -70,10 +71,14 @@ + + + + diff --git a/tests/fsharp/test-framework.fs b/tests/fsharp/test-framework.fs index 6804b829f1..c76d908289 100644 --- a/tests/fsharp/test-framework.fs +++ b/tests/fsharp/test-framework.fs @@ -105,6 +105,9 @@ module Commands = let ildasm exec ildasmExe flags assembly = exec ildasmExe (sprintf "%s %s" flags (quotepath assembly)) + let ilasm exec ilasmExe flags assembly = + exec ilasmExe (sprintf "%s %s" flags (quotepath assembly)) + let peverify exec peverifyExe flags path = exec peverifyExe (sprintf "%s %s" (quotepath path) flags) @@ -132,6 +135,7 @@ type TestConfig = FSharpCompilerInteractiveSettings : string fsi_flags : string ILDASM : string + ILASM : string PEVERIFY : string Directory: string DotNetExe: string @@ -173,14 +177,16 @@ let config configurationName envVars = let repoRoot = SCRIPT_ROOT ++ ".." ++ ".." let artifactsPath = repoRoot ++ "artifacts" let artifactsBinPath = artifactsPath ++ "bin" + let coreClrRuntimePackageVersion = "3.0.0-preview-27318-01" let csc_flags = "/nologo" let fsc_flags = "-r:System.Core.dll --nowarn:20 --define:COMPILED" let fsi_flags = "-r:System.Core.dll --nowarn:20 --define:INTERACTIVE --maxerrors:1 --abortonerror" let Is64BitOperatingSystem = WindowsPlatform.Is64BitOperatingSystem envVars let architectureMoniker = if Is64BitOperatingSystem then "x64" else "x86" let CSC = requireFile (packagesDir ++ "Microsoft.Net.Compilers" ++ "2.7.0" ++ "tools" ++ "csc.exe") - let ILDASM = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.ILDAsm") ++ "2.0.3" ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "ildasm.exe") - let coreclrdll = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.Runtime.CoreCLR") ++ "2.0.3" ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "coreclr.dll") + let ILDASM = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.ILDAsm") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "ildasm.exe") + let ILASM = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.ILAsm") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "ilasm.exe") + let coreclrdll = requireFile (packagesDir ++ ("runtime.win-" + architectureMoniker + ".Microsoft.NETCore.Runtime.CoreCLR") ++ coreClrRuntimePackageVersion ++ "runtimes" ++ ("win-" + architectureMoniker) ++ "native" ++ "coreclr.dll") let PEVERIFY = requireFile (artifactsBinPath ++ "PEVerify" ++ configurationName ++ "net472" ++ "PEVerify.exe") let FSI_FOR_SCRIPTS = artifactsBinPath ++ "fsi" ++ configurationName ++ fsiArchitecture ++ "fsi.exe" let FSharpBuild = requireFile (artifactsBinPath ++ "FSharp.Build" ++ configurationName ++ fsharpBuildArchitecture ++ "FSharp.Build.dll") @@ -190,8 +196,9 @@ let config configurationName envVars = let repoLocalDotnetPath = repoRoot ++ ".dotnet" ++ "dotnet.exe" if File.Exists(repoLocalDotnetPath) then repoLocalDotnetPath else "dotnet.exe" - // ildasm requires coreclr.dll to run which has already been restored to the packages directory + // ildasm + ilasm requires coreclr.dll to run which has already been restored to the packages directory File.Copy(coreclrdll, Path.GetDirectoryName(ILDASM) ++ "coreclr.dll", overwrite=true) + File.Copy(coreclrdll, Path.GetDirectoryName(ILASM) ++ "coreclr.dll", overwrite=true) let FSI = requireFile (FSI_FOR_SCRIPTS) #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS @@ -210,6 +217,7 @@ let config configurationName envVars = { EnvironmentVariables = envVars FSCOREDLLPATH = FSCOREDLLPATH ILDASM = ILDASM + ILASM = ILASM PEVERIFY = PEVERIFY CSC = CSC BUILD_CONFIG = configurationName @@ -448,6 +456,7 @@ let fscBothToOut cfg out arg = Printf.ksprintf (Commands.fsc cfg.Directory (exec let fscAppendErrExpectFail cfg errPath arg = Printf.ksprintf (Commands.fsc cfg.Directory (execAppendErrExpectFail cfg errPath) cfg.DotNetExe cfg.FSC) 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 ilasm cfg arg = Printf.ksprintf (Commands.ilasm (exec cfg) cfg.ILASM) arg let peverify cfg = Commands.peverify (exec cfg) cfg.PEVERIFY "/nologo" let peverifyWithArgs cfg args = Commands.peverify (exec cfg) cfg.PEVERIFY args let fsi cfg = Printf.ksprintf (Commands.fsi (exec cfg) cfg.FSI) From bde3682a886f77f1e43bce856099899c24d0ade1 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Thu, 1 Aug 2019 17:45:32 -0700 Subject: [PATCH 208/286] Fix suggestions (#7311) * Fix suggestions * feedback --- src/fsharp/NameResolution.fs | 19 ++++++++++++++++--- src/fsharp/NameResolution.fsi | 1 + tests/fsharp/core/nameof/version46/test.fsx | 8 ++++++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index af800ac659..6c6cac0dd6 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -36,6 +36,7 @@ type NameResolver(g: TcGlobals, amap: Import.ImportMap, infoReader: InfoReader, instantiationGenerator: (range -> Typars -> TypeInst)) = + /// Used to transform typars into new inference typars // instantiationGenerator is a function to help us create the // type parameters by copying them from type parameter specifications read @@ -50,6 +51,7 @@ type NameResolver(g: TcGlobals, member nr.g = g member nr.amap = amap member nr.InfoReader = infoReader + member nr.languageSupportsNameOf = g.langVersion.SupportsFeature LanguageFeature.NameOf //------------------------------------------------------------------------- // Helpers for unionconstrs and recdfields @@ -2496,6 +2498,15 @@ let ChooseTyconRefInExpr (ncenv: NameResolver, m, ad, nenv, id: Ident, typeNameR /// that may represent further actions, e.g. further lookups. let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified m ad nenv (typeNameResInfo: TypeNameResolutionInfo) (id: Ident) (rest: Ident list) isOpenDecl = let resInfo = ResolutionInfo.Empty + let canSuggestThisItem (item:Item) = + // All items can be suggested except nameof when it comes from FSharp.Core.dll and the nameof feature is not enabled + match item with + | Item.Value v -> + let isNameOfOperator = valRefEq ncenv.g ncenv.g.nameof_vref v + if isNameOfOperator && not (ncenv.g.langVersion.SupportsFeature LanguageFeature.NameOf) then false + else true + | _ -> true + if first && id.idText = MangledGlobalName then match rest with | [] -> @@ -2534,7 +2545,7 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified match fresh with | Item.Value value -> let isNameOfOperator = valRefEq ncenv.g ncenv.g.nameof_vref value - if isNameOfOperator && not (ncenv.g.langVersion.SupportsFeature LanguageFeature.NameOf) then + if isNameOfOperator && not (ncenv.languageSupportsNameOf) then // Do not resolve `nameof` if the feature is unsupported, even if it is FSharp.Core None else @@ -2570,7 +2581,8 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified | _ -> let suggestNamesAndTypes (addToBuffer: string -> unit) = for e in nenv.eUnqualifiedItems do - addToBuffer e.Value.DisplayName + if canSuggestThisItem e.Value then + addToBuffer e.Value.DisplayName for e in nenv.TyconsByDemangledNameAndArity fullyQualified do if IsEntityAccessible ncenv.amap m ad e.Value then @@ -2666,7 +2678,8 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified addToBuffer e.Value.DisplayName for e in nenv.eUnqualifiedItems do - addToBuffer e.Value.DisplayName + if canSuggestThisItem e.Value then + addToBuffer e.Value.DisplayName match innerSearch with | Exception (UndefinedName(0, _, id1, suggestionsF)) when Range.equals id.idRange id1.idRange -> diff --git a/src/fsharp/NameResolution.fsi b/src/fsharp/NameResolution.fsi index 4d809d435a..0f3e318d9d 100755 --- a/src/fsharp/NameResolution.fsi +++ b/src/fsharp/NameResolution.fsi @@ -22,6 +22,7 @@ type NameResolver = member InfoReader : InfoReader member amap : ImportMap member g : TcGlobals + member languageSupportsNameOf : bool /// Get the active pattern elements defined in a module, if any. Cache in the slot in the module type. val ActivePatternElemsOfModuleOrNamespace : ModuleOrNamespaceRef -> NameMap diff --git a/tests/fsharp/core/nameof/version46/test.fsx b/tests/fsharp/core/nameof/version46/test.fsx index 273427d2d7..111ac45dc6 100644 --- a/tests/fsharp/core/nameof/version46/test.fsx +++ b/tests/fsharp/core/nameof/version46/test.fsx @@ -47,13 +47,13 @@ //The value or constructor 'nameof' is not defined. //The value or constructor 'nameof' is not defined. //The value or constructor 'nameof' is not defined. +//The value or constructor 'name' is not defined. Maybe you want one of the following: + #if TESTS_AS_APP module TestSuite_FSharpCore_nameof_46 #endif - - #nowarn "44" open System @@ -337,6 +337,10 @@ type Person = | x when x = nameof __.Age -> { __ with Age = value :?> int } | _ -> __ +module Foo = + let nameof = () + let x = name () + do test "local variable name lookup" (BasicNameOfTests.``local variable name lookup`` ()) do test "local int function name" (BasicNameOfTests.``local int function name`` ()) do test "local curried function name" (BasicNameOfTests.``local curried function name`` ()) From 90f03ee622733264bf7c161c6cf6cb1652875d81 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Fri, 2 Aug 2019 09:04:56 -0700 Subject: [PATCH 209/286] Reneable warnexpressions tests (#7331) --- tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs b/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs index 7bf6cc211c..09883b519f 100644 --- a/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs +++ b/tests/fsharp/Compiler/ErrorMessages/WarnExpressionTests.fs @@ -105,7 +105,7 @@ let changeX() = (6, 5, 6, 15) "The result of this equality expression has type 'bool' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'." - // [] // Disable this test until we refactor tcImports and tcGlobals + [] let ``Warn If Discarded In List``() = CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:4.6" |] @@ -127,7 +127,7 @@ let view model dispatch = "This expression returns a value of type 'int' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield'." |] - // [] // Disable this test until we refactor tcImports and tcGlobals + [] let ``Warn If Discarded In List 2``() = CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:4.6" |] @@ -154,7 +154,7 @@ let view model dispatch = "This expression returns a value of type 'int list' but is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'. If you intended to use the expression as a value in the sequence then use an explicit 'yield!'." |] - // [] // Disable this test until we refactor tcImports and tcGlobals + [] let ``Warn If Discarded In List 3``() = CompilerAssert.TypeCheckWithErrorsAndOptions [| "--langversion:4.6" |] From dbdca013b44800cbea7485946abe10c3e0e21036 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Fri, 2 Aug 2019 11:58:25 -0700 Subject: [PATCH 210/286] Build correct FSharp.Core version number --- eng/Versions.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Versions.props b/eng/Versions.props index 869a471cbf..9b7c67a037 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,7 +14,7 @@ beta 4.7 $(FSLanguageVersion) - $(FSCoreMajorVersion).3 + $(FSCoreMajorVersion).0 $(FSCoreMajorVersion).0 $(FSCoreVersionPrefix).0 From 9add797ab102df0cef806d406d77ee8e7ad15c5d Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Fri, 2 Aug 2019 16:24:08 -0700 Subject: [PATCH 211/286] remove auto-preview (#7344) --- src/fsharp/FSharp.Build/Microsoft.FSharp.Targets | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets b/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets index ced8a931e9..8421c8ea50 100644 --- a/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets +++ b/src/fsharp/FSharp.Build/Microsoft.FSharp.Targets @@ -272,13 +272,6 @@ this file. $(OtherFlags) - - - preview - - Date: Fri, 2 Aug 2019 17:56:59 -0700 Subject: [PATCH 212/286] Update fsharp.core nuget package numbers (#7345) * Update fsharp.core numbers * vsic * More templates --- eng/Versions.props | 4 ++-- tests/projects/stress/Templates/fsproj.template | 2 +- .../ConsoleProject/Template/ConsoleApplication.vstemplate | 2 +- .../LibraryProject/Template/Library.vstemplate | 2 +- .../TutorialProject/Template/Tutorial.vstemplate | 2 +- .../Vsix/VisualFSharpTemplates/VisualFSharpTemplates.csproj | 6 +++--- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 9b7c67a037..10343461d1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -14,11 +14,11 @@ beta 4.7 $(FSLanguageVersion) - $(FSCoreMajorVersion).0 + $(FSCoreMajorVersion).1 $(FSCoreMajorVersion).0 $(FSCoreVersionPrefix).0 - 4.6.2 + 4.7.0 $(FSCorePackageVersion)-$(PreReleaseVersionLabel).* diff --git a/tests/projects/stress/Templates/fsproj.template b/tests/projects/stress/Templates/fsproj.template index 2e87b3a4a8..9af6ff1673 100644 --- a/tests/projects/stress/Templates/fsproj.template +++ b/tests/projects/stress/Templates/fsproj.template @@ -36,7 +36,7 @@ - ..\packages\FSharp.Core.4.6.2\lib\net45\FSharp.Core.dll + ..\packages\FSharp.Core.4.7.0\lib\net45\FSharp.Core.dll diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/ConsoleApplication.vstemplate b/vsintegration/ProjectTemplates/ConsoleProject/Template/ConsoleApplication.vstemplate index 457a0d84b6..fea0279b94 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/ConsoleApplication.vstemplate +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/ConsoleApplication.vstemplate @@ -27,7 +27,7 @@ - + diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/Library.vstemplate b/vsintegration/ProjectTemplates/LibraryProject/Template/Library.vstemplate index 07c8ab1065..d7f9a14d8d 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/Library.vstemplate +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/Library.vstemplate @@ -27,7 +27,7 @@ - + diff --git a/vsintegration/ProjectTemplates/TutorialProject/Template/Tutorial.vstemplate b/vsintegration/ProjectTemplates/TutorialProject/Template/Tutorial.vstemplate index 73b11c8c90..adb7d6e230 100644 --- a/vsintegration/ProjectTemplates/TutorialProject/Template/Tutorial.vstemplate +++ b/vsintegration/ProjectTemplates/TutorialProject/Template/Tutorial.vstemplate @@ -25,7 +25,7 @@ - + diff --git a/vsintegration/Vsix/VisualFSharpTemplates/VisualFSharpTemplates.csproj b/vsintegration/Vsix/VisualFSharpTemplates/VisualFSharpTemplates.csproj index 0f3774974e..cfab3f5dfa 100644 --- a/vsintegration/Vsix/VisualFSharpTemplates/VisualFSharpTemplates.csproj +++ b/vsintegration/Vsix/VisualFSharpTemplates/VisualFSharpTemplates.csproj @@ -15,9 +15,9 @@ packages\System.ValueTuple.4.4.0.nupkg true - + PreserveNewest - packages\FSharp.Core.4.6.2.nupkg + packages\FSharp.Core.$(FSharpCoreShippedPackageVersion).nupkg true @@ -27,7 +27,7 @@ - + From 1b879b1a3001292d4a2fc4ec3124d88a671f680a Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Fri, 9 Aug 2019 13:56:07 -0700 Subject: [PATCH 213/286] Use GetFullPath when determining the full path in handling command line options (cherry picked from commit 6009548ddc30f85939d1dd8ea2d0e6cc5ab8ec2e) --- .../LanguageService/FSharpProjectOptionsManager.fs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs index a555b47ff3..5a2c3eed96 100644 --- a/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs +++ b/vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs @@ -378,11 +378,15 @@ type internal FSharpProjectOptionsManager match Microsoft.CodeAnalysis.ExternalAccess.FSharp.LanguageServices.FSharpVisualStudioWorkspaceExtensions.TryGetProjectIdByBinPath(workspace, path) with | true, projectId -> projectId | false, _ -> Microsoft.CodeAnalysis.ExternalAccess.FSharp.LanguageServices.FSharpVisualStudioWorkspaceExtensions.GetOrCreateProjectIdForPath(workspace, path, projectDisplayNameOf path) - let path = Microsoft.CodeAnalysis.ExternalAccess.FSharp.LanguageServices.FSharpVisualStudioWorkspaceExtensions.GetProjectFilePath(workspace, projectId); - let fullPath p = - if Path.IsPathRooted(p) || path = null then p - else Path.Combine(Path.GetDirectoryName(path), p) - let sourcePaths = sources |> Seq.map(fun s -> fullPath s.Path) |> Seq.toArray + let path = Microsoft.CodeAnalysis.ExternalAccess.FSharp.LanguageServices.FSharpVisualStudioWorkspaceExtensions.GetProjectFilePath(workspace, projectId) + + let getFullPath p = + let p' = + if Path.IsPathRooted(p) || path = null then p + else Path.Combine(Path.GetDirectoryName(path), p) + Path.GetFullPathSafe(p') + + let sourcePaths = sources |> Seq.map(fun s -> getFullPath s.Path) |> Seq.toArray reactor.SetCpsCommandLineOptions(projectId, sourcePaths, options.ToArray()) From 4c88e2773ad581ae3ea0a8ca9e0f11dbf3020baf Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Fri, 9 Aug 2019 19:53:39 -0700 Subject: [PATCH 214/286] pull all unit test assemblies from NuGet packages (#7378) --- eng/Versions.props | 5 ++ .../tests/Salsa/VisualFSharp.Salsa.fsproj | 37 ++++++++------ vsintegration/tests/Salsa/VsMocks.fs | 48 +++++++------------ .../UnitTests/VisualFSharp.UnitTests.fsproj | 2 + 4 files changed, 46 insertions(+), 46 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 10343461d1..aad596af86 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -115,6 +115,8 @@ 16.1.89 1.1.4322 16.1.89 + 16.1.89 + 16.0.28226-alpha 16.1.28916.169 16.1.28917.181 16.1.3121 @@ -124,6 +126,7 @@ 8.0.50728 7.10.6071 16.1.28917.181 + 16.1.89 8.0.50728 16.0.201-pre-g7d366164d0 2.3.6152103 @@ -140,7 +143,9 @@ 10.0.30320 11.0.61031 12.0.30111 + 16.0.0 16.1.89 + 16.1.89 7.10.6071 8.0.50728 10.0.30320 diff --git a/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj b/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj index f7eea70d97..c3e21061e0 100644 --- a/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj +++ b/vsintegration/tests/Salsa/VisualFSharp.Salsa.fsproj @@ -49,23 +49,30 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - + + diff --git a/vsintegration/tests/Salsa/VsMocks.fs b/vsintegration/tests/Salsa/VsMocks.fs index e498dd1f8f..c3008cf636 100644 --- a/vsintegration/tests/Salsa/VsMocks.fs +++ b/vsintegration/tests/Salsa/VsMocks.fs @@ -1657,41 +1657,27 @@ module internal VsActual = let CreateEditorCatalog() = let thisAssembly = Assembly.GetExecutingAssembly().Location - let editorAssemblyDir = Path.Combine(vsInstallDir, @"IDE\CommonExtensions\Microsoft\Editor") - let privateAssemblyDir = Path.Combine(vsInstallDir, @"IDE\PrivateAssemblies") - let publicAssemblyDir = Path.Combine(vsInstallDir, @"IDE\PublicAssemblies") - - let CreateAssemblyCatalog(path, file) = - let fullPath = Path.GetFullPath(Path.Combine(path, file)) - if File.Exists(fullPath) then - new AssemblyCatalog(fullPath) - else - failwith("could not find " + fullPath) - + let thisAssemblyDir = Path.GetDirectoryName(thisAssembly) let list = new ResizeArray() - - let addMovedFile originalDir alternateDir file = - let path = Path.Combine(originalDir, file) - if File.Exists(path) then - list.Add(CreateAssemblyCatalog(originalDir, file)) + let add p = + let fullPath = Path.GetFullPath(Path.Combine(thisAssemblyDir, p)) + if File.Exists(fullPath) then + list.Add(new AssemblyCatalog(fullPath)) else - list.Add(CreateAssemblyCatalog(alternateDir, file)) + failwith <| sprintf "unable to find assembly %s" p list.Add(new AssemblyCatalog(thisAssembly)) - list.Add(CreateAssemblyCatalog(editorAssemblyDir, "Microsoft.VisualStudio.Text.Data.dll")) - list.Add(CreateAssemblyCatalog(editorAssemblyDir, "Microsoft.VisualStudio.Text.Logic.dll")) - - // "Microsoft.VisualStudio.Text.Internal.dll" moved locations between dev15 and 16 - // This ensures we can run in both Devs 15 and 16 - addMovedFile privateAssemblyDir editorAssemblyDir "Microsoft.VisualStudio.Text.Internal.dll" - - list.Add(CreateAssemblyCatalog(editorAssemblyDir, "Microsoft.VisualStudio.Text.UI.dll")) - list.Add(CreateAssemblyCatalog(editorAssemblyDir, "Microsoft.VisualStudio.Text.UI.Wpf.dll")) - list.Add(CreateAssemblyCatalog(privateAssemblyDir, "Microsoft.VisualStudio.Threading.dll")) - list.Add(CreateAssemblyCatalog(editorAssemblyDir, "Microsoft.VisualStudio.Platform.VSEditor.dll")) - list.Add(CreateAssemblyCatalog(editorAssemblyDir, "Microsoft.VisualStudio.Editor.Implementation.dll")) - list.Add(CreateAssemblyCatalog(publicAssemblyDir, "Microsoft.VisualStudio.ComponentModelHost.dll")) - list.Add(CreateAssemblyCatalog(publicAssemblyDir, "Microsoft.VisualStudio.Shell.15.0.dll")) + [ "Microsoft.VisualStudio.Text.Data.dll" + "Microsoft.VisualStudio.Text.Logic.dll" + "Microsoft.VisualStudio.Text.Internal.dll" + "Microsoft.VisualStudio.Text.UI.dll" + "Microsoft.VisualStudio.Text.UI.Wpf.dll" + "Microsoft.VisualStudio.Threading.dll" + "Microsoft.VisualStudio.Platform.VSEditor.dll" + "Microsoft.VisualStudio.Editor.Implementation.dll" + "Microsoft.VisualStudio.ComponentModelHost.dll" + "Microsoft.VisualStudio.Shell.15.0.dll" ] + |> List.iter add new AggregateCatalog(list) let exportProvider = new CompositionContainer(new AggregateCatalog(CreateEditorCatalog()), true, null) diff --git a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj index 7a0bea7701..6a3cae016a 100644 --- a/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj +++ b/vsintegration/tests/UnitTests/VisualFSharp.UnitTests.fsproj @@ -234,6 +234,7 @@ + @@ -243,6 +244,7 @@ + From e12f8dc70d780e020646ee1c05234540bd0378d1 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Tue, 13 Aug 2019 15:53:13 -0700 Subject: [PATCH 215/286] Move nameof to preview (#7391) * Move nameof to preview * fsharpqa tests --- src/fsharp/LanguageFeatures.fs | 2 +- .../nameof/{version47 => preview}/test.fsx | 0 tests/fsharp/tests.fs | 6 ++--- .../DataExpressions/NameOf/env.lst | 22 +++++++++---------- 4 files changed, 15 insertions(+), 15 deletions(-) rename tests/fsharp/core/nameof/{version47 => preview}/test.fsx (100%) diff --git a/src/fsharp/LanguageFeatures.fs b/src/fsharp/LanguageFeatures.fs index c4c46e4b66..abe35febff 100644 --- a/src/fsharp/LanguageFeatures.fs +++ b/src/fsharp/LanguageFeatures.fs @@ -52,7 +52,7 @@ type LanguageVersion (specifiedVersion) = LanguageFeature.SingleUnderscorePattern, languageVersion47 LanguageFeature.WildCardInForLoop, languageVersion47 LanguageFeature.RelaxWhitespace, languageVersion47 - LanguageFeature.NameOf, languageVersion47 + LanguageFeature.NameOf, previewVersion LanguageFeature.ImplicitYield, languageVersion47 LanguageFeature.OpenStaticClasses, languageVersion47 |] diff --git a/tests/fsharp/core/nameof/version47/test.fsx b/tests/fsharp/core/nameof/preview/test.fsx similarity index 100% rename from tests/fsharp/core/nameof/version47/test.fsx rename to tests/fsharp/core/nameof/preview/test.fsx diff --git a/tests/fsharp/tests.fs b/tests/fsharp/tests.fs index 94c46a1dce..bb3c7b8bda 100644 --- a/tests/fsharp/tests.fs +++ b/tests/fsharp/tests.fs @@ -1821,13 +1821,13 @@ module VersionTests = let ``nameof-version4.6``() = singleTestBuildAndRunVersion "core/nameof/version46" FSC_BUILDONLY "4.6" [] - let ``nameof-version4.7``() = singleTestBuildAndRun "core/nameof/version47" FSC_BUILDONLY + let ``nameof-versionpreview``() = singleTestBuildAndRunVersion "core/nameof/preview" FSC_BUILDONLY "preview" [] - let ``nameof-execute``() = singleTestBuildAndRun "core/nameof/version47" FSC_BASIC + let ``nameof-execute``() = singleTestBuildAndRunVersion "core/nameof/preview" FSC_BASIC "preview" [] - let ``nameof-fsi``() = singleTestBuildAndRun "core/nameof/version47" FSI_BASIC + let ``nameof-fsi``() = singleTestBuildAndRunVersion "core/nameof/preview" FSI_BASIC "preview" #if !FSHARP_SUITE_DRIVES_CORECLR_TESTS module ToolsTests = diff --git a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst index 53b393330d..9d473234e6 100644 --- a/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst +++ b/tests/fsharpqa/Source/Conformance/Expressions/DataExpressions/NameOf/env.lst @@ -1,11 +1,11 @@ - SOURCE=E_NameOfIntConst.fs # E_NameOfIntConst.fs - SOURCE=E_NameOfStringConst.fs # E_NameOfStringConst.fs - SOURCE=E_NameOfAppliedFunction.fs # E_NameOfAppliedFunction.fs - SOURCE=E_NameOfIntegerAppliedFunction.fs # E_NameOfIntegerAppliedFunction.fs - SOURCE=E_NameOfPartiallyAppliedFunction.fs # E_NameOfPartiallyAppliedFunction.fs - SOURCE=E_NameOfDictLookup.fs # E_NameOfDictLookup.fs - SOURCE=E_NameOfAdditionExpr.fs # E_NameOfAdditionExpr.fs - SOURCE=E_NameOfParameterAppliedFunction.fs # E_NameOfParameterAppliedFunction.fs - SOURCE=E_NameOfAsAFunction.fs # E_NameOfAsAFunction.fs - SOURCE=E_NameOfWithPipe.fs # E_NameOfWithPipe.fs - SOURCE=E_NameOfUnresolvableName.fs # E_NameOfUnresolvableName.fs + SOURCE=E_NameOfIntConst.fs SCFLAGS="--langversion:preview" # E_NameOfIntConst.fs + SOURCE=E_NameOfStringConst.fs SCFLAGS="--langversion:preview" # E_NameOfStringConst.fs + SOURCE=E_NameOfAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfAppliedFunction.fs + SOURCE=E_NameOfIntegerAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfIntegerAppliedFunction.fs + SOURCE=E_NameOfPartiallyAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfPartiallyAppliedFunction.fs + SOURCE=E_NameOfDictLookup.fs SCFLAGS="--langversion:preview" # E_NameOfDictLookup.fs + SOURCE=E_NameOfAdditionExpr.fs SCFLAGS="--langversion:preview" # E_NameOfAdditionExpr.fs + SOURCE=E_NameOfParameterAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfParameterAppliedFunction.fs + SOURCE=E_NameOfAsAFunction.fs SCFLAGS="--langversion:preview" # E_NameOfAsAFunction.fs + SOURCE=E_NameOfWithPipe.fs SCFLAGS="--langversion:preview" # E_NameOfWithPipe.fs + SOURCE=E_NameOfUnresolvableName.fs SCFLAGS="--langversion:preview" # E_NameOfUnresolvableName.fs From 1c6e82038318d93972b407279073aee80683304b Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Fri, 16 Aug 2019 09:55:24 -0700 Subject: [PATCH 216/286] Allow consuming visible fields and items we have an IVT for with opening of static classes (#7411) --- src/fsharp/NameResolution.fs | 30 ++++++++++++------- src/fsharp/NameResolution.fsi | 2 +- src/fsharp/TypeChecker.fs | 6 ++-- .../Compiler/Language/OpenStaticClasses.fs | 15 ++++++++++ 4 files changed, 39 insertions(+), 14 deletions(-) diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index 6c6cac0dd6..5ae1df003f 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -758,14 +758,14 @@ let AddUnionCases2 bulkAddMode (eUnqualifiedItems: UnqualifiedItems) (ucrefs: Un let item = Item.UnionCase(GeneralizeUnionCaseRef ucref, false) acc.Add (ucref.CaseName, item)) -let AddStaticContentOfTyconRefToNameEnv (g:TcGlobals) (amap: Import.ImportMap) m (nenv: NameResolutionEnv) (tcref:TyconRef) = +let AddStaticContentOfTyconRefToNameEnv (g:TcGlobals) (amap: Import.ImportMap) ad m (nenv: NameResolutionEnv) (tcref:TyconRef) = // If OpenStaticClasses is not enabled then don't do this if amap.g.langVersion.SupportsFeature LanguageFeature.OpenStaticClasses then let ty = generalizedTyconRef tcref let infoReader = InfoReader(g,amap) let items = [| let methGroups = - AllMethInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty + AllMethInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None ad PreferOverrides m ty |> List.groupBy (fun m -> m.LogicalName) for (methName, methGroup) in methGroups do @@ -774,20 +774,30 @@ let AddStaticContentOfTyconRefToNameEnv (g:TcGlobals) (amap: Import.ImportMap) m yield KeyValuePair(methName, Item.MethodGroup(methName, methGroup, None)) let propInfos = - AllPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None AccessorDomain.AccessibleFromSomeFSharpCode PreferOverrides m ty + AllPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None ad PreferOverrides m ty |> List.groupBy (fun m -> m.PropertyName) for (propName, propInfos) in propInfos do let propInfos = propInfos |> List.filter (fun m -> m.IsStatic) for propInfo in propInfos do - yield KeyValuePair(propName , Item.Property(propName,[propInfo])) |] + yield KeyValuePair(propName , Item.Property(propName,[propInfo])) + + let fields = + infoReader.GetILFieldInfosOfType(None, ad, m, ty) + |> List.groupBy (fun f -> f.FieldName) + + for (fieldName, fieldInfos) in fields do + let fieldInfos = fieldInfos |> List.filter (fun fi -> fi.IsStatic) + for fieldInfo in fieldInfos do + yield KeyValuePair(fieldName, Item.ILField(fieldInfo)) + |] { nenv with eUnqualifiedItems = nenv.eUnqualifiedItems.AddAndMarkAsCollapsible items } else nenv /// Add any implied contents of a type definition to the environment. -let private AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition (g: TcGlobals) amap m nenv (tcref: TyconRef) = +let private AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition (g: TcGlobals) amap ad m nenv (tcref: TyconRef) = let isIL = tcref.IsILTycon let ucrefs = if isIL then [] else tcref.UnionCasesAsList |> List.map tcref.MakeNestedUnionCaseRef @@ -860,16 +870,16 @@ let private AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition (g: TcGlobals) let nenv = if TryFindFSharpBoolAttribute g g.attrib_AutoOpenAttribute tcref.Attribs = Some true && isStaticClass g tcref then - AddStaticContentOfTyconRefToNameEnv g amap m nenv tcref + AddStaticContentOfTyconRefToNameEnv g amap ad m nenv tcref else nenv nenv /// Add a set of type definitions to the name resolution environment -let AddTyconRefsToNameEnv bulkAddMode ownDefinition g amap m root nenv tcrefs = +let AddTyconRefsToNameEnv bulkAddMode ownDefinition g amap ad m root nenv tcrefs = if isNil tcrefs then nenv else - let env = List.fold (AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition g amap m) nenv tcrefs + let env = List.fold (AddPartsOfTyconRefToNameEnv bulkAddMode ownDefinition g amap ad m) nenv tcrefs // Add most of the contents of the tycons en-masse, then flatten the tables if we're opening a module or namespace let tcrefs = Array.ofList tcrefs { env with @@ -968,7 +978,7 @@ and AddModuleOrNamespaceContentsToNameEnv (g: TcGlobals) amap (ad: AccessorDomai let tcref = modref.NestedTyconRef tycon if IsEntityAccessible amap m ad tcref then Some tcref else None) - let nenv = (nenv, tcrefs) ||> AddTyconRefsToNameEnv BulkAdd.Yes false g amap m false + let nenv = (nenv, tcrefs) ||> AddTyconRefsToNameEnv BulkAdd.Yes false g amap ad m false let vrefs = mty.AllValsAndMembers.ToList() |> List.choose (fun x -> if IsAccessible ad x.Accessibility then TryMkValRefInModRef modref x else None) @@ -993,7 +1003,7 @@ and AddEntityContentsToNameEnv g amap ad m root nenv (modref: EntityRef) = if modref.IsModuleOrNamespace then AddModuleOrNamespaceContentsToNameEnv g amap ad m root nenv modref else - AddStaticContentOfTyconRefToNameEnv g amap m nenv modref + AddStaticContentOfTyconRefToNameEnv g amap ad m nenv modref /// Add a single modules or namespace to the name resolution environment let AddModuleOrNamespaceRefToNameEnv g amap m root ad nenv (modref: EntityRef) = diff --git a/src/fsharp/NameResolution.fsi b/src/fsharp/NameResolution.fsi index 0f3e318d9d..a1567ed43b 100755 --- a/src/fsharp/NameResolution.fsi +++ b/src/fsharp/NameResolution.fsi @@ -187,7 +187,7 @@ val internal AddValRefToNameEnv : NameResolutionEnv -> ValRef val internal AddActivePatternResultTagsToNameEnv : ActivePatternInfo -> NameResolutionEnv -> TType -> range -> NameResolutionEnv /// Add a list of type definitions to the name resolution environment -val internal AddTyconRefsToNameEnv : BulkAdd -> bool -> TcGlobals -> ImportMap -> range -> bool -> NameResolutionEnv -> TyconRef list -> NameResolutionEnv +val internal AddTyconRefsToNameEnv : BulkAdd -> bool -> TcGlobals -> ImportMap -> AccessorDomain -> range -> bool -> NameResolutionEnv -> TyconRef list -> NameResolutionEnv /// Add an F# exception definition to the name resolution environment val internal AddExceptionDeclsToNameEnv : BulkAdd -> NameResolutionEnv -> TyconRef -> NameResolutionEnv diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index bf70c63a17..215ac3e547 100644 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -358,7 +358,7 @@ let AddLocalExnDefnAndReport tcSink scopem env (exnc: Tycon) = /// Add a list of type definitions to TcEnv let AddLocalTyconRefs ownDefinition g amap m tcrefs env = if isNil tcrefs then env else - { env with eNameResEnv = AddTyconRefsToNameEnv BulkAdd.No ownDefinition g amap m false env.eNameResEnv tcrefs } + { env with eNameResEnv = AddTyconRefsToNameEnv BulkAdd.No ownDefinition g amap env.eAccessRights m false env.eNameResEnv tcrefs } /// Add a list of type definitions to TcEnv let AddLocalTycons g amap m (tycons: Tycon list) env = @@ -407,7 +407,7 @@ let AddNonLocalCcu g amap scopem env assemblyName (ccu: CcuThunk, internalsVisib let env = AddRootModuleOrNamespaceRefs g amap scopem env modrefs let env = if isNil tcrefs then env else - { env with eNameResEnv = AddTyconRefsToNameEnv BulkAdd.Yes false g amap scopem true env.eNameResEnv tcrefs } + { env with eNameResEnv = AddTyconRefsToNameEnv BulkAdd.Yes false g amap env.eAccessRights scopem true env.eNameResEnv tcrefs } env /// Adjust the TcEnv to account for a fully processed "namespace" declaration in thie file @@ -418,7 +418,7 @@ let AddLocalRootModuleOrNamespace tcSink g amap scopem env (mtyp: ModuleOrNamesp let tcrefs = mtyp.TypeAndExceptionDefinitions |> List.map mkLocalTyconRef let env = AddRootModuleOrNamespaceRefs g amap scopem env modrefs let env = { env with - eNameResEnv = if isNil tcrefs then env.eNameResEnv else AddTyconRefsToNameEnv BulkAdd.No false g amap scopem true env.eNameResEnv tcrefs + eNameResEnv = if isNil tcrefs then env.eNameResEnv else AddTyconRefsToNameEnv BulkAdd.No false g amap env.eAccessRights scopem true env.eNameResEnv tcrefs eUngeneralizableItems = addFreeItemOfModuleTy mtyp env.eUngeneralizableItems } CallEnvSink tcSink (scopem, env.NameEnv, env.eAccessRights) env diff --git a/tests/fsharp/Compiler/Language/OpenStaticClasses.fs b/tests/fsharp/Compiler/Language/OpenStaticClasses.fs index bd036d3a10..821e698dc8 100644 --- a/tests/fsharp/Compiler/Language/OpenStaticClasses.fs +++ b/tests/fsharp/Compiler/Language/OpenStaticClasses.fs @@ -171,3 +171,18 @@ module OpenAutoMath = let x = AutoMin(1.0, 2.0) let x2 = AutoMin(1, 2)""") [| |] + + [] + let ``OpenStaticClassesTests - OpenAccessibleFields - langversion:preview`` () = + CompilerAssert.TypeCheckWithErrorsAndOptions + [| "--langversion:preview" |] + (baseModule + """ +module OpenAFieldFromMath = + open System.Math + + let pi = PI""") + [||] + + // TODO - wait for Will's integration of testing changes that makes this easlier + // [] + // let ``OpenStaticClassesTests - InternalsVisibleWhenHavingAnIVT - langversion:preview``() = ... \ No newline at end of file From 650a166ed33f19b6d601cdff0a58d6e18021c893 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Fri, 16 Aug 2019 13:53:41 -0700 Subject: [PATCH 217/286] Open static classes in preview (#7414) --- src/fsharp/LanguageFeatures.fs | 2 +- .../Compiler/Language/OpenStaticClasses.fs | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/fsharp/LanguageFeatures.fs b/src/fsharp/LanguageFeatures.fs index abe35febff..4f55325311 100644 --- a/src/fsharp/LanguageFeatures.fs +++ b/src/fsharp/LanguageFeatures.fs @@ -54,7 +54,7 @@ type LanguageVersion (specifiedVersion) = LanguageFeature.RelaxWhitespace, languageVersion47 LanguageFeature.NameOf, previewVersion LanguageFeature.ImplicitYield, languageVersion47 - LanguageFeature.OpenStaticClasses, languageVersion47 + LanguageFeature.OpenStaticClasses, previewVersion |] let specified = diff --git a/tests/fsharp/Compiler/Language/OpenStaticClasses.fs b/tests/fsharp/Compiler/Language/OpenStaticClasses.fs index 821e698dc8..5dcc962db3 100644 --- a/tests/fsharp/Compiler/Language/OpenStaticClasses.fs +++ b/tests/fsharp/Compiler/Language/OpenStaticClasses.fs @@ -8,7 +8,7 @@ open NUnit.Framework (* Tests in this file evaluate whether the language supports accessing functions on static classes using open - The feature was added in FSharp4.7, the test cases ensure that the original errors are reproduced when the langversion:4.6 is specified + The feature was added in preview, the test cases ensure that the original errors are reproduced when the langversion:4.6 is specified *) [] @@ -49,9 +49,9 @@ module OpenSystemMathOnce = |] [] - let ``OpenStaticClassesTests - OpenSystemMathOnce - langversion:v4.7`` () = + let ``OpenStaticClassesTests - OpenSystemMathOnce - langversion:preview`` () = CompilerAssert.TypeCheckWithErrorsAndOptions - [| "--langversion:4.7" |] + [| "--langversion:preview" |] (baseModule + """ module OpenSystemMathOnce = @@ -79,9 +79,9 @@ module OpenSystemMathTwice = |] [] - let ``OpenStaticClassesTests - OpenSystemMathTwice - langversion:v4.7`` () = + let ``OpenStaticClassesTests - OpenSystemMathTwice - langversion:preview`` () = CompilerAssert.TypeCheckWithErrorsAndOptions - [| "--langversion:4.7" |] + [| "--langversion:preview" |] (baseModule + """ module OpenSystemMathOnce = @@ -106,9 +106,9 @@ module OpenMyMathOnce = |] [] - let ``OpenStaticClassesTests - OpenMyMathOnce - langversion:v4.7`` () = + let ``OpenStaticClassesTests - OpenMyMathOnce - langversion:preview`` () = CompilerAssert.TypeCheckWithErrorsAndOptions - [| "--langversion:4.7" |] + [| "--langversion:preview" |] (baseModule + """ module OpenMyMathOnce = @@ -132,9 +132,9 @@ module DontOpenAutoMath = |] [] - let ``OpenStaticClassesTests - DontOpenAutoMath - langversion:v4.7`` () = + let ``OpenStaticClassesTests - DontOpenAutoMath - langversion:preview`` () = CompilerAssert.TypeCheckWithErrorsAndOptions - [| "--langversion:4.7" |] + [| "--langversion:preview" |] (baseModule + """ module DontOpenAutoMath = @@ -160,9 +160,9 @@ module OpenAutoMath = |] [] - let ``OpenStaticClassesTests - OpenAutoMath - langversion:v4.7`` () = + let ``OpenStaticClassesTests - OpenAutoMath - langversion:preview`` () = CompilerAssert.TypeCheckWithErrorsAndOptions - [| "--langversion:4.7" |] + [| "--langversion:preview" |] (baseModule + """ module OpenAutoMath = open AutoOpenMyMath From 8dd81c6424bfafd02b31b2ddd92c20fc7cd0e817 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Tue, 20 Aug 2019 10:15:56 -0700 Subject: [PATCH 218/286] Added inref immutability assumption removal (#7407) * Added inref immutability assumption fix. Aware of IsReadOnly attribute, only on ILMethods. * Added isILStructTy * targeting assumption * Fixed tests * renaming * Better IsReadOnly check * Added tests * Splitting read-only assumption and read-only attribute check * Func removal * Better tests * Trying to fix test * More tests * Fixed extension member inref check * small cleanup * Added mkDereferencedByrefExpr * Minor cleanup * More tests. Changed how we deref addresses * Update comment * Being more specific on dereference addr work * Drastically simplified the solution * Added tests * Verifying current behavior --- src/fsharp/MethodCalls.fs | 13 ++ src/fsharp/PostInferenceChecks.fs | 3 +- src/fsharp/TastOps.fs | 65 ++++-- src/fsharp/TastOps.fsi | 3 + src/fsharp/TypeChecker.fs | 9 +- src/fsharp/infos.fs | 29 ++- src/fsharp/tast.fs | 203 +++++++++++-------- tests/fsharp/Compiler/CompilerAssert.fs | 4 +- tests/fsharp/Compiler/Language/ByrefTests.fs | 198 ++++++++++++++++++ tests/fsharp/FSharpSuite.Tests.fsproj | 1 + tests/fsharp/core/fsfromfsviacs/lib2.cs | 13 ++ tests/fsharp/core/fsfromfsviacs/test.fsx | 69 +++++++ 12 files changed, 498 insertions(+), 112 deletions(-) create mode 100644 tests/fsharp/Compiler/Language/ByrefTests.fs diff --git a/src/fsharp/MethodCalls.fs b/src/fsharp/MethodCalls.fs index 895f2d1f72..cf590b69ee 100644 --- a/src/fsharp/MethodCalls.fs +++ b/src/fsharp/MethodCalls.fs @@ -938,6 +938,19 @@ let TakeObjAddrForMethodCall g amap (minfo: MethInfo) isMutable m objArgs f = let hasCallInfo = ccallInfo.IsSome let mustTakeAddress = hasCallInfo || minfo.ObjArgNeedsAddress(amap, m) let objArgTy = tyOfExpr g objArgExpr + + let isMutable = + match isMutable with + | DefinitelyMutates + | NeverMutates + | AddressOfOp -> isMutable + | PossiblyMutates -> + // Check to see if the method is read-only. Perf optimization. + // If there is an extension member whose first arg is an inref, we must return NeverMutates. + if mustTakeAddress && (minfo.IsReadOnly || minfo.IsReadOnlyExtensionMember (amap, m)) then + NeverMutates + else + isMutable let wrap, objArgExprAddr, isReadOnly, _isWriteOnly = mkExprAddrOfExpr g mustTakeAddress hasCallInfo isMutable objArgExpr None m diff --git a/src/fsharp/PostInferenceChecks.fs b/src/fsharp/PostInferenceChecks.fs index dd1ec5c2af..d97766ac1b 100644 --- a/src/fsharp/PostInferenceChecks.fs +++ b/src/fsharp/PostInferenceChecks.fs @@ -263,7 +263,8 @@ let GetLimitValByRef cenv env m v = { scope = scope; flags = flags } let LimitVal cenv (v: Val) limit = - cenv.limitVals.[v.Stamp] <- limit + if not v.IgnoresByrefScope then + cenv.limitVals.[v.Stamp] <- limit let BindVal cenv env (v: Val) = //printfn "binding %s..." v.DisplayName diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 1889404478..55576c88d4 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -3004,8 +3004,8 @@ let isByrefTyconRef (g: TcGlobals) (tcref: TyconRef) = let isByrefLikeTyconRef (g: TcGlobals) m (tcref: TyconRef) = tcref.CanDeref && match tcref.TryIsByRefLike with - | Some res -> res - | None -> + | ValueSome res -> res + | _ -> let res = isByrefTyconRef g tcref || (isStructTyconRef tcref && TyconRefHasAttribute g m g.attrib_IsByRefLikeAttribute tcref) @@ -5941,34 +5941,53 @@ let mkAndSimplifyMatch spBind exprm matchm ty tree targets = //------------------------------------------------------------------------- type Mutates = AddressOfOp | DefinitelyMutates | PossiblyMutates | NeverMutates -exception DefensiveCopyWarning of string * range +exception DefensiveCopyWarning of string * range let isRecdOrStructTyconRefAssumedImmutable (g: TcGlobals) (tcref: TyconRef) = tcref.CanDeref && not (isRecdOrUnionOrStructTyconRefDefinitelyMutable tcref) || - tyconRefEq g tcref g.decimal_tcr || + tyconRefEq g tcref g.decimal_tcr || tyconRefEq g tcref g.date_tcr -let isRecdOrStructTyconRefReadOnly (g: TcGlobals) m (tcref: TyconRef) = +let isTyconRefReadOnly g m (tcref: TyconRef) = tcref.CanDeref && match tcref.TryIsReadOnly with - | Some res -> res - | None -> - let isImmutable = isRecdOrStructTyconRefAssumedImmutable g tcref - let hasAttrib = TyconRefHasAttribute g m g.attrib_IsReadOnlyAttribute tcref - let res = isImmutable || hasAttrib + | ValueSome res -> res + | _ -> + let res = TyconRefHasAttribute g m g.attrib_IsReadOnlyAttribute tcref tcref.SetIsReadOnly res res -let isRecdOrStructTyReadOnly (g: TcGlobals) m ty = +let isTyconRefAssumedReadOnly g (tcref: TyconRef) = + tcref.CanDeref && + match tcref.TryIsAssumedReadOnly with + | ValueSome res -> res + | _ -> + let res = isRecdOrStructTyconRefAssumedImmutable g tcref + tcref.SetIsAssumedReadOnly res + res + +let isRecdOrStructTyconRefReadOnlyAux g m isInref (tcref: TyconRef) = + if isInref && tcref.IsILStructOrEnumTycon then + isTyconRefReadOnly g m tcref + else + isTyconRefReadOnly g m tcref || isTyconRefAssumedReadOnly g tcref + +let isRecdOrStructTyconRefReadOnly g m tcref = + isRecdOrStructTyconRefReadOnlyAux g m false tcref + +let isRecdOrStructTyReadOnlyAux (g: TcGlobals) m isInref ty = match tryDestAppTy g ty with | ValueNone -> false - | ValueSome tcref -> isRecdOrStructTyconRefReadOnly g m tcref + | ValueSome tcref -> isRecdOrStructTyconRefReadOnlyAux g m isInref tcref + +let isRecdOrStructTyReadOnly g m ty = + isRecdOrStructTyReadOnlyAux g m false ty -let CanTakeAddressOf g m ty mut = +let CanTakeAddressOf g m isInref ty mut = match mut with | NeverMutates -> true - | PossiblyMutates -> isRecdOrStructTyReadOnly g m ty + | PossiblyMutates -> isRecdOrStructTyReadOnlyAux g m isInref ty | DefinitelyMutates -> false | AddressOfOp -> true // you can take the address but you might get a (readonly) inref as a result @@ -5996,7 +6015,7 @@ let CanTakeAddressOfImmutableVal (g: TcGlobals) m (vref: ValRef) mut = // || valRefInThisAssembly g.compilingFslib vref // This is because we don't actually guarantee to generate static backing fields for all values like these, e.g. simple constants "let x = 1". // We always generate a static property but there is no field to take an address of - CanTakeAddressOf g m vref.Type mut + CanTakeAddressOf g m false vref.Type mut let MustTakeAddressOfVal (g: TcGlobals) (vref: ValRef) = vref.IsMutable && @@ -6008,7 +6027,7 @@ let MustTakeAddressOfByrefGet (g: TcGlobals) (vref: ValRef) = let CanTakeAddressOfByrefGet (g: TcGlobals) (vref: ValRef) mut = isInByrefTy g vref.Type && - CanTakeAddressOf g vref.Range (destByrefTy g vref.Type) mut + CanTakeAddressOf g vref.Range true (destByrefTy g vref.Type) mut let MustTakeAddressOfRecdField (rfref: RecdField) = // Static mutable fields must be private, hence we don't have to take their address @@ -6021,14 +6040,18 @@ let CanTakeAddressOfRecdFieldRef (g: TcGlobals) m (rfref: RecdFieldRef) tinst mu // We only do this if the field is defined in this assembly because we can't take addresses across assemblies for immutable fields entityRefInThisAssembly g.compilingFslib rfref.TyconRef && not rfref.RecdField.IsMutable && - CanTakeAddressOf g m (actualTyOfRecdFieldRef rfref tinst) mut + CanTakeAddressOf g m false (actualTyOfRecdFieldRef rfref tinst) mut let CanTakeAddressOfUnionFieldRef (g: TcGlobals) m (uref: UnionCaseRef) cidx tinst mut = // We only do this if the field is defined in this assembly because we can't take addresses across assemblies for immutable fields entityRefInThisAssembly g.compilingFslib uref.TyconRef && let rfref = uref.FieldByIndex cidx not rfref.IsMutable && - CanTakeAddressOf g m (actualTyOfUnionFieldRef uref cidx tinst) mut + CanTakeAddressOf g m false (actualTyOfUnionFieldRef uref cidx tinst) mut + +let mkDerefAddrExpr mAddrGet expr mExpr exprTy = + let v, _ = mkCompGenLocal mAddrGet "byrefReturn" exprTy + mkCompGenLet mExpr v expr (mkAddrGet mAddrGet (mkLocalValRef v)) /// Make the address-of expression and return a wrapper that adds any allocated locals at an appropriate scope. /// Also return a flag that indicates if the resulting pointer is a not a pointer where writing is allowed and will @@ -6166,8 +6189,12 @@ let rec mkExprAddrOfExprAux g mustTakeAddress useReadonlyForGenericArrayAddress // Take a defensive copy let tmp, _ = match mut with - | NeverMutates -> mkCompGenLocal m "copyOfStruct" ty + | NeverMutates -> mkCompGenLocal m "copyOfStruct" ty | _ -> mkMutableCompGenLocal m "copyOfStruct" ty + + // This local is special in that it ignore byref scoping rules. + tmp.SetIgnoresByrefScope() + let readonly = true let writeonly = false Some (tmp, expr), (mkValAddr m readonly (mkLocalValRef tmp)), readonly, writeonly diff --git a/src/fsharp/TastOps.fsi b/src/fsharp/TastOps.fsi index 1da2274230..6119007d52 100755 --- a/src/fsharp/TastOps.fsi +++ b/src/fsharp/TastOps.fsi @@ -369,6 +369,9 @@ exception DefensiveCopyWarning of string * range type Mutates = AddressOfOp | DefinitelyMutates | PossiblyMutates | NeverMutates +/// Helper to create an expression that dereferences an address. +val mkDerefAddrExpr: mAddrGet: range -> expr: Expr -> mExpr: range -> exprTy: TType -> Expr + /// Helper to take the address of an expression val mkExprAddrOfExprAux : TcGlobals -> bool -> bool -> Mutates -> Expr -> ValRef option -> range -> (Val * Expr) option * Expr * bool * bool diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 215ac3e547..58cc3af35f 100644 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -3394,8 +3394,7 @@ let AnalyzeArbitraryExprAsEnumerable cenv (env: TcEnv) localAlloc m exprty expr let currentExpr, enumElemTy = // Implicitly dereference byref for expr 'for x in ...' if isByrefTy cenv.g enumElemTy then - let v, _ = mkCompGenLocal m "byrefReturn" enumElemTy - let expr = mkCompGenLet currentExpr.Range v currentExpr (mkAddrGet m (mkLocalValRef v)) + let expr = mkDerefAddrExpr m currentExpr currentExpr.Range enumElemTy expr, destByrefTy cenv.g enumElemTy else currentExpr, enumElemTy @@ -4139,9 +4138,8 @@ let buildApp cenv expr resultTy arg m = | _ when isByrefTy g resultTy -> // Handle byref returns, byref-typed returns get implicitly dereferenced - let v, _ = mkCompGenLocal m "byrefReturn" resultTy let expr = expr.SupplyArgument (arg, m) - let expr = mkCompGenLet m v expr.Expr (mkAddrGet m (mkLocalValRef v)) + let expr = mkDerefAddrExpr m expr.Expr m resultTy let resultTy = destByrefTy g resultTy MakeApplicableExprNoFlex cenv expr, resultTy @@ -10214,8 +10212,7 @@ and TcMethodApplication // byref-typed returns get implicitly dereferenced let vty = tyOfExpr cenv.g callExpr0 if isByrefTy cenv.g vty then - let v, _ = mkCompGenLocal mMethExpr "byrefReturn" vty - mkCompGenLet mMethExpr v callExpr0 (mkAddrGet mMethExpr (mkLocalValRef v)) + mkDerefAddrExpr mMethExpr callExpr0 mMethExpr vty else callExpr0 diff --git a/src/fsharp/infos.fs b/src/fsharp/infos.fs index dd6f8b0e3f..4ca16f77cd 100755 --- a/src/fsharp/infos.fs +++ b/src/fsharp/infos.fs @@ -835,7 +835,15 @@ type ILMethInfo = member x.IsDllImport (g: TcGlobals) = match g.attrib_DllImportAttribute with | None -> false - | Some (AttribInfo(tref, _)) ->x.RawMetadata.CustomAttrs |> TryDecodeILAttribute g tref |> Option.isSome + | Some attr -> + x.RawMetadata.CustomAttrs + |> TryFindILAttribute attr + + /// Indicates if the method is marked with the [] attribute. This is done by looking at the IL custom attributes on + /// the method. + member x.IsReadOnly (g: TcGlobals) = + x.RawMetadata.CustomAttrs + |> TryFindILAttribute g.attrib_IsReadOnlyAttribute /// Get the (zero or one) 'self'/'this'/'object' arguments associated with an IL method. /// An instance extension method returns one object argument. @@ -1238,6 +1246,25 @@ type MethInfo = member x.IsStruct = isStructTy x.TcGlobals x.ApparentEnclosingType + /// Indicates if this method is read-only; usually by the [] attribute. + /// Must be an instance method. + /// Receiver must be a struct type. + member x.IsReadOnly = + // Perf Review: Is there a way we can cache this result? + x.IsInstance && + x.IsStruct && + match x with + | ILMeth (g, ilMethInfo, _) -> ilMethInfo.IsReadOnly g + | FSMeth _ -> false // F# defined methods not supported yet. Must be a language feature. + | _ -> false + + /// Indicates if this method is an extension member that is read-only. + /// An extension member is considered read-only if the first argument is a read-only byref (inref) type. + member x.IsReadOnlyExtensionMember (amap: Import.ImportMap, m) = + x.IsExtensionMember && + x.TryObjArgByrefType(amap, m, x.FormalMethodInst) + |> Option.exists (isInByrefTy amap.g) + /// Build IL method infos. static member CreateILMeth (amap: Import.ImportMap, m, ty: TType, md: ILMethodDef) = let tinfo = ILTypeInfo.FromType amap.g ty diff --git a/src/fsharp/tast.fs b/src/fsharp/tast.fs index d59c33f700..6e063cd831 100644 --- a/src/fsharp/tast.fs +++ b/src/fsharp/tast.fs @@ -116,133 +116,137 @@ type ValFlags(flags: int64) = new (recValInfo, baseOrThis, isCompGen, inlineInfo, isMutable, isModuleOrMemberBinding, isExtensionMember, isIncrClassSpecialMember, isTyFunc, allowTypeInst, isGeneratedEventVal) = let flags = (match baseOrThis with - | BaseVal -> 0b0000000000000000000L - | CtorThisVal -> 0b0000000000000000010L - | NormalVal -> 0b0000000000000000100L - | MemberThisVal -> 0b0000000000000000110L) ||| - (if isCompGen then 0b0000000000000001000L - else 0b00000000000000000000L) ||| + | BaseVal -> 0b00000000000000000000L + | CtorThisVal -> 0b00000000000000000010L + | NormalVal -> 0b00000000000000000100L + | MemberThisVal -> 0b00000000000000000110L) ||| + (if isCompGen then 0b00000000000000001000L + else 0b000000000000000000000L) ||| (match inlineInfo with - | ValInline.PseudoVal -> 0b0000000000000000000L - | ValInline.Always -> 0b0000000000000010000L - | ValInline.Optional -> 0b0000000000000100000L - | ValInline.Never -> 0b0000000000000110000L) ||| + | ValInline.PseudoVal -> 0b00000000000000000000L + | ValInline.Always -> 0b00000000000000010000L + | ValInline.Optional -> 0b00000000000000100000L + | ValInline.Never -> 0b00000000000000110000L) ||| (match isMutable with - | Immutable -> 0b0000000000000000000L - | Mutable -> 0b0000000000001000000L) ||| + | Immutable -> 0b00000000000000000000L + | Mutable -> 0b00000000000001000000L) ||| (match isModuleOrMemberBinding with - | false -> 0b0000000000000000000L - | true -> 0b0000000000010000000L) ||| + | false -> 0b00000000000000000000L + | true -> 0b00000000000010000000L) ||| (match isExtensionMember with - | false -> 0b0000000000000000000L - | true -> 0b0000000000100000000L) ||| + | false -> 0b00000000000000000000L + | true -> 0b00000000000100000000L) ||| (match isIncrClassSpecialMember with - | false -> 0b0000000000000000000L - | true -> 0b0000000001000000000L) ||| + | false -> 0b00000000000000000000L + | true -> 0b00000000001000000000L) ||| (match isTyFunc with - | false -> 0b0000000000000000000L - | true -> 0b0000000010000000000L) ||| + | false -> 0b00000000000000000000L + | true -> 0b00000000010000000000L) ||| (match recValInfo with - | ValNotInRecScope -> 0b0000000000000000000L - | ValInRecScope true -> 0b0000000100000000000L - | ValInRecScope false -> 0b0000001000000000000L) ||| + | ValNotInRecScope -> 0b00000000000000000000L + | ValInRecScope true -> 0b00000000100000000000L + | ValInRecScope false -> 0b00000001000000000000L) ||| (match allowTypeInst with - | false -> 0b0000000000000000000L - | true -> 0b0000100000000000000L) ||| + | false -> 0b00000000000000000000L + | true -> 0b00000100000000000000L) ||| (match isGeneratedEventVal with - | false -> 0b0000000000000000000L - | true -> 0b0100000000000000000L) + | false -> 0b00000000000000000000L + | true -> 0b00100000000000000000L) ValFlags flags member x.BaseOrThisInfo = - match (flags &&& 0b0000000000000000110L) with - | 0b0000000000000000000L -> BaseVal - | 0b0000000000000000010L -> CtorThisVal - | 0b0000000000000000100L -> NormalVal - | 0b0000000000000000110L -> MemberThisVal + match (flags &&& 0b00000000000000000110L) with + | 0b00000000000000000000L -> BaseVal + | 0b00000000000000000010L -> CtorThisVal + | 0b00000000000000000100L -> NormalVal + | 0b00000000000000000110L -> MemberThisVal | _ -> failwith "unreachable" - member x.IsCompilerGenerated = (flags &&& 0b0000000000000001000L) <> 0x0L + member x.IsCompilerGenerated = (flags &&& 0b00000000000000001000L) <> 0x0L member x.SetIsCompilerGenerated isCompGen = - let flags = (flags &&& ~~~0b0000000000000001000L) ||| + let flags = (flags &&& ~~~0b00000000000000001000L) ||| (match isCompGen with - | false -> 0b0000000000000000000L - | true -> 0b0000000000000001000L) + | false -> 0b00000000000000000000L + | true -> 0b00000000000000001000L) ValFlags flags member x.InlineInfo = - match (flags &&& 0b0000000000000110000L) with - | 0b0000000000000000000L -> ValInline.PseudoVal - | 0b0000000000000010000L -> ValInline.Always - | 0b0000000000000100000L -> ValInline.Optional - | 0b0000000000000110000L -> ValInline.Never + match (flags &&& 0b00000000000000110000L) with + | 0b00000000000000000000L -> ValInline.PseudoVal + | 0b00000000000000010000L -> ValInline.Always + | 0b00000000000000100000L -> ValInline.Optional + | 0b00000000000000110000L -> ValInline.Never | _ -> failwith "unreachable" member x.MutabilityInfo = - match (flags &&& 0b0000000000001000000L) with - | 0b0000000000000000000L -> Immutable - | 0b0000000000001000000L -> Mutable + match (flags &&& 0b00000000000001000000L) with + | 0b00000000000000000000L -> Immutable + | 0b00000000000001000000L -> Mutable | _ -> failwith "unreachable" member x.IsMemberOrModuleBinding = - match (flags &&& 0b0000000000010000000L) with - | 0b0000000000000000000L -> false - | 0b0000000000010000000L -> true + match (flags &&& 0b00000000000010000000L) with + | 0b00000000000000000000L -> false + | 0b00000000000010000000L -> true | _ -> failwith "unreachable" - member x.WithIsMemberOrModuleBinding = ValFlags(flags ||| 0b0000000000010000000L) + member x.WithIsMemberOrModuleBinding = ValFlags(flags ||| 0b00000000000010000000L) - member x.IsExtensionMember = (flags &&& 0b0000000000100000000L) <> 0L + member x.IsExtensionMember = (flags &&& 0b00000000000100000000L) <> 0L - member x.IsIncrClassSpecialMember = (flags &&& 0b0000000001000000000L) <> 0L + member x.IsIncrClassSpecialMember = (flags &&& 0b00000000001000000000L) <> 0L - member x.IsTypeFunction = (flags &&& 0b0000000010000000000L) <> 0L + member x.IsTypeFunction = (flags &&& 0b00000000010000000000L) <> 0L - member x.RecursiveValInfo = match (flags &&& 0b0000001100000000000L) with - | 0b0000000000000000000L -> ValNotInRecScope - | 0b0000000100000000000L -> ValInRecScope true - | 0b0000001000000000000L -> ValInRecScope false + member x.RecursiveValInfo = match (flags &&& 0b00000001100000000000L) with + | 0b00000000000000000000L -> ValNotInRecScope + | 0b00000000100000000000L -> ValInRecScope true + | 0b00000001000000000000L -> ValInRecScope false | _ -> failwith "unreachable" member x.WithRecursiveValInfo recValInfo = let flags = - (flags &&& ~~~0b0000001100000000000L) ||| + (flags &&& ~~~0b00000001100000000000L) ||| (match recValInfo with - | ValNotInRecScope -> 0b0000000000000000000L - | ValInRecScope true -> 0b0000000100000000000L - | ValInRecScope false -> 0b0000001000000000000L) + | ValNotInRecScope -> 0b00000000000000000000L + | ValInRecScope true -> 0b00000000100000000000L + | ValInRecScope false -> 0b00000001000000000000L) ValFlags flags - member x.MakesNoCriticalTailcalls = (flags &&& 0b0000010000000000000L) <> 0L + member x.MakesNoCriticalTailcalls = (flags &&& 0b00000010000000000000L) <> 0L - member x.WithMakesNoCriticalTailcalls = ValFlags(flags ||| 0b0000010000000000000L) + member x.WithMakesNoCriticalTailcalls = ValFlags(flags ||| 0b00000010000000000000L) - member x.PermitsExplicitTypeInstantiation = (flags &&& 0b0000100000000000000L) <> 0L + member x.PermitsExplicitTypeInstantiation = (flags &&& 0b00000100000000000000L) <> 0L - member x.HasBeenReferenced = (flags &&& 0b0001000000000000000L) <> 0L + member x.HasBeenReferenced = (flags &&& 0b00001000000000000000L) <> 0L - member x.WithHasBeenReferenced = ValFlags(flags ||| 0b0001000000000000000L) + member x.WithHasBeenReferenced = ValFlags(flags ||| 0b00001000000000000000L) - member x.IsCompiledAsStaticPropertyWithoutField = (flags &&& 0b0010000000000000000L) <> 0L + member x.IsCompiledAsStaticPropertyWithoutField = (flags &&& 0b00010000000000000000L) <> 0L - member x.WithIsCompiledAsStaticPropertyWithoutField = ValFlags(flags ||| 0b0010000000000000000L) + member x.WithIsCompiledAsStaticPropertyWithoutField = ValFlags(flags ||| 0b00010000000000000000L) - member x.IsGeneratedEventVal = (flags &&& 0b0100000000000000000L) <> 0L + member x.IsGeneratedEventVal = (flags &&& 0b00100000000000000000L) <> 0L - member x.IsFixed = (flags &&& 0b1000000000000000000L) <> 0L + member x.IsFixed = (flags &&& 0b01000000000000000000L) <> 0L - member x.WithIsFixed = ValFlags(flags ||| 0b1000000000000000000L) + member x.WithIsFixed = ValFlags(flags ||| 0b01000000000000000000L) + + member x.IgnoresByrefScope = (flags &&& 0b10000000000000000000L) <> 0L + + member x.WithIgnoresByrefScope = ValFlags(flags ||| 0b10000000000000000000L) /// Get the flags as included in the F# binary metadata member x.PickledBits = @@ -250,7 +254,7 @@ type ValFlags(flags: int64) = // Clear the IsCompiledAsStaticPropertyWithoutField, only used to determine whether to use a true field for a value, and to eliminate the optimization info for observable bindings // Clear the HasBeenReferenced, only used to report "unreferenced variable" warnings and to help collect 'it' values in FSI.EXE // Clear the IsGeneratedEventVal, since there's no use in propagating specialname information for generated add/remove event vals - (flags &&& ~~~0b0011001100000000000L) + (flags &&& ~~~0b10011001100000000000L) /// Represents the kind of a type parameter [] @@ -423,9 +427,9 @@ type EntityFlags(flags: int64) = /// These two bits represents the on-demand analysis about whether the entity has the IsByRefLike attribute member x.TryIsByRefLike = (flags &&& 0b000000011000000L) |> function - | 0b000000011000000L -> Some true - | 0b000000010000000L -> Some false - | _ -> None + | 0b000000011000000L -> ValueSome true + | 0b000000010000000L -> ValueSome false + | _ -> ValueNone /// Adjust the on-demand analysis about whether the entity has the IsByRefLike attribute member x.WithIsByRefLike flag = @@ -436,14 +440,14 @@ type EntityFlags(flags: int64) = | false -> 0b000000010000000L) EntityFlags flags - /// These two bits represents the on-demand analysis about whether the entity has the IsReadOnly attribute or is otherwise determined to be a readonly struct + /// These two bits represents the on-demand analysis about whether the entity has the IsReadOnly attribute member x.TryIsReadOnly = (flags &&& 0b000001100000000L) |> function - | 0b000001100000000L -> Some true - | 0b000001000000000L -> Some false - | _ -> None + | 0b000001100000000L -> ValueSome true + | 0b000001000000000L -> ValueSome false + | _ -> ValueNone - /// Adjust the on-demand analysis about whether the entity has the IsReadOnly attribute or is otherwise determined to be a readonly struct + /// Adjust the on-demand analysis about whether the entity has the IsReadOnly attribute member x.WithIsReadOnly flag = let flags = (flags &&& ~~~0b000001100000000L) ||| @@ -452,8 +456,24 @@ type EntityFlags(flags: int64) = | false -> 0b000001000000000L) EntityFlags flags + /// These two bits represents the on-demand analysis about whether the entity is assumed to be a readonly struct + member x.TryIsAssumedReadOnly = (flags &&& 0b000110000000000L) + |> function + | 0b000110000000000L -> ValueSome true + | 0b000100000000000L -> ValueSome false + | _ -> ValueNone + + /// Adjust the on-demand analysis about whether the entity is assumed to be a readonly struct + member x.WithIsAssumedReadOnly flag = + let flags = + (flags &&& ~~~0b000110000000000L) ||| + (match flag with + | true -> 0b000110000000000L + | false -> 0b000100000000000L) + EntityFlags flags + /// Get the flags as included in the F# binary metadata - member x.PickledBits = (flags &&& ~~~0b000001111000100L) + member x.PickledBits = (flags &&& ~~~0b000111111000100L) #if DEBUG @@ -1065,12 +1085,18 @@ and /// Represents a type definition, exception definition, module definition or /// Set the on-demand analysis about whether the entity has the IsByRefLike attribute member x.SetIsByRefLike b = x.entity_flags <- x.entity_flags.WithIsByRefLike b - /// These two bits represents the on-demand analysis about whether the entity has the IsReadOnly attribute or is otherwise determined to be a readonly struct + /// These two bits represents the on-demand analysis about whether the entity has the IsReadOnly attribute member x.TryIsReadOnly = x.entity_flags.TryIsReadOnly - /// Set the on-demand analysis about whether the entity has the IsReadOnly attribute or is otherwise determined to be a readonly struct + /// Set the on-demand analysis about whether the entity has the IsReadOnly attribute member x.SetIsReadOnly b = x.entity_flags <- x.entity_flags.WithIsReadOnly b + /// These two bits represents the on-demand analysis about whether the entity is assumed to be a readonly struct + member x.TryIsAssumedReadOnly = x.entity_flags.TryIsAssumedReadOnly + + /// Set the on-demand analysis about whether the entity is assumed to be a readonly struct + member x.SetIsAssumedReadOnly b = x.entity_flags <- x.entity_flags.WithIsAssumedReadOnly b + /// Indicates if this is an F# type definition whose r.h.s. is known to be some kind of F# object model definition member x.IsFSharpObjectModelTycon = match x.TypeReprInfo with | TFSharpObjectRepr _ -> true | _ -> false @@ -2725,6 +2751,9 @@ and [] /// Indicates if the value is pinned/fixed member x.IsFixed = x.val_flags.IsFixed + /// Indicates if the value will ignore byref scoping rules + member x.IgnoresByrefScope = x.val_flags.IgnoresByrefScope + /// Indicates if this value allows the use of an explicit type instantiation (i.e. does it itself have explicit type arguments, /// or does it have a signature?) member x.PermitsExplicitTypeInstantiation = x.val_flags.PermitsExplicitTypeInstantiation @@ -2948,6 +2977,8 @@ and [] member x.SetIsFixed() = x.val_flags <- x.val_flags.WithIsFixed + member x.SetIgnoresByrefScope() = x.val_flags <- x.val_flags.WithIgnoresByrefScope + member x.SetValReprInfo info = match x.val_opt_data with | Some optData -> optData.val_repr_info <- info @@ -3551,12 +3582,18 @@ and /// Set the on-demand analysis about whether the entity has the IsByRefLike attribute member x.SetIsByRefLike b = x.Deref.SetIsByRefLike b - /// The on-demand analysis about whether the entity has the IsByRefLike attribute + /// The on-demand analysis about whether the entity has the IsReadOnly attribute member x.TryIsReadOnly = x.Deref.TryIsReadOnly - /// Set the on-demand analysis about whether the entity has the IsReadOnly attribute or is otherwise determined to be a readonly struct + /// Set the on-demand analysis about whether the entity has the IsReadOnly attribute member x.SetIsReadOnly b = x.Deref.SetIsReadOnly b + /// The on-demand analysis about whether the entity is assumed to be a readonly struct + member x.TryIsAssumedReadOnly = x.Deref.TryIsAssumedReadOnly + + /// Set the on-demand analysis about whether the entity is assumed to be a readonly struct + member x.SetIsAssumedReadOnly b = x.Deref.SetIsAssumedReadOnly b + /// Indicates if this is an F# type definition whose r.h.s. definition is unknown (i.e. a traditional ML 'abstract' type in a signature, /// which in F# is called a 'unknown representation' type). member x.IsHiddenReprTycon = x.Deref.IsHiddenReprTycon diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index 89bc15f5f2..61058df1e5 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -108,11 +108,11 @@ let main argv = 0""" ProjectId = None SourceFiles = [|"test.fs"|] #if !NETCOREAPP - OtherOptions = [|"--preferreduilang:en-US";|] + OtherOptions = [|"--preferreduilang:en-US";"--warn:5"|] #else OtherOptions = let assemblies = getNetCoreAppReferences |> Array.map (fun x -> sprintf "-r:%s" x) - Array.append [|"--preferreduilang:en-US"; "--targetprofile:netcore"; "--noframework"|] assemblies + Array.append [|"--preferreduilang:en-US"; "--targetprofile:netcore"; "--noframework";"--warn:5"|] assemblies #endif ReferencedProjects = [||] IsIncompleteTypeCheckEnvironment = false diff --git a/tests/fsharp/Compiler/Language/ByrefTests.fs b/tests/fsharp/Compiler/Language/ByrefTests.fs new file mode 100644 index 0000000000..2797125d79 --- /dev/null +++ b/tests/fsharp/Compiler/Language/ByrefTests.fs @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ByrefTests = + + [] + let ``No defensive copy on .NET struct`` () = + CompilerAssert.Pass + """ +open System +open System.Runtime.CompilerServices + +let f (x: DateTime) = x.ToLocalTime() +let f2 () = + let x = DateTime.Now + x.ToLocalTime() + +[] +type Extensions = + + [] + static member Test(x: inref) = &x + + [] + static member Test2(x: byref) = &x + +let test (x: inref) = + x.Test() + +let test2 (x: byref) = + x.Test2() + +let test3 (x: byref) = + x.Test() + +let test4 () = + DateTime.Now.Test() + +let test5 (x: inref) = + &x.Test() + +let test6 () = + DateTime.Now.Test().Test().Test() + """ + + [] + let ``Extension method scope errors`` () = + CompilerAssert.TypeCheckWithErrors + """ +open System +open System.Runtime.CompilerServices + +[] +type Extensions = + + [] + static member Test(x: inref) = &x + +let f1 () = + &DateTime.Now.Test() + +let f2 () = + let result = + let dt = DateTime.Now + &dt.Test() + result + +let f3 () = + Extensions.Test(let dt = DateTime.Now in &dt) + +let f4 () = + let dt = DateTime.Now + &Extensions.Test(&dt) + +let f5 () = + &Extensions.Test(let dt = DateTime.Now in &dt) + """ + [| + ( + FSharpErrorSeverity.Error, + 3228, + (12, 6, 12, 25), + "The address of a value returned from the expression cannot be used at this point. This is to ensure the address of the local value does not escape its scope." + ) + ( + FSharpErrorSeverity.Error, + 3228, + (17, 10, 17, 19), + "The address of a value returned from the expression cannot be used at this point. This is to ensure the address of the local value does not escape its scope." + ) + ( + FSharpErrorSeverity.Error, + 3228, + (21, 5, 21, 50), + "The address of a value returned from the expression cannot be used at this point. This is to ensure the address of the local value does not escape its scope." + ) + ( + FSharpErrorSeverity.Error, + 3228, + (25, 6, 25, 26), + "The address of a value returned from the expression cannot be used at this point. This is to ensure the address of the local value does not escape its scope." + ) + ( + FSharpErrorSeverity.Error, + 3228, + (28, 6, 28, 51), + "The address of a value returned from the expression cannot be used at this point. This is to ensure the address of the local value does not escape its scope." + ) + |] + +// TODO: A better way to test the ones below are to use a custom struct in C# code that contains explicit use of their "readonly" keyword. +#if NETCOREAPP + // NETCORE makes DateTime a readonly struct; therefore, it should not error. + [] + let ``No defensive copy on .NET struct - netcore`` () = + CompilerAssert.Pass + """ +open System +let f (x: inref) = x.ToLocalTime() +let f2 () = + let x = DateTime.Now + let y = &x + y.ToLocalTime() +let f3 (x: inref) = &x +let f4 (x: inref) = + (f3 &x).ToLocalTime() + +open System.Runtime.CompilerServices +[] +type Extensions = + + [] + static member Test(x: inref) = &x + +let test1 () = + DateTime.Now.Test().Date + +let test2 () = + DateTime.Now.Test().Test().Date.Test().Test().Date.Test() + """ +#else + // Note: Currently this is assuming NET472. That may change which might break these tests. Consider using custom C# code. + [] + let ``Defensive copy on .NET struct for inref`` () = + CompilerAssert.TypeCheckWithErrors + """ +open System +let f (x: inref) = x.ToLocalTime() +let f2 () = + let x = DateTime.Now + let y = &x + y.ToLocalTime() +let f3 (x: inref) = &x +let f4 (x: inref) = + (f3 &x).ToLocalTime() + +open System.Runtime.CompilerServices +[] +type Extensions = + + [] + static member Test(x: inref) = &x + +let test1 () = + DateTime.Now.Test().Date + """ + [| + ( + FSharpErrorSeverity.Warning, + 52, + (3, 30, 3, 45), + "The value has been copied to ensure the original is not mutated by this operation or because the copy is implicit when returning a struct from a member and another member is then accessed" + ) + ( + FSharpErrorSeverity.Warning, + 52, + (7, 5, 7, 20), + "The value has been copied to ensure the original is not mutated by this operation or because the copy is implicit when returning a struct from a member and another member is then accessed" + ) + ( + FSharpErrorSeverity.Warning, + 52, + (10, 5, 10, 26), + "The value has been copied to ensure the original is not mutated by this operation or because the copy is implicit when returning a struct from a member and another member is then accessed" + ) + ( + FSharpErrorSeverity.Warning, + 52, + (20, 5, 20, 29), + "The value has been copied to ensure the original is not mutated by this operation or because the copy is implicit when returning a struct from a member and another member is then accessed" + ) + |] +#endif \ No newline at end of file diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 1278cbe0be..79adf613e0 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -51,6 +51,7 @@ + diff --git a/tests/fsharp/core/fsfromfsviacs/lib2.cs b/tests/fsharp/core/fsfromfsviacs/lib2.cs index eb6d6acc14..449f926d7f 100644 --- a/tests/fsharp/core/fsfromfsviacs/lib2.cs +++ b/tests/fsharp/core/fsfromfsviacs/lib2.cs @@ -124,4 +124,17 @@ public class ApiWrapper public static Func f4 = new Func((int arg1, string arg2, byte arg3, sbyte arg4) => arg1 + arg2.Length + 1 + arg3 + arg4); public static Func f5 = new Func((int arg1, string arg2, byte arg3, sbyte arg4, Int16 arg5) => arg1 + arg2.Length + 1 + arg3 + arg4 + arg5); } +} + +namespace StructTests +{ + public struct NonReadOnlyStruct + { + public int X { get; set; } + + public void M(int x) + { + X = x; + } + } } \ No newline at end of file diff --git a/tests/fsharp/core/fsfromfsviacs/test.fsx b/tests/fsharp/core/fsfromfsviacs/test.fsx index 072a896c1e..47e2e35976 100644 --- a/tests/fsharp/core/fsfromfsviacs/test.fsx +++ b/tests/fsharp/core/fsfromfsviacs/test.fsx @@ -210,6 +210,75 @@ let ToFSharpFunc() = test "vkejhwew904" (FuncConvert.FromFunc(FSharpFuncTests.ApiWrapper.f4)(3)("a")(6uy)(7y) = FSharpFuncTests.ApiWrapper.f4.Invoke(3, "a", 6uy, 7y)) test "vkejhwew905" (FuncConvert.FromFunc(FSharpFuncTests.ApiWrapper.f5)(3)("a")(6uy)(7y)(7s) = FSharpFuncTests.ApiWrapper.f5.Invoke(3, "a", 6uy, 7y, 7s)) +module TestStructs = + open StructTests + + let someFunc (s: NonReadOnlyStruct) = + s.M(456) + s.X + + let someByrefFunc (s: byref) = + s.M(456) + s.X + + let someInrefFunc (s: inref) = + s.M(456) + s.X + + let someFuncReturn (s: NonReadOnlyStruct) = + s.X + + let someInrefFuncReturn (s: inref) = + s.X + + let test1 () = + let s = NonReadOnlyStruct() + check "hdlcjiklhen1" s.X 0 + s.M(123) + check "hdlcjiklhen2" s.X 123 + check "hdlcjiklhen3" (someFunc s) 456 + check "hdlcjiklhen4" s.X 123 + + + let test2 () = + let mutable s = NonReadOnlyStruct() + check "hdlcjiklhen5" s.X 0 + s.M(123) + check "hdlcjiklhen6" s.X 123 + check "hdlcjiklhen7" (someByrefFunc &s) 456 + check "hdlcjiklhen8" s.X 456 + + + let test3 () = + let s = NonReadOnlyStruct() + check "hdlcjiklhen9" s.X 0 + s.M(123) + check "hdlcjiklhen10" s.X 123 + check "hdlcjiklhen11" (someInrefFunc &s) 123 + check "hdlcjiklhen12" s.X 123 + + let test4 () = + let s = NonReadOnlyStruct() + check "hdlcjiklhen13" s.X 0 + s.M(123) + check "hdlcjiklhen14" s.X 123 + check "hdlcjiklhen15" (someFuncReturn s) 0 // Technically a bug today, but test is to verify current behavior. + check "hdlcjiklhen16" s.X 123 + + let test5 () = + let s = NonReadOnlyStruct() + check "hdlcjiklhen17" s.X 0 + s.M(123) + check "hdlcjiklhen18" s.X 123 + check "hdlcjiklhen19" (someInrefFuncReturn &s) 123 + check "hdlcjiklhen20" s.X 123 + +TestStructs.test1 () +TestStructs.test2 () +TestStructs.test3 () +TestStructs.test4 () +TestStructs.test5 () + #endif #if TESTS_AS_APP From 9f51ac5290b1dfc5dc434841d61b2ac31997ea8c Mon Sep 17 00:00:00 2001 From: Will Smith Date: Tue, 20 Aug 2019 22:39:01 -0700 Subject: [PATCH 219/286] Opt out of PLM (partial load mode) (#7432) --- vsintegration/Vsix/RegisterFsharpPackage.pkgdef | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vsintegration/Vsix/RegisterFsharpPackage.pkgdef b/vsintegration/Vsix/RegisterFsharpPackage.pkgdef index cc6731507e..b0b49ad4ef 100644 --- a/vsintegration/Vsix/RegisterFsharpPackage.pkgdef +++ b/vsintegration/Vsix/RegisterFsharpPackage.pkgdef @@ -7,6 +7,9 @@ "Name"="F#" @="{871d2a70-12a2-4e42-9440-425dd92a4116}" +[$RootKey$\Editors\{8a5aa6cf-46e3-4520-a70a-7393d15233e9}] +"DeferUntilIntellisenseIsReady"=dword:00000000 + [$RootKey$\Editors\{8a5aa6cf-46e3-4520-a70a-7393d15233e9}\LogicalViews] "{7651a700-06e5-11d1-8ebd-00a0c90f26ea}"="" "{7651a701-06e5-11d1-8ebd-00a0c90f26ea}"="" From dc8bc8d71df2789168d4a75e7160b574339125e7 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Thu, 22 Aug 2019 13:23:33 -0700 Subject: [PATCH 220/286] Enums are always read-only (#7434) * Enums are always read-only * Minor cleanup --- src/fsharp/TastOps.fs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/fsharp/TastOps.fs b/src/fsharp/TastOps.fs index 55576c88d4..91a63819da 100644 --- a/src/fsharp/TastOps.fs +++ b/src/fsharp/TastOps.fs @@ -5951,12 +5951,15 @@ let isRecdOrStructTyconRefAssumedImmutable (g: TcGlobals) (tcref: TyconRef) = let isTyconRefReadOnly g m (tcref: TyconRef) = tcref.CanDeref && - match tcref.TryIsReadOnly with - | ValueSome res -> res - | _ -> - let res = TyconRefHasAttribute g m g.attrib_IsReadOnlyAttribute tcref - tcref.SetIsReadOnly res - res + if + match tcref.TryIsReadOnly with + | ValueSome res -> res + | _ -> + let res = TyconRefHasAttribute g m g.attrib_IsReadOnlyAttribute tcref + tcref.SetIsReadOnly res + res + then true + else tcref.IsEnumTycon let isTyconRefAssumedReadOnly g (tcref: TyconRef) = tcref.CanDeref && From 9a9aead747e4b822eb2edb1b21a7a6f8ea060f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbyn=C4=9Bk=20Sailer=20=28Moravia=20IT=29?= Date: Thu, 29 Aug 2019 13:43:48 +0200 Subject: [PATCH 221/286] LOC CHECKIN | dotnet/fsharp release/dev16.3 | 20190829 --- .../FSharp.Build/xlf/FSBuild.txt.ja.xlf | 2 +- src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf | 2 +- src/fsharp/FSharp.Core/xlf/FSCore.de.xlf | 2 +- src/fsharp/FSharp.Core/xlf/FSCore.es.xlf | 2 +- src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf | 2 +- src/fsharp/FSharp.Core/xlf/FSCore.it.xlf | 2 +- src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf | 2 +- src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf | 2 +- src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf | 2 +- src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf | 2 +- src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf | 2 +- src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf | 2 +- src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf | 2 +- src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf | 4 +- src/fsharp/fsi/xlf/FSIstrings.txt.de.xlf | 12 ++--- src/fsharp/fsi/xlf/FSIstrings.txt.ja.xlf | 2 +- src/fsharp/fsi/xlf/FSIstrings.txt.zh-Hant.xlf | 12 ++--- src/fsharp/xlf/FSComp.txt.cs.xlf | 18 +++---- src/fsharp/xlf/FSComp.txt.de.xlf | 50 +++++++++---------- src/fsharp/xlf/FSComp.txt.es.xlf | 22 ++++---- src/fsharp/xlf/FSComp.txt.fr.xlf | 18 +++---- src/fsharp/xlf/FSComp.txt.it.xlf | 28 +++++------ src/fsharp/xlf/FSComp.txt.ja.xlf | 32 ++++++------ src/fsharp/xlf/FSComp.txt.ko.xlf | 16 +++--- src/fsharp/xlf/FSComp.txt.pl.xlf | 16 +++--- src/fsharp/xlf/FSComp.txt.pt-BR.xlf | 18 +++---- src/fsharp/xlf/FSComp.txt.ru.xlf | 16 +++--- src/fsharp/xlf/FSComp.txt.tr.xlf | 16 +++--- src/fsharp/xlf/FSComp.txt.zh-Hans.xlf | 16 +++--- src/fsharp/xlf/FSComp.txt.zh-Hant.xlf | 16 +++--- src/fsharp/xlf/FSStrings.de.xlf | 14 +++--- src/fsharp/xlf/FSStrings.es.xlf | 2 +- src/fsharp/xlf/FSStrings.it.xlf | 2 +- .../Template/xlf/AssemblyInfo.fs.de.xlf | 6 +-- .../Template/xlf/Program.fs.cs.xlf | 2 +- .../Template/xlf/Program.fs.de.xlf | 2 +- .../Template/xlf/Program.fs.es.xlf | 2 +- .../Template/xlf/Program.fs.fr.xlf | 2 +- .../Template/xlf/Program.fs.it.xlf | 2 +- .../Template/xlf/Program.fs.ja.xlf | 2 +- .../Template/xlf/Program.fs.ko.xlf | 2 +- .../Template/xlf/Program.fs.pl.xlf | 2 +- .../Template/xlf/Program.fs.pt-BR.xlf | 2 +- .../Template/xlf/Program.fs.ru.xlf | 2 +- .../Template/xlf/Program.fs.tr.xlf | 2 +- .../Template/xlf/Program.fs.zh-Hans.xlf | 2 +- .../Template/xlf/Program.fs.zh-Hant.xlf | 2 +- .../Template/xlf/AssemblyInfo.fs.de.xlf | 6 +-- .../Template/xlf/Script.fsx.cs.xlf | 2 +- .../Template/xlf/Script.fsx.de.xlf | 2 +- .../Template/xlf/Script.fsx.es.xlf | 2 +- .../Template/xlf/Script.fsx.fr.xlf | 2 +- .../Template/xlf/Script.fsx.it.xlf | 2 +- .../Template/xlf/Script.fsx.ja.xlf | 2 +- .../Template/xlf/Script.fsx.ko.xlf | 2 +- .../Template/xlf/Script.fsx.pl.xlf | 2 +- .../Template/xlf/Script.fsx.pt-BR.xlf | 2 +- .../Template/xlf/Script.fsx.ru.xlf | 2 +- .../Template/xlf/Script.fsx.tr.xlf | 2 +- .../Template/xlf/Script.fsx.zh-Hans.xlf | 2 +- .../Template/xlf/Script.fsx.zh-Hant.xlf | 2 +- .../Template/xlf/Tutorial.fsx.de.xlf | 20 ++++---- .../Template/xlf/Tutorial.fsx.ja.xlf | 2 +- .../Template/xlf/Tutorial.fsx.zh-Hant.xlf | 2 +- .../xlf/FSLangSvcStrings.de.xlf | 6 +-- .../xlf/FSLangSvcStrings.ja.xlf | 2 +- .../xlf/VSPackage.de.xlf | 6 +-- .../xlf/VSPackage.it.xlf | 4 +- .../xlf/VSPackage.pt-BR.xlf | 2 +- ...rosoft.VisualStudio.Package.Project.de.xlf | 20 ++++---- ...rosoft.VisualStudio.Package.Project.es.xlf | 6 +-- ...rosoft.VisualStudio.Package.Project.it.xlf | 4 +- ...rosoft.VisualStudio.Package.Project.pl.xlf | 6 +-- ...oft.VisualStudio.Package.Project.pt-BR.xlf | 2 +- ...t.VisualStudio.Package.Project.zh-Hant.xlf | 2 +- .../xlf/MenusAndCommands.vsct.zh-Hant.xlf | 10 ++-- .../xlf/VSPackage.cs.xlf | 2 +- .../xlf/VSPackage.ja.xlf | 4 +- .../xlf/VSPackage.pl.xlf | 2 +- .../xlf/VSPackage.pt-BR.xlf | 12 ++--- .../xlf/VSPackage.zh-Hant.xlf | 6 +-- .../xlf/ApplicationPropPage.de.xlf | 2 +- ...osoft.VisualStudio.Editors.Designer.cs.xlf | 5 +- ...osoft.VisualStudio.Editors.Designer.de.xlf | 9 ++-- ...osoft.VisualStudio.Editors.Designer.es.xlf | 9 ++-- ...osoft.VisualStudio.Editors.Designer.fr.xlf | 5 +- ...osoft.VisualStudio.Editors.Designer.it.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.ja.xlf | 5 +- ...osoft.VisualStudio.Editors.Designer.ko.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.pl.xlf | 5 +- ...ft.VisualStudio.Editors.Designer.pt-BR.xlf | 9 ++-- ...osoft.VisualStudio.Editors.Designer.ru.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.tr.xlf | 3 +- ....VisualStudio.Editors.Designer.zh-Hans.xlf | 3 +- ....VisualStudio.Editors.Designer.zh-Hant.xlf | 3 +- .../Resources/xlf/WCF.de.xlf | 4 +- .../Resources/xlf/WCF.ja.xlf | 2 +- .../src/FSharp.VS.FSI/xlf/Properties.de.xlf | 2 +- .../FSharp.VS.FSI/xlf/Properties.pt-BR.xlf | 8 +-- .../FSharp.VS.FSI/xlf/Properties.zh-Hant.xlf | 6 +-- .../xlf/VFSIstrings.txt.pt-BR.xlf | 2 +- .../xlf/VFSIstrings.txt.zh-Hant.xlf | 4 +- 102 files changed, 310 insertions(+), 325 deletions(-) diff --git a/src/fsharp/FSharp.Build/xlf/FSBuild.txt.ja.xlf b/src/fsharp/FSharp.Build/xlf/FSBuild.txt.ja.xlf index 2cbcdb1927..558d9a4705 100644 --- a/src/fsharp/FSharp.Build/xlf/FSBuild.txt.ja.xlf +++ b/src/fsharp/FSharp.Build/xlf/FSBuild.txt.ja.xlf @@ -4,7 +4,7 @@ {0} for F# {1} - F# {1} の {0} + F# {1} のための {0} diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf index e1e2a27ab6..c1837555d3 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.cs.xlf @@ -709,7 +709,7 @@ maxDegreeOfParallelism must be positive, was {0} - maxDegreeOfParallelism must be positive, was {0} + Hodnota maxDegreeOfParallelism musí být kladná, ale vyskytla se hodnota {0}. diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.de.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.de.xlf index be95b723e6..bb113a5dd4 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.de.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.de.xlf @@ -709,7 +709,7 @@ maxDegreeOfParallelism must be positive, was {0} - maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism muss positiv sein, lautete jedoch "{0}". diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.es.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.es.xlf index ad05289fb6..da7f891936 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.es.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.es.xlf @@ -709,7 +709,7 @@ maxDegreeOfParallelism must be positive, was {0} - maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism debe ser positivo, era {0} diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf index 46f595fa21..7dc0ce7839 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.fr.xlf @@ -709,7 +709,7 @@ maxDegreeOfParallelism must be positive, was {0} - maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism doit être positif, était {0} diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.it.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.it.xlf index ea57def3be..170e1e51a8 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.it.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.it.xlf @@ -709,7 +709,7 @@ maxDegreeOfParallelism must be positive, was {0} - maxDegreeOfParallelism must be positive, was {0} + Il valore di maxDegreeOfParallelism deve essere positivo. È {0} diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf index a62609fafb..23b3da2999 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.ja.xlf @@ -709,7 +709,7 @@ maxDegreeOfParallelism must be positive, was {0} - maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism には正の値を指定する必要がありますが、{0} が指定されました diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf index 018fd4ac35..0b5c94149a 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.ko.xlf @@ -709,7 +709,7 @@ maxDegreeOfParallelism must be positive, was {0} - maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism은 양수여야 하는데 {0}였습니다. diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf index 67c614650b..2fdde8861c 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.pl.xlf @@ -709,7 +709,7 @@ maxDegreeOfParallelism must be positive, was {0} - maxDegreeOfParallelism must be positive, was {0} + Wartość maxDegreeOfParallelism musi być dodatnia, a była równa {0} diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf index 01192de362..78d9107a47 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.pt-BR.xlf @@ -709,7 +709,7 @@ maxDegreeOfParallelism must be positive, was {0} - maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism deve ser positivo, foi {0} diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf index 81aa2e8561..c45569be95 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.ru.xlf @@ -709,7 +709,7 @@ maxDegreeOfParallelism must be positive, was {0} - maxDegreeOfParallelism must be positive, was {0} + Параметр maxDegreeOfParallelism должен иметь положительное значение, указано значение {0} diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf index ab262b8e56..f168225ae6 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.tr.xlf @@ -709,7 +709,7 @@ maxDegreeOfParallelism must be positive, was {0} - maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism pozitif olmalıdır, değeri: {0} diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf index 58fcba36d9..4995ea3408 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hans.xlf @@ -709,7 +709,7 @@ maxDegreeOfParallelism must be positive, was {0} - maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism 必须是正数,它之前是 {0} diff --git a/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf b/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf index 7ebdf213bf..e89c723874 100644 --- a/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf +++ b/src/fsharp/FSharp.Core/xlf/FSCore.zh-Hant.xlf @@ -564,7 +564,7 @@ Bad integer supplied to dynamic formatter - 提供給動態格式子的整數錯誤 + 提供給動態格式器的整數錯誤 @@ -709,7 +709,7 @@ maxDegreeOfParallelism must be positive, was {0} - maxDegreeOfParallelism must be positive, was {0} + maxDegreeOfParallelism 必須為正數,原先為 {0} diff --git a/src/fsharp/fsi/xlf/FSIstrings.txt.de.xlf b/src/fsharp/fsi/xlf/FSIstrings.txt.de.xlf index 404171af9a..0e7145c703 100644 --- a/src/fsharp/fsi/xlf/FSIstrings.txt.de.xlf +++ b/src/fsharp/fsi/xlf/FSIstrings.txt.de.xlf @@ -14,27 +14,27 @@ - INPUT FILES - - - EINGABEDATEIEN - + – EINGABEDATEIEN – - CODE GENERATION - - - CODEGENERIERUNG - + – CODEGENERIERUNG – - ERRORS AND WARNINGS - - - FEHLER UND WARNUNGEN - + – FEHLER UND WARNUNGEN – - LANGUAGE - - - SPRACHE - + – SPRACHE – - MISCELLANEOUS - - - VERSCHIEDENES - + – VERSCHIEDENES – @@ -199,7 +199,7 @@ - Aborting main thread... - - Hauptthread wird abgebrochen... + – Hauptthread wird abgebrochen... diff --git a/src/fsharp/fsi/xlf/FSIstrings.txt.ja.xlf b/src/fsharp/fsi/xlf/FSIstrings.txt.ja.xlf index 0751b4601e..c70b2e1dd3 100644 --- a/src/fsharp/fsi/xlf/FSIstrings.txt.ja.xlf +++ b/src/fsharp/fsi/xlf/FSIstrings.txt.ja.xlf @@ -129,7 +129,7 @@ gen - gen + 全般 diff --git a/src/fsharp/fsi/xlf/FSIstrings.txt.zh-Hant.xlf b/src/fsharp/fsi/xlf/FSIstrings.txt.zh-Hant.xlf index 295ea67495..4ba5fc71b7 100644 --- a/src/fsharp/fsi/xlf/FSIstrings.txt.zh-Hant.xlf +++ b/src/fsharp/fsi/xlf/FSIstrings.txt.zh-Hant.xlf @@ -74,7 +74,7 @@ Execute interactions on a Windows Forms event loop (on by default) - 在 Windows Form 事件迴圈上執行互動 (預設為開啟) + 在 Windows Forms 事件迴圈上執行互動 (預設為開啟) @@ -99,7 +99,7 @@ A problem occurred starting the F# Interactive process. This may be due to a known problem with background process console support for Unicode-enabled applications on some Windows systems. Try selecting Tools->Options->F# Interactive for Visual Studio and enter '--fsi-server-no-unicode'. - 啟動 F# Interactive 處理序時發生問題。這可能是因為背景處理序主控台對於支援某些 Windows 系統上具備 Unicode 支援功能之應用程式的已知問題所造成。請嘗試選取 [工具]5D; -> [選項]5D; -> [F# Interactive for Visual Studio]5D;,然後輸入 '--fsi-server-no-unicode'。 + 啟動 F# 互動處理序時發生問題。這可能是因為背景處理序主控台對於支援某些 Windows 系統上具備 Unicode 支援功能之應用程式的已知問題所造成。請嘗試選取 [工具] -> [選項] -> [F# Interactive for Visual Studio],然後輸入 '--fsi-server-no-unicode'。 @@ -139,7 +139,7 @@ F# Interactive directives: - F# Interactive 指示詞: + F# 互動指示詞: @@ -174,7 +174,7 @@ F# Interactive command line options: - F# Interactive 命令列選項: + F# 互動命令列選項: @@ -214,7 +214,7 @@ --> Referenced '{0}' (file may be locked by F# Interactive process) - --> 參考的 '{0}' (檔案可能已被 F# Interactive 處理序鎖定) + --> 參考的 '{0}' (檔案可能已被 F# 互動處理序鎖定) @@ -264,7 +264,7 @@ Prevents references from being locked by the F# Interactive process - 避免參考遭 F# 互動式處理序封鎖 + 避免參考遭 F# 互動處理序封鎖 diff --git a/src/fsharp/xlf/FSComp.txt.cs.xlf b/src/fsharp/xlf/FSComp.txt.cs.xlf index de68f97439..38bdcc4cfb 100644 --- a/src/fsharp/xlf/FSComp.txt.cs.xlf +++ b/src/fsharp/xlf/FSComp.txt.cs.xlf @@ -9,32 +9,32 @@ Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Zobrazte si povolené hodnoty verze jazyka a pak zadejte požadovanou verzi, například latest nebo preview. Supported language versions: - Supported language versions: + Podporované jazykové verze: Unrecognized value '{0}' for --langversion use --langversion:? for complete list - Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Nerozpoznaná hodnota {0} pro parametr --langversion; seznam možností zobrazíte zadáním --langversion:? Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. - Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Neočekávaný symbol . v definici členu. Očekávalo se with, = nebo jiný token. Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) - Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Zadejte algoritmus pro výpočet kontrolního součtu zdrojového souboru uloženého v PDB. Podporované hodnoty jsou: SHA1 nebo SHA256 (výchozí). Algorithm '{0}' is not supported - Algorithm '{0}' is not supported + Algoritmus {0} není podporovaný. @@ -2034,7 +2034,7 @@ Type annotations on property getters and setters must be given after the 'get()' or 'set(v)', e.g. 'with get() : string = ...' - Poznámky typu u metod getter nebo setter vlastnosti se musí předávat až po get() nebo set(v). Příklad: with get() : string = + Poznámky typu u metod getter nebo setter vlastnosti se musí předávat až po get() nebo set(v). Příklad: with get() : string = ... @@ -7194,12 +7194,12 @@ Expression does not have a name. - Expression does not have a name. + Výraz není pojmenovaný. Using the 'nameof' operator as a first-class function value is not permitted. - Using the 'nameof' operator as a first-class function value is not permitted. + Použití operátoru nameof jako hodnoty funkce první třídy není povolené. diff --git a/src/fsharp/xlf/FSComp.txt.de.xlf b/src/fsharp/xlf/FSComp.txt.de.xlf index d81bf821cf..75d2d85f19 100644 --- a/src/fsharp/xlf/FSComp.txt.de.xlf +++ b/src/fsharp/xlf/FSComp.txt.de.xlf @@ -9,32 +9,32 @@ Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Zeigen Sie die zulässigen Werte für die Sprachversion an. Geben Sie die Sprachversion als "latest" oder "preview" an. Supported language versions: - Supported language versions: + Unterstützte Sprachversionen: Unrecognized value '{0}' for --langversion use --langversion:? for complete list - Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Unbekannter Wert "{0}" für "--langversion". Verwenden Sie "--langversion:?", um die vollständige Liste anzuzeigen. Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. - Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Unerwartetes Symbol "." in der Memberdefinition. Erwartet wurde "with", "=" oder ein anderes Token. Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) - Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Geben Sie einen Algorithmus für die Berechnung der Quelldateiprüfsumme an, welcher in PDB gespeichert ist. Unterstützte Werte sind: SHA1 oder SHA256 (Standard) Algorithm '{0}' is not supported - Algorithm '{0}' is not supported + Algorithmus "{0}" wird nicht unterstützt @@ -339,7 +339,7 @@ Invalid directive. Expected '#time', '#time \"on\"' or '#time \"off\"'. - Ungültige Direktive. Erwartet wurde "#time", "#time \"on\"" oder '#time \"off\"". + Ungültige Direktive. Erwartet wurde "#time", '#time \"on\"' oder '#time \"off\"'. @@ -3964,7 +3964,7 @@ This definition may only be used in a type with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'. - Diese Definition kann nur in einem Typ mit einem primären Konstruktor verwendet werden. Ziehen Sie in Betracht, Argumente zur Typdefinition hinzuzufügen, z. B. "type X(args) = ...". + Diese Definition kann nur in einem Typ mit einem primären Konstruktor verwendet werden. Ziehen Sie in Betracht, Argumente zur Typdefinition hinzuzufügen, z.B. "type X(args) = ...". @@ -4419,7 +4419,7 @@ - INPUT FILES - - - EINGABEDATEIEN - + – EINGABEDATEIEN – @@ -4429,7 +4429,7 @@ - CODE GENERATION - - - CODEGENERIERUNG - + - CODE GENERATION - @@ -4439,17 +4439,17 @@ - MISCELLANEOUS - - - VERSCHIEDENES - + – VERSCHIEDENES – - LANGUAGE - - - SPRACHE - + – SPRACHE – - ERRORS AND WARNINGS - - - FEHLER UND WARNUNGEN - + – FEHLER UND WARNUNGEN – @@ -4974,7 +4974,7 @@ This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0b0001 (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger). - Dies ist kein gültiges numerisches Literal. Die folgenden numerischen Literale sind z. B. gültig: 1, 0x1, 0b0001 (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger). + Dies ist kein gültiges numerisches Literal. Die folgenden numerischen Literale sind z.B. gültig: 1, 0x1, 0b0001 (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger). @@ -5159,12 +5159,12 @@ Remove spaces between the type name and type parameter, e.g. \"type C<'T>\", not type \"C <'T>\". Type parameters must be placed directly adjacent to the type name. - Entfernen Sie die Leerzeichen zwischen dem Typnamen und dem Typparameter, z. B. "\"type C<'T>\"", statt "type \"C <'T>\"". Typparameter müssen direkt an den Typnamen angeschlossen werden. + Entfernen Sie die Leerzeichen zwischen dem Typnamen und dem Typparameter, z.B. "\"type C<'T>\"", statt "type \"C <'T>\"". Typparameter müssen direkt an den Typnamen angeschlossen werden. Remove spaces between the type name and type parameter, e.g. \"C<'T>\", not \"C <'T>\". Type parameters must be placed directly adjacent to the type name. - Entfernen Sie die Leerzeichen zwischen dem Typnamen und Typparameter, z. B. "\"C<'T>\"" statt "\"C <'T>\"". Typparameter müssen direkt an den Typnamen angeschlossen werden. + Entfernen Sie die Leerzeichen zwischen dem Typnamen und Typparameter, z.B. "\"C<'T>\"" statt "\"C <'T>\"". Typparameter müssen direkt an den Typnamen angeschlossen werden. @@ -5569,7 +5569,7 @@ Static linking may not be used on an assembly referencing mscorlib (e.g. a .NET Framework assembly) when generating an assembly that references System.Runtime (e.g. a .NET Core or Portable assembly). - Statische Verknüpfungen dürfen beim Generieren einer Assembly mit Verweis auf System.Runtime (z. B. eine .NET Core- oder eine portierbare Assembly) nicht für eine Assembly verwendet werden, die auf mscorlib verweist (z. B. eine .NET Framework-Assembly). + Statische Verknüpfungen dürfen beim Generieren einer Assembly mit Verweis auf System.Runtime (z.B. eine .NET Core- oder eine portierbare Assembly) nicht für eine Assembly verwendet werden, die auf mscorlib verweist (z.B. eine .NET Framework-Assembly). @@ -5579,7 +5579,7 @@ Deterministic builds only support portable PDBs (--debug:portable or --debug:embedded) - Deterministische Builds unterstützen nur portable PDB-Dateien (--debug:portable oder --debug:embedded) + Deterministische Builds unterstützen nur portierbare PDBs ("--debug:portable" oder "--debug:embedded"). @@ -6154,7 +6154,7 @@ 'member val' definitions are only permitted in types with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'. - 'member val'-Definitionen sind nur in Typen mit einem primären Konstruktor zulässig. Möglicherweise sollten Sie Ihrer Typdefinition Argumente hinzufügen, z. B. 'type X(args) = ...'. + 'member val'-Definitionen sind nur in Typen mit einem primären Konstruktor zulässig. Möglicherweise sollten Sie Ihrer Typdefinition Argumente hinzufügen, z.B. 'type X(args) = ...'. @@ -6209,7 +6209,7 @@ 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. - Dies ist kein bekannter Abfrageoperator. Abfrageoperatoren sind Bezeichner wie z. B. 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' und 'averageBy', die mithilfe der entsprechenden Methoden für den Typ 'QueryBuilder' definiert werden. + Dies ist kein bekannter Abfrageoperator. Abfrageoperatoren sind Bezeichner wie z.B. 'select', 'where', 'sortBy', 'thenBy', 'groupBy', 'groupValBy', 'join', 'groupJoin', 'sumBy' und 'averageBy', die mithilfe der entsprechenden Methoden für den Typ 'QueryBuilder' definiert werden. @@ -6249,7 +6249,7 @@ Arguments to query operators may require parentheses, e.g. 'where (x > y)' or 'groupBy (x.Length / 10)' - Argumente für Abfrageoperatoren erfordern möglicherweise Klammern, z. B. "where (x > y)" oder "groupBy (x.Length / 10)". + Argumente für Abfrageoperatoren erfordern möglicherweise Klammern, z.B. "where (x > y)" oder "groupBy (x.Length / 10)". @@ -6834,7 +6834,7 @@ Used in query expressions to specify what fields or columns to extract. Note that this is a contextual keyword, which means that it is not actually a reserved word and it only acts like a keyword in appropriate context. - Wird in Abfrageausdrücken verwendet, um festzulegen, welche Felder oder Spalten extrahiert werden. Dies ist kontextabhängiges Schlüsselwort, d. h. es ist kein reserviertes Wort und funktioniert nur im entsprechenden Kontext als Schlüsselwort. + Wird in Abfrageausdrücken verwendet, um festzulegen, welche Felder oder Spalten extrahiert werden. Dies ist kontextabhängiges Schlüsselwort, d. h. es ist kein reserviertes Wort und funktioniert nur im entsprechenden Kontext als Schlüsselwort. @@ -7054,7 +7054,7 @@ A value defined in a module must be mutable in order to take its address, e.g. 'let mutable x = ...' - Ein in einem Modul definierter Wert muss änderbar sein, um die Adresse anzunehmen, z. B. "let mutable x = ...". + Ein in einem Modul definierter Wert muss änderbar sein, um die Adresse anzunehmen, z.B. "let mutable x = ...". @@ -7194,12 +7194,12 @@ Expression does not have a name. - Expression does not have a name. + Ausdruck hat keinen Namen. Using the 'nameof' operator as a first-class function value is not permitted. - Using the 'nameof' operator as a first-class function value is not permitted. + Die Verwendung des Operators "nameof" als erstklassiger Funktionswert ist nicht zulässig. diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index 72534507d4..4697a1a2b4 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -9,32 +9,32 @@ Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Mostrar los valores permitidos para la versión de idioma, especificar la versión de idioma como "latest" "preview" Supported language versions: - Supported language versions: + Versiones de lenguaje admitidas: Unrecognized value '{0}' for --langversion use --langversion:? for complete list - Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Valor no reconocido "{0}" para --langversion, use --langversion:? para una lista completa Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. - Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Símbolo inesperado "." en la definición de miembro. Se esperaba "with", "=" u otro token. Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) - Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Especifique el algoritmo para calcular la suma de comprobación del archivo de origen almacenada en PDB. Los valores admitidos son SHA1 o SHA256 (predeterminado) Algorithm '{0}' is not supported - Algorithm '{0}' is not supported + No se admite el algoritmo '{0}' @@ -144,7 +144,7 @@ All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. - All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. + Todas las ramas de una expresión de coincidencia de patrón deben devolver valores del mismo tipo. La primera rama devolvió un valor de tipo "{0}", pero esta rama devolvió un valor de tipo "\{1 \}". @@ -4959,7 +4959,7 @@ Invalid floating point number - número de punto flotante no válido. + Número de punto flotante no válido. @@ -5194,7 +5194,7 @@ The parameter '{0}' was inferred to have byref type. Parameters of byref type must be given an explicit type annotation, e.g. 'x1: byref<int>'. When used, a byref parameter is implicitly dereferenced. - Se infirió que el parámetro "{0}" tiene un tipo byref. Los parámetros de tipo byref deben recibir una anotación de tipo explícita, por ejemplo,"'x1: byref<int>". Cuando se usa, la referencia de un parámetro byref se elimina de forma implícita. + Se infirió que el parámetro "{0}" tiene un tipo byref. Los parámetros de tipo byref deben recibir una anotación de tipo explícita, por ejemplo,"x1: byref<int>". Cuando se usa, la referencia de un parámetro byref se elimina de forma implícita. @@ -7194,12 +7194,12 @@ Expression does not have a name. - Expression does not have a name. + La expresión no tiene un nombre. Using the 'nameof' operator as a first-class function value is not permitted. - Using the 'nameof' operator as a first-class function value is not permitted. + No se permite el uso del operador "nameof" como un valor de función de primera clase. diff --git a/src/fsharp/xlf/FSComp.txt.fr.xlf b/src/fsharp/xlf/FSComp.txt.fr.xlf index 454795901d..9c5026aa2b 100644 --- a/src/fsharp/xlf/FSComp.txt.fr.xlf +++ b/src/fsharp/xlf/FSComp.txt.fr.xlf @@ -9,32 +9,32 @@ Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Afficher les valeurs autorisées pour la version du langage, spécifier la version du langage comme 'dernière' ou 'préversion' Supported language versions: - Supported language versions: + Versions linguistiques prises en charge : Unrecognized value '{0}' for --langversion use --langversion:? for complete list - Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Valeur non reconnue '{0}' pour --langversion use --langversion:? pour la liste complète Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. - Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Symbole '.' inattendu dans la définition du membre. 'with','=' ou autre jeton attendu. Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) - Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Spécifiez l'algorithme pour calculer la somme de contrôle du fichier source stocké au format PDB. Les valeurs prises en charge sont : SHA1 ou SHA256 (par défaut) Algorithm '{0}' is not supported - Algorithm '{0}' is not supported + Algorithme '{0}' non pris en charge @@ -2254,7 +2254,7 @@ Invalid literal in type - littéral non valide dans le type + Littéral non valide dans le type @@ -7194,12 +7194,12 @@ Expression does not have a name. - Expression does not have a name. + L'expression n'a pas de nom. Using the 'nameof' operator as a first-class function value is not permitted. - Using the 'nameof' operator as a first-class function value is not permitted. + L'utilisation de l'opérateur 'nameof' comme valeur de fonction de première classe n'est pas autorisée. diff --git a/src/fsharp/xlf/FSComp.txt.it.xlf b/src/fsharp/xlf/FSComp.txt.it.xlf index 4f4b4d0332..02b1a185fb 100644 --- a/src/fsharp/xlf/FSComp.txt.it.xlf +++ b/src/fsharp/xlf/FSComp.txt.it.xlf @@ -9,32 +9,32 @@ Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Visualizza i valori consentiti per la versione del linguaggio. Specificare la versione del linguaggio, ad esempio 'latest' o 'preview' Supported language versions: - Supported language versions: + Versioni del linguaggio supportate: Unrecognized value '{0}' for --langversion use --langversion:? for complete list - Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Valore '{0}' non riconosciuto per --langversion. Per l'elenco completo usare --langversion:? Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. - Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Simbolo '.' imprevisto nella definizione di membro. È previsto 'with', '=' o un altro token. Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) - Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Consente di specificare l'algoritmo per calcolare il checksum del file di origine archiviato nel file PDB. I valori supportati sono SHA1 e SHA256 (predefinito). Algorithm '{0}' is not supported - Algorithm '{0}' is not supported + L'algoritmo '{0}' non è supportato @@ -1984,7 +1984,7 @@ Syntax error - errore di sintassi + Errore di sintassi @@ -2299,12 +2299,12 @@ The syntax 'module ... = struct .. end' is not used in F# code. Consider using 'module ... = begin .. end' - La sintassi 'module ... = struct .. end' non è utilizzata nel codice F#. Provare a utilizzare 'module ... = begin .. end' + La sintassi 'module ... = struct .. end' non è usata nel codice F#. Provare a usare 'module ... = begin .. end' The syntax 'module ... : sig .. end' is not used in F# code. Consider using 'module ... = begin .. end' - La sintassi 'module ... : sig .. end' non è utilizzata nel codice F#. Provare a utilizzare 'module ... = begin .. end' + La sintassi 'module ... : sig .. end' non è usata nel codice F#. Provare a usare 'module ... = begin .. end' @@ -2674,7 +2674,7 @@ This property has an invalid type. Properties taking multiple indexer arguments should have types of the form 'ty1 * ty2 -> ty3'. Properties returning functions should have types of the form '(ty1 -> ty2)'. - La proprietà contiene un tipo non valido. Le proprietà che usano più argomenti di indicizzatore devono avere tipi nel formato 'ty1 * ty2 -> ty3'.. Le proprietà che restituiscono funzioni devono avere tipi nel formato '(ti1 -> ti2)'. + La proprietà contiene un tipo non valido. Le proprietà che usano più argomenti di indicizzatore devono avere tipi nel formato 'ty1 * ty2 -> ty3'. Le proprietà che restituiscono funzioni devono avere tipi nel formato '(ti1 -> ti2)'. @@ -2819,7 +2819,7 @@ This is not a valid pattern - Criterio non valido + Questo non è un criterio valido @@ -3294,7 +3294,7 @@ This is not a valid name for an active pattern - Il nome non è valido per un criterio attivo + Questo non è un nome valido per un criterio attivo @@ -7194,12 +7194,12 @@ Expression does not have a name. - Expression does not have a name. + L'espressione non ha un nome. Using the 'nameof' operator as a first-class function value is not permitted. - Using the 'nameof' operator as a first-class function value is not permitted. + L'operatore 'nameof' non è consentito come valore di funzione di prima classe. diff --git a/src/fsharp/xlf/FSComp.txt.ja.xlf b/src/fsharp/xlf/FSComp.txt.ja.xlf index 7e3a8fb832..3087b57453 100644 --- a/src/fsharp/xlf/FSComp.txt.ja.xlf +++ b/src/fsharp/xlf/FSComp.txt.ja.xlf @@ -4,37 +4,37 @@ {0} for F# {1} - F# {1} の {0} + F# {1} のための {0} Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Display the allowed values for language version, specify language version such as 'latest' or 'preview' + 言語バージョンで許可された値を表示し、'最新' や 'プレビュー' などの言語バージョンを指定する Supported language versions: - Supported language versions: + サポートされる言語バージョン: Unrecognized value '{0}' for --langversion use --langversion:? for complete list - Unrecognized value '{0}' for --langversion use --langversion:? for complete list + --langversion の値 '{0}' が認識されません。完全なリストについては、--langversion:? を使用してください Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. - Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + メンバー定義に予期しない記号 '.' があります。'with'、'=' またはその他のトークンが必要です。 Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) - Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + PDB に格納されているソース ファイル チェックサムを計算するためのアルゴリズムを指定します。サポートされる値は次のとおりです: SHA1 または SHA256 (既定) Algorithm '{0}' is not supported - Algorithm '{0}' is not supported + アルゴリズム '{0}' はサポートされていません @@ -249,7 +249,7 @@ Unrecognized privacy setting '{0}' for managed resource, valid options are 'public' and 'private' - マネージ リソースの認識されないプライバシー設定 '{0}'。有効なオプションは 'public' および 'private' です。 + マネージド リソースの認識されないプライバシー設定 '{0}'。有効なオプションは 'public' および 'private' です。 @@ -274,7 +274,7 @@ Files in libraries or multiple-file applications must begin with a namespace or module declaration, e.g. 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'. Only the last source file of an application may omit such a declaration. - ライブラリまたは複数ファイル アプリケーション内のファイルは、名前空間またはモジュールの宣言から開始する必要があります (例: 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule'。アプリケーションの最後のソース ファイルのみ、このような宣言を省略できます。 + ライブラリまたは複数ファイル アプリケーション内のファイルは、名前空間またはモジュールの宣言から開始する必要があります (例: 'namespace SomeNamespace.SubNamespace' or 'module SomeNamespace.SomeModule')。アプリケーションの最後のソース ファイルのみ、このような宣言を省略できます。 @@ -2299,7 +2299,7 @@ The syntax 'module ... = struct .. end' is not used in F# code. Consider using 'module ... = begin .. end' - F# コードでは 'module ... = struct .. end' という構文は使用されません。'module ... = begin .. end' を使用してください。 + F# コードでは ... 'module ... = struct .. end' という構文は使用されません。'module ... = begin .. end' を使用してください。 @@ -3554,8 +3554,7 @@ Uninitialized 'val' fields must be mutable and marked with the '[<DefaultValue>]' attribute. Consider using a 'let' binding instead of a 'val' field. - 初期化されていない 'val' フィールドは変更可能で、'[<DefaultValue>]' 属性によってマークされている必要があります。'val' フィールドの代わりに 'let' -バインディングの使用を検討してください。 + 初期化されていない 'val' フィールドは変更可能で、'[<DefaultValue>]' 属性によってマークされている必要があります。'val' フィールドの代わりに 'let' バインディングの使用を検討してください。 @@ -5160,13 +5159,12 @@ Remove spaces between the type name and type parameter, e.g. \"type C<'T>\", not type \"C <'T>\". Type parameters must be placed directly adjacent to the type name. - 型名と型パラメーター間のスペースを削除します。たとえば、\"C <'T>\" ではなく \"type C<'T>\" と入力します。型パラメーターは型名に隣接していなければなりません。 + 型名と型パラメーターの間のスペースを削除します。たとえば、\"C <'T>\" ではなく \"C<'T>\" とします。型パラメーターは型名に隣接して配置する必要があります。 Remove spaces between the type name and type parameter, e.g. \"C<'T>\", not \"C <'T>\". Type parameters must be placed directly adjacent to the type name. - 型名と型パラメーターの間のスペースを削除します。たとえば、 -\"C <'T>\" ではなく \"C<'T>\" とします。型パラメーターは型名に隣接して配置する必要があります。 + 型名と型パラメーターの間のスペースを削除します。たとえば、\"C <'T>\" ではなく \"C<'T>\" とします。型パラメーターは型名に隣接して配置する必要があります。 @@ -7196,12 +7194,12 @@ Expression does not have a name. - Expression does not have a name. + 式に名前がありません。 Using the 'nameof' operator as a first-class function value is not permitted. - Using the 'nameof' operator as a first-class function value is not permitted. + 'nameof' 演算子をファーストクラスの関数値として使用することは許可されていません。 diff --git a/src/fsharp/xlf/FSComp.txt.ko.xlf b/src/fsharp/xlf/FSComp.txt.ko.xlf index 84768df5bf..9899e4288b 100644 --- a/src/fsharp/xlf/FSComp.txt.ko.xlf +++ b/src/fsharp/xlf/FSComp.txt.ko.xlf @@ -9,32 +9,32 @@ Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Display the allowed values for language version, specify language version such as 'latest' or 'preview' + 언어 버전의 허용된 값을 표시하고 '최신' 또는 '미리 보기'와 같은 언어 버전을 지정합니다. Supported language versions: - Supported language versions: + 지원되는 언어 버전: Unrecognized value '{0}' for --langversion use --langversion:? for complete list - Unrecognized value '{0}' for --langversion use --langversion:? for complete list + 전체 목록에 대한 --langversion use --langversion:?의 인식할 수 없는 값 '{0}'입니다. Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. - Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + 멤버 정의의 예기치 않은 기호 '.'입니다. 'with', '=' 또는 기타 토큰이 필요합니다. Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) - Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + PDB에 저장된 소스 파일 체크섬을 계산하기 위한 알고리즘을 지정합니다. 지원되는 값은 SHA1 또는 SHA256(기본값)입니다. Algorithm '{0}' is not supported - Algorithm '{0}' is not supported + {0}' 알고리즘은 지원되지 않습니다. @@ -7194,12 +7194,12 @@ Expression does not have a name. - Expression does not have a name. + 식에 이름이 없습니다. Using the 'nameof' operator as a first-class function value is not permitted. - Using the 'nameof' operator as a first-class function value is not permitted. + 'nameof' 연산자는 첫 번째 클래스 함수 값으로 사용할 수 없습니다. diff --git a/src/fsharp/xlf/FSComp.txt.pl.xlf b/src/fsharp/xlf/FSComp.txt.pl.xlf index 002003ee57..d9c8adb0fe 100644 --- a/src/fsharp/xlf/FSComp.txt.pl.xlf +++ b/src/fsharp/xlf/FSComp.txt.pl.xlf @@ -9,32 +9,32 @@ Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Wyświetl dozwolone wartości dla wersji językowej; określ wersję językową, np. „latest” lub „preview” Supported language versions: - Supported language versions: + Obsługiwane wersje językowe: Unrecognized value '{0}' for --langversion use --langversion:? for complete list - Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Nierozpoznana wartość „{0}” dla parametru –langversion; podaj parametr –langversion:?, aby uzyskać pełną listę Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. - Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Nieoczekiwany symbol „.” w definicji składowej. Oczekiwano ciągu „with”, znaku „=” lub innego tokenu. Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) - Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Określ algorytm obliczania sumy kontrolnej pliku źródłowego przechowywanej w pliku PDB. Obsługiwane wartości to SHA1 lub SHA256 (domyślnie) Algorithm '{0}' is not supported - Algorithm '{0}' is not supported + Algorytm „{0}” nie jest obsługiwany @@ -7194,12 +7194,12 @@ Expression does not have a name. - Expression does not have a name. + Wyrażenie nie ma nazwy. Using the 'nameof' operator as a first-class function value is not permitted. - Using the 'nameof' operator as a first-class function value is not permitted. + Używanie operatora „nameof” jako pierwszoklasowej wartości funkcji nie jest dozwolone. diff --git a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf index 181f64a8c5..c332507ee8 100644 --- a/src/fsharp/xlf/FSComp.txt.pt-BR.xlf +++ b/src/fsharp/xlf/FSComp.txt.pt-BR.xlf @@ -9,32 +9,32 @@ Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Exibe os valores permitidos para a versão do idioma, especifica a versão do idioma, como 'mais recente ' ou 'prévia' Supported language versions: - Supported language versions: + Versões de linguagens com suporte: Unrecognized value '{0}' for --langversion use --langversion:? for complete list - Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Valor não reconhecido '{0}' para --langversion use --langversion:? para a lista completa Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. - Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Símbolo inesperado '.' na definição de membro. Esperado 'com', '=' ou outro token. Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) - Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Especifique o algoritmo para calcular a soma de verificação do arquivo de origem armazenada no PDB. Os valores suportados são: SHA1 ou SHA256 (padrão) Algorithm '{0}' is not supported - Algorithm '{0}' is not supported + Algoritmo '{0}' sem suporte @@ -1984,7 +1984,7 @@ Syntax error - erro de sintaxe + Erro de sintaxe @@ -7194,12 +7194,12 @@ Expression does not have a name. - Expression does not have a name. + A expressão não tem um nome. Using the 'nameof' operator as a first-class function value is not permitted. - Using the 'nameof' operator as a first-class function value is not permitted. + O uso do operador ' nameof ' como um valor de função de primeira classe não é permitido. diff --git a/src/fsharp/xlf/FSComp.txt.ru.xlf b/src/fsharp/xlf/FSComp.txt.ru.xlf index 71d53bd57c..3979f446a5 100644 --- a/src/fsharp/xlf/FSComp.txt.ru.xlf +++ b/src/fsharp/xlf/FSComp.txt.ru.xlf @@ -9,32 +9,32 @@ Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Отображение допустимых значений для версии языка. Укажите версию языка, например, "latest" или "preview". Supported language versions: - Supported language versions: + Поддерживаемые языковые версии: Unrecognized value '{0}' for --langversion use --langversion:? for complete list - Unrecognized value '{0}' for --langversion use --langversion:? for complete list + Не удалось распознать значение "{0}" для параметра --langversion. Для получения полного списка допустимых значений выполните команду use --langversion:? Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. - Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Неожиданный символ "." в определении члена. Ожидаемые инструкции: "with", "=" или другие токены. Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) - Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + Укажите алгоритм для вычисления контрольной суммы исходного файла, хранящейся в файле PDB. Поддерживаемые значения: SHA1 или SHA256 (по умолчанию) Algorithm '{0}' is not supported - Algorithm '{0}' is not supported + Алгоритм "{0}" не поддерживается @@ -7194,12 +7194,12 @@ Expression does not have a name. - Expression does not have a name. + Выражение не имеет имени. Using the 'nameof' operator as a first-class function value is not permitted. - Using the 'nameof' operator as a first-class function value is not permitted. + Использование оператора "nameof" в качестве значения функции первого класса не допускается. diff --git a/src/fsharp/xlf/FSComp.txt.tr.xlf b/src/fsharp/xlf/FSComp.txt.tr.xlf index 64935d65b6..32336c3d1b 100644 --- a/src/fsharp/xlf/FSComp.txt.tr.xlf +++ b/src/fsharp/xlf/FSComp.txt.tr.xlf @@ -9,32 +9,32 @@ Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Display the allowed values for language version, specify language version such as 'latest' or 'preview' + Dil sürümü için izin verilen değerleri görüntüleyin, dil sürümünü 'en son' veya 'önizleme' örneklerindeki gibi belirtin Supported language versions: - Supported language versions: + Desteklenen dil sürümleri: Unrecognized value '{0}' for --langversion use --langversion:? for complete list - Unrecognized value '{0}' for --langversion use --langversion:? for complete list + --langversion için '{0}' değeri tanınmıyor. Tam liste için --langversion:? kullanın Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. - Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + Üye tanımında '.' sembolü beklenmiyordu. 'with', '=' veya başka bir belirteç bekleniyordu. Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) - Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + PDB içinde depolanan kaynak dosyası sağlama toplamını hesaplama algoritmasını belirtin. Desteklenen değerler: SHA1 veya SHA256 (varsayılan) Algorithm '{0}' is not supported - Algorithm '{0}' is not supported + {0}' algoritması desteklenmiyor @@ -7194,12 +7194,12 @@ Expression does not have a name. - Expression does not have a name. + İfade bir ada sahip değil. Using the 'nameof' operator as a first-class function value is not permitted. - Using the 'nameof' operator as a first-class function value is not permitted. + 'Nameof' işlecinin birinci sınıf işlev değeri olarak kullanılmasına izin verilmez. diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf index a61c36af5c..33f01e7790 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hans.xlf @@ -9,32 +9,32 @@ Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Display the allowed values for language version, specify language version such as 'latest' or 'preview' + 显示语言版本的允许值,指定语言版本,如“最新”或“预览” Supported language versions: - Supported language versions: + 支持的语言版本: Unrecognized value '{0}' for --langversion use --langversion:? for complete list - Unrecognized value '{0}' for --langversion use --langversion:? for complete list + --langversion 的值“{0}”无法识别,使用 --langversion:? 获取完整列表。 Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. - Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + 成员定义中有意外的符号 "."。预期 "with"、"+" 或其他标记。 Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) - Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + 指定用于计算存储在 PDB 中的源文件校验的算法。支持的值是:SHA1 或 SHA256(默认) Algorithm '{0}' is not supported - Algorithm '{0}' is not supported + 不支持算法“{0}” @@ -7194,12 +7194,12 @@ Expression does not have a name. - Expression does not have a name. + 表达式不具有名称。 Using the 'nameof' operator as a first-class function value is not permitted. - Using the 'nameof' operator as a first-class function value is not permitted. + 不允许使用 "nameof" 运算符作为第一类函数的值。 diff --git a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf index 56af5fad54..5713fd536f 100644 --- a/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf +++ b/src/fsharp/xlf/FSComp.txt.zh-Hant.xlf @@ -9,32 +9,32 @@ Display the allowed values for language version, specify language version such as 'latest' or 'preview' - Display the allowed values for language version, specify language version such as 'latest' or 'preview' + 顯示語言版本允許的值,指定 'latest' 或 'preview' 等語言版本 Supported language versions: - Supported language versions: + 支援的語言版本: Unrecognized value '{0}' for --langversion use --langversion:? for complete list - Unrecognized value '{0}' for --langversion use --langversion:? for complete list + 對 --langversion 為無法識別的值 '{0}',對完整清單使用 --langversion:? Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. - Unexpected symbol '.' in member definition. Expected 'with', '=' or other token. + 成員定義中的非預期符號 '.'。預期為 'with'、'=' 或其他語彙基元。 Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) - Specify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 or SHA256 (default) + 請指定用來計算 PDB 中所儲存來源檔案總和檢查碼的演算法。支援的值為: SHA1 或 SHA256 (預設) Algorithm '{0}' is not supported - Algorithm '{0}' is not supported + 不支援演算法 '{0}' @@ -7194,12 +7194,12 @@ Expression does not have a name. - Expression does not have a name. + 運算式沒有名稱。 Using the 'nameof' operator as a first-class function value is not permitted. - Using the 'nameof' operator as a first-class function value is not permitted. + 不允許使用"nameof" 運算子作為第一類函式值。 diff --git a/src/fsharp/xlf/FSStrings.de.xlf b/src/fsharp/xlf/FSStrings.de.xlf index 60734cae52..7e373ec534 100644 --- a/src/fsharp/xlf/FSStrings.de.xlf +++ b/src/fsharp/xlf/FSStrings.de.xlf @@ -74,7 +74,7 @@ Possible overload: '{0}'. {1}. - Mögliche Überladung: '{0}'. {1}. + Mögliche Überladung: "{0}". {1}. @@ -284,7 +284,7 @@ symbol ':?>' - Symbol ':?>' + Symbol ":?>" @@ -634,7 +634,7 @@ keyword 'const' - Schlüsselwort 'const' + Schlüsselwort "const" @@ -1434,7 +1434,7 @@ This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable {0} = expression'. - Dieser Wert ist nicht änderbar. Verwenden Sie ggf. ein änderbares Schlüsselwort, z. B. "let mutable {0} = Ausdruck". + Dieser Wert ist nicht änderbar. Verwenden Sie ggf. ein änderbares Schlüsselwort, z.B. "let mutable {0} = Ausdruck". @@ -1549,17 +1549,17 @@ #I directives may only occur in F# script files (extensions .fsx or .fsscript). Either move this code to a script file, add a '-I' compiler option for this reference or delimit the directive with delimit it with '#if INTERACTIVE'/'#endif'. - #I-Direktiven dürfen nur in F#-Skriptdateien (Dateierweiterungen .fsx oder .fsscript) verwendet werden. Verschieben Sie entweder diesen Code in eine Skriptdatei, fügen Sie die Compileroption "-I" für diesen Verweis hinzu, oder trennen Sie die Direktive mit "#if INTERACTIVE'/'#endif" ab. + #I-Direktiven dürfen nur in F#-Skriptdateien (Dateierweiterungen .fsx oder .fsscript) verwendet werden. Verschieben Sie entweder diesen Code in eine Skriptdatei, fügen Sie die Compileroption "-I" für diesen Verweis hinzu, oder trennen Sie die Direktive mit "#if INTERACTIVE"/"#endif" ab. #r directives may only occur in F# script files (extensions .fsx or .fsscript). Either move this code to a script file or replace this reference with the '-r' compiler option. If this directive is being executed as user input, you may delimit it with '#if INTERACTIVE'/'#endif'. - #r-Anweisungen dürfen nur in F#-Skriptdateien (Dateierweiterungen .fsx oder .fsscript) verwendet werden. Verschieben Sie entweder diesen Code in eine Skriptdatei, oder ersetzen Sie diesen Verweis durch die Compileroption "-r". Wenn diese Anweisung als Benutzereingabe ausgeführt wird, trennen Sie sie mit "#if INTERACTIVE'/'#endif" ab. + #r-Anweisungen dürfen nur in F#-Skriptdateien (Dateierweiterungen .fsx oder .fsscript) verwendet werden. Verschieben Sie entweder diesen Code in eine Skriptdatei, oder ersetzen Sie diesen Verweis durch die Compileroption "-r". Wenn diese Anweisung als Benutzereingabe ausgeführt wird, trennen Sie sie mit "#if INTERACTIVE"/"#endif" ab. This directive may only be used in F# script files (extensions .fsx or .fsscript). Either remove the directive, move this code to a script file or delimit the directive with '#if INTERACTIVE'/'#endif'. - Diese Direktive darf nur in F#-Skriptdateien (Dateierweiterungen .fsx oder .fsscript) verwendet werden. Entfernen Sie entweder die Direktive, verschieben Sie diesen Code in eine Skriptdatei, oder trennen Sie die Direktive mit "#if INTERACTIVE'/'#endif" ab. + Diese Direktive darf nur in F#-Skriptdateien (Dateierweiterungen .fsx oder .fsscript) verwendet werden. Entfernen Sie entweder die Direktive, verschieben Sie diesen Code in eine Skriptdatei, oder trennen Sie die Direktive mit "#if INTERACTIVE"/"#endif" ab. diff --git a/src/fsharp/xlf/FSStrings.es.xlf b/src/fsharp/xlf/FSStrings.es.xlf index 238c6db503..6ccd80493d 100644 --- a/src/fsharp/xlf/FSStrings.es.xlf +++ b/src/fsharp/xlf/FSStrings.es.xlf @@ -954,7 +954,7 @@ comment - Comentario + comentario diff --git a/src/fsharp/xlf/FSStrings.it.xlf b/src/fsharp/xlf/FSStrings.it.xlf index 6ec47804c8..c8f96cadae 100644 --- a/src/fsharp/xlf/FSStrings.it.xlf +++ b/src/fsharp/xlf/FSStrings.it.xlf @@ -954,7 +954,7 @@ comment - Commento + commento diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/AssemblyInfo.fs.de.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/AssemblyInfo.fs.de.xlf index 87fa85b31c..8df6ae7fc3 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/AssemblyInfo.fs.de.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/AssemblyInfo.fs.de.xlf @@ -19,17 +19,17 @@ Setting ComVisible to false makes the types in this assembly not visible - Durch Festlegen von ComVisible auf 'false' werden die Typen in dieser Assembly unsichtbar + Durch Festlegen von ComVisible auf FALSE sind die Typen in dieser Assembly nicht to COM components. If you need to access a type in this assembly from - für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von + für COM-Komponenten sichtbar. Wenn Sie auf einen Typ in dieser Assembly von COM, set the ComVisible attribute to true on that type. - COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. + COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf TRUE festlegen. diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.cs.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.cs.xlf index ffd1deada4..0a1913fea3 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.cs.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.cs.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Další informace o F# na https://fsharp.org + Další informace o F# najdete na https://fsharp.org. diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.de.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.de.xlf index 59272645d4..8c434e9d7d 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.de.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.de.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Weitere Informationen zu F# unter "https://fsharp.org". + Weitere Informationen zu F# unter https://fsharp.org. diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.es.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.es.xlf index 081582225e..1472966885 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.es.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.es.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Más información acerca de F# en https://fsharp.org + Más información sobre F# en https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.fr.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.fr.xlf index c2ed6e21e3..8052d98708 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.fr.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.fr.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - En savoir plus sur F# sur le site https://fsharp.org + En savoir plus sur F# : https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.it.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.it.xlf index 5b9b76eb7f..c9027ad5b6 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.it.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.it.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Altre informazioni su F# all'indirizzo https://fsharp.org + Altre informazioni su F# disponibili all'indirizzo https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ja.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ja.xlf index e0935dc291..c24608aec3 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ja.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ja.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - F# の詳細については、https://fsharp.org を参照してください + F# の詳細については、https://fsharp.org をご覧ください diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ko.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ko.xlf index e41549ea2a..7d9f7dc54e 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ko.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ko.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - hF#에 대해 https://fsharp.org에서 자세히 알아보기 + https://fsharp.org에서 F#에 대해 자세히 알아보기 diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pl.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pl.xlf index 298af71ef0..763d2db3df 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pl.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pl.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Dowiedz się więcej na temat języka F# pod adresem https://fsharp.org + Dowiedz się więcej o języku F# na stronie https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pt-BR.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pt-BR.xlf index 701d39192b..7af54cd8fd 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pt-BR.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.pt-BR.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Saiba mais sobre F# em https://fsharp.org + Saiba mais sobre o F# em https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ru.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ru.xlf index 57caaf2c82..54eb018503 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ru.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.ru.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Дополнительные сведения о F# см. на https://fsharp.org + Дополнительные сведения об F# см. на странице https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.tr.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.tr.xlf index deaa07d46b..c584140b66 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.tr.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.tr.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - F# hakkında daha fazla bilgi için bkz. https://fsharp.org + F# hakkında daha fazla bilgi edinmek için bkz. https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hans.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hans.xlf index 74de5b0fe0..27df727dbd 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hans.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hans.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - 在 https://fsharp.org 上了解有关 F# 的详细信息 + 了解更多关于 F# 的信息,请访问 https://fsharp.org diff --git a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hant.xlf b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hant.xlf index b0f43a7d4a..5f67238de8 100644 --- a/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hant.xlf +++ b/vsintegration/ProjectTemplates/ConsoleProject/Template/xlf/Program.fs.zh-Hant.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - 請參閱 https://fsharp.org,進一步了解 F# + 前往 https://fsharp.org 深入了解 F# diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/AssemblyInfo.fs.de.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/AssemblyInfo.fs.de.xlf index 87fa85b31c..8df6ae7fc3 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/AssemblyInfo.fs.de.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/AssemblyInfo.fs.de.xlf @@ -19,17 +19,17 @@ Setting ComVisible to false makes the types in this assembly not visible - Durch Festlegen von ComVisible auf 'false' werden die Typen in dieser Assembly unsichtbar + Durch Festlegen von ComVisible auf FALSE sind die Typen in dieser Assembly nicht to COM components. If you need to access a type in this assembly from - für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von + für COM-Komponenten sichtbar. Wenn Sie auf einen Typ in dieser Assembly von COM, set the ComVisible attribute to true on that type. - COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. + COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf TRUE festlegen. diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.cs.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.cs.xlf index fc829e7113..e9771690a9 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.cs.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.cs.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Další informace o F# na https://fsharp.org + Další informace o F# najdete na https://fsharp.org. diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.de.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.de.xlf index 28fe2b6f40..61df76a280 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.de.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.de.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Weitere Informationen zu F# unter "https://fsharp.org". + Weitere Informationen zu F# unter https://fsharp.org. diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.es.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.es.xlf index 507619b46b..96fb3d3647 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.es.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.es.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Más información acerca de F# en https://fsharp.org + Más información sobre F# en https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.fr.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.fr.xlf index 53a859e0d5..cb48575303 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.fr.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.fr.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - En savoir plus sur F# sur le site https://fsharp.org + Pour en savoir plus sur le F# : https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.it.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.it.xlf index d65ce6f70c..42558ead9d 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.it.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.it.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Altre informazioni su F# all'indirizzo https://fsharp.org + Altre informazioni su F# disponibili all'indirizzo https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ja.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ja.xlf index 45cbcbec9a..45967e26bf 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ja.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ja.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - F# の詳細については、https://fsharp.org を参照してください + F# の詳細については、https://fsharp.org をご覧ください diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ko.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ko.xlf index 45d7cd9e47..661f9e6344 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ko.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ko.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - hF#에 대해 https://fsharp.org에서 자세히 알아보기 + https://fsharp.org에서 F#에 대해 자세히 알아보기 diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pl.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pl.xlf index 94269ce71b..e32717ff70 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pl.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pl.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Dowiedz się więcej na temat języka F# pod adresem https://fsharp.org + Dowiedz się więcej o języku F# na stronie https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pt-BR.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pt-BR.xlf index f1be7744b1..1bd32f9343 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pt-BR.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.pt-BR.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Saiba mais sobre F# em https://fsharp.org + Saiba mais sobre o F# em https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ru.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ru.xlf index 08746c4a7f..b8a6d8cced 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ru.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.ru.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - Дополнительные сведения о F# см. на https://fsharp.org + Дополнительные сведения об F# см. на странице https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.tr.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.tr.xlf index 564cfc2dca..1b3c2476e6 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.tr.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.tr.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - F# hakkında daha fazla bilgi için bkz. https://fsharp.org + F# hakkında daha fazla bilgi edinmek için bkz. https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hans.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hans.xlf index 0859fdcd1a..4d849f68e3 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hans.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hans.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - 在 https://fsharp.org 上了解有关 F# 的详细信息 + 了解更多关于 F# 的信息,请访问 https://fsharp.org diff --git a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hant.xlf b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hant.xlf index 9edde3fd88..14ed4156de 100644 --- a/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hant.xlf +++ b/vsintegration/ProjectTemplates/LibraryProject/Template/xlf/Script.fsx.zh-Hant.xlf @@ -4,7 +4,7 @@ Learn more about F# at https://fsharp.org - 請參閱 https://fsharp.org,進一步了解 F# + 前往 https://fsharp.org 深入了解 F# diff --git a/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.de.xlf b/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.de.xlf index 5fbb27634d..0908855049 100644 --- a/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.de.xlf +++ b/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.de.xlf @@ -84,7 +84,7 @@ and they also allow editors (such as Visual Studio) to extract information from them. - und sie ermöglichen das Extrahieren von Informationen über Editoren (z. B. Visual Studio). + und sie ermöglichen das Extrahieren von Informationen über Editoren (z.B. Visual Studio). @@ -104,7 +104,7 @@ A module is a grouping of F# code, such as values, types, and function values. - Ein Modul ist eine Gruppierung von F#-Code, z. B. Werte, Typen und Funktionswerte. + Ein Modul ist eine Gruppierung von F#-Code, z.B. Werte, Typen und Funktionswerte. @@ -199,7 +199,7 @@ You could not use '=' here for this purpose since it is used for equality - Sie können '=' hier nicht verwenden, da es für Gleichheit verwendet wird. + Sie können "=" hier nicht verwenden, da es für Gleichheit verwendet wird. @@ -234,7 +234,7 @@ Apply the function, naming the function return result using 'let'. - Die Funktion anwenden, und das Rückgabeergebnis der Funktion mithilfe von 'let' benennen. + Die Funktion anwenden, und das Rückgabeergebnis der Funktion mithilfe von "let" benennen. @@ -249,7 +249,7 @@ If 'result1' were not of type 'int', then the line would fail to compile. - Wenn "result1" nicht vom Typ "int" wäre, würde die Kompilierung der Zeile fehlschlagen. + Wenn "result1" nicht vom Typ "int" wäre, käme es bei der Kompilierung der Zeile zu einem Fehler. @@ -1294,7 +1294,7 @@ Option values are any kind of value tagged with either 'Some' or 'None'. - Bei Optionswerten handelt es sich um eine beliebige Art von Werten, die entweder mit 'Some' oder mit 'None' markiert sind. + Bei Optionswerten handelt es sich um eine beliebige Art von Werten, die entweder mit "Some" oder mit "None" markiert sind. @@ -1394,7 +1394,7 @@ Values using Units of Measure can be used just like the primitive numeric type for things like printing. - Werte, die Maßeinheiten verwenden, können wie der primitive numerische Typ z. B. zum Drucken genutzt werden. + Werte, die Maßeinheiten verwenden, können wie der primitive numerische Typ z.B. zum Drucken genutzt werden. @@ -1444,7 +1444,7 @@ 'this' specifies a name for the object's self identifier. - 'this' gibt einen Namen für den Selbstbezeichner des Objekts an. + "this" gibt einen Namen für den Selbstbezeichner des Objekts an. @@ -1494,7 +1494,7 @@ use the '<-' operator to mutate the value. - Den '<-'-Operator verwenden, um den Wert zu mutieren + Den "<-"-Operator verwenden, um den Wert zu mutieren @@ -1509,7 +1509,7 @@ An 'int' instance of the state tracker class. Note that the type parameter is inferred. - Eine 'int'-Instanz der 'state tracker'-Klasse. Beachten Sie, dass der Typ-Parameter abgeleitet wird. + Eine int-Instanz der state tracker-Klasse. Beachten Sie, dass der Typ-Parameter abgeleitet wird. diff --git a/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.ja.xlf b/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.ja.xlf index 5694cd3bf7..0eda61edb1 100644 --- a/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.ja.xlf +++ b/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.ja.xlf @@ -1324,7 +1324,7 @@ Next, define an interface type that represents an object to compute the shipping zone for the customer's zip code, - 他に多くのリストの組み合わせがあります。次の二乗和をコンピューティングします: + 次に、オブジェクトを表すインターフェイスの型を定義して、顧客の郵便番号の出荷ゾーンをコンピューティングし、 diff --git a/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.zh-Hant.xlf b/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.zh-Hant.xlf index fea7e0434e..fd33d17fa3 100644 --- a/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.zh-Hant.xlf +++ b/vsintegration/ProjectTemplates/TutorialProject/Template/xlf/Tutorial.fsx.zh-Hant.xlf @@ -14,7 +14,7 @@ and select "Execute in Interactive". You can open the F# Interactive Window from the "View" menu. - 並選取 [以互動方式執行]5D;。您可以從 [檢視]5D; 功能表開啟 F# Interactive 視窗。 + 並選取 [以互動方式執行]。您可以從 [檢視] 功能表開啟 F# 互動式視窗。 diff --git a/vsintegration/src/FSharp.LanguageService/xlf/FSLangSvcStrings.de.xlf b/vsintegration/src/FSharp.LanguageService/xlf/FSLangSvcStrings.de.xlf index a77fe0da02..d397b74850 100644 --- a/vsintegration/src/FSharp.LanguageService/xlf/FSLangSvcStrings.de.xlf +++ b/vsintegration/src/FSharp.LanguageService/xlf/FSLangSvcStrings.de.xlf @@ -29,17 +29,17 @@ Cannot navigate to the provided member '{0}'. - Wechseln zum angegebenen Member '{0}' ist nicht möglich. + Wechseln zum angegebenen Member "{0}" ist nicht möglich. Cannot navigate to the provided type '{0}'. - Wechseln zum angegebenen Typ '{0}' ist nicht möglich. + Wechseln zum angegebenen Typ "{0}" ist nicht möglich. Cannot navigate to definition. Type check information is not available, please try later. - Wechseln zur Definition ist nicht möglich. Die Informationen zum Überprüfen des Typen sind nicht verfügbar. Versuchen Sie es später erneut. + Wechseln zur Definition ist nicht möglich. Die Informationen zum Überprüfen des Typen sind nicht verfügbar. Versuchen Sie es später noch mal. diff --git a/vsintegration/src/FSharp.LanguageService/xlf/FSLangSvcStrings.ja.xlf b/vsintegration/src/FSharp.LanguageService/xlf/FSLangSvcStrings.ja.xlf index 3b541159f2..8e843b7338 100644 --- a/vsintegration/src/FSharp.LanguageService/xlf/FSLangSvcStrings.ja.xlf +++ b/vsintegration/src/FSharp.LanguageService/xlf/FSLangSvcStrings.ja.xlf @@ -4,7 +4,7 @@ (The documentation cache is still being constructed. Please try again in a few seconds.) - (ドキュメント キャッシュの作成中です。何秒か待ってからもう 一度操作を行ってください。 + (ドキュメント キャッシュの作成中です。何秒か待ってからもう 一度操作を行ってください。) diff --git a/vsintegration/src/FSharp.LanguageService/xlf/VSPackage.de.xlf b/vsintegration/src/FSharp.LanguageService/xlf/VSPackage.de.xlf index ffc095348b..2a026b25d5 100644 --- a/vsintegration/src/FSharp.LanguageService/xlf/VSPackage.de.xlf +++ b/vsintegration/src/FSharp.LanguageService/xlf/VSPackage.de.xlf @@ -29,12 +29,12 @@ F# Interface File (*.fsi) - F# Schnittstellendatei (*.fsi) + F#-Schnittstellendatei (*.fsi) F# Script File (*.fsx) - F# Skriptdatei (*.fsx) + F#-Skriptdatei (*.fsx) @@ -59,7 +59,7 @@ Number - Anzahl + Zahl diff --git a/vsintegration/src/FSharp.LanguageService/xlf/VSPackage.it.xlf b/vsintegration/src/FSharp.LanguageService/xlf/VSPackage.it.xlf index e0c47b9efa..a79fee2306 100644 --- a/vsintegration/src/FSharp.LanguageService/xlf/VSPackage.it.xlf +++ b/vsintegration/src/FSharp.LanguageService/xlf/VSPackage.it.xlf @@ -19,7 +19,7 @@ Operator - operatore + Operatore @@ -49,7 +49,7 @@ Identifier - identificatore + Identificatore diff --git a/vsintegration/src/FSharp.LanguageService/xlf/VSPackage.pt-BR.xlf b/vsintegration/src/FSharp.LanguageService/xlf/VSPackage.pt-BR.xlf index 2f9badfbb4..502d5956da 100644 --- a/vsintegration/src/FSharp.LanguageService/xlf/VSPackage.pt-BR.xlf +++ b/vsintegration/src/FSharp.LanguageService/xlf/VSPackage.pt-BR.xlf @@ -49,7 +49,7 @@ Identifier - identificador + Identificador diff --git a/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.de.xlf b/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.de.xlf index b9b597b8d5..d5de79f0e5 100644 --- a/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.de.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.de.xlf @@ -64,7 +64,7 @@ If you change a file name extension, the file may become unusable. Are you sure you want to change it? - Wenn Sie eine Dateinamenerweiterung ändern, wird die Datei möglicherweise unbrauchbar. Möchten Sie sie wirklich ändern? + Wenn Sie eine Dateinamenerweiterung ändern, wird die Datei möglicherweise unbrauchbar. Möchten Sie sie ändern? @@ -129,10 +129,10 @@ - contain only '.' - have any of the following characters: / ? : & \ * " < > | # % Für Dateien und Ordner gilt Folgendes: -- Sie dürfen keine leeren Zeichenfolgen sein. -- Sie dürfen keine für das System reservierten Namen aufweisen, einschließlich "CON", "AUX", PRN", "COM1" oder "LPT2". -- Sie dürfen nicht nur "." enthalten. -- Sie dürfen folgende Zeichen nicht aufweisen: / ? : & \ * " < > | # % +– Sie dürfen keine leeren Zeichenfolgen sein. +– Sie dürfen keine für das System reservierten Namen aufweisen, einschließlich "CON", "AUX", PRN", "COM1" oder "LPT2". +– Sie dürfen nicht ausschließlich "." enthalten. +– Sie dürfen folgende Zeichen nicht aufweisen: / ? : & \ * " < > | # % @@ -252,22 +252,22 @@ Minimal - minimal + Minimal Misc - Verschiedenes + Verschiedene None - NONE + Keine Normal - NORMAL + Normal @@ -802,7 +802,7 @@ Version - VERSION + Version diff --git a/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.es.xlf b/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.es.xlf index b94354b317..a6784f5ff5 100644 --- a/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.es.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.es.xlf @@ -119,7 +119,7 @@ error - Fehler + error @@ -252,7 +252,7 @@ Minimal - mínimo + Mínimo @@ -387,7 +387,7 @@ warning - Advertencia + advertencia diff --git a/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.it.xlf b/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.it.xlf index ce42e4ef50..2f9d220339 100644 --- a/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.it.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.it.xlf @@ -119,7 +119,7 @@ error - Errore + errore @@ -387,7 +387,7 @@ warning - Avviso + avviso diff --git a/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.pl.xlf b/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.pl.xlf index 00055ae4a8..8c5a5b3bf5 100644 --- a/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.pl.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.pl.xlf @@ -119,7 +119,7 @@ error - Błąd + błąd @@ -387,7 +387,7 @@ warning - Ostrzeżenie + ostrzeżenie @@ -462,7 +462,7 @@ Build - Kompiluj + Kompilacja diff --git a/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.pt-BR.xlf b/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.pt-BR.xlf index f72f70bbe8..904ef68a5c 100644 --- a/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.pt-BR.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.pt-BR.xlf @@ -252,7 +252,7 @@ Minimal - mínimo + Mínimo diff --git a/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.zh-Hant.xlf b/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.zh-Hant.xlf index 52c142cf47..ad597cad5b 100644 --- a/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.zh-Hant.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.Base/Project/xlf/Microsoft.VisualStudio.Package.Project.zh-Hant.xlf @@ -627,7 +627,7 @@ The project location is not trusted:{0}{0}{1}{0}{0}Running the application may result in security exceptions when it attempts to perform actions which require full trust.{0}{0}Click OK to ignore and continue. - 專案位置不受信任:{0}{0}{1}{0}{0}執行應用程式時若嘗試執行需要完全信任的動作,可能會產生安全性例外狀況。{0}{0}按一下 [確定]5D; 以忽略並繼續。 + 專案位置不受信任:{0}{0}{1}{0}{0}執行應用程式時若嘗試執行需要完全信任的動作,可能會產生安全性例外狀況。{0}{0}按一下 [確定] 以忽略並繼續。 diff --git a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/MenusAndCommands.vsct.zh-Hant.xlf b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/MenusAndCommands.vsct.zh-Hant.xlf index f1c96d5286..918c882429 100644 --- a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/MenusAndCommands.vsct.zh-Hant.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/MenusAndCommands.vsct.zh-Hant.xlf @@ -49,7 +49,7 @@ F# Interactive - F# Interactive + F# 互動 @@ -84,12 +84,12 @@ &Send to F# Interactive - 傳送到 F# Interactive(&S) + 傳送到 F# 互動(&S) &Send to F# Interactive - 傳送到 F# Interactive(&S) + 傳送到 F# 互動(&S) @@ -114,12 +114,12 @@ &Send Project Output to F# Interactive - 傳送專案輸出到 F# Interactive(&S) + 傳送專案輸出到 F# 互動(&S) &Send Project Output to F# Interactive - 傳送專案輸出到 F# Interactive(&S) + 傳送專案輸出到 F# 互動(&S) diff --git a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.cs.xlf b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.cs.xlf index 34cc71a6cf..e27841feae 100644 --- a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.cs.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.cs.xlf @@ -544,7 +544,7 @@ Referencing this version of FSharp.Core will cause your project to be incompatible with older versions of Visual Studio. Do you want to continue? - Odkazování na tuto verzi oboru názvů FSharp.Core zapříčíní nekompatibilitu projektu se staršími verzemi Visual Studia. Chcete pokračovat? + Odkazování na tuto verzi oboru názvů FSharp.Core zapříčiní nekompatibilitu projektu se staršími verzemi sady Visual Studio. Chcete pokračovat? diff --git a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.ja.xlf b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.ja.xlf index 0e69ee238b..e0c79c4a2b 100644 --- a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.ja.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.ja.xlf @@ -434,12 +434,12 @@ Microsoft Visual F# Tools 10.4 for F# 4.6 - F# 4.6 用 Microsoft Visual F# Tools + F# 4.6 用 Microsoft Visual F# Tools 10.4 Microsoft Visual F# Tools 10.4 for F# 4.6 - F# 4.6 用 Microsoft Visual F# Tools + F# 4.6 用 Microsoft Visual F# Tools 10.4 diff --git a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.pl.xlf b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.pl.xlf index 827c5be830..5ae72d11dc 100644 --- a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.pl.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.pl.xlf @@ -144,7 +144,7 @@ Build - Kompiluj + Kompilacja diff --git a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.pt-BR.xlf b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.pt-BR.xlf index aaa4543ca5..eb0221892a 100644 --- a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.pt-BR.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.pt-BR.xlf @@ -334,17 +334,17 @@ SQL Database Connection (LINQ to SQL, type provider) - Conexão de Banco de Dados SQL (LINQ para SQL, provedor de tipos) + Conexão de Banco de Dados SQL (LINQ to SQL, provedor de tipos) A project item for using the SqlDataConnection (LINQ to SQL) type provider to generate types and consume data in a live SQL database. - Um item de projeto para usar o provedor de tipos SqlDataConnection (LINQ para SQL) para gerar tipos e consumir dados em um banco de dados SQL dinâmico. + Um item de projeto para usar o provedor de tipos SqlDataConnection (LINQ to SQL) para gerar tipos e consumir dados em um banco de dados SQL dinâmico. SQL Database Connection (LINQ to Entities, type provider) - Conexão de Banco de Dados SQL (LINQ para Entidades, provedor de tipos) + Conexão de Banco de Dados SQL (LINQ to Entities, provedor de tipos) @@ -434,12 +434,12 @@ Microsoft Visual F# Tools 10.4 for F# 4.6 - Ferramentas F# do Microsoft Visual 10.4 para F# 4.6 + Microsoft Visual F# Tools 10.4 para F# 4.6 Microsoft Visual F# Tools 10.4 for F# 4.6 - Ferramentas F# do Microsoft Visual 10.4 para F# 4.6 + Microsoft Visual F# Tools 10.4 para F# 4.6 @@ -454,7 +454,7 @@ Visual F# Tools 10.4 for F# 4.6 - Ferramentas F# do Visual 10.4 para F# 4.6 + Visual F# Tools 10.4 para F# 4.6 diff --git a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.zh-Hant.xlf b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.zh-Hant.xlf index 6b452390e2..326a36bb81 100644 --- a/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.zh-Hant.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.FSharp/xlf/VSPackage.zh-Hant.xlf @@ -409,7 +409,7 @@ F# Interactive - F# Interactive + F# 互動 @@ -459,7 +459,7 @@ F# Interactive - F# Interactive + F# 互動 @@ -509,7 +509,7 @@ Change path and command line arguments passed to the F# Interactive - 變更傳遞到 F# Interactive 的路徑和命令列引數 + 變更傳遞到 F# 互動的路徑和命令列引數 diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/xlf/ApplicationPropPage.de.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/xlf/ApplicationPropPage.de.xlf index 88fafb076b..b106a3db12 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/xlf/ApplicationPropPage.de.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/xlf/ApplicationPropPage.de.xlf @@ -44,7 +44,7 @@ Target F# runtime: - F#-Ziellaufzeit: + F#-Zielruntime: diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf index 860555f344..b071e0c5f7 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf @@ -295,7 +295,7 @@ Vyberte prosím platnou cestu ke složce. Solution Explorer), and make changes on the Application tab. - průzkumníku řešení), a proveďte změny v kartě Aplikace. + Průzkumníku řešení), a proveďte změny v kartě Aplikace. @@ -1828,9 +1828,8 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size - # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf index 65b4328fdc..4184f3edc5 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf @@ -355,7 +355,7 @@ Wählen Sie einen gültigen Ordnerpfad aus. None - NONE + Keine @@ -1828,9 +1828,8 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size - # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" @@ -2148,12 +2147,12 @@ CONSIDER: get this from CodeDom The file '{0}' already exists. Do you want to replace it? - Die Datei "{0}" ist bereits vorhanden. Möchten Sie sie ersetzen? + Die Datei "{0}" ist bereits vorhanden. Möchten Sie sie ersetzen? {0} = full file path and name The following files already exist. Do you want to replace them? - Die folgenden Dateien sind bereits vorhanden. Möchten Sie sie ersetzen? + Die folgenden Dateien sind bereits vorhanden. Möchten Sie sie ersetzen? diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf index 1153755c3d..4b1a5e0d90 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf @@ -39,7 +39,7 @@ Debug - depurar + Depurar @@ -365,7 +365,7 @@ Seleccione una ruta de acceso de carpeta válida. Error - Fehler + Error @@ -614,7 +614,7 @@ Error: Error - Fehler + Error @@ -1828,9 +1828,8 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size - # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf index cd60e9f07e..99d3469919 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf @@ -39,7 +39,7 @@ Debug - déboguer + Déboguer @@ -1828,9 +1828,8 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size - # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf index dd58cb9a11..8902030751 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf @@ -1828,9 +1828,8 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size - # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf index bdb896a5c8..de4d65e71f 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf @@ -1828,9 +1828,8 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size - # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" @@ -2930,7 +2929,7 @@ app.config ファイルでの新しい値は '{1}' です The application will fail to run in the selected zone because of this requested elevated permission. Click the help link above for more info. - この引き上げられたアクセス許可が原因で、選択されたゾーンでのアプリケーションの実行は失敗します。詳細については、ヘルプ リンクをクリックしてください。 + 要求されたこの引き上げられたアクセス許可が原因で、選択されたゾーンでのアプリケーションの実行は失敗します。詳細については、ヘルプ リンクをクリックしてください。 diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf index 6f540b5425..e7191ac3c4 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf @@ -1828,9 +1828,8 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size - # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf index 73bef853b9..6936b8e97f 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf @@ -59,7 +59,7 @@ Build - Kompiluj + Kompilacja @@ -1828,9 +1828,8 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size - # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf index 3e8a169348..fefd197867 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf @@ -1828,9 +1828,8 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size - # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" @@ -1969,7 +1968,7 @@ CONSIDER: get this from CodeDom Portable Network Graphics - formato PNG + Formato PNG Friendly Image types @@ -2063,7 +2062,7 @@ CONSIDER: get this from CodeDom Portable Network Graphics - formato PNG + Formato PNG # File dialog filters # # E.g., for icons, the actual filter created would look like "Icons (*.ico)". These resources @@ -2072,7 +2071,7 @@ CONSIDER: get this from CodeDom Graphics Interchange Format - Formato de intercâmbio de gráficos + Graphics Interchange Format # File dialog filters # # E.g., for icons, the actual filter created would look like "Icons (*.ico)". These resources diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf index 2b5303d91d..355d363084 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf @@ -1828,9 +1828,8 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size - # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf index 73a72b806a..86ac32f4b3 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf @@ -1828,9 +1828,8 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size - # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf index 474f99a3dc..0537632d5f 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf @@ -1828,9 +1828,8 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size - # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf index 16b7339b2a..17c64ffefb 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf @@ -1828,9 +1828,8 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size - # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/WCF.de.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/WCF.de.xlf index 584143c811..1b8578d6fe 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/WCF.de.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/WCF.de.xlf @@ -9,7 +9,7 @@ Unable to find a code generator (CodeDomProvider). - Code-Generator (CodeDomProvider) kann nicht gefunden werden. + Es wurde kein Code-Generator (CodeDomProvider) gefunden. @@ -259,7 +259,7 @@ The requested operation is not valid while an asynchronous operation is in progress. - Der angeforderte Vorgang ist unzulässig, während ein asynchroner Vorgang läuft. + Der angeforderte Vorgang ist unzulässig, während ein asynchroner Vorgang ausgeführt wird. diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/WCF.ja.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/WCF.ja.xlf index 76999ca3e0..def3cf2048 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/WCF.ja.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/WCF.ja.xlf @@ -279,7 +279,7 @@ The file is already opened in an incompatible editor. - ファイルは、互換性のないエディターで既に開かれています。 + ファイルが、互換性のないエディターで既に開かれています。 diff --git a/vsintegration/src/FSharp.VS.FSI/xlf/Properties.de.xlf b/vsintegration/src/FSharp.VS.FSI/xlf/Properties.de.xlf index 7178a91c60..989b2031fe 100644 --- a/vsintegration/src/FSharp.VS.FSI/xlf/Properties.de.xlf +++ b/vsintegration/src/FSharp.VS.FSI/xlf/Properties.de.xlf @@ -24,7 +24,7 @@ Misc - Verschiedenes + Verschiedene diff --git a/vsintegration/src/FSharp.VS.FSI/xlf/Properties.pt-BR.xlf b/vsintegration/src/FSharp.VS.FSI/xlf/Properties.pt-BR.xlf index b3f7cfc54a..6099d3d9fd 100644 --- a/vsintegration/src/FSharp.VS.FSI/xlf/Properties.pt-BR.xlf +++ b/vsintegration/src/FSharp.VS.FSI/xlf/Properties.pt-BR.xlf @@ -4,17 +4,17 @@ 64-bit F# Interactive - F# Interative de 64 bits + F# Interativo de 64 bits If set to true, and the current machine is 64-bit, then run F# Interactive as a 64-bit process. (Otherwise, F# Interactive is a 32-bit process.) - Se estiver definido como true, e o computador atual for 64 bits, execute o F# Interactive como um processo de 64 bits. (Caso contrário, o F# Interactive será um processo de 32 bits.) + Se estiver definido como true, e o computador atual for 64 bits, execute o F# Interativo como um processo de 64 bits. (Caso contrário, o F# Interactive será um processo de 32 bits.) F# Interactive options - Opções interativas F# + Opções do F# Interativo @@ -34,7 +34,7 @@ Prevents referenced assemblies from being locked by the F# Interactive process. - Impede que os assemblies referenciados sejam bloqueados pelo processo de F# interativo. + Impede que os assemblies referenciados sejam bloqueados pelo processo do F# Interativo. diff --git a/vsintegration/src/FSharp.VS.FSI/xlf/Properties.zh-Hant.xlf b/vsintegration/src/FSharp.VS.FSI/xlf/Properties.zh-Hant.xlf index 3b60c892d4..dd4f7af326 100644 --- a/vsintegration/src/FSharp.VS.FSI/xlf/Properties.zh-Hant.xlf +++ b/vsintegration/src/FSharp.VS.FSI/xlf/Properties.zh-Hant.xlf @@ -4,7 +4,7 @@ 64-bit F# Interactive - 64 位元 F# Interactive + 64 位元 F# 互動 @@ -19,7 +19,7 @@ Additional command line arguments passed to the F# Interactive executable by Visual Studio. (optimization and debug flags are ignored if script debugging is enabled) - 由 Visual Studio 額外傳遞給 F# Interactive 可執行檔的命令列引數。(若啟用指令碼偵錯,則會忽略最佳化及偵錯旗標) + 由 Visual Studio 額外傳遞給 F# 互動可執行檔的命令列引數。(若啟用指令碼偵錯,則會忽略最佳化及偵錯旗標) @@ -34,7 +34,7 @@ Prevents referenced assemblies from being locked by the F# Interactive process. - 避免參考的組件遭 F# 互動式處理序封鎖。 + 避免參考的組件遭 F# 互動處理序封鎖。 diff --git a/vsintegration/src/FSharp.VS.FSI/xlf/VFSIstrings.txt.pt-BR.xlf b/vsintegration/src/FSharp.VS.FSI/xlf/VFSIstrings.txt.pt-BR.xlf index e8cc3f22c7..a3d2f3edb3 100644 --- a/vsintegration/src/FSharp.VS.FSI/xlf/VFSIstrings.txt.pt-BR.xlf +++ b/vsintegration/src/FSharp.VS.FSI/xlf/VFSIstrings.txt.pt-BR.xlf @@ -34,7 +34,7 @@ Could not find fsi.exe, the F# Interactive executable.\nThis file does not exist:\n\n{0}\n - Não foi possível encontrar fsi.exe, o Executável interativo F#.\nEste arquivo não existe:\n\n{0}\n + Não foi possível encontrar fsi.exe, o executável do F# Interativo.\nEste arquivo não existe:\n\n{0}\n diff --git a/vsintegration/src/FSharp.VS.FSI/xlf/VFSIstrings.txt.zh-Hant.xlf b/vsintegration/src/FSharp.VS.FSI/xlf/VFSIstrings.txt.zh-Hant.xlf index b891d6630c..ba06ff3281 100644 --- a/vsintegration/src/FSharp.VS.FSI/xlf/VFSIstrings.txt.zh-Hant.xlf +++ b/vsintegration/src/FSharp.VS.FSI/xlf/VFSIstrings.txt.zh-Hant.xlf @@ -29,12 +29,12 @@ F# Interactive - F# Interactive + F# 互動 Could not find fsi.exe, the F# Interactive executable.\nThis file does not exist:\n\n{0}\n - 找不到 F# Interactive 可執行檔 fsi.exe。\n這個檔案不存在:\n\n{0}\n + 找不到 F# 互動可執行檔 fsi.exe。\n這個檔案不存在:\n\n{0}\n From 2959506b3fbbda7c1760262e3c25b75de64c67c2 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Thu, 29 Aug 2019 14:45:40 -0700 Subject: [PATCH 222/286] update package feed url (#7468) --- NuGet.config | 11 ++++++++--- eng/Versions.props | 5 ++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/NuGet.config b/NuGet.config index a8664a73c5..9acafaa472 100644 --- a/NuGet.config +++ b/NuGet.config @@ -18,10 +18,15 @@ - - + + - + + + + + + diff --git a/eng/Versions.props b/eng/Versions.props index aad596af86..8efcedaa53 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -59,10 +59,9 @@ https://dotnet.myget.org/F/interactive-window/api/v3/index.json; https://myget.org/F/vs-devcore/api/v3/index.json; https://myget.org/F/vs-editor/api/v3/index.json; - https://vside.myget.org/F/vssdk/api/v3/index.json; - https://vside.myget.org/F/vs-impl/api/v3/index.json; + https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json; + https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json; https://myget.org/F/roslyn_concord/api/v3/index.json; - https://vside.myget.org/F/devcore/api/v3/index.json; $([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)..\RoslynPackageVersion.txt').Trim()) From 0422ff293bb2cc722fe5021b85ef50378a9af823 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Wed, 4 Sep 2019 23:25:59 -0700 Subject: [PATCH 223/286] IMAGE_DEBUG_TYPE_CHECKSUMPDB version in pdb writer (#7443) (#7444) F# Compiler is emitting the incorrect minor version number for Debug Directory entry type #19 (PDB Checksum). This bug seems like either a copy/paste error or human error. 0x0100 is the correct minor version number for embedded pdb info, but 0 is the correct minor version number for pdb checksum as spec'd here: https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PE-COFF.md#pdb-checksum-debug-directory-entry-type-19 This issues causes the VS Debugger to ignore PDB Checksum entries in F# pdbs, which breaks NuGet.org Symbol Server scenarios for F#. --- src/absil/ilwritepdb.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index 86b7ee9224..90d53444e7 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -203,7 +203,7 @@ let pdbChecksumDebugInfo timestamp (checksumPdbChunk: BinaryChunk) (algorithmNam buffer { iddCharacteristics = 0 // Reserved iddMajorVersion = 1 // VersionMajor should be 1 - iddMinorVersion = 0x0100 // VersionMinor should be 0x0100 + iddMinorVersion = 0 // VersionMinor should be 0 iddType = 19 // IMAGE_DEBUG_TYPE_CHECKSUMPDB iddTimestamp = timestamp iddData = iddBuffer // Path name to the pdb file when built From 6798df354ea369f8435373d46cb403a30065ea3d Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Fri, 9 Aug 2019 19:53:39 -0700 Subject: [PATCH 224/286] pull all unit test assemblies from NuGet packages (#7378) --- eng/Versions.props | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eng/Versions.props b/eng/Versions.props index 4a8ca4fbc4..95e131a0c0 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -116,6 +116,8 @@ 16.1.89 1.1.4322 16.1.89 + 16.1.89 + 16.0.28226-alpha 16.1.28916.169 16.1.28917.181 16.1.3121 @@ -125,6 +127,7 @@ 8.0.50728 7.10.6071 16.1.28917.181 + 16.1.89 8.0.50728 16.0.201-pre-g7d366164d0 2.3.6152103 @@ -141,7 +144,9 @@ 10.0.30320 11.0.61031 12.0.30111 + 16.0.0 16.1.89 + 16.1.89 7.10.6071 8.0.50728 10.0.30320 From 48ec6824a85d57d95758e379b48498d25d0ab09b Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Tue, 20 Aug 2019 19:27:23 -0700 Subject: [PATCH 225/286] remove package restore hack and don't allow package fallback folders (#7430) --- NuGet.config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NuGet.config b/NuGet.config index df85afb048..1b0f596f07 100644 --- a/NuGet.config +++ b/NuGet.config @@ -32,4 +32,7 @@ + + + From ffc2d2fac3ded03684f129f248299d46340b0ef7 Mon Sep 17 00:00:00 2001 From: Grzegorz Dziadkiewicz Date: Wed, 21 Aug 2019 17:55:54 +0200 Subject: [PATCH 226/286] Fix #5729 (#6352) --- src/fsharp/FSharp.Core/prim-types.fs | 28 +++++++++++++--------------- src/fsharp/lex.fsl | 14 ++++++-------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index 2e91dec124..bfd5bdacc9 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -2395,13 +2395,11 @@ namespace Microsoft.FSharp.Core then p <- p + 1; -1L else 1L - let parseOctalUInt64 (s:string) p l = - let rec parse n acc = if n < l then parse (n+1) (acc *.. 8UL +.. (let c = s.Chars(n) in if c >=... '0' && c <=... '7' then Convert.ToUInt64(c) -.. Convert.ToUInt64('0') else formatError())) else acc in - parse p 0UL - - let parseBinaryUInt64 (s:string) p l = - let rec parse n acc = if n < l then parse (n+1) (acc *.. 2UL +.. (match s.Chars(n) with '0' -> 0UL | '1' -> 1UL | _ -> formatError())) else acc in - parse p 0UL + let parseBinaryUInt64 (s:string) = + Convert.ToUInt64(s, 2) + + let parseOctalUInt64 (s:string) = + Convert.ToUInt64(s, 8) let inline removeUnderscores (s:string) = match s with @@ -2418,8 +2416,8 @@ namespace Microsoft.FSharp.Core if p >= l then formatError() else match specifier with | 'x' -> UInt32.Parse( s.Substring(p), NumberStyles.AllowHexSpecifier,CultureInfo.InvariantCulture) - | 'b' -> Convert.ToUInt32(parseBinaryUInt64 s p l) - | 'o' -> Convert.ToUInt32(parseOctalUInt64 s p l) + | 'b' -> Convert.ToUInt32(parseBinaryUInt64 (s.Substring(p))) + | 'o' -> Convert.ToUInt32(parseOctalUInt64 (s.Substring(p))) | _ -> UInt32.Parse(s.Substring(p), NumberStyles.Integer, CultureInfo.InvariantCulture) in let inline int32OfUInt32 (x:uint32) = (# "" x : int32 #) @@ -2436,8 +2434,8 @@ namespace Microsoft.FSharp.Core if p >= l then formatError() else match Char.ToLowerInvariant(specifier) with | 'x' -> sign * (int32OfUInt32 (Convert.ToUInt32(UInt64.Parse(s.Substring(p), NumberStyles.AllowHexSpecifier,CultureInfo.InvariantCulture)))) - | 'b' -> sign * (int32OfUInt32 (Convert.ToUInt32(parseBinaryUInt64 s p l))) - | 'o' -> sign * (int32OfUInt32 (Convert.ToUInt32(parseOctalUInt64 s p l))) + | 'b' -> sign * (int32OfUInt32 (Convert.ToUInt32(parseBinaryUInt64 (s.Substring(p))))) + | 'o' -> sign * (int32OfUInt32 (Convert.ToUInt32(parseOctalUInt64 (s.Substring(p))))) | _ -> Int32.Parse(s, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture) let ParseInt64 (s:string) = @@ -2451,8 +2449,8 @@ namespace Microsoft.FSharp.Core if p >= l then formatError() else match Char.ToLowerInvariant(specifier) with | 'x' -> sign *. Int64.Parse(s.Substring(p), NumberStyles.AllowHexSpecifier,CultureInfo.InvariantCulture) - | 'b' -> sign *. (int64OfUInt64 (parseBinaryUInt64 s p l)) - | 'o' -> sign *. (int64OfUInt64 (parseOctalUInt64 s p l)) + | 'b' -> sign *. (int64OfUInt64 (parseBinaryUInt64 (s.Substring(p)))) + | 'o' -> sign *. (int64OfUInt64 (parseOctalUInt64 (s.Substring(p)))) | _ -> Int64.Parse(s, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture) let ParseUInt64 (s:string) : uint64 = @@ -2465,8 +2463,8 @@ namespace Microsoft.FSharp.Core if p >= l then formatError() else match specifier with | 'x' -> UInt64.Parse(s.Substring(p), NumberStyles.AllowHexSpecifier,CultureInfo.InvariantCulture) - | 'b' -> parseBinaryUInt64 s p l - | 'o' -> parseOctalUInt64 s p l + | 'b' -> parseBinaryUInt64 (s.Substring(p)) + | 'o' -> parseOctalUInt64 (s.Substring(p)) | _ -> UInt64.Parse(s.Substring(p), NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture) diff --git a/src/fsharp/lex.fsl b/src/fsharp/lex.fsl index c32c9a641b..a0d3f449c0 100755 --- a/src/fsharp/lex.fsl +++ b/src/fsharp/lex.fsl @@ -66,13 +66,11 @@ let get0OXB (s:string) (p:byref) l = let formatError() = raise (new System.FormatException(SR.GetString("bad format string"))) -let parseBinaryUInt64 (s:string) p l = - let rec parse n acc = if n < l then parse (n+1) (acc * 2UL + (match s.[n] with '0' -> 0UL | '1' -> 1UL | _ -> formatError())) else acc - parse p 0UL +let parseBinaryUInt64 (s:string) = + Convert.ToUInt64(s, 2) -let parseOctalUInt64 (s:string) p l = - let rec parse n acc = if n < l then parse (n+1) (acc * 8UL + (let c = s.[n] in if c >= '0' && c <= '7' then Convert.ToUInt64 c - Convert.ToUInt64 '0' else formatError())) else acc - parse p 0UL +let parseOctalUInt64 (s:string) = + Convert.ToUInt64(s, 8) let removeUnderscores (s:string) = match s with @@ -91,8 +89,8 @@ let parseInt32 (s:string) = match Char.ToLower(specifier,CultureInfo.InvariantCulture) with #endif | 'x' -> sign * (int32 (Convert.ToUInt32(UInt64.Parse(s.Substring(p), NumberStyles.AllowHexSpecifier,CultureInfo.InvariantCulture)))) - | 'b' -> sign * (int32 (Convert.ToUInt32(parseBinaryUInt64 s p l))) - | 'o' -> sign * (int32 (Convert.ToUInt32(parseOctalUInt64 s p l))) + | 'b' -> sign * (int32 (Convert.ToUInt32(parseBinaryUInt64 (s.Substring(p))))) + | 'o' -> sign * (int32 (Convert.ToUInt32(parseOctalUInt64 (s.Substring(p))))) | _ -> Int32.Parse(s, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture) let lexemeTrimRightToInt32 args lexbuf n = From 9e73d5ec54a4aa0846a97f10b2efd35c2340eafe Mon Sep 17 00:00:00 2001 From: dotnet-maestro <@dotnet-maestro> Date: Wed, 14 Aug 2019 13:19:12 +0000 Subject: [PATCH 227/286] Update dependencies from https://github.com/dotnet/arcade build 20190812.7 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19412.7 --- eng/Version.Details.xml | 4 +-- eng/common/performance/performance-setup.ps1 | 2 +- eng/common/performance/performance-setup.sh | 36 ++++++++++---------- global.json | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 848ec45335..e338fffe94 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - e2f5f0f5c20a1fef71845795b09066a5cd892a7e + 82c822ee7db08f5347e6ac44e3ed465248394a9e diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 index 7e5441f797..ac05256bfd 100644 --- a/eng/common/performance/performance-setup.ps1 +++ b/eng/common/performance/performance-setup.ps1 @@ -33,7 +33,7 @@ if ($Framework.StartsWith("netcoreapp")) { } if ($Internal) { - $Queue = "Windows.10.Amd64.ClientRS5.Perf" + $Queue = "Windows.10.Amd64.19H1.Tiger.Perf" $PerfLabArguments = "--upload-to-perflab-container" $ExtraBenchmarkDotNetArguments = "" $Creator = "" diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index 126da5f76d..dc6fd21871 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -132,7 +132,7 @@ if [[ "$internal" == true ]]; then if [[ "$architecture" = "arm64" ]]; then queue=Ubuntu.1804.Arm64.Perf else - queue=Ubuntu.1804.Amd64.Perf + queue=Ubuntu.1804.Amd64.Tiger.Perf fi fi @@ -157,20 +157,20 @@ if [[ "$use_core_run" = true ]]; then fi # Make sure all of our variables are available for future steps -echo "##vso[task.setvariable variable=UseCoreRun]$use_core_run" -echo "##vso[task.setvariable variable=Architecture]$architecture" -echo "##vso[task.setvariable variable=PayloadDirectory]$payload_directory" -echo "##vso[task.setvariable variable=PerformanceDirectory]$performance_directory" -echo "##vso[task.setvariable variable=WorkItemDirectory]$workitem_directory" -echo "##vso[task.setvariable variable=Queue]$queue" -echo "##vso[task.setvariable variable=SetupArguments]$setup_arguments" -echo "##vso[task.setvariable variable=Python]python3" -echo "##vso[task.setvariable variable=PerfLabArguments]$perflab_arguments" -echo "##vso[task.setvariable variable=ExtraBenchmarkDotNetArguments]$extra_benchmark_dotnet_arguments" -echo "##vso[task.setvariable variable=BDNCategories]$run_categories" -echo "##vso[task.setvariable variable=TargetCsproj]$csproj" -echo "##vso[task.setvariable variable=RunFromPerfRepo]$run_from_perf_repo" -echo "##vso[task.setvariable variable=Creator]$creator" -echo "##vso[task.setvariable variable=HelixSourcePrefix]$helix_source_prefix" -echo "##vso[task.setvariable variable=Kind]$kind" -echo "##vso[task.setvariable variable=_BuildConfig]$architecture.$kind.$framework" \ No newline at end of file +Write-PipelineSetVariable -name "UseCoreRun" -value "$use_core_run" -is_multi_job_variable false +Write-PipelineSetVariable -name "Architecture" -value "$architecture" -is_multi_job_variable false +Write-PipelineSetVariable -name "PayloadDirectory" -value "$payload_directory" -is_multi_job_variable false +Write-PipelineSetVariable -name "PerformanceDirectory" -value "$performance_directory" -is_multi_job_variable false +Write-PipelineSetVariable -name "WorkItemDirectory" -value "$workitem_directory" -is_multi_job_variable false +Write-PipelineSetVariable -name "Queue" -value "$queue" -is_multi_job_variable false +Write-PipelineSetVariable -name "SetupArguments" -value "$setup_arguments" -is_multi_job_variable false +Write-PipelineSetVariable -name "Python" -value "$python3" -is_multi_job_variable false +Write-PipelineSetVariable -name "PerfLabArguments" -value "$perflab_arguments" -is_multi_job_variable false +Write-PipelineSetVariable -name "ExtraBenchmarkDotNetArguments" -value "$extra_benchmark_dotnet_arguments" -is_multi_job_variable false +Write-PipelineSetVariable -name "BDNCategories" -value "$run_categories" -is_multi_job_variable false +Write-PipelineSetVariable -name "TargetCsproj" -value "$csproj" -is_multi_job_variable false +Write-PipelineSetVariable -name "RunFromPerfRepo" -value "$run_from_perf_repo" -is_multi_job_variable false +Write-PipelineSetVariable -name "Creator" -value "$creator" -is_multi_job_variable false +Write-PipelineSetVariable -name "HelixSourcePrefix" -value "$helix_source_prefix" -is_multi_job_variable false +Write-PipelineSetVariable -name "Kind" -value "$kind" -is_multi_job_variable false +Write-PipelineSetVariable -name "_BuildConfig" -value "$architecture.$kind.$framework" -is_multi_job_variable false \ No newline at end of file diff --git a/global.json b/global.json index 42b7fded08..ab3fa438c1 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19410.2", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19412.7", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From b6da3367d776a0e18307ab93b4f566a9e209eb8d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 16 Aug 2019 12:30:36 +0000 Subject: [PATCH 228/286] Update dependencies from https://github.com/dotnet/arcade build 20190815.27 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19415.27 --- eng/Version.Details.xml | 4 +-- eng/common/performance/performance-setup.ps1 | 2 +- eng/common/performance/performance-setup.sh | 7 ++++- eng/common/post-build/darc-gather-drop.ps1 | 10 +++++++ eng/common/post-build/dotnetsymbol-init.ps1 | 29 ------------------ eng/common/post-build/sourcelink-cli-init.ps1 | 29 ------------------ eng/common/sdl/execute-all-sdl-tools.ps1 | 4 +-- eng/common/sdl/run-sdl.ps1 | 30 +++++++------------ .../channels/internal-servicing.yml | 5 ++++ .../post-build/channels/netcore-dev-5.yml | 5 ++++ .../channels/netcore-tools-latest.yml | 5 ++++ .../channels/public-dev-release.yml | 5 ++++ .../post-build/channels/public-release.yml | 5 ++++ .../channels/public-validation-release.yml | 4 +++ .../templates/post-build/post-build.yml | 23 +++++++++++++- global.json | 2 +- 16 files changed, 84 insertions(+), 85 deletions(-) delete mode 100644 eng/common/post-build/dotnetsymbol-init.ps1 delete mode 100644 eng/common/post-build/sourcelink-cli-init.ps1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e338fffe94..56b636c4a3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 82c822ee7db08f5347e6ac44e3ed465248394a9e + 98d779a16826fd6ecda6d4d4fa8da7b556b9638f diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 index ac05256bfd..4a6706b638 100644 --- a/eng/common/performance/performance-setup.ps1 +++ b/eng/common/performance/performance-setup.ps1 @@ -2,7 +2,7 @@ Param( [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, [string] $CoreRootDirectory, [string] $Architecture="x64", - [string] $Framework="netcoreapp3.0", + [string] $Framework="netcoreapp5.0", [string] $CompilationMode="Tiered", [string] $Repository=$env:BUILD_REPOSITORY_NAME, [string] $Branch=$env:BUILD_SOURCEBRANCH, diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index dc6fd21871..76126b1f86 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -3,7 +3,7 @@ source_directory=$BUILD_SOURCESDIRECTORY core_root_directory= architecture=x64 -framework=netcoreapp3.0 +framework=netcoreapp5.0 compilation_mode=tiered repository=$BUILD_REPOSITORY_NAME branch=$BUILD_SOURCEBRANCH @@ -156,6 +156,11 @@ if [[ "$use_core_run" = true ]]; then mv $core_root_directory $new_core_root fi +ci=true + +_script_dir=$(pwd)/eng/common +. "$_script_dir/pipeline-logging-functions.sh" + # Make sure all of our variables are available for future steps Write-PipelineSetVariable -name "UseCoreRun" -value "$use_core_run" -is_multi_job_variable false Write-PipelineSetVariable -name "Architecture" -value "$architecture" -is_multi_job_variable false diff --git a/eng/common/post-build/darc-gather-drop.ps1 b/eng/common/post-build/darc-gather-drop.ps1 index 93a0bd8328..89854d3c1c 100644 --- a/eng/common/post-build/darc-gather-drop.ps1 +++ b/eng/common/post-build/darc-gather-drop.ps1 @@ -19,7 +19,17 @@ try { ExitWithExitCode $exitCode } + # For now, only use a dry run. + # Ideally we would change darc to enable a quick request that + # would check whether the file exists that you can download it, + # and that it won't conflict with other files. + # https://github.com/dotnet/arcade/issues/3674 + # Right now we can't remove continue-on-error because we ocassionally will have + # dependencies that have no associated builds (e.g. an old dependency). + # We need to add an option to baseline specific dependencies away, or add them manually + # to the BAR. darc gather-drop --non-shipping ` + --dry-run ` --continue-on-error ` --id $BarBuildId ` --output-dir $DropLocation ` diff --git a/eng/common/post-build/dotnetsymbol-init.ps1 b/eng/common/post-build/dotnetsymbol-init.ps1 deleted file mode 100644 index e7659b98c8..0000000000 --- a/eng/common/post-build/dotnetsymbol-init.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -param ( - $dotnetsymbolVersion = $null -) - -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 - -. $PSScriptRoot\..\tools.ps1 - -$verbosity = "minimal" - -function Installdotnetsymbol ($dotnetsymbolVersion) { - $dotnetsymbolPackageName = "dotnet-symbol" - - $dotnetRoot = InitializeDotNetCli -install:$true - $dotnet = "$dotnetRoot\dotnet.exe" - $toolList = & "$dotnet" tool list --global - - if (($toolList -like "*$dotnetsymbolPackageName*") -and ($toolList -like "*$dotnetsymbolVersion*")) { - Write-Host "dotnet-symbol version $dotnetsymbolVersion is already installed." - } - else { - Write-Host "Installing dotnet-symbol version $dotnetsymbolVersion..." - Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." - & "$dotnet" tool install $dotnetsymbolPackageName --version $dotnetsymbolVersion --verbosity $verbosity --global - } -} - -Installdotnetsymbol $dotnetsymbolVersion diff --git a/eng/common/post-build/sourcelink-cli-init.ps1 b/eng/common/post-build/sourcelink-cli-init.ps1 deleted file mode 100644 index 9eaa25b3b5..0000000000 --- a/eng/common/post-build/sourcelink-cli-init.ps1 +++ /dev/null @@ -1,29 +0,0 @@ -param ( - $sourcelinkCliVersion = $null -) - -$ErrorActionPreference = "Stop" -Set-StrictMode -Version 2.0 - -. $PSScriptRoot\..\tools.ps1 - -$verbosity = "minimal" - -function InstallSourcelinkCli ($sourcelinkCliVersion) { - $sourcelinkCliPackageName = "sourcelink" - - $dotnetRoot = InitializeDotNetCli -install:$true - $dotnet = "$dotnetRoot\dotnet.exe" - $toolList = & "$dotnet" tool list --global - - if (($toolList -like "*$sourcelinkCliPackageName*") -and ($toolList -like "*$sourcelinkCliVersion*")) { - Write-Host "SourceLink CLI version $sourcelinkCliVersion is already installed." - } - else { - Write-Host "Installing SourceLink CLI version $sourcelinkCliVersion..." - Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." - & "$dotnet" tool install $sourcelinkCliPackageName --version $sourcelinkCliVersion --verbosity $verbosity --global - } -} - -InstallSourcelinkCli $sourcelinkCliVersion diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 index aab7589f2c..6d9bdcf72b 100644 --- a/eng/common/sdl/execute-all-sdl-tools.ps1 +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -86,8 +86,8 @@ if ($TsaPublish) { if (-not $TsaRepositoryName) { $TsaRepositoryName = "$($Repository)-$($BranchName)" } - Write-Host "$guardianCliLocation tsa-publish --all-tools --repository-name `"$TsaRepositoryName`" --branch-name `"$TsaBranchName`" --build-number `"$BuildNumber`" --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $SourceDirectory --logger-level $GuardianLoggerLevel" - & $guardianCliLocation tsa-publish --all-tools --repository-name "$TsaRepositoryName" --branch-name "$TsaBranchName" --build-number "$BuildNumber" --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel + Write-Host "$guardianCliLocation tsa-publish --all-tools --repository-name `"$TsaRepositoryName`" --branch-name `"$TsaBranchName`" --build-number `"$BuildNumber`" --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel" + & $guardianCliLocation tsa-publish --all-tools --repository-name "$TsaRepositoryName" --branch-name "$TsaBranchName" --build-number "$BuildNumber" --onboard $True --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel if ($LASTEXITCODE -ne 0) { Write-Host "Guardian tsa-publish failed with exit code $LASTEXITCODE." exit $LASTEXITCODE diff --git a/eng/common/sdl/run-sdl.ps1 b/eng/common/sdl/run-sdl.ps1 index d7b8564458..b90c4399ba 100644 --- a/eng/common/sdl/run-sdl.ps1 +++ b/eng/common/sdl/run-sdl.ps1 @@ -25,19 +25,19 @@ if ($ValidPath -eq $False) exit 1 } +$configParam = @("--config") + foreach ($tool in $ToolsList) { $gdnConfigFile = Join-Path $gdnConfigPath "$tool-configure.gdnconfig" - $config = $False Write-Host $tool # We have to manually configure tools that run on source to look at the source directory only if ($tool -eq "credscan") { - Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory : $TargetDirectory `" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams})" - & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory : $TargetDirectory " $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams}) + Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory : $TargetDirectory `" `" OutputType : pre `" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams})" + & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory : $TargetDirectory " "OutputType : pre" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams}) if ($LASTEXITCODE -ne 0) { Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." exit $LASTEXITCODE } - $config = $True } if ($tool -eq "policheck") { Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target : $TargetDirectory `" $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams})" @@ -46,22 +46,14 @@ foreach ($tool in $ToolsList) { Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." exit $LASTEXITCODE } - $config = $True } - Write-Host "$GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel --config $gdnConfigFile $config" - if ($config) { - & $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel --config $gdnConfigFile - if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian run for $tool using $gdnConfigFile failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE - } - } else { - & $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel - if ($LASTEXITCODE -ne 0) { - Write-Host "Guardian run for $tool failed with exit code $LASTEXITCODE." - exit $LASTEXITCODE - } - } + $configParam+=$gdnConfigFile } +Write-Host "$GuardianCliLocation run --working-directory $WorkingDirectory --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel $configParam" +& $GuardianCliLocation run --working-directory $WorkingDirectory --tool $tool --baseline mainbaseline --update-baseline $UpdateBaseline --logger-level $GuardianLoggerLevel $configParam +if ($LASTEXITCODE -ne 0) { + Write-Host "Guardian run for $ToolsList using $configParam failed with exit code $LASTEXITCODE." + exit $LASTEXITCODE +} \ No newline at end of file diff --git a/eng/common/templates/post-build/channels/internal-servicing.yml b/eng/common/templates/post-build/channels/internal-servicing.yml index dc065ab308..348a67e8ad 100644 --- a/eng/common/templates/post-build/channels/internal-servicing.yml +++ b/eng/common/templates/post-build/channels/internal-servicing.yml @@ -1,5 +1,7 @@ parameters: enableSymbolValidation: true + symbolPublishingAdditionalParameters: '' + artifactsPublishingAdditionalParameters: '' stages: - stage: IS_Publish @@ -34,7 +36,9 @@ stages: /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' /p:Configuration=Release + ${{ parameters.symbolPublishingAdditionalParameters }} - job: publish_assets displayName: Publish Assets @@ -92,6 +96,7 @@ stages: /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' /p:Configuration=Release + ${{ parameters.artifactsPublishingAdditionalParameters }} - task: NuGetCommand@2 displayName: Publish Packages to AzDO Feed diff --git a/eng/common/templates/post-build/channels/netcore-dev-5.yml b/eng/common/templates/post-build/channels/netcore-dev-5.yml index f2b0cfb269..764c47fc1c 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-5.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-5.yml @@ -1,5 +1,7 @@ parameters: enableSymbolValidation: true + symbolPublishingAdditionalParameters: '' + artifactsPublishingAdditionalParameters: '' stages: - stage: NetCore_Dev5_Publish @@ -34,7 +36,9 @@ stages: /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' /p:Configuration=Release + ${{ parameters.symbolPublishingAdditionalParameters }} - job: displayName: Publish Assets @@ -92,6 +96,7 @@ stages: /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release + ${{ parameters.artifactsPublishingAdditionalParameters }} - task: NuGetCommand@2 displayName: Publish Packages to AzDO Feed diff --git a/eng/common/templates/post-build/channels/netcore-tools-latest.yml b/eng/common/templates/post-build/channels/netcore-tools-latest.yml index fd6c09b227..7cf6740d79 100644 --- a/eng/common/templates/post-build/channels/netcore-tools-latest.yml +++ b/eng/common/templates/post-build/channels/netcore-tools-latest.yml @@ -1,5 +1,7 @@ parameters: enableSymbolValidation: true + symbolPublishingAdditionalParameters: '' + artifactsPublishingAdditionalParameters: '' stages: - stage: NetCore_Tools_Latest_Publish @@ -34,7 +36,9 @@ stages: /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' /p:Configuration=Release + ${{ parameters.symbolPublishingAdditionalParameters }} - job: displayName: Publish Assets @@ -92,6 +96,7 @@ stages: /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release + ${{ parameters.artifactsPublishingAdditionalParameters }} - task: NuGetCommand@2 displayName: Publish Packages to AzDO Feed diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml index 771dcf4ef8..28d764d527 100644 --- a/eng/common/templates/post-build/channels/public-dev-release.yml +++ b/eng/common/templates/post-build/channels/public-dev-release.yml @@ -1,5 +1,7 @@ parameters: enableSymbolValidation: true + symbolPublishingAdditionalParameters: '' + artifactsPublishingAdditionalParameters: '' stages: - stage: Publish @@ -34,7 +36,9 @@ stages: /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' /p:Configuration=Release + ${{ parameters.symbolPublishingAdditionalParameters }} - job: displayName: Publish Assets @@ -92,6 +96,7 @@ stages: /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release + ${{ parameters.artifactsPublishingAdditionalParameters }} - task: NuGetCommand@2 displayName: Publish Packages to AzDO Feed diff --git a/eng/common/templates/post-build/channels/public-release.yml b/eng/common/templates/post-build/channels/public-release.yml index 00108bd3f8..4543e64911 100644 --- a/eng/common/templates/post-build/channels/public-release.yml +++ b/eng/common/templates/post-build/channels/public-release.yml @@ -1,5 +1,7 @@ parameters: enableSymbolValidation: true + symbolPublishingAdditionalParameters: '' + artifactsPublishingAdditionalParameters: '' stages: - stage: PubRel_Publish @@ -34,7 +36,9 @@ stages: /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' /p:Configuration=Release + ${{ parameters.symbolPublishingAdditionalParameters }} - job: publish_assets displayName: Publish Assets @@ -92,6 +96,7 @@ stages: /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' /p:Configuration=Release + ${{ parameters.artifactsPublishingAdditionalParameters }} - task: NuGetCommand@2 displayName: Publish Packages to AzDO Feed diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index f64184da9f..c62831095b 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -1,3 +1,6 @@ +parameters: + artifactsPublishingAdditionalParameters: '' + stages: - stage: PVR_Publish dependsOn: validate @@ -63,6 +66,7 @@ stages: /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' /p:Configuration=Release + ${{ parameters.artifactsPublishingAdditionalParameters }} - task: NuGetCommand@2 displayName: Publish Packages to AzDO Feed diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index aba0b0fcaf..e6b75088c9 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -7,6 +7,12 @@ parameters: enable: false params: '' + # These parameters let the user customize the call to sdk-task.ps1 for publishing + # symbols & general artifacts as well as for signing validation + symbolPublishingAdditionalParameters: '' + artifactsPublishingAdditionalParameters: '' + signingValidationAdditionalParameters: '' + # Which stages should finish execution before post-build stages start dependsOn: [build] @@ -53,7 +59,8 @@ stages: arguments: -task SigningValidation -restore -msbuildEngine dotnet /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts' /p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt' - /p:Configuration=Release + /p:Configuration=Release + ${{ parameters.signingValidationAdditionalParameters }} - ${{ if eq(parameters.enableSourceLinkValidation, 'true') }}: - job: @@ -87,17 +94,31 @@ stages: - template: \eng\common\templates\post-build\channels\netcore-dev-5.yml parameters: enableSymbolValidation: ${{ parameters.enableSymbolValidation }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\public-dev-release.yml parameters: enableSymbolValidation: ${{ parameters.enableSymbolValidation }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\netcore-tools-latest.yml parameters: enableSymbolValidation: ${{ parameters.enableSymbolValidation }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\public-validation-release.yml + parameters: + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\public-release.yml + parameters: + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\internal-servicing.yml + parameters: + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} diff --git a/global.json b/global.json index ab3fa438c1..664bbbf15e 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19412.7", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19415.27", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From d93aac6d2780bedc600a7607eb160377246e816d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 17 Aug 2019 12:30:51 +0000 Subject: [PATCH 229/286] Update dependencies from https://github.com/dotnet/arcade build 20190816.16 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19416.16 --- eng/Version.Details.xml | 4 ++-- .../post-build/channels/internal-servicing.yml | 12 +++++++++--- .../templates/post-build/channels/netcore-dev-5.yml | 12 +++++++++--- .../post-build/channels/netcore-tools-latest.yml | 12 +++++++++--- .../post-build/channels/public-dev-release.yml | 12 +++++++++--- .../templates/post-build/channels/public-release.yml | 12 +++++++++--- global.json | 2 +- 7 files changed, 48 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 56b636c4a3..34abd7a59b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 98d779a16826fd6ecda6d4d4fa8da7b556b9638f + 0e36c2410b72166a1b9a67142e652225e22feada diff --git a/eng/common/templates/post-build/channels/internal-servicing.yml b/eng/common/templates/post-build/channels/internal-servicing.yml index 348a67e8ad..4ca36358d9 100644 --- a/eng/common/templates/post-build/channels/internal-servicing.yml +++ b/eng/common/templates/post-build/channels/internal-servicing.yml @@ -22,10 +22,16 @@ stages: vmImage: 'windows-2019' steps: - task: DownloadBuildArtifacts@0 - displayName: Download Artifacts + displayName: Download Blob Artifacts + inputs: + artifactName: 'BlobArtifacts' + continueOnError: true + + - task: DownloadBuildArtifacts@0 + displayName: Download PDB Artifacts inputs: - downloadType: specific files - matchingPattern: "*Artifacts*" + artifactName: 'PDBArtifacts' + continueOnError: true - task: PowerShell@2 displayName: Publish diff --git a/eng/common/templates/post-build/channels/netcore-dev-5.yml b/eng/common/templates/post-build/channels/netcore-dev-5.yml index 764c47fc1c..dab3a10e57 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-5.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-5.yml @@ -22,10 +22,16 @@ stages: vmImage: 'windows-2019' steps: - task: DownloadBuildArtifacts@0 - displayName: Download Artifacts + displayName: Download Blob Artifacts + inputs: + artifactName: 'BlobArtifacts' + continueOnError: true + + - task: DownloadBuildArtifacts@0 + displayName: Download PDB Artifacts inputs: - downloadType: specific files - matchingPattern: "*Artifacts*" + artifactName: 'PDBArtifacts' + continueOnError: true - task: PowerShell@2 displayName: Publish diff --git a/eng/common/templates/post-build/channels/netcore-tools-latest.yml b/eng/common/templates/post-build/channels/netcore-tools-latest.yml index 7cf6740d79..982ee00627 100644 --- a/eng/common/templates/post-build/channels/netcore-tools-latest.yml +++ b/eng/common/templates/post-build/channels/netcore-tools-latest.yml @@ -22,10 +22,16 @@ stages: vmImage: 'windows-2019' steps: - task: DownloadBuildArtifacts@0 - displayName: Download Artifacts + displayName: Download Blob Artifacts + inputs: + artifactName: 'BlobArtifacts' + continueOnError: true + + - task: DownloadBuildArtifacts@0 + displayName: Download PDB Artifacts inputs: - downloadType: specific files - matchingPattern: "*Artifacts*" + artifactName: 'PDBArtifacts' + continueOnError: true - task: PowerShell@2 displayName: Publish diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml index 28d764d527..36b2818558 100644 --- a/eng/common/templates/post-build/channels/public-dev-release.yml +++ b/eng/common/templates/post-build/channels/public-dev-release.yml @@ -22,10 +22,16 @@ stages: vmImage: 'windows-2019' steps: - task: DownloadBuildArtifacts@0 - displayName: Download Artifacts + displayName: Download Blob Artifacts + inputs: + artifactName: 'BlobArtifacts' + continueOnError: true + + - task: DownloadBuildArtifacts@0 + displayName: Download PDB Artifacts inputs: - downloadType: specific files - matchingPattern: "*Artifacts*" + artifactName: 'PDBArtifacts' + continueOnError: true - task: PowerShell@2 displayName: Publish diff --git a/eng/common/templates/post-build/channels/public-release.yml b/eng/common/templates/post-build/channels/public-release.yml index 4543e64911..5dcd9a8c41 100644 --- a/eng/common/templates/post-build/channels/public-release.yml +++ b/eng/common/templates/post-build/channels/public-release.yml @@ -22,10 +22,16 @@ stages: vmImage: 'windows-2019' steps: - task: DownloadBuildArtifacts@0 - displayName: Download Artifacts + displayName: Download Blob Artifacts + inputs: + artifactName: 'BlobArtifacts' + continueOnError: true + + - task: DownloadBuildArtifacts@0 + displayName: Download PDB Artifacts inputs: - downloadType: specific files - matchingPattern: "*Artifacts*" + artifactName: 'PDBArtifacts' + continueOnError: true - task: PowerShell@2 displayName: Publish diff --git a/global.json b/global.json index 664bbbf15e..cfe0df430e 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19415.27", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19416.16", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From e2fbfeb04d31b3f3f70484cea4211b8ae3f0866b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 20 Aug 2019 12:28:40 +0000 Subject: [PATCH 230/286] Update dependencies from https://github.com/dotnet/arcade build 20190819.12 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19419.12 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 34abd7a59b..bceba6fdaa 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 0e36c2410b72166a1b9a67142e652225e22feada + 10b2260aeed5f07582bf8d8dcd4221a447b171c5 diff --git a/global.json b/global.json index cfe0df430e..d89f5408ec 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19416.16", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19419.12", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 2cb4d5d6387d8c31a58f10ee7ce7eb65fba28b65 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 21 Aug 2019 12:33:30 +0000 Subject: [PATCH 231/286] Update dependencies from https://github.com/dotnet/arcade build 20190820.8 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19420.8 --- eng/Version.Details.xml | 4 +- .../post-build/sourcelink-validation.ps1 | 82 +++++++++++++------ .../post-build/channels/netcore-dev-5.yml | 8 +- .../channels/netcore-tools-latest.yml | 8 +- .../channels/public-dev-release.yml | 6 ++ .../post-build/channels/public-release.yml | 1 + .../channels/public-validation-release.yml | 8 +- .../templates/post-build/common-variables.yml | 7 ++ .../templates/post-build/post-build.yml | 6 ++ global.json | 2 +- 10 files changed, 100 insertions(+), 32 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index bceba6fdaa..9e5319ccd5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 10b2260aeed5f07582bf8d8dcd4221a447b171c5 + fa168dd690798a683ef0d1e65d60ce5d6918d987 diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 index 41e01ae6e6..428e8c9607 100644 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -1,8 +1,8 @@ param( [Parameter(Mandatory=$true)][string] $InputPath, # Full path to directory where Symbols.NuGet packages to be checked are stored [Parameter(Mandatory=$true)][string] $ExtractPath, # Full path to directory where the packages will be extracted during validation - [Parameter(Mandatory=$true)][string] $GHRepoName, # GitHub name of the repo including the Org. E.g., dotnet/arcade - [Parameter(Mandatory=$true)][string] $GHCommit, # GitHub commit SHA used to build the packages + [Parameter(Mandatory=$false)][string] $GHRepoName, # GitHub name of the repo including the Org. E.g., dotnet/arcade + [Parameter(Mandatory=$false)][string] $GHCommit, # GitHub commit SHA used to build the packages [Parameter(Mandatory=$true)][string] $SourcelinkCliVersion # Version of SourceLink CLI to use ) @@ -13,6 +13,12 @@ param( # all files present in the repo at a specific commit point. $global:RepoFiles = @{} +# Maximum number of jobs to run in parallel +$MaxParallelJobs = 6 + +# Wait time between check for system load +$SecondsBetweenLoadChecks = 10 + $ValidatePackage = { param( [string] $PackagePath # Full path to a Symbols.NuGet package @@ -22,8 +28,8 @@ $ValidatePackage = { # Ensure input file exist if (!(Test-Path $PackagePath)) { - Write-PipelineTaskError "Input file does not exist: $PackagePath" - ExitWithExitCode 1 + Write-Host "Input file does not exist: $PackagePath" + return 1 } # Extensions for which we'll look for SourceLink information @@ -38,7 +44,7 @@ $ValidatePackage = { Add-Type -AssemblyName System.IO.Compression.FileSystem - [System.IO.Directory]::CreateDirectory($ExtractPath); + [System.IO.Directory]::CreateDirectory($ExtractPath) | Out-Null try { $zip = [System.IO.Compression.ZipFile]::OpenRead($PackagePath) @@ -138,16 +144,18 @@ $ValidatePackage = { if ($FailedFiles -eq 0) { Write-Host "Passed." + return 0 } else { - Write-PipelineTaskError "$PackagePath has broken SourceLink links." + Write-Host "$PackagePath has broken SourceLink links." + return 1 } } function ValidateSourceLinkLinks { - if (!($GHRepoName -Match "^[^\s\/]+/[^\s\/]+$")) { + if ($GHRepoName -ne "" -and !($GHRepoName -Match "^[^\s\/]+/[^\s\/]+$")) { if (!($GHRepoName -Match "^[^\s-]+-[^\s]+$")) { - Write-PipelineTaskError "GHRepoName should be in the format / or -" + Write-PipelineTaskError "GHRepoName should be in the format / or -. '$GHRepoName'" ExitWithExitCode 1 } else { @@ -155,30 +163,33 @@ function ValidateSourceLinkLinks { } } - if (!($GHCommit -Match "^[0-9a-fA-F]{40}$")) { - Write-PipelineTaskError "GHCommit should be a 40 chars hexadecimal string" + if ($GHCommit -ne "" -and !($GHCommit -Match "^[0-9a-fA-F]{40}$")) { + Write-PipelineTaskError "GHCommit should be a 40 chars hexadecimal string. '$GHCommit'" ExitWithExitCode 1 } - $RepoTreeURL = -Join("http://api.github.com/repos/", $GHRepoName, "/git/trees/", $GHCommit, "?recursive=1") - $CodeExtensions = @(".cs", ".vb", ".fs", ".fsi", ".fsx", ".fsscript") + if ($GHRepoName -ne "" -and $GHCommit -ne "") { + $RepoTreeURL = -Join("http://api.github.com/repos/", $GHRepoName, "/git/trees/", $GHCommit, "?recursive=1") + $CodeExtensions = @(".cs", ".vb", ".fs", ".fsi", ".fsx", ".fsscript") - try { - # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash - $Data = Invoke-WebRequest $RepoTreeURL -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty tree + try { + # Retrieve the list of files in the repo at that particular commit point and store them in the RepoFiles hash + $Data = Invoke-WebRequest $RepoTreeURL -UseBasicParsing | ConvertFrom-Json | Select-Object -ExpandProperty tree - foreach ($file in $Data) { - $Extension = [System.IO.Path]::GetExtension($file.path) + foreach ($file in $Data) { + $Extension = [System.IO.Path]::GetExtension($file.path) - if ($CodeExtensions.Contains($Extension)) { - $RepoFiles[$file.path] = 1 + if ($CodeExtensions.Contains($Extension)) { + $RepoFiles[$file.path] = 1 + } } } + catch { + Write-Host "Problems downloading the list of files from the repo. Url used: $RepoTreeURL . Execution will proceed without caching." + } } - catch { - Write-PipelineTaskError "Problems downloading the list of files from the repo. Url used: $RepoTreeURL" - Write-Host $_ - ExitWithExitCode 1 + elseif ($GHRepoName -ne "" -or $GHCommit -ne "") { + Write-Host "For using the http caching mechanism both GHRepoName and GHCommit should be informed." } if (Test-Path $ExtractPath) { @@ -186,14 +197,33 @@ function ValidateSourceLinkLinks { } # Process each NuGet package in parallel - $Jobs = @() Get-ChildItem "$InputPath\*.symbols.nupkg" | ForEach-Object { - $Jobs += Start-Job -ScriptBlock $ValidatePackage -ArgumentList $_.FullName + Start-Job -ScriptBlock $ValidatePackage -ArgumentList $_.FullName | Out-Null + $NumJobs = @(Get-Job -State 'Running').Count + + while ($NumJobs -ge $MaxParallelJobs) { + Write-Host "There are $NumJobs validation jobs running right now. Waiting $SecondsBetweenLoadChecks seconds to check again." + sleep $SecondsBetweenLoadChecks + $NumJobs = @(Get-Job -State 'Running').Count + } + + foreach ($Job in @(Get-Job -State 'Completed')) { + Receive-Job -Id $Job.Id + Remove-Job -Id $Job.Id + } } + $ValidationFailures = 0 foreach ($Job in $Jobs) { - Wait-Job -Id $Job.Id | Receive-Job + $jobResult = Wait-Job -Id $Job.Id | Receive-Job + if ($jobResult -ne "0") { + $ValidationFailures++ + } + } + if ($ValidationFailures -gt 0) { + Write-PipelineTaskError " $ValidationFailures package(s) failed validation." + ExitWithExitCode 1 } } diff --git a/eng/common/templates/post-build/channels/netcore-dev-5.yml b/eng/common/templates/post-build/channels/netcore-dev-5.yml index dab3a10e57..812def3154 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-5.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-5.yml @@ -2,6 +2,7 @@ parameters: enableSymbolValidation: true symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + publishInstallersAndChecksums: false stages: - stage: NetCore_Dev5_Publish @@ -101,7 +102,12 @@ stages: /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release + /p:Configuration=Release + /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) + /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) + /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} + /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) + /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) ${{ parameters.artifactsPublishingAdditionalParameters }} - task: NuGetCommand@2 diff --git a/eng/common/templates/post-build/channels/netcore-tools-latest.yml b/eng/common/templates/post-build/channels/netcore-tools-latest.yml index 982ee00627..c2d2076730 100644 --- a/eng/common/templates/post-build/channels/netcore-tools-latest.yml +++ b/eng/common/templates/post-build/channels/netcore-tools-latest.yml @@ -2,6 +2,7 @@ parameters: enableSymbolValidation: true symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + publishInstallersAndChecksums: false stages: - stage: NetCore_Tools_Latest_Publish @@ -101,7 +102,12 @@ stages: /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release + /p:Configuration=Release + /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) + /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} + /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) + /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) + /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) ${{ parameters.artifactsPublishingAdditionalParameters }} - task: NuGetCommand@2 diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/public-dev-release.yml index 36b2818558..afa9542148 100644 --- a/eng/common/templates/post-build/channels/public-dev-release.yml +++ b/eng/common/templates/post-build/channels/public-dev-release.yml @@ -2,6 +2,7 @@ parameters: enableSymbolValidation: true symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + publishInstallersAndChecksums: false stages: - stage: Publish @@ -102,6 +103,11 @@ stages: /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release + /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} + /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) + /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) + /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) + /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) ${{ parameters.artifactsPublishingAdditionalParameters }} - task: NuGetCommand@2 diff --git a/eng/common/templates/post-build/channels/public-release.yml b/eng/common/templates/post-build/channels/public-release.yml index 5dcd9a8c41..7ec1f89c08 100644 --- a/eng/common/templates/post-build/channels/public-release.yml +++ b/eng/common/templates/post-build/channels/public-release.yml @@ -90,6 +90,7 @@ stages: /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' /p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName) /p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1) /p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url) diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index c62831095b..12124d6215 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -1,5 +1,6 @@ parameters: artifactsPublishingAdditionalParameters: '' + publishInstallersAndChecksums: false stages: - stage: PVR_Publish @@ -65,7 +66,12 @@ stages: /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' - /p:Configuration=Release + /p:Configuration=Release + /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) + /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) + /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} + /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) + /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) ${{ parameters.artifactsPublishingAdditionalParameters }} - task: NuGetCommand@2 diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index 52a74487fd..b00d85d8ce 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -1,5 +1,6 @@ variables: - group: Publish-Build-Assets + - group: DotNet-DotNetCli-Storage # .NET Core 3 Dev - name: PublicDevRelease_30_Channel_Id @@ -45,3 +46,9 @@ variables: value: 3.0.0 - name: SymbolToolVersion value: 1.0.1 + + # Default locations for Installers and checksums + - name: ChecksumsBlobFeedUrl + value: https://dotnetcli.blob.core.windows.net/dotnet/index.json + - name: InstallersBlobFeedUrl + value: https://dotnetclichecksums.blob.core.windows.net/dotnet/index.json diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index e6b75088c9..3f239fae2b 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -3,6 +3,7 @@ parameters: enableSigningValidation: true enableSymbolValidation: true enableNugetValidation: true + publishInstallersAndChecksums: false SDLValidationParameters: enable: false params: '' @@ -85,6 +86,7 @@ stages: -GHRepoName $(Build.Repository.Name) -GHCommit $(Build.SourceVersion) -SourcelinkCliVersion $(SourceLinkCLIVersion) + continueOnError: true - ${{ if eq(parameters.SDLValidationParameters.enable, 'true') }}: - template: /eng/common/templates/job/execute-sdl.yml @@ -96,22 +98,26 @@ stages: enableSymbolValidation: ${{ parameters.enableSymbolValidation }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - template: \eng\common\templates\post-build\channels\public-dev-release.yml parameters: enableSymbolValidation: ${{ parameters.enableSymbolValidation }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - template: \eng\common\templates\post-build\channels\netcore-tools-latest.yml parameters: enableSymbolValidation: ${{ parameters.enableSymbolValidation }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - template: \eng\common\templates\post-build\channels\public-validation-release.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - template: \eng\common\templates\post-build\channels\public-release.yml parameters: diff --git a/global.json b/global.json index d89f5408ec..048c3a55cb 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19419.12", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19420.8", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 794e4abda60905f3dc44b5e25ad08f02ded7c1d1 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Fri, 23 Aug 2019 15:37:41 -0700 Subject: [PATCH 232/286] add FSharp.Compiler.Scripting (#7437) * add FSharp.Compiler.Scripting * allow evaluation of non-expressions * rename FSharp.Compiler.Scripting to FSharp.Compiler.Private.Scripting * remove unnecessary project reference --- eng/Build.ps1 | 2 ++ eng/build.sh | 1 + src/fsharp/fsi/fsi.fs | 3 +-- src/fsharp/fsi/fsi.fsi | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/eng/Build.ps1 b/eng/Build.ps1 index 75f0178b7d..1d64fc8460 100644 --- a/eng/Build.ps1 +++ b/eng/Build.ps1 @@ -337,6 +337,7 @@ try { if ($testDesktop -and -not $noVisualStudio) { TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $desktopTargetFramework TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.LanguageServer.UnitTests\FSharp.Compiler.LanguageServer.UnitTests.fsproj" -targetFramework $desktopTargetFramework + TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $desktopTargetFramework TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $desktopTargetFramework TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $desktopTargetFramework TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $desktopTargetFramework @@ -345,6 +346,7 @@ try { if ($testCoreClr) { TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $coreclrTargetFramework TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.LanguageServer.UnitTests\FSharp.Compiler.LanguageServer.UnitTests.fsproj" -targetFramework $coreclrTargetFramework + TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.Private.Scripting.UnitTests\FSharp.Compiler.Private.Scripting.UnitTests.fsproj" -targetFramework $coreclrTargetFramework TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Build.UnitTests\FSharp.Build.UnitTests.fsproj" -targetFramework $coreclrTargetFramework TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $coreclrTargetFramework TestUsingNUnit -testProject "$RepoRoot\tests\fsharp\FSharpSuite.Tests.fsproj" -targetFramework $coreclrTargetFramework diff --git a/eng/build.sh b/eng/build.sh index e806856c55..e7627f2bd4 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -272,6 +272,7 @@ if [[ "$test_core_clr" == true ]]; then coreclrtestframework=netcoreapp3.0 TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.UnitTests/FSharp.Compiler.UnitTests.fsproj" --targetframework $coreclrtestframework TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.LanguageServer.UnitTests/FSharp.Compiler.LanguageServer.UnitTests.fsproj" --targetframework $coreclrtestframework + TestUsingNUnit --testproject "$repo_root/tests/FSharp.Compiler.Private.Scripting.UnitTests/FSharp.Compiler.Private.Scripting.UnitTests.fsproj" --targetframework $coreclrtestframework TestUsingNUnit --testproject "$repo_root/tests/FSharp.Build.UnitTests/FSharp.Build.UnitTests.fsproj" --targetframework $coreclrtestframework TestUsingNUnit --testproject "$repo_root/tests/FSharp.Core.UnitTests/FSharp.Core.UnitTests.fsproj" --targetframework $coreclrtestframework fi diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index 02b26bf9af..d36f442e58 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -2709,9 +2709,8 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i let errorOptions = TcConfig.Create(tcConfigB,validate = false).errorSeverityOptions let errorLogger = CompilationErrorLogger("EvalInteraction", errorOptions) - fsiInteractionProcessor.EvalInteraction(ctok, sourceText, dummyScriptFileName, errorLogger) + fsiInteractionProcessor.EvalInteraction(ctok, sourceText, dummyScriptFileName, errorLogger) |> commitResultNonThrowing errorOptions "input.fsx" errorLogger - |> function Choice1Of2 (_), errs -> Choice1Of2 (), errs | Choice2Of2 exn, errs -> Choice2Of2 exn, errs member x.EvalScript(scriptPath) : unit = // Explanation: When the user of the FsiInteractiveSession object calls this method, the diff --git a/src/fsharp/fsi/fsi.fsi b/src/fsharp/fsi/fsi.fsi index 49c307b6cb..918afe85f9 100644 --- a/src/fsharp/fsi/fsi.fsi +++ b/src/fsharp/fsi/fsi.fsi @@ -149,7 +149,7 @@ type FsiEvaluationSession = /// /// Due to a current limitation, it is not fully thread-safe to run this operation concurrently with evaluation triggered /// by input from 'stdin'. - member EvalInteractionNonThrowing : code: string -> Choice * FSharpErrorInfo[] + member EvalInteractionNonThrowing : code: string -> Choice * FSharpErrorInfo[] /// Execute the given script. Stop on first error, discarding the rest /// of the script. Errors are sent to the output writer, a 'true' return value indicates there From 1e6fb85ee4c1258a05325df2d2af3bad3a0fc03d Mon Sep 17 00:00:00 2001 From: Chuck Ries Date: Fri, 23 Aug 2019 16:25:41 -0700 Subject: [PATCH 233/286] IMAGE_DEBUG_TYPE_CHECKSUMPDB version in pdb writer (#7443) F# Compiler is emitting the incorrect minor version number for Debug Directory entry type #19 (PDB Checksum). This bug seems like either a copy/paste error or human error. 0x0100 is the correct minor version number for embedded pdb info, but 0 is the correct minor version number for pdb checksum as spec'd here: https://github.com/dotnet/corefx/blob/master/src/System.Reflection.Metadata/specs/PE-COFF.md#pdb-checksum-debug-directory-entry-type-19 This issues causes the VS Debugger to ignore PDB Checksum entries in F# pdbs, which breaks NuGet.org Symbol Server scenarios for F#. --- src/absil/ilwritepdb.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index 86b7ee9224..90d53444e7 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -203,7 +203,7 @@ let pdbChecksumDebugInfo timestamp (checksumPdbChunk: BinaryChunk) (algorithmNam buffer { iddCharacteristics = 0 // Reserved iddMajorVersion = 1 // VersionMajor should be 1 - iddMinorVersion = 0x0100 // VersionMinor should be 0x0100 + iddMinorVersion = 0 // VersionMinor should be 0 iddType = 19 // IMAGE_DEBUG_TYPE_CHECKSUMPDB iddTimestamp = timestamp iddData = iddBuffer // Path name to the pdb file when built From d4155a6f66b31a7f2cc35ecf123814ea0c7037e6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 23 Aug 2019 22:12:29 -0700 Subject: [PATCH 234/286] [master] Update dependencies from dotnet/arcade (#7438) * Update dependencies from https://github.com/dotnet/arcade build 20190821.4 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19421.4 * Update dependencies from https://github.com/dotnet/arcade build 20190822.24 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19422.24 --- eng/Version.Details.xml | 4 +- eng/common/performance/perfhelixpublish.proj | 25 +++++++++++++ eng/common/performance/performance-setup.ps1 | 17 ++++++++- eng/common/performance/performance-setup.sh | 37 ++++++++++++++++++- .../post-build/sourcelink-validation.ps1 | 2 +- global.json | 2 +- 6 files changed, 81 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9e5319ccd5..e55a3460eb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - fa168dd690798a683ef0d1e65d60ce5d6918d987 + c7f03b2cf06bdfc64dad4140fd0d486127095cd8 diff --git a/eng/common/performance/perfhelixpublish.proj b/eng/common/performance/perfhelixpublish.proj index 05e5f09891..d07b1fa6e2 100644 --- a/eng/common/performance/perfhelixpublish.proj +++ b/eng/common/performance/perfhelixpublish.proj @@ -5,8 +5,14 @@ --dotnet-versions %DOTNET_VERSION% --cli-source-info args --cli-branch %PERFLAB_BRANCH% --cli-commit-sha %PERFLAB_HASH% --cli-repository https://github.com/%PERFLAB_REPO% --cli-source-timestamp %PERFLAB_BUILDTIMESTAMP% py -3 %HELIX_CORRELATION_PAYLOAD%\Core_Root\CoreRun.exe + %HELIX_CORRELATION_PAYLOAD%\Baseline_Core_Root\CoreRun.exe $(HelixPreCommands);call %HELIX_CORRELATION_PAYLOAD%\performance\tools\machine-setup.cmd %HELIX_CORRELATION_PAYLOAD%\artifacts\BenchmarkDotNet.Artifacts + %HELIX_CORRELATION_PAYLOAD%\artifacts\BenchmarkDotNet.Artifacts_Baseline + %HELIX_CORRELATION_PAYLOAD%\performance\src\tools\ResultsComparer\ResultsComparer.csproj + %HELIX_CORRELATION_PAYLOAD%\performance\tools\dotnet\$(Architecture)\dotnet.exe + %25%25 + %HELIX_WORKITEM_ROOT%\testResults.xml @@ -24,14 +30,24 @@ --dotnet-versions $DOTNET_VERSION --cli-source-info args --cli-branch $PERFLAB_BRANCH --cli-commit-sha $PERFLAB_HASH --cli-repository https://github.com/$PERFLAB_REPO --cli-source-timestamp $PERFLAB_BUILDTIMESTAMP python3 $(BaseDirectory)/Core_Root/corerun + $(BaseDirectory)/Baseline_Core_Root/corerun $(HelixPreCommands);chmod +x $(PerformanceDirectory)/tools/machine-setup.sh;. $(PerformanceDirectory)/tools/machine-setup.sh $(BaseDirectory)/artifacts/BenchmarkDotNet.Artifacts + $(BaseDirectory)/artifacts/BenchmarkDotNet.Artifacts_Baseline + $(PerformanceDirectory)/src/tools/ResultsComparer/ResultsComparer.csproj + $(PerformanceDirectory)/tools/dotnet/$(Architecture)/dotnet + %25 + $HELIX_WORKITEM_ROOT/testResults.xml --corerun $(CoreRun) + + --corerun $(BaselineCoreRun) + + $(Python) $(WorkItemCommand) --incremental no --architecture $(Architecture) -f $(_Framework) $(PerfLabArguments) @@ -57,20 +73,29 @@ + + false + + $(WorkItemDirectory) + $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(BaselineCoreRunArgument) --artifacts $(BaselineArtifactsDirectory) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --artifacts $(ArtifactsDirectory) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" + $(DotnetExe) run -f $(_Framework) -p $(ResultsComparer) --base $(BaselineArtifactsDirectory) --diff $(ArtifactsDirectory) --threshold 2$(Percent) --xml $(XMLResults);$(FinalCommand) 4:00 + $(WorkItemDirectory) + $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(BaselineCoreRunArgument) --artifacts $(ArtifactsDirectory)" $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --artifacts $(ArtifactsDirectory)" + $(DotnetExe) run -f $(_Framework) -p $(ResultsComparer) --base $(BaselineArtifactsDirectory) --diff $(ArtifactsDirectory) --threshold 2$(Percent) --xml $(XMLResults) 4:00 diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 index 4a6706b638..268986246e 100644 --- a/eng/common/performance/performance-setup.ps1 +++ b/eng/common/performance/performance-setup.ps1 @@ -1,6 +1,7 @@ Param( [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, [string] $CoreRootDirectory, + [string] $BaselineCoreRootDirectory, [string] $Architecture="x64", [string] $Framework="netcoreapp5.0", [string] $CompilationMode="Tiered", @@ -12,11 +13,13 @@ Param( [string] $Csproj="src\benchmarks\micro\MicroBenchmarks.csproj", [string] $Kind="micro", [switch] $Internal, + [switch] $Compare, [string] $Configurations="CompilationMode=$CompilationMode" ) $RunFromPerformanceRepo = ($Repository -eq "dotnet/performance") $UseCoreRun = ($CoreRootDirectory -ne [string]::Empty) +$UseBaselineCoreRun = ($BaselineCoreRootDirectory -ne [string]::Empty) $PayloadDirectory = (Join-Path $SourceDirectory "Payload") $PerformanceDirectory = (Join-Path $PayloadDirectory "performance") @@ -29,7 +32,13 @@ $HelixSourcePrefix = "pr" $Queue = "Windows.10.Amd64.ClientRS4.DevEx.15.8.Open" if ($Framework.StartsWith("netcoreapp")) { - $Queue = "Windows.10.Amd64.ClientRS4.Open" + $Queue = "Windows.10.Amd64.ClientRS5.Open" +} + +if ($Compare) { + $Queue = "Windows.10.Amd64.19H1.Tiger.Perf.Open" + $PerfLabArguments = "" + $ExtraBenchmarkDotNetArguments = "" } if ($Internal) { @@ -56,6 +65,10 @@ if ($UseCoreRun) { $NewCoreRoot = (Join-Path $PayloadDirectory "Core_Root") Move-Item -Path $CoreRootDirectory -Destination $NewCoreRoot } +if ($UseBaselineCoreRun) { + $NewBaselineCoreRoot = (Join-Path $PayloadDirectory "Baseline_Core_Root") + Move-Item -Path $BaselineCoreRootDirectory -Destination $NewBaselineCoreRoot +} $DocsDir = (Join-Path $PerformanceDirectory "docs") robocopy $DocsDir $WorkItemDirectory @@ -80,7 +93,9 @@ Write-PipelineSetVariable -Name 'TargetCsproj' -Value "$Csproj" -IsMultiJobVaria Write-PipelineSetVariable -Name 'Kind' -Value "$Kind" -IsMultiJobVariable $false Write-PipelineSetVariable -Name 'Architecture' -Value "$Architecture" -IsMultiJobVariable $false Write-PipelineSetVariable -Name 'UseCoreRun' -Value "$UseCoreRun" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'UseBaselineCoreRun' -Value "$UseBaselineCoreRun" -IsMultiJobVariable $false Write-PipelineSetVariable -Name 'RunFromPerfRepo' -Value "$RunFromPerformanceRepo" -IsMultiJobVariable $false +Write-PipelineSetVariable -Name 'Compare' -Value "$Compare" -IsMultiJobVariable $false # Helix Arguments Write-PipelineSetVariable -Name 'Creator' -Value "$Creator" -IsMultiJobVariable $false diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index 76126b1f86..550b3ebf18 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -2,6 +2,7 @@ source_directory=$BUILD_SOURCESDIRECTORY core_root_directory= +baseline_core_root_directory= architecture=x64 framework=netcoreapp5.0 compilation_mode=tiered @@ -10,12 +11,14 @@ branch=$BUILD_SOURCEBRANCH commit_sha=$BUILD_SOURCEVERSION build_number=$BUILD_BUILDNUMBER internal=false +compare=false kind="micro" run_categories="coreclr corefx" csproj="src\benchmarks\micro\MicroBenchmarks.csproj" configurations= run_from_perf_repo=false use_core_run=true +use_baseline_core_run=true while (($# > 0)); do lowerI="$(echo $1 | awk '{print tolower($0)}')" @@ -28,6 +31,10 @@ while (($# > 0)); do core_root_directory=$2 shift 2 ;; + --baselinecorerootdirectory) + baseline_core_root_directory=$2 + shift 2 + ;; --architecture) architecture=$2 shift 2 @@ -72,6 +79,10 @@ while (($# > 0)); do internal=true shift 1 ;; + --compare) + compare=true + shift 1 + ;; --configurations) configurations=$2 shift 2 @@ -114,6 +125,10 @@ if [ -z "$core_root_directory" ]; then use_core_run=false fi +if [ -z "$baseline_core_root_directory" ]; then + use_baseline_core_run=false +fi + payload_directory=$source_directory/Payload performance_directory=$payload_directory/performance workitem_directory=$source_directory/workitem @@ -123,6 +138,19 @@ queue=Ubuntu.1804.Amd64.Open creator=$BUILD_DEFINITIONNAME helix_source_prefix="pr" +if [[ "$compare" == true ]]; then + extra_benchmark_dotnet_arguments= + perflab_arguments= + + # No open queues for arm64 + if [[ "$architecture" = "arm64" ]]; then + echo "Compare not available for arm64" + exit 1 + fi + + queue=Ubuntu.1804.Amd64.Tiger.Perf.Open +fi + if [[ "$internal" == true ]]; then perflab_arguments="--upload-to-perflab-container" helix_source_prefix="official" @@ -156,6 +184,11 @@ if [[ "$use_core_run" = true ]]; then mv $core_root_directory $new_core_root fi +if [[ "$use_baseline_core_run" = true ]]; then + new_baseline_core_root=$payload_directory/Baseline_Core_Root + mv $baseline_core_root_directory $new_baseline_core_root +fi + ci=true _script_dir=$(pwd)/eng/common @@ -163,6 +196,7 @@ _script_dir=$(pwd)/eng/common # Make sure all of our variables are available for future steps Write-PipelineSetVariable -name "UseCoreRun" -value "$use_core_run" -is_multi_job_variable false +Write-PipelineSetVariable -name "UseBaselineCoreRun" -value "$use_baseline_core_run" -is_multi_job_variable false Write-PipelineSetVariable -name "Architecture" -value "$architecture" -is_multi_job_variable false Write-PipelineSetVariable -name "PayloadDirectory" -value "$payload_directory" -is_multi_job_variable false Write-PipelineSetVariable -name "PerformanceDirectory" -value "$performance_directory" -is_multi_job_variable false @@ -178,4 +212,5 @@ Write-PipelineSetVariable -name "RunFromPerfRepo" -value "$run_from_perf_repo" - Write-PipelineSetVariable -name "Creator" -value "$creator" -is_multi_job_variable false Write-PipelineSetVariable -name "HelixSourcePrefix" -value "$helix_source_prefix" -is_multi_job_variable false Write-PipelineSetVariable -name "Kind" -value "$kind" -is_multi_job_variable false -Write-PipelineSetVariable -name "_BuildConfig" -value "$architecture.$kind.$framework" -is_multi_job_variable false \ No newline at end of file +Write-PipelineSetVariable -name "_BuildConfig" -value "$architecture.$kind.$framework" -is_multi_job_variable false +Write-PipelineSetVariable -name "Compare" -value "$compare" -is_multi_job_variable false diff --git a/eng/common/post-build/sourcelink-validation.ps1 b/eng/common/post-build/sourcelink-validation.ps1 index 428e8c9607..bbfdacca13 100644 --- a/eng/common/post-build/sourcelink-validation.ps1 +++ b/eng/common/post-build/sourcelink-validation.ps1 @@ -215,7 +215,7 @@ function ValidateSourceLinkLinks { } $ValidationFailures = 0 - foreach ($Job in $Jobs) { + foreach ($Job in @(Get-Job)) { $jobResult = Wait-Job -Id $Job.Id | Receive-Job if ($jobResult -ne "0") { $ValidationFailures++ diff --git a/global.json b/global.json index 048c3a55cb..21be738930 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19420.8", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19422.24", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 5778a64743a48093ac198abab764d24f0fe123d0 Mon Sep 17 00:00:00 2001 From: jb Date: Sat, 24 Aug 2019 12:45:14 -0400 Subject: [PATCH 235/286] FCS Doc update - SourceText (#7446) * Fix typos * Add SourceText type conversion to FCS docs --- fcs/README.md | 2 +- fcs/docsrc/content/devnotes.md | 4 ++-- fcs/docsrc/content/editor.fsx | 9 +++++---- fcs/docsrc/content/interactive.fsx | 6 +++--- fcs/docsrc/content/project.fsx | 5 +++-- fcs/docsrc/content/symbols.fsx | 3 ++- fcs/docsrc/content/typedtree.fsx | 3 ++- fcs/docsrc/content/untypedtree.fsx | 10 +++++++--- 8 files changed, 25 insertions(+), 17 deletions(-) diff --git a/fcs/README.md b/fcs/README.md index b85678d58c..87fb90c2e7 100644 --- a/fcs/README.md +++ b/fcs/README.md @@ -99,5 +99,5 @@ FSharp.Compiler.Service is a somewhat awkward component. There are some things w 1. Remove the use of Paket and FAKE 1. Move all projects under fcs\... to new .NET SDK project file format 1. Drop the use of ``dotnet mergenupkg`` since we should be able to use cross targeting -1. Make FCS a DLL similar ot the rest of the build and make this an official component from Microsoft (signed etc.) +1. Make FCS a DLL similar to the rest of the build and make this an official component from Microsoft (signed etc.) 1. Replace FSharp.Compiler.Private by FSharp.Compiler.Service diff --git a/fcs/docsrc/content/devnotes.md b/fcs/docsrc/content/devnotes.md index d086b57796..7f80660f36 100644 --- a/fcs/docsrc/content/devnotes.md +++ b/fcs/docsrc/content/devnotes.md @@ -20,7 +20,7 @@ This repo should be _identical_ to 'fsharp' except: - No bootstrap or proto compiler is used - an installed F# compiler is assumed - Build script using FAKE that builds everything, produces NuGet package and - generates documentation, files for publising NuGet packages etc. + generates documentation, files for publishing NuGet packages etc. (following [F# project scaffold](https://github.com/fsprojects/FSharp.ProjectScaffold)) - Changes to compiler source code to expose new functionality; Changes to the @@ -30,7 +30,7 @@ This repo should be _identical_ to 'fsharp' except: - Additions to compiler source code which add new functionality to the compiler service API -If language or compiler addiitons are committed to `fsharp/fsharp`, they should be merged into +If language or compiler additions are committed to `fsharp/fsharp`, they should be merged into this repo and a new NuGet package released. ## Building and NuGet diff --git a/fcs/docsrc/content/editor.fsx b/fcs/docsrc/content/editor.fsx index b8af9d0117..b057e094d4 100644 --- a/fcs/docsrc/content/editor.fsx +++ b/fcs/docsrc/content/editor.fsx @@ -27,6 +27,7 @@ of `InteractiveChecker`: open System open FSharp.Compiler.SourceCodeServices +open FSharp.Compiler.Text // Create an interactive checker instance let checker = FSharpChecker.Create() @@ -53,7 +54,7 @@ let inputLines = input.Split('\n') let file = "/home/user/Test.fsx" let projOptions, errors = - checker.GetProjectOptionsFromScript(file, input) + checker.GetProjectOptionsFromScript(file, SourceText.ofString input) |> Async.RunSynchronously let parsingOptions, _errors = checker.GetParsingOptionsFromProjectOptions(projOptions) @@ -68,7 +69,7 @@ together. // Perform parsing let parseFileResults = - checker.ParseFile(file, input, parsingOptions) + checker.ParseFile(file, SourceText.ofString input, parsingOptions) |> Async.RunSynchronously (** Before we look at the interesting operations provided by `TypeCheckResults`, we @@ -78,7 +79,7 @@ result (but it may contain incorrectly "guessed" results). // Perform type checking let checkFileAnswer = - checker.CheckFileInProject(parseFileResults, file, 0, input, projOptions) + checker.CheckFileInProject(parseFileResults, file, 0, SourceText.ofString input, projOptions) |> Async.RunSynchronously (** @@ -86,7 +87,7 @@ Alternatively you can use `ParseAndCheckFileInProject` to check both in one step *) let parseResults2, checkFileAnswer2 = - checker.ParseAndCheckFileInProject(file, 0, input, projOptions) + checker.ParseAndCheckFileInProject(file, 0, SourceText.ofString input, projOptions) |> Async.RunSynchronously (** diff --git a/fcs/docsrc/content/interactive.fsx b/fcs/docsrc/content/interactive.fsx index 2854d4529e..656ae44a69 100644 --- a/fcs/docsrc/content/interactive.fsx +++ b/fcs/docsrc/content/interactive.fsx @@ -44,8 +44,8 @@ open System.IO open System.Text // Intialize output and input streams -let sbOut = new StringBuilder() -let sbErr = new StringBuilder() +let sbOut = StringBuilder() +let sbErr = StringBuilder() let inStream = new StringReader("") let outStream = new StringWriter(sbOut) let errStream = new StringWriter(sbErr) @@ -242,7 +242,7 @@ If you want your scripting code to be able to access the 'fsi' object, you shoul Normally the one fromm FSharp.Compiler.Interactive.Settings.dll is used. *) -let fsiConfig2 = FsiEvaluationSession.GetDefaultConfiguration(fsi) +let fsiConfig2 = FsiEvaluationSession.GetDefaultConfiguration(fsiSession) (** Collectible code generation diff --git a/fcs/docsrc/content/project.fsx b/fcs/docsrc/content/project.fsx index 72bf7993f4..015563a220 100644 --- a/fcs/docsrc/content/project.fsx +++ b/fcs/docsrc/content/project.fsx @@ -28,6 +28,7 @@ of `InteractiveChecker`: open System open System.Collections.Generic open FSharp.Compiler.SourceCodeServices +open FSharp.Compiler.Text // Create an interactive checker instance let checker = FSharpChecker.Create() @@ -220,7 +221,7 @@ in the project are still read from disk, unless you are using the [FileSystem AP *) let parseResults1, checkAnswer1 = - checker.ParseAndCheckFileInProject(Inputs.fileName1, 0, Inputs.fileSource1, projectOptions) + checker.ParseAndCheckFileInProject(Inputs.fileName1, 0, SourceText.ofString Inputs.fileSource1, projectOptions) |> Async.RunSynchronously let checkResults1 = @@ -229,7 +230,7 @@ let checkResults1 = | _ -> failwith "unexpected aborted" let parseResults2, checkAnswer2 = - checker.ParseAndCheckFileInProject(Inputs.fileName2, 0, Inputs.fileSource2, projectOptions) + checker.ParseAndCheckFileInProject(Inputs.fileName2, 0, SourceText.ofString Inputs.fileSource2, projectOptions) |> Async.RunSynchronously let checkResults2 = diff --git a/fcs/docsrc/content/symbols.fsx b/fcs/docsrc/content/symbols.fsx index 74701e8b73..c25f0d1c31 100644 --- a/fcs/docsrc/content/symbols.fsx +++ b/fcs/docsrc/content/symbols.fsx @@ -19,6 +19,7 @@ of `FSharpChecker`: open System open System.IO open FSharp.Compiler.SourceCodeServices +open FSharp.Compiler.Text // Create an interactive checker instance let checker = FSharpChecker.Create() @@ -72,7 +73,7 @@ type C() = member x.P = 1 """ let parseFileResults, checkFileResults = - parseAndTypeCheckSingleFile(file, input2) + parseAndTypeCheckSingleFile(file, SourceText.ofString input2) (** Now get the partial assembly signature for the code: diff --git a/fcs/docsrc/content/typedtree.fsx b/fcs/docsrc/content/typedtree.fsx index 500dc5fd24..f373cc2395 100644 --- a/fcs/docsrc/content/typedtree.fsx +++ b/fcs/docsrc/content/typedtree.fsx @@ -26,6 +26,7 @@ To use the interactive checker, reference `FSharp.Compiler.Service.dll` and open open System open System.IO open FSharp.Compiler.SourceCodeServices +open FSharp.Compiler.Text (** ### Checking code @@ -42,7 +43,7 @@ let parseAndCheckSingleFile (input) = File.WriteAllText(file, input) // Get context representing a stand-alone (script) file let projOptions, _errors = - checker.GetProjectOptionsFromScript(file, input) + checker.GetProjectOptionsFromScript(file, SourceText.ofString input) |> Async.RunSynchronously let fprojOptions, _ = projOptions diff --git a/fcs/docsrc/content/untypedtree.fsx b/fcs/docsrc/content/untypedtree.fsx index 959e14fb94..3cb4e80765 100644 --- a/fcs/docsrc/content/untypedtree.fsx +++ b/fcs/docsrc/content/untypedtree.fsx @@ -31,6 +31,7 @@ To use the interactive checker, reference `FSharp.Compiler.Service.dll` and open #r "FSharp.Compiler.Service.dll" open System open FSharp.Compiler.SourceCodeServices +open FSharp.Compiler.Text (** ### Performing untyped parse @@ -201,16 +202,19 @@ with location of the file. The location does not have to exist (it is used only information) and it can be in both Unix and Windows formats: *) // Sample input for the compiler service -let input = """ +let input = + """ let foo() = let msg = "Hello world" if true then - printfn "%s" msg """ + printfn "%s" msg + """ + // File name in Unix format let file = "/home/user/Test.fsx" // Get the AST of sample F# code -let tree = getUntypedTree(file, input) +let tree = getUntypedTree(file, SourceText.ofString input) (** When you run the code in F# interactive, you can enter `tree;;` in the interactive console and see pretty printed representation of the data structure - the tree contains a lot of information, From 33de8764f60488b9607ac0088471aad116a2e7db Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 24 Aug 2019 22:45:49 +0000 Subject: [PATCH 236/286] Update dependencies from https://github.com/dotnet/arcade build 20190823.6 (#7447) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19423.6 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e55a3460eb..714234e669 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - c7f03b2cf06bdfc64dad4140fd0d486127095cd8 + c48732c894e73e4b1f491929392a465182eb7ba6 diff --git a/global.json b/global.json index 21be738930..73f2146573 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19422.24", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19423.6", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 9f4ded750cee0300f5653f174b1849794e801781 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 25 Aug 2019 12:28:34 +0000 Subject: [PATCH 237/286] Update dependencies from https://github.com/dotnet/arcade build 20190824.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19424.1 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 714234e669..a290e42803 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - c48732c894e73e4b1f491929392a465182eb7ba6 + a7b5eb8de300b6a30bd797c4ecc8769f7028aeec diff --git a/global.json b/global.json index 73f2146573..44db835d2a 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19423.6", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19424.1", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 697fedd1fd32fe4d99bb1f3815cd1226dc296732 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Mon, 26 Aug 2019 21:17:19 +0200 Subject: [PATCH 238/286] Fix #3113 by porting the relevant roslyn codeand integrate it into the codebase (#7024) --- .gitignore | 1 - .../FSharp.Compiler.Service.fsproj | 12 + src/absil/cvtres.fs | 723 ++++++++++++++++++ src/absil/cvtres.fsi | 37 + src/absil/ilread.fs | 8 +- src/absil/ilsupp.fs | 40 +- src/absil/ilsupp.fsi | 4 - src/absil/ilwrite.fs | 38 +- src/absil/writenativeres.fs | 192 +++++ src/absil/writenativeres.fsi | 34 + 10 files changed, 1047 insertions(+), 42 deletions(-) create mode 100644 src/absil/cvtres.fs create mode 100644 src/absil/cvtres.fsi create mode 100644 src/absil/writenativeres.fs create mode 100644 src/absil/writenativeres.fsi diff --git a/.gitignore b/.gitignore index fe10c6d0bb..2f831172de 100644 --- a/.gitignore +++ b/.gitignore @@ -221,7 +221,6 @@ source_link.json System.ValueTuple.dll tests/fsharpqa/testenv/bin/System.ValueTuple.dll lib/netcore/fsc/bin/ - !lib/bootstrap/signed/**/* */.fake /fcs/packages/ diff --git a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index 55b2ad535e..59d25f7ea0 100644 --- a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -228,6 +228,18 @@ + + AbsIL/writenativeres.fsi + + + AbsIL/writenativeres.fs + + + AbsIL/cvtres.fsi + + + AbsIL/cvtres.fs + AbsIL/ilsupp.fsi diff --git a/src/absil/cvtres.fs b/src/absil/cvtres.fs new file mode 100644 index 0000000000..baf9eec79d --- /dev/null +++ b/src/absil/cvtres.fs @@ -0,0 +1,723 @@ +// Quite literal port of https://github.com/dotnet/roslyn/blob/d36121da4b527ee0617e4b0940b9d0b17b584470/src/Compilers/Core/Portable/CvtRes.cs +// And its dependencies (some classes) +module internal FSharp.Compiler.AbstractIL.Internal.CVTres + +open System +open System.Collections.Generic +open System.IO +open System.Linq +open System.Text +open System.Diagnostics + +type BYTE = System.Byte +type DWORD = System.UInt32 +type WCHAR = System.Char +type WORD = System.UInt16 + +module CONVHELPER = + let inline WORD s = uint16 s + let inline DWORD s = uint32 s + let inline WCHAR s = char s + let inline BYTE s = byte s + +open CONVHELPER + +open Checked // make sure stuff works properly + +open System.Reflection.PortableExecutable + + +type ResourceException(name : string, ?inner : Exception) = + inherit Exception(name, defaultArg inner null) + //ew(name : string, ?inner : Exception) as this = + // (ResourceException ()) + // then + // let inner = (defaultArg inner) Unchecked.defaultof<_> + // () + +type RESOURCE_STRING() = + member val Ordinal = Unchecked.defaultof with get, set + member val theString = Unchecked.defaultof with get, set +type RESOURCE() = + member val pstringType = Unchecked.defaultof with get, set + member val pstringName = Unchecked.defaultof with get, set + member val DataSize = Unchecked.defaultof with get, set + member val HeaderSize = Unchecked.defaultof with get, set + member val DataVersion = Unchecked.defaultof with get, set + member val MemoryFlags = Unchecked.defaultof with get, set + member val LanguageId = Unchecked.defaultof with get, set + member val Version = Unchecked.defaultof with get, set + member val Characteristics = Unchecked.defaultof with get, set + member val data = Unchecked.defaultof with get, set +type CvtResFile() = + static member val private RT_DLGINCLUDE = 17 with get, set + static member ReadResFile(stream : Stream) = + let mutable reader = new BinaryReader(stream, Encoding.Unicode) + let mutable resourceNames = new List() + let mutable startPos = stream.Position + let mutable initial32Bits = reader.ReadUInt32 () + if initial32Bits <> uint32 0 + then raise <| ResourceException("Stream does not begin with a null resource and is not in .RES format.") + stream.Position <- startPos + while (stream.Position < stream.Length) do + let mutable cbData = reader.ReadUInt32 () + let mutable cbHdr = reader.ReadUInt32 () + if cbHdr < 2u * uint32 sizeof + then raise <| ResourceException(String.Format ("Resource header beginning at offset 0x{0:x} is malformed.", (stream.Position - 8L))) + if cbData = 0u + then + stream.Position <- stream.Position + int64 cbHdr - 2L * int64 sizeof + else + let mutable pAdditional = RESOURCE() + pAdditional.HeaderSize <- cbHdr + pAdditional.DataSize <- cbData + pAdditional.pstringType <- CvtResFile.ReadStringOrID (reader) + pAdditional.pstringName <- CvtResFile.ReadStringOrID (reader) + stream.Position <- stream.Position + 3L &&& ~~~3L + pAdditional.DataVersion <- reader.ReadUInt32 () + pAdditional.MemoryFlags <- reader.ReadUInt16 () + pAdditional.LanguageId <- reader.ReadUInt16 () + pAdditional.Version <- reader.ReadUInt32 () + pAdditional.Characteristics <- reader.ReadUInt32 () + pAdditional.data <- Array.zeroCreate (int pAdditional.DataSize) + reader.Read (pAdditional.data, 0, pAdditional.data.Length) |> ignore + stream.Position <- stream.Position + 3L &&& ~~~3L + if pAdditional.pstringType.theString = Unchecked.defaultof<_> && (pAdditional.pstringType.Ordinal = uint16 CvtResFile.RT_DLGINCLUDE) + then () (* ERROR ContinueNotSupported *) + else resourceNames.Add (pAdditional) + resourceNames + static member private ReadStringOrID(fhIn : BinaryReader) = + let mutable (pstring : RESOURCE_STRING) = RESOURCE_STRING() + let mutable (firstWord : WCHAR) = (fhIn.ReadChar ()) + if int firstWord = 0xFFFF + then pstring.Ordinal <- fhIn.ReadUInt16 () + else + pstring.Ordinal <- uint16 0xFFFF + let mutable (sb : StringBuilder) = StringBuilder() + let mutable (curChar : WCHAR) = firstWord + while (curChar <> char 0) do + sb.Append(curChar) |> ignore + curChar <- fhIn.ReadChar() + pstring.theString <- sb.ToString () + pstring + + +[] +type SectionCharacteristics = + | TypeReg = 0u + | TypeDSect = 1u + | TypeNoLoad = 2u + | TypeGroup = 4u + | TypeNoPad = 8u + | TypeCopy = 16u + | ContainsCode = 32u + | ContainsInitializedData = 64u + | ContainsUninitializedData = 128u + | LinkerOther = 256u + | LinkerInfo = 512u + | TypeOver = 1024u + | LinkerRemove = 2048u + | LinkerComdat = 4096u + | MemProtected = 16384u + | NoDeferSpecExc = 16384u + | GPRel = 32768u + | MemFardata = 32768u + | MemSysheap = 65536u + | MemPurgeable = 131072u + | Mem16Bit = 131072u + | MemLocked = 262144u + | MemPreload = 524288u + | Align1Bytes = 1048576u + | Align2Bytes = 2097152u + | Align4Bytes = 3145728u + | Align8Bytes = 4194304u + | Align16Bytes = 5242880u + | Align32Bytes = 6291456u + | Align64Bytes = 7340032u + | Align128Bytes = 8388608u + | Align256Bytes = 9437184u + | Align512Bytes = 10485760u + | Align1024Bytes = 11534336u + | Align2048Bytes = 12582912u + | Align4096Bytes = 13631488u + | Align8192Bytes = 14680064u + | AlignMask = 15728640u + | LinkerNRelocOvfl = 16777216u + | MemDiscardable = 33554432u + | MemNotCached = 67108864u + | MemNotPaged = 134217728u + | MemShared = 268435456u + | MemExecute = 536870912u + | MemRead = 1073741824u + | MemWrite = 2147483648u + +type ResourceSection() = + new(sectionBytes : byte[], relocations : uint32[]) as this = + (ResourceSection ()) + then + Debug.Assert (sectionBytes :> obj <> Unchecked.defaultof<_>) + Debug.Assert (relocations :> obj <> Unchecked.defaultof<_>) + this.SectionBytes <- sectionBytes + this.Relocations <- relocations + member val SectionBytes = Unchecked.defaultof with get,set + member val Relocations = Unchecked.defaultof with get,set + +open System.Runtime.CompilerServices +[] +type StreamExtensions () = + [] + static member TryReadAll(stream : Stream, buffer : byte[], offset : int, count : int) = + Debug.Assert (count > 0) + let mutable (totalBytesRead : int) = Unchecked.defaultof + let mutable (isFinished : bool) = false + let mutable (bytesRead : int) = 0 + do + totalBytesRead <- 0 + while totalBytesRead < count && not isFinished do + bytesRead <- stream.Read (buffer, (offset + totalBytesRead), (count - totalBytesRead)) + if bytesRead = 0 + then isFinished <- true // break; + else totalBytesRead <- totalBytesRead + bytesRead + totalBytesRead + +type COFFResourceReader() = + static member private ConfirmSectionValues(hdr : SectionHeader, fileSize : System.Int64) = + if int64 hdr.PointerToRawData + int64 hdr.SizeOfRawData > fileSize + then raise <| ResourceException("CoffResourceInvalidSectionSize") + () + static member ReadWin32ResourcesFromCOFF(stream : Stream) = + let mutable peHeaders = new PEHeaders(stream) + let mutable rsrc1 = SectionHeader() + let mutable rsrc2 = SectionHeader() + let mutable (foundCount : int) = 0 + for sectionHeader in peHeaders.SectionHeaders do + if sectionHeader.Name = ".rsrc$01" + then + rsrc1 <- sectionHeader + foundCount <- foundCount + 1 + else + if sectionHeader.Name = ".rsrc$02" + then + rsrc2 <- sectionHeader + foundCount <- foundCount + 1 + if foundCount <> 2 + then raise <| ResourceException("CoffResourceMissingSection") + COFFResourceReader.ConfirmSectionValues (rsrc1, stream.Length) + COFFResourceReader.ConfirmSectionValues (rsrc2, stream.Length) + let mutable imageResourceSectionBytes = Array.zeroCreate (rsrc1.SizeOfRawData + rsrc2.SizeOfRawData) + stream.Seek (int64 rsrc1.PointerToRawData, SeekOrigin.Begin) |> ignore + stream.TryReadAll (imageResourceSectionBytes, 0, rsrc1.SizeOfRawData) |> ignore + stream.Seek (int64 rsrc2.PointerToRawData, SeekOrigin.Begin) |> ignore + stream.TryReadAll (imageResourceSectionBytes, rsrc1.SizeOfRawData, rsrc2.SizeOfRawData) |> ignore + let mutable (SizeOfRelocationEntry : int) = 10 + try + let mutable relocLastAddress = rsrc1.PointerToRelocations + (int rsrc1.NumberOfRelocations * SizeOfRelocationEntry) + if int64 relocLastAddress > stream.Length + then raise <| ResourceException("CoffResourceInvalidRelocation") + with + :? OverflowException -> (raise <| ResourceException("CoffResourceInvalidRelocation")) + let mutable relocationOffsets = Array.zeroCreate (int rsrc1.NumberOfRelocations) + let mutable relocationSymbolIndices = Array.zeroCreate (int rsrc1.NumberOfRelocations) + let mutable reader = new BinaryReader(stream, Encoding.Unicode) + stream.Position <- int64 rsrc1.PointerToRelocations + do + let mutable (i : int) = 0 + while (i < int rsrc1.NumberOfRelocations) do + relocationOffsets.[i] <- reader.ReadUInt32 () + relocationSymbolIndices.[i] <- reader.ReadUInt32 () + reader.ReadUInt16 () |> ignore //we do nothing with the "Type" + i <- i + 1 + stream.Position <- int64 peHeaders.CoffHeader.PointerToSymbolTable + let mutable (ImageSizeOfSymbol : System.UInt32) = 18u + try + let mutable lastSymAddress = int64 peHeaders.CoffHeader.PointerToSymbolTable + int64 peHeaders.CoffHeader.NumberOfSymbols * int64 ImageSizeOfSymbol (* ERROR UnknownNode *) + if lastSymAddress > stream.Length + then raise <| ResourceException("CoffResourceInvalidSymbol") + with + :? OverflowException -> (raise <| ResourceException("CoffResourceInvalidSymbol")) + let mutable outputStream = new MemoryStream(imageResourceSectionBytes) + let mutable writer = new BinaryWriter(outputStream) + do + let mutable (i : int) = 0 + while (i < relocationSymbolIndices.Length) do + if int relocationSymbolIndices.[i] > peHeaders.CoffHeader.NumberOfSymbols + then raise <| ResourceException("CoffResourceInvalidRelocation") + let mutable offsetOfSymbol = int64 peHeaders.CoffHeader.PointerToSymbolTable + int64 relocationSymbolIndices.[i] * int64 ImageSizeOfSymbol + stream.Position <- offsetOfSymbol + stream.Position <- stream.Position + 8L + let mutable symValue = reader.ReadUInt32 () + let mutable symSection = reader.ReadInt16 () + let mutable symType = reader.ReadUInt16 () + let mutable (IMAGE_SYM_TYPE_NULL : System.UInt16) = uint16 0x0000 + if symType <> IMAGE_SYM_TYPE_NULL || symSection <> 3s + then raise <| ResourceException("CoffResourceInvalidSymbol") + outputStream.Position <- int64 relocationOffsets.[i] + writer.Write (uint32 (int64 symValue + int64 rsrc1.SizeOfRawData)) + i <- i + 1 + + ResourceSection(imageResourceSectionBytes, relocationOffsets) + +type ICONDIRENTRY = + struct + val mutable bWidth: BYTE + val mutable bHeight: BYTE + val mutable bColorCount: BYTE + val mutable bReserved: BYTE + val mutable wPlanes: WORD + val mutable wBitCount: WORD + val mutable dwBytesInRes: DWORD + val mutable dwImageOffset: DWORD + end + +type VersionHelper() = + /// + /// Parses a version string of the form "major [ '.' minor [ '.' build [ '.' revision ] ] ]". + /// + /// The version string to parse. + /// If parsing succeeds, the parsed version. Otherwise a version that represents as much of the input as could be parsed successfully. + /// True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise. + static member TryParse(s : string, [] version : byref) = + VersionHelper.TryParse (s, false, UInt16.MaxValue, true, ref version) + /// + /// Parses a version string of the form "major [ '.' minor [ '.' ( '*' | ( build [ '.' ( '*' | revision ) ] ) ) ] ]" + /// as accepted by System.Reflection.AssemblyVersionAttribute. + /// + /// The version string to parse. + /// Indicates whether or not a wildcard is accepted as the terminal component. + /// + /// If parsing succeeded, the parsed version. Otherwise a version instance with all parts set to zero. + /// If contains * the version build and/or revision numbers are set to . + /// + /// True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise. + + static member TryParseAssemblyVersion(s : string, allowWildcard : System.Boolean, [] version : byref) = + VersionHelper.TryParse (s, allowWildcard, (UInt16.MaxValue - 1us), false, ref version) + + static member private NullVersion = new Version(0, 0, 0, 0) + /// + /// Parses a version string of the form "major [ '.' minor [ '.' ( '*' | ( build [ '.' ( '*' | revision ) ] ) ) ] ]" + /// as accepted by System.Reflection.AssemblyVersionAttribute. + /// + /// The version string to parse. + /// Indicates whether or not we're parsing an assembly version string. If so, wildcards are accepted and each component must be less than 65535. + /// The maximum value that a version component may have. + /// Allow the parsing of version elements where invalid characters exist. e.g. 1.2.2a.1 + /// + /// If parsing succeeded, the parsed version. When is true a version with values up to the first invalid character set. Otherwise a version with all parts set to zero. + /// If contains * and wildcard is allowed the version build and/or revision numbers are set to . + /// + /// True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise. + static member private TryParse(s : string, allowWildcard : System.Boolean, maxValue : System.UInt16, allowPartialParse : System.Boolean, [] version : byref) = + Debug.Assert (not allowWildcard || maxValue < UInt16.MaxValue) + if String.IsNullOrWhiteSpace (s) + then + version <- VersionHelper.NullVersion + false + else + let mutable (elements : string[]) = s.Split ('.') + let mutable (hasWildcard : System.Boolean) = allowWildcard && elements.[(int (elements.Length - 1))] = "*" + if hasWildcard && elements.Length < 3 || elements.Length > 4 + then + version <- VersionHelper.NullVersion + false + else + let mutable (values : uint16[]) = Array.zeroCreate 4 + let mutable (lastExplicitValue : int) = + if hasWildcard + then elements.Length - 1 + else elements.Length + let mutable (parseError : System.Boolean) = false + let mutable earlyReturn = None + do + let mutable (i : int) = 0 + let mutable breakLoop = false + while (i < lastExplicitValue) && not breakLoop do + if not (UInt16.TryParse (elements.[i], System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, ref values.[i])) || values.[i] > maxValue + then + if not allowPartialParse + then + earlyReturn <- Some false + breakLoop <- true + version <- VersionHelper.NullVersion + else + parseError <- true + if String.IsNullOrWhiteSpace (elements.[i]) + then + values.[i] <- 0us + breakLoop <- true + else + if values.[i] > maxValue + then + values.[i] <- 0us + breakLoop <- true + else + let mutable (invalidFormat : System.Boolean) = false + //let mutable (number : System.Numerics.BigInteger) = 0I + do + let mutable idx = 0 + let mutable breakLoop = false + while (idx < elements.[i].Length) && not breakLoop do + if not (Char.IsDigit (elements.[i].[idx])) + then + invalidFormat <- true + VersionHelper.TryGetValue ((elements.[i].Substring (0, idx)), ref values.[i]) |> ignore + breakLoop <- true + else + idx <- idx + 1 + let mutable doBreak = true + if not invalidFormat + then + if VersionHelper.TryGetValue (elements.[i], ref values.[i]) + then + //For this scenario the old compiler would continue processing the remaining version elements + //so continue processing + doBreak <- false + () (* ERROR ContinueNotSupported *) + (* ERROR BreakNotSupported *) + if not breakLoop then + i <- i + 1 + if hasWildcard + then + do + let mutable (i : int) = lastExplicitValue + while (i < values.Length) do + values.[i] <- UInt16.MaxValue + i <- i + 1 + version <- new Version(int values.[0], int values.[1], int values.[2], int values.[3]) + not parseError + static member private TryGetValue(s : string, [] value : byref) : bool = + let mutable (number : System.Numerics.BigInteger) = Unchecked.defaultof + if System.Numerics.BigInteger.TryParse (s, System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, ref number) + then + value <- uint16 (number % bigint 65536) + true + else + value <- 0us + false + static member GenerateVersionFromPatternAndCurrentTime(time : DateTime, pattern : Version) = + if pattern = Unchecked.defaultof<_> || pattern.Revision <> int UInt16.MaxValue + then pattern + else + let mutable time = time + // MSDN doc on the attribute: + // "The default build number increments daily. The default revision number is the number of seconds since midnight local time + // (without taking into account time zone adjustments for daylight saving time), divided by 2." + if time = Unchecked.defaultof + then time <- DateTime.Now + let mutable (revision : int) = int time.TimeOfDay.TotalSeconds / 2 + Debug.Assert (revision < int UInt16.MaxValue) + if pattern.Build = int UInt16.MaxValue + then + let mutable (days : TimeSpan) = time.Date - new DateTime(2000, 1, 1) + let mutable (build : int) = Math.Min (int UInt16.MaxValue, (int days.TotalDays)) + new Version(pattern.Major, pattern.Minor, int (uint16 build), int (uint16 revision)) + else new Version(pattern.Major, pattern.Minor, pattern.Build, int (uint16 revision)) + +type VersionResourceSerializer() = + member val private _commentsContents = Unchecked.defaultof with get, set + member val private _companyNameContents = Unchecked.defaultof with get, set + member val private _fileDescriptionContents = Unchecked.defaultof with get, set + member val private _fileVersionContents = Unchecked.defaultof with get, set + member val private _internalNameContents = Unchecked.defaultof with get, set + member val private _legalCopyrightContents = Unchecked.defaultof with get, set + member val private _legalTrademarksContents = Unchecked.defaultof with get, set + member val private _originalFileNameContents = Unchecked.defaultof with get, set + member val private _productNameContents = Unchecked.defaultof with get, set + member val private _productVersionContents = Unchecked.defaultof with get, set + member val private _assemblyVersionContents = Unchecked.defaultof with get, set + static member val private vsVersionInfoKey = "VS_VERSION_INFO" with get, set + static member val private varFileInfoKey = "VarFileInfo" with get, set + static member val private translationKey = "Translation" with get, set + static member val private stringFileInfoKey = "StringFileInfo" with get, set + member val private _langIdAndCodePageKey = Unchecked.defaultof with get, set + static member val private CP_WINUNICODE = 1200u + static member val private sizeVS_FIXEDFILEINFO = uint16 (sizeof * 13) + member val private _isDll = Unchecked.defaultof with get, set + new(isDll : System.Boolean, comments : string, companyName : string, fileDescription : string, fileVersion : string, internalName : string, legalCopyright : string, legalTrademark : string, originalFileName : string, productName : string, productVersion : string, assemblyVersion : Version) as this = + (VersionResourceSerializer ()) + then + this._isDll <- isDll + this._commentsContents <- comments + this._companyNameContents <- companyName + this._fileDescriptionContents <- fileDescription + this._fileVersionContents <- fileVersion + this._internalNameContents <- internalName + this._legalCopyrightContents <- legalCopyright + this._legalTrademarksContents <- legalTrademark + this._originalFileNameContents <- originalFileName + this._productNameContents <- productName + this._productVersionContents <- productVersion + this._assemblyVersionContents <- assemblyVersion + this._langIdAndCodePageKey <- System.String.Format ("{0:x4}{1:x4}", 0, VersionResourceSerializer.CP_WINUNICODE) + static member val private VFT_APP = 0x00000001u + static member val private VFT_DLL = 0x00000002u + member private this.GetVerStrings() = seq { + if this._commentsContents <> Unchecked.defaultof<_> + then yield KeyValuePair<_,_>("Comments", this._commentsContents) + if this._companyNameContents <> Unchecked.defaultof<_> + then yield KeyValuePair<_,_>("CompanyName", this._companyNameContents) + if this._fileDescriptionContents <> Unchecked.defaultof<_> + then yield KeyValuePair<_,_>("FileDescription", this._fileDescriptionContents) + yield KeyValuePair<_,_>("FileVersion", this._fileVersionContents) + if this._internalNameContents <> Unchecked.defaultof<_> + then yield KeyValuePair<_,_>("InternalName", this._internalNameContents) + if this._legalCopyrightContents <> Unchecked.defaultof<_> + then yield KeyValuePair<_,_>("LegalCopyright", this._legalCopyrightContents) + if this._legalTrademarksContents <> Unchecked.defaultof<_> + then yield KeyValuePair<_,_>("LegalTrademarks", this._legalTrademarksContents) + if this._originalFileNameContents <> Unchecked.defaultof<_> + then yield KeyValuePair<_,_>("OriginalFilename", this._originalFileNameContents) + if this._productNameContents <> Unchecked.defaultof<_> + then yield KeyValuePair<_,_>("ProductName", this._productNameContents) + yield KeyValuePair<_,_>("ProductVersion", this._fileVersionContents) + if this._assemblyVersionContents <> Unchecked.defaultof<_> + then yield KeyValuePair<_,_>("Assembly Version", this._assemblyVersionContents.ToString()) + } + member private this.FileType + with get() : uint32 = + if this._isDll + then VersionResourceSerializer.VFT_DLL + else VersionResourceSerializer.VFT_APP + member private this.WriteVSFixedFileInfo(writer : BinaryWriter) = + let mutable (fileVersion : Version) = Unchecked.defaultof + VersionHelper.TryParse (this._fileVersionContents, ref fileVersion) |> ignore + let mutable (productVersion : Version) = Unchecked.defaultof + VersionHelper.TryParse (this._productVersionContents, ref productVersion) |> ignore + writer.Write (0xFEEF04BDu) + writer.Write (0x00010000u) + writer.Write ((uint32 fileVersion.Major <<< 16) ||| uint32 fileVersion.Minor) + writer.Write ((uint32 fileVersion.Build <<< 16) ||| uint32 fileVersion.Revision) + writer.Write ((uint32 productVersion.Major <<< 16) ||| uint32 productVersion.Minor) + writer.Write ((uint32 productVersion.Build <<< 16) ||| uint32 productVersion.Revision) + writer.Write (0x0000003Fu) + writer.Write (0u) + writer.Write (0x00000004u) + writer.Write (this.FileType) + writer.Write (0u) + writer.Write (0u) + writer.Write (0u) + static member private PadKeyLen(cb : int) = + VersionResourceSerializer.PadToDword (cb + 3 * sizeof) - 3 * sizeof + static member private PadToDword(cb : int) = + cb + 3 &&& ~~~3 + static member val private HDRSIZE = (int (3 * sizeof)) with get, set + static member private SizeofVerString(lpszKey : string, lpszValue : string) = + let mutable (cbKey : int) = Unchecked.defaultof + let mutable (cbValue : int) = Unchecked.defaultof + cbKey <- lpszKey.Length + 1 * 2 + cbValue <- lpszValue.Length + 1 * 2 + VersionResourceSerializer.PadKeyLen(cbKey) + cbValue + VersionResourceSerializer.HDRSIZE + static member private WriteVersionString(keyValuePair : KeyValuePair, writer : BinaryWriter) = + System.Diagnostics.Debug.Assert (keyValuePair.Value <> Unchecked.defaultof<_>) + let mutable (cbBlock : System.UInt16) = uint16 <| VersionResourceSerializer.SizeofVerString (keyValuePair.Key, keyValuePair.Value) + let mutable (cbKey : int) = keyValuePair.Key.Length + 1 * 2 + //let mutable (cbVal : int) = keyValuePair.Value.Length + 1 * 2 + let mutable startPos = writer.BaseStream.Position + Debug.Assert (startPos &&& 3L = 0L) + writer.Write (cbBlock) + writer.Write (uint16 (keyValuePair.Value.Length + 1)) + writer.Write (1us) + writer.Write (keyValuePair.Key.ToCharArray ()) + writer.Write (uint16 0) //(WORD)'\0' + writer.Write (Array.zeroCreate (VersionResourceSerializer.PadKeyLen (cbKey) - cbKey) : byte[]) + Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) + writer.Write (keyValuePair.Value.ToCharArray ()) + writer.Write (uint16 0) // (WORD)'\0' + System.Diagnostics.Debug.Assert (int64 cbBlock = writer.BaseStream.Position - startPos) + static member private KEYSIZE(sz : string) = + VersionResourceSerializer.PadKeyLen (sz.Length + 1 * sizeof) / sizeof + static member private KEYBYTES(sz : string) = + VersionResourceSerializer.KEYSIZE (sz) * sizeof + member private this.GetStringsSize() = + let mutable (sum : int) = 0 + for verString in this.GetVerStrings () do + sum <- sum + 3 &&& ~~~3 + sum <- sum + VersionResourceSerializer.SizeofVerString (verString.Key, verString.Value) + sum + member this.GetDataSize() = + let mutable (sizeEXEVERRESOURCE : int) = + sizeof * 3 * 5 + 2 * sizeof + + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.vsVersionInfoKey) + + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.varFileInfoKey) + + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.translationKey) + + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.stringFileInfoKey) + + VersionResourceSerializer.KEYBYTES (this._langIdAndCodePageKey) + + int VersionResourceSerializer.sizeVS_FIXEDFILEINFO + this.GetStringsSize () + sizeEXEVERRESOURCE + member this.WriteVerResource(writer : BinaryWriter) = + let mutable debugPos = writer.BaseStream.Position + let mutable dataSize = this.GetDataSize () + writer.Write (WORD dataSize) + writer.Write (WORD VersionResourceSerializer.sizeVS_FIXEDFILEINFO) + writer.Write (WORD 0us) + writer.Write (VersionResourceSerializer.vsVersionInfoKey.ToCharArray ()) + writer.Write (Array.zeroCreate (VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.vsVersionInfoKey) - VersionResourceSerializer.vsVersionInfoKey.Length * 2) : byte[]) + System.Diagnostics.Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) + this.WriteVSFixedFileInfo (writer) + writer.Write (WORD (sizeof * 2 + 2 * VersionResourceSerializer.HDRSIZE + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.varFileInfoKey) + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.translationKey))) + writer.Write (WORD 0us) + writer.Write (WORD 1us) + writer.Write (VersionResourceSerializer.varFileInfoKey.ToCharArray ()) + writer.Write (Array.zeroCreate (VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.varFileInfoKey) - VersionResourceSerializer.varFileInfoKey.Length * 2): byte[]) + System.Diagnostics.Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) + writer.Write (WORD (sizeof * 2 + VersionResourceSerializer.HDRSIZE + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.translationKey))) + writer.Write (WORD (sizeof * 2)) + writer.Write (WORD 0us) + writer.Write (VersionResourceSerializer.translationKey.ToCharArray ()) + writer.Write (Array.zeroCreate (VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.translationKey) - VersionResourceSerializer.translationKey.Length * 2): byte[]) + System.Diagnostics.Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) + writer.Write (0us) + writer.Write (WORD VersionResourceSerializer.CP_WINUNICODE) + System.Diagnostics.Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) + writer.Write (WORD (2 * VersionResourceSerializer.HDRSIZE + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.stringFileInfoKey) + VersionResourceSerializer.KEYBYTES (this._langIdAndCodePageKey) + this.GetStringsSize ())) + writer.Write (0us) + writer.Write (1us) + writer.Write (VersionResourceSerializer.stringFileInfoKey.ToCharArray ()) + writer.Write (Array.zeroCreate (VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.stringFileInfoKey) - VersionResourceSerializer.stringFileInfoKey.Length * 2): byte[]) + System.Diagnostics.Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) + writer.Write (WORD (VersionResourceSerializer.HDRSIZE + VersionResourceSerializer.KEYBYTES (this._langIdAndCodePageKey) + this.GetStringsSize ())) + writer.Write (0us) + writer.Write (1us) + writer.Write (this._langIdAndCodePageKey.ToCharArray ()) + writer.Write (Array.zeroCreate (VersionResourceSerializer.KEYBYTES (this._langIdAndCodePageKey) - this._langIdAndCodePageKey.Length * 2): byte[]) + System.Diagnostics.Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) + System.Diagnostics.Debug.Assert (writer.BaseStream.Position - debugPos = int64 dataSize - int64 (this.GetStringsSize ())) + debugPos <- writer.BaseStream.Position + for entry in this.GetVerStrings () do + let mutable writerPos = writer.BaseStream.Position + writer.Write (Array.zeroCreate (int ((writerPos + 3L) &&& ~~~3L - writerPos)): byte[]) + System.Diagnostics.Debug.Assert (entry.Value <> Unchecked.defaultof<_>) + VersionResourceSerializer.WriteVersionString (entry, writer) + System.Diagnostics.Debug.Assert (writer.BaseStream.Position - debugPos = int64 (this.GetStringsSize ())) + +type Win32ResourceConversions() = + static member AppendIconToResourceStream(resStream : Stream, iconStream : Stream) = + let mutable iconReader = new BinaryReader(iconStream) + let mutable reserved = iconReader.ReadUInt16 () + if reserved <> 0us + then raise <| ResourceException("IconStreamUnexpectedFormat") + let mutable ``type`` = iconReader.ReadUInt16 () + if ``type`` <> 1us + then raise <| ResourceException("IconStreamUnexpectedFormat") + let mutable count = iconReader.ReadUInt16 () + if count = 0us + then raise <| ResourceException("IconStreamUnexpectedFormat") + let mutable iconDirEntries : ICONDIRENTRY [] = Array.zeroCreate (int count) + do + let mutable (i : System.UInt16) = 0us + while (i < count) do + iconDirEntries.[(int i)].bWidth <- iconReader.ReadByte () + iconDirEntries.[(int i)].bHeight <- iconReader.ReadByte () + iconDirEntries.[(int i)].bColorCount <- iconReader.ReadByte () + iconDirEntries.[(int i)].bReserved <- iconReader.ReadByte () + iconDirEntries.[(int i)].wPlanes <- iconReader.ReadUInt16 () + iconDirEntries.[(int i)].wBitCount <- iconReader.ReadUInt16 () + iconDirEntries.[(int i)].dwBytesInRes <- iconReader.ReadUInt32 () + iconDirEntries.[(int i)].dwImageOffset <- iconReader.ReadUInt32 () + i <- i + 1us + + do + let mutable (i : System.UInt16) = 0us + while (i < count) do + iconStream.Position <- int64 iconDirEntries.[(int i)].dwImageOffset + if iconReader.ReadUInt32 () = 40u + then + iconStream.Position <- iconStream.Position + 8L + iconDirEntries.[(int i)].wPlanes <- iconReader.ReadUInt16 () + iconDirEntries.[(int i)].wBitCount <- iconReader.ReadUInt16 () + i <- i + 1us + + let mutable resWriter = new BinaryWriter(resStream) + let mutable (RT_ICON : WORD) = 3us + do + let mutable (i : System.UInt16) = 0us + while (i < count) do + resStream.Position <- resStream.Position + 3L &&& ~~~3L + resWriter.Write (iconDirEntries.[(int i)].dwBytesInRes) + resWriter.Write (0x00000020u) + resWriter.Write (0xFFFFus) + resWriter.Write (RT_ICON) + resWriter.Write (0xFFFFus) + resWriter.Write ((i + 1us)) + resWriter.Write (0x00000000u) + resWriter.Write (0x1010us) + resWriter.Write (0x0000us) + resWriter.Write (0x00000000u) + resWriter.Write (0x00000000u) + iconStream.Position <- int64 iconDirEntries.[(int i)].dwImageOffset + resWriter.Write (iconReader.ReadBytes (int (iconDirEntries.[int i].dwBytesInRes))) + i <- i + 1us + + let mutable (RT_GROUP_ICON : WORD) = (RT_ICON + 11us) + resStream.Position <- resStream.Position + 3L &&& ~~~3L + resWriter.Write (uint32 (3 * sizeof + int count * 14)) + resWriter.Write (0x00000020u) + resWriter.Write (0xFFFFus) + resWriter.Write (RT_GROUP_ICON) + resWriter.Write (0xFFFFus) + resWriter.Write (0x7F00us) + resWriter.Write (0x00000000u) + resWriter.Write (0x1030us) + resWriter.Write (0x0000us) + resWriter.Write (0x00000000u) + resWriter.Write (0x00000000u) + resWriter.Write (0x0000us) + resWriter.Write (0x0001us) + resWriter.Write (count) + do + let mutable (i : System.UInt16) = 0us + while (i < count) do + resWriter.Write (iconDirEntries.[(int i)].bWidth) + resWriter.Write (iconDirEntries.[(int i)].bHeight) + resWriter.Write (iconDirEntries.[(int i)].bColorCount) + resWriter.Write (iconDirEntries.[(int i)].bReserved) + resWriter.Write (iconDirEntries.[(int i)].wPlanes) + resWriter.Write (iconDirEntries.[(int i)].wBitCount) + resWriter.Write (iconDirEntries.[(int i)].dwBytesInRes) + resWriter.Write ((i + 1us)) + i <- i + 1us + () + static member AppendVersionToResourceStream(resStream : Stream, isDll : System.Boolean, fileVersion : string, originalFileName : string, internalName : string, productVersion : string, assemblyVersion : Version, ?fileDescription : string, ?legalCopyright : string, ?legalTrademarks : string, ?productName : string, ?comments : string, ?companyName : string) = + let fileDescription = (defaultArg fileDescription) " " + let legalCopyright = (defaultArg legalCopyright) " " + let legalTrademarks = (defaultArg legalTrademarks) Unchecked.defaultof<_> + let productName = (defaultArg productName) Unchecked.defaultof<_> + let comments = (defaultArg comments) Unchecked.defaultof<_> + let companyName = (defaultArg companyName) Unchecked.defaultof<_> + let mutable resWriter = new BinaryWriter(resStream, Encoding.Unicode) + resStream.Position <- resStream.Position + 3L &&& ~~~3L + let mutable (RT_VERSION : DWORD) = 16u + let mutable ver = new VersionResourceSerializer(isDll, comments, companyName, fileDescription, fileVersion, internalName, legalCopyright, legalTrademarks, originalFileName, productName, productVersion, assemblyVersion) + let mutable startPos = resStream.Position + let mutable dataSize = ver.GetDataSize () + let mutable (headerSize : int) = 0x20 + resWriter.Write (uint32 dataSize) + resWriter.Write (uint32 headerSize) + resWriter.Write (0xFFFFus) + resWriter.Write (uint16 RT_VERSION) + resWriter.Write (0xFFFFus) + resWriter.Write (0x0001us) + resWriter.Write (0x00000000u) + resWriter.Write (0x0030us) + resWriter.Write (0x0000us) + resWriter.Write (0x00000000u) + resWriter.Write (0x00000000u) + ver.WriteVerResource (resWriter) + System.Diagnostics.Debug.Assert (resStream.Position - startPos = int64 dataSize + int64 headerSize) + static member AppendManifestToResourceStream(resStream : Stream, manifestStream : Stream, isDll : System.Boolean) = + resStream.Position <- resStream.Position + 3L &&& ~~~3L (* ERROR UnknownPrefixOperator "~" *) + let mutable (RT_MANIFEST : WORD) = 24us + let mutable resWriter = new BinaryWriter(resStream) + resWriter.Write (uint32 manifestStream.Length) + resWriter.Write (0x00000020u) + resWriter.Write (0xFFFFus) + resWriter.Write (RT_MANIFEST) + resWriter.Write (0xFFFFus) + resWriter.Write ( + if isDll then 0x0002us else 0x0001us) + resWriter.Write (0x00000000u) + resWriter.Write (0x1030us) + resWriter.Write (0x0000us) + resWriter.Write (0x00000000u) + resWriter.Write (0x00000000u) + manifestStream.CopyTo (resStream) \ No newline at end of file diff --git a/src/absil/cvtres.fsi b/src/absil/cvtres.fsi new file mode 100644 index 0000000000..351d45626f --- /dev/null +++ b/src/absil/cvtres.fsi @@ -0,0 +1,37 @@ +module internal FSharp.Compiler.AbstractIL.Internal.CVTres + +open System +open System.IO + +type BYTE = System.Byte +type DWORD = System.UInt32 +type WCHAR = System.Char +type WORD = System.UInt16 + +[] +type RESOURCE_STRING = + member Ordinal: WORD with get, set + member theString : string with get, set + +[] +type RESOURCE = + member pstringType : RESOURCE_STRING with get, set + member pstringName : RESOURCE_STRING with get, set + member DataSize : DWORD with get, set + member HeaderSize : DWORD with get, set + member DataVersion : DWORD with get, set + member MemoryFlags : WORD with get, set + member LanguageId : WORD with get, set + member Version : DWORD with get, set + member Characteristics : DWORD with get, set + member data : byte[] with get, set + +[] +type CvtResFile = + static member ReadResFile : stream:Stream -> System.Collections.Generic.List + +[] +type Win32ResourceConversions = + static member AppendIconToResourceStream : resStream:Stream * iconStream:Stream -> unit + static member AppendVersionToResourceStream : resStream:Stream * isDll:System.Boolean * fileVersion:string * originalFileName:string * internalName:string * productVersion:string * assemblyVersion:Version * ?fileDescription:string * ?legalCopyright:string * ?legalTrademarks:string * ?productName:string * ?comments:string * ?companyName:string -> unit + static member AppendManifestToResourceStream : resStream:Stream * manifestStream:Stream * isDll:System.Boolean -> unit diff --git a/src/absil/ilread.fs b/src/absil/ilread.fs index 280bbf0c38..38c1c5ff81 100755 --- a/src/absil/ilread.fs +++ b/src/absil/ilread.fs @@ -20,9 +20,7 @@ open Internal.Utilities open Internal.Utilities.Collections open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.Internal -#if !FX_NO_PDB_READER -open FSharp.Compiler.AbstractIL.Internal.Support -#endif +open FSharp.Compiler.AbstractIL.Internal.Support open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.AbstractIL.Internal.BinaryConstants open FSharp.Compiler.AbstractIL.IL @@ -1551,14 +1549,10 @@ let readNativeResources (pectxt: PEReader) = [ if pectxt.nativeResourcesSize <> 0x0 && pectxt.nativeResourcesAddr <> 0x0 then let start = pectxt.anyV2P (pectxt.fileName + ": native resources", pectxt.nativeResourcesAddr) if pectxt.noFileOnDisk then -#if !FX_NO_LINKEDRESOURCES let unlinkedResource = let linkedResource = seekReadBytes (pectxt.pefile.GetView()) start pectxt.nativeResourcesSize unlinkResource pectxt.nativeResourcesAddr linkedResource yield ILNativeResource.Out unlinkedResource -#else - () -#endif else yield ILNativeResource.In (pectxt.fileName, pectxt.nativeResourcesAddr, start, pectxt.nativeResourcesSize ) ] diff --git a/src/absil/ilsupp.fs b/src/absil/ilsupp.fs index ba72c0292f..42d8b13ac6 100755 --- a/src/absil/ilsupp.fs +++ b/src/absil/ilsupp.fs @@ -22,16 +22,15 @@ open System.Diagnostics.SymbolStore open System.Runtime.InteropServices open System.Runtime.CompilerServices + let DateTime1970Jan01 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc) (* ECMA Spec (Oct2002), Part II, 24.2.2 PE File Header. *) let absilWriteGetTimeStamp () = (DateTime.UtcNow - DateTime1970Jan01).TotalSeconds |> int -#if !FX_NO_LINKEDRESOURCES // Force inline, so GetLastWin32Error calls are immediately after interop calls as seen by FxCop under Debug build. let inline ignore _x = () // Native Resource linking/unlinking type IStream = System.Runtime.InteropServices.ComTypes.IStream -#endif let check _action (hresult) = if uint32 hresult >= 0x80000000ul then @@ -56,7 +55,6 @@ let bytesToQWord ((b0: byte), (b1: byte), (b2: byte), (b3: byte), (b4: byte), (b let dwToBytes n = [| byte (n &&& 0xff) ; byte ((n >>> 8) &&& 0xff) ; byte ((n >>> 16) &&& 0xff) ; byte ((n >>> 24) &&& 0xff) |], 4 let wToBytes (n: int16) = [| byte (n &&& 0xffs) ; byte ((n >>> 8) &&& 0xffs) |], 2 -#if !FX_NO_LINKEDRESOURCES // REVIEW: factor these classes under one hierarchy, use reflection for creation from buffer and toBytes() // Though, everything I'd like to unify is static - metaclasses? type IMAGE_FILE_HEADER (m: int16, secs: int16, tds: int32, ptst: int32, nos: int32, soh: int16, c: int16) = @@ -572,7 +570,7 @@ type ResFormatNode(tid: int32, nid: int32, lid: int32, dataOffset: int32, pbLink !size -let linkNativeResources (unlinkedResources: byte[] list) (ulLinkedResourceBaseRVA: int32) (fileType: PEFileType) (outputFilePath: string) = +let linkNativeResourcesViaCVTres (unlinkedResources: byte[] list) (ulLinkedResourceBaseRVA: int32) (fileType: PEFileType) (outputFilePath: string) = let nPEFileType = match fileType with X86 -> 0 | X64 -> 2 let mutable tempResFiles: string list = [] let mutable objBytes: byte[] = [||] @@ -740,6 +738,39 @@ let linkNativeResources (unlinkedResources: byte[] list) (ulLinkedResourceBaseR // return the buffer pResBuffer +let linkNativeResourcesManaged (unlinkedResources: byte[] list) (ulLinkedResourceBaseRVA: int32) (fileType: PEFileType) (outputFilePath: string) = + ignore fileType + ignore outputFilePath + + let resources = + unlinkedResources + |> Seq.map (fun s -> new MemoryStream(s)) + |> Seq.map (fun s -> + let res = CVTres.CvtResFile.ReadResFile s + s.Dispose() + res) + |> Seq.collect id + // See MakeWin32ResourceList https://github.com/dotnet/roslyn/blob/f40b89234db51da1e1153c14af184e618504be41/src/Compilers/Core/Portable/Compilation/Compilation.cs + |> Seq.map (fun r -> + WriteNativeRes.Win32Resource(data = r.data, codePage = 0u, languageId = uint32 r.LanguageId, + id = int (int16 r.pstringName.Ordinal), name = r.pstringName.theString, + typeId = int (int16 r.pstringType.Ordinal), typeName = r.pstringType.theString)) + let bb = new System.Reflection.Metadata.BlobBuilder() + WriteNativeRes.NativeResourceWriter.SerializeWin32Resources(bb, resources, ulLinkedResourceBaseRVA) + bb.ToArray() + +let linkNativeResources (unlinkedResources: byte[] list) (ulLinkedResourceBaseRVA: int32) (fileType: PEFileType) (outputFilePath: string) = +#if ENABLE_MONO_SUPPORT + if IL.runningOnMono then + linkNativeResourcesManaged unlinkedResources ulLinkedResourceBaseRVA fileType outputFilePath + else +#endif +#if !FX_NO_LINKEDRESOURCES + linkNativeResourcesViaCVTres unlinkedResources ulLinkedResourceBaseRVA fileType outputFilePath +#else + linkNativeResourcesManaged unlinkedResources ulLinkedResourceBaseRVA fileType outputFilePath +#endif + let unlinkResource (ulLinkedResourceBaseRVA: int32) (pbLinkedResource: byte[]) = let mutable nResNodes = 0 @@ -843,7 +874,6 @@ let unlinkResource (ulLinkedResourceBaseRVA: int32) (pbLinkedResource: byte[]) = resBufferOffset <- resBufferOffset + pResNodes.[i].Save(ulLinkedResourceBaseRVA, pbLinkedResource, pResBuffer, resBufferOffset) pResBuffer -#endif #if !FX_NO_PDB_WRITER // PDB Writing diff --git a/src/absil/ilsupp.fsi b/src/absil/ilsupp.fsi index 48e7de602b..6b70a89b45 100755 --- a/src/absil/ilsupp.fsi +++ b/src/absil/ilsupp.fsi @@ -29,9 +29,7 @@ open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.IL -#if !FX_NO_LINKEDRESOURCES type IStream = System.Runtime.InteropServices.ComTypes.IStream -#endif /// Unmanaged resource file linker - for native resources (not managed ones). /// The function may be called twice, once with a zero-RVA and @@ -39,10 +37,8 @@ type IStream = System.Runtime.InteropServices.ComTypes.IStream /// required buffer is returned. type PEFileType = X86 | X64 -#if !FX_NO_LINKEDRESOURCES val linkNativeResources: unlinkedResources:byte[] list -> rva:int32 -> PEFileType -> tempFilePath:string -> byte[] val unlinkResource: int32 -> byte[] -> byte[] -#endif #if !FX_NO_PDB_WRITER /// PDB reader and associated types diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index e9978c3de5..561d250e5b 100755 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -3744,28 +3744,18 @@ let writeBinaryAndReportMappings (outfile, match modul.NativeResources with | [] -> [||] | resources -> -#if ENABLE_MONO_SUPPORT - if runningOnMono then - [||] - else -#endif -#if FX_NO_LINKEDRESOURCES - ignore resources - ignore resourceFormat - [||] -#else - let unlinkedResources = - resources |> List.map (function - | ILNativeResource.Out bytes -> bytes - | ILNativeResource.In (fileName, linkedResourceBase, start, len) -> - let linkedResource = File.ReadBinaryChunk (fileName, start, len) - unlinkResource linkedResourceBase linkedResource) - - begin - try linkNativeResources unlinkedResources next resourceFormat (Path.GetDirectoryName outfile) - with e -> failwith ("Linking a native resource failed: "+e.Message+"") - end -#endif + let unlinkedResources = + resources |> List.map (function + | ILNativeResource.Out bytes -> bytes + | ILNativeResource.In (fileName, linkedResourceBase, start, len) -> + let linkedResource = File.ReadBinaryChunk (fileName, start, len) + unlinkResource linkedResourceBase linkedResource) + + begin + try linkNativeResources unlinkedResources next resourceFormat (Path.GetDirectoryName outfile) + with e -> failwith ("Linking a native resource failed: "+e.Message+"") + end + let nativeResourcesSize = nativeResources.Length let nativeResourcesChunk, next = chunk nativeResourcesSize next @@ -4169,14 +4159,12 @@ let writeBinaryAndReportMappings (outfile, writePadding os "end of .text" (dataSectionPhysLoc - textSectionPhysLoc - textSectionSize) - // DATA SECTION -#if !FX_NO_LINKEDRESOURCES + // DATA SECTION match nativeResources with | [||] -> () | resources -> write (Some (dataSectionVirtToPhys nativeResourcesChunk.addr)) os "raw native resources" [| |] writeBytes os resources -#endif if dummydatap.size <> 0x0 then write (Some (dataSectionVirtToPhys dummydatap.addr)) os "dummy data" [| 0x0uy |] diff --git a/src/absil/writenativeres.fs b/src/absil/writenativeres.fs new file mode 100644 index 0000000000..b2a7badf10 --- /dev/null +++ b/src/absil/writenativeres.fs @@ -0,0 +1,192 @@ +// Quite literal port of https://github.com/dotnet/roslyn/blob/fab7134296816fc80019c60b0f5bef7400cf23ea/src/Compilers/Core/Portable/PEWriter/NativeResourceWriter.cs +// And its dependencies (some classes) +module internal FSharp.Compiler.AbstractIL.Internal.WriteNativeRes + +open System +open System.Collections.Generic +open System.Linq +open System.Diagnostics +open System.IO +open System.Reflection.Metadata +//open Roslyn.Utilities; + +type DWORD = System.UInt32 + +type Win32Resource(data : byte[], codePage : DWORD, languageId : DWORD, id : int, name : string, typeId : int, typeName : string) = + member val Data = data + member val CodePage = codePage + member val LanguageId = languageId + member val Id = id + member val Name = name + member val TypeId = typeId + member val TypeName = typeName + +type Directory(name, id) = + member val Name = name + member val ID = id + member val NumberOfNamedEntries = Unchecked.defaultof with get, set + member val NumberOfIdEntries = Unchecked.defaultof with get, set + member val Entries = new List() + +type NativeResourceWriter() = + static member private CompareResources (left : Win32Resource) (right : Win32Resource) = + let mutable (result : int) = NativeResourceWriter.CompareResourceIdentifiers (left.TypeId, left.TypeName, right.TypeId, right.TypeName) + if result = 0 + then NativeResourceWriter.CompareResourceIdentifiers (left.Id, left.Name, right.Id, right.Name) + else result + static member private CompareResourceIdentifiers(xOrdinal : int, xString : string, yOrdinal : int, yString : string) = + if xString = Unchecked.defaultof<_> + then + if yString = Unchecked.defaultof<_> + then xOrdinal - yOrdinal + else 1 + else + if yString = Unchecked.defaultof<_> + then - 1 + else String.Compare (xString, yString, StringComparison.OrdinalIgnoreCase) + static member SortResources(resources : IEnumerable) = + resources.OrderBy ((fun d -> d), Comparer<_>.Create(Comparison<_> NativeResourceWriter.CompareResources)) :> IEnumerable + static member SerializeWin32Resources(builder : BlobBuilder, theResources : IEnumerable, resourcesRva : int) = + let theResources = NativeResourceWriter.SortResources (theResources) + let mutable (typeDirectory : Directory) = new Directory(String.Empty, 0) + let mutable (nameDirectory : Directory) = Unchecked.defaultof<_> + let mutable (languageDirectory : Directory) = Unchecked.defaultof<_> + let mutable (lastTypeID : int) = Int32.MinValue + let mutable (lastTypeName : string) = Unchecked.defaultof<_> + let mutable (lastID : int) = Int32.MinValue + let mutable (lastName : string) = Unchecked.defaultof<_> + let mutable (sizeOfDirectoryTree : System.UInt32) = 16u + for (r : Win32Resource) in theResources do + let mutable (typeDifferent : System.Boolean) = r.TypeId < 0 && r.TypeName <> lastTypeName || r.TypeId > lastTypeID + if typeDifferent + then + lastTypeID <- r.TypeId + lastTypeName <- r.TypeName + if lastTypeID < 0 + then + Debug.Assert ((typeDirectory.NumberOfIdEntries = 0us), "Not all Win32 resources with types encoded as strings precede those encoded as ints") + typeDirectory.NumberOfNamedEntries <- typeDirectory.NumberOfNamedEntries + 1us + else + typeDirectory.NumberOfIdEntries <- typeDirectory.NumberOfIdEntries + 1us + sizeOfDirectoryTree <- sizeOfDirectoryTree + 24u + nameDirectory <- new Directory(lastTypeName, lastTypeID) + typeDirectory.Entries.Add (nameDirectory) + if typeDifferent || r.Id < 0 && r.Name <> lastName || r.Id > lastID + then + lastID <- r.Id + lastName <- r.Name + if lastID < 0 + then + Debug.Assert ((nameDirectory.NumberOfIdEntries = 0us), "Not all Win32 resources with names encoded as strings precede those encoded as ints") + nameDirectory.NumberOfNamedEntries <- nameDirectory.NumberOfNamedEntries + 1us + else + nameDirectory.NumberOfIdEntries <- nameDirectory.NumberOfIdEntries + 1us + sizeOfDirectoryTree <- sizeOfDirectoryTree + 24u + languageDirectory <- new Directory(lastName, lastID) + nameDirectory.Entries.Add (languageDirectory) + languageDirectory.NumberOfIdEntries <- languageDirectory.NumberOfIdEntries + 1us + sizeOfDirectoryTree <- sizeOfDirectoryTree + 8u + languageDirectory.Entries.Add (r) + let mutable dataWriter = new BlobBuilder() + NativeResourceWriter.WriteDirectory (typeDirectory, builder, (0u), (0u), sizeOfDirectoryTree, resourcesRva, dataWriter) + builder.LinkSuffix (dataWriter) + builder.WriteByte (0uy) + builder.Align (4) + static member private WriteDirectory(directory : Directory, writer : BlobBuilder, offset : System.UInt32, level : System.UInt32, sizeOfDirectoryTree : System.UInt32, virtualAddressBase : int, dataWriter : BlobBuilder) = + writer.WriteUInt32 (0u) + writer.WriteUInt32 (0u) + writer.WriteUInt32 (0u) + writer.WriteUInt16 (directory.NumberOfNamedEntries) + writer.WriteUInt16 (directory.NumberOfIdEntries) + let mutable (n : System.UInt32) = uint32 directory.Entries.Count + let mutable (k : System.UInt32) = offset + 16u + n * 8u + do + let mutable (i : uint32) = 0u + while (i < n) do + let mutable (id : int) = Unchecked.defaultof + let mutable (name : string) = Unchecked.defaultof + let mutable (nameOffset : System.UInt32) = uint32 dataWriter.Count + sizeOfDirectoryTree + let mutable (directoryOffset : System.UInt32) = k + let isDir = + match directory.Entries.[int i] with + | :? Directory as subDir -> + id <- subDir.ID + name <- subDir.Name + if level = 0u + then k <- k + NativeResourceWriter.SizeOfDirectory (subDir) + else k <- k + 16u + 8u * uint32 subDir.Entries.Count + true + | :? Win32Resource as r -> + id <- + if level = 0u + then r.TypeId + else + if level = 1u + then r.Id + else int r.LanguageId + name <- + if level = 0u + then r.TypeName + else + if level = 1u + then r.Name + else Unchecked.defaultof<_> + dataWriter.WriteUInt32 ((uint32 virtualAddressBase + sizeOfDirectoryTree + 16u + uint32 dataWriter.Count)) + let mutable (data : byte[]) = (new List(r.Data)).ToArray () + dataWriter.WriteUInt32 (uint32 data.Length) + dataWriter.WriteUInt32 (r.CodePage) + dataWriter.WriteUInt32 (0u) + dataWriter.WriteBytes (data) + while (dataWriter.Count % 4 <> 0) do + dataWriter.WriteByte (0uy) + false + | e -> failwithf "Unknown entry %s" (if isNull e then "" else e.GetType().FullName) + if id >= 0 + then writer.WriteInt32 (id) + else + if name = Unchecked.defaultof<_> + then name <- String.Empty + writer.WriteUInt32 (nameOffset ||| 0x80000000u) + dataWriter.WriteUInt16 (uint16 name.Length) + dataWriter.WriteUTF16 (name) + if isDir + then writer.WriteUInt32 (directoryOffset ||| 0x80000000u) + else writer.WriteUInt32 (nameOffset) + i <- i + 1u + + k <- offset + 16u + n * 8u + do + let mutable (i : int) = 0 + while (uint32 i < n) do + match directory.Entries.[i] with + | :? Directory as subDir -> + NativeResourceWriter.WriteDirectory (subDir, writer, k, (level + 1u), sizeOfDirectoryTree, virtualAddressBase, dataWriter) + if level = 0u + then k <- k + NativeResourceWriter.SizeOfDirectory (subDir) + else k <- k + 16u + 8u * uint32 subDir.Entries.Count + | _ -> () + i <- i + 1 + () + static member private SizeOfDirectory(directory : Directory) = + let mutable (n : System.UInt32) = uint32 directory.Entries.Count + let mutable (size : System.UInt32) = 16u + 8u * n + do + let mutable (i : int) = 0 + while (uint32 i < n) do + match directory.Entries.[i] with + | :? Directory as subDir -> + size <- size + 16u + 8u * uint32 subDir.Entries.Count + | _ -> () + i <- i + 1 + size + (* + static member SerializeWin32Resources(builder : BlobBuilder, resourceSections : ResourceSection, resourcesRva : int) = + let mutable sectionWriter = new BlobWriter(builder.ReserveBytes (resourceSections.SectionBytes.Length)) + sectionWriter.WriteBytes (resourceSections.SectionBytes) + let mutable readStream = new MemoryStream(resourceSections.SectionBytes) + let mutable reader = new BinaryReader(readStream) + for (addressToFixup : int) in resourceSections.Relocations do + sectionWriter.Offset <- addressToFixup + reader.BaseStream.Position <- addressToFixup + sectionWriter.WriteUInt32 (reader.ReadUInt32 () + resourcesRva :> System.UInt32) + ()*) \ No newline at end of file diff --git a/src/absil/writenativeres.fsi b/src/absil/writenativeres.fsi new file mode 100644 index 0000000000..8728e5d538 --- /dev/null +++ b/src/absil/writenativeres.fsi @@ -0,0 +1,34 @@ + +module internal FSharp.Compiler.AbstractIL.Internal.WriteNativeRes + + +open System +open System.Collections.Generic +open System.Linq +open System.Diagnostics +open System.IO +open System.Reflection.Metadata +//open Roslyn.Utilities; + +type DWORD = System.UInt32 + +type Win32Resource = + class + new : data:byte [] * codePage:DWORD * languageId:DWORD * id:int * + name:string * typeId:int * typeName:string -> Win32Resource + member CodePage : DWORD + member Data : byte [] + member Id : int + member LanguageId : DWORD + member Name : string + member TypeId : int + member TypeName : string + end + +[] +type NativeResourceWriter = + static member SortResources : resources : IEnumerable -> IEnumerable + static member SerializeWin32Resources : builder:BlobBuilder * theResources:IEnumerable * resourcesRva:int -> unit + (* + static member SerializeWin32Resources(builder : BlobBuilder, resourceSections : ResourceSection, resourcesRva : int) -> unit + ()*) \ No newline at end of file From 3742740f273071ffca3600945295d22db28c8130 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Wed, 28 Aug 2019 16:12:10 -0700 Subject: [PATCH 239/286] update package feed url (#7459) --- NuGet.config | 5 ++--- eng/Versions.props | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/NuGet.config b/NuGet.config index 1b0f596f07..ef069a5bdf 100644 --- a/NuGet.config +++ b/NuGet.config @@ -18,10 +18,9 @@ - - + + - diff --git a/eng/Versions.props b/eng/Versions.props index 95e131a0c0..3556edc478 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -60,10 +60,9 @@ https://dotnet.myget.org/F/interactive-window/api/v3/index.json; https://myget.org/F/vs-devcore/api/v3/index.json; https://myget.org/F/vs-editor/api/v3/index.json; - https://vside.myget.org/F/vssdk/api/v3/index.json; - https://vside.myget.org/F/vs-impl/api/v3/index.json; + https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json; + https://pkgs.dev.azure.com/azure-public/vside/_packaging/vs-impl/nuget/v3/index.json; https://myget.org/F/roslyn_concord/api/v3/index.json; - https://vside.myget.org/F/devcore/api/v3/index.json; $([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)..\RoslynPackageVersion.txt').Trim()) From 20ab6da9ac18f1cb4678ea79c69141b1dc8ff8b4 Mon Sep 17 00:00:00 2001 From: Grzegorz Dziadkiewicz Date: Thu, 29 Aug 2019 07:31:33 +0200 Subject: [PATCH 240/286] * #6928 - Removed SByte and Byte from default case requirement and added check for complete match. * Upgrade new tests (#6928) --- src/fsharp/PatternMatchCompilation.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fsharp/PatternMatchCompilation.fs b/src/fsharp/PatternMatchCompilation.fs index 0bf4df1c25..3b172de1e3 100755 --- a/src/fsharp/PatternMatchCompilation.fs +++ b/src/fsharp/PatternMatchCompilation.fs @@ -528,9 +528,7 @@ let (|ConstNeedsDefaultCase|_|) c = | Const.Decimal _ | Const.String _ | Const.Single _ - | Const.Double _ - | Const.SByte _ - | Const.Byte _ + | Const.Double _ | Const.Int16 _ | Const.UInt16 _ | Const.Int32 _ @@ -1084,6 +1082,8 @@ let CompilePatternBasic match simulSetOfDiscrims with | DecisionTreeTest.Const (Const.Bool _b) :: _ when simulSetOfCases.Length = 2 -> None + | DecisionTreeTest.Const (Const.Byte _) :: _ when simulSetOfCases.Length = 256 -> None + | DecisionTreeTest.Const (Const.SByte _) :: _ when simulSetOfCases.Length = 256 -> None | DecisionTreeTest.Const (Const.Unit) :: _ -> None | DecisionTreeTest.UnionCase (ucref, _) :: _ when simulSetOfCases.Length = ucref.TyconRef.UnionCasesArray.Length -> None | DecisionTreeTest.ActivePatternCase _ :: _ -> error(InternalError("DecisionTreeTest.ActivePatternCase should have been eliminated", matchm)) From 5030e295696c6956ec76d93d6ab436fa66e6c6f0 Mon Sep 17 00:00:00 2001 From: Jan Wosnitza Date: Thu, 29 Aug 2019 07:33:47 +0200 Subject: [PATCH 241/286] Dynamic compiling in Unity Player (2019.1.6f1) (#7427) * add type annotation * annotate parameter * Update src/fsharp/NameResolution.fs Co-Authored-By: Phillip Carter --- src/fsharp/NameResolution.fs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fsharp/NameResolution.fs b/src/fsharp/NameResolution.fs index 6f03bbc1d4..57b81f0ff4 100644 --- a/src/fsharp/NameResolution.fs +++ b/src/fsharp/NameResolution.fs @@ -1894,7 +1894,8 @@ let rec ResolveLongIndentAsModuleOrNamespace sink atMostOne amap m first fullyQu | _ -> raze (namespaceNotFound.Force()) -let ResolveLongIndentAsModuleOrNamespaceThen sink atMostOne amap m fullyQualified (nenv: NameResolutionEnv) ad id rest isOpenDecl f = +// Note - 'rest' is annotated due to a bug currently in Unity (see: https://github.com/dotnet/fsharp/pull/7427) +let ResolveLongIndentAsModuleOrNamespaceThen sink atMostOne amap m fullyQualified (nenv: NameResolutionEnv) ad id (rest: Ident list) isOpenDecl f = match ResolveLongIndentAsModuleOrNamespace sink ResultCollectionSettings.AllResults amap m true fullyQualified nenv ad id [] isOpenDecl with | Result modrefs -> match rest with From c48028939d4864189a7ec3dc9b1e512e1ab6ede2 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Thu, 29 Aug 2019 00:27:01 -0700 Subject: [PATCH 242/286] Fix native resource issue with emptry streams --- src/absil/cvtres.fs | 64 +++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/src/absil/cvtres.fs b/src/absil/cvtres.fs index baf9eec79d..cf448b9561 100644 --- a/src/absil/cvtres.fs +++ b/src/absil/cvtres.fs @@ -54,37 +54,39 @@ type CvtResFile() = static member ReadResFile(stream : Stream) = let mutable reader = new BinaryReader(stream, Encoding.Unicode) let mutable resourceNames = new List() - let mutable startPos = stream.Position - let mutable initial32Bits = reader.ReadUInt32 () - if initial32Bits <> uint32 0 - then raise <| ResourceException("Stream does not begin with a null resource and is not in .RES format.") - stream.Position <- startPos - while (stream.Position < stream.Length) do - let mutable cbData = reader.ReadUInt32 () - let mutable cbHdr = reader.ReadUInt32 () - if cbHdr < 2u * uint32 sizeof - then raise <| ResourceException(String.Format ("Resource header beginning at offset 0x{0:x} is malformed.", (stream.Position - 8L))) - if cbData = 0u - then - stream.Position <- stream.Position + int64 cbHdr - 2L * int64 sizeof - else - let mutable pAdditional = RESOURCE() - pAdditional.HeaderSize <- cbHdr - pAdditional.DataSize <- cbData - pAdditional.pstringType <- CvtResFile.ReadStringOrID (reader) - pAdditional.pstringName <- CvtResFile.ReadStringOrID (reader) - stream.Position <- stream.Position + 3L &&& ~~~3L - pAdditional.DataVersion <- reader.ReadUInt32 () - pAdditional.MemoryFlags <- reader.ReadUInt16 () - pAdditional.LanguageId <- reader.ReadUInt16 () - pAdditional.Version <- reader.ReadUInt32 () - pAdditional.Characteristics <- reader.ReadUInt32 () - pAdditional.data <- Array.zeroCreate (int pAdditional.DataSize) - reader.Read (pAdditional.data, 0, pAdditional.data.Length) |> ignore - stream.Position <- stream.Position + 3L &&& ~~~3L - if pAdditional.pstringType.theString = Unchecked.defaultof<_> && (pAdditional.pstringType.Ordinal = uint16 CvtResFile.RT_DLGINCLUDE) - then () (* ERROR ContinueNotSupported *) - else resourceNames.Add (pAdditional) + // The stream might be empty ... so lets check + if not (reader.PeekChar() = -1) then + let mutable startPos = stream.Position + let mutable initial32Bits = reader.ReadUInt32 () + if initial32Bits <> uint32 0 + then raise <| ResourceException("Stream does not begin with a null resource and is not in .RES format.") + stream.Position <- startPos + while (stream.Position < stream.Length) do + let mutable cbData = reader.ReadUInt32 () + let mutable cbHdr = reader.ReadUInt32 () + if cbHdr < 2u * uint32 sizeof + then raise <| ResourceException(String.Format ("Resource header beginning at offset 0x{0:x} is malformed.", (stream.Position - 8L))) + if cbData = 0u + then + stream.Position <- stream.Position + int64 cbHdr - 2L * int64 sizeof + else + let mutable pAdditional = RESOURCE() + pAdditional.HeaderSize <- cbHdr + pAdditional.DataSize <- cbData + pAdditional.pstringType <- CvtResFile.ReadStringOrID (reader) + pAdditional.pstringName <- CvtResFile.ReadStringOrID (reader) + stream.Position <- stream.Position + 3L &&& ~~~3L + pAdditional.DataVersion <- reader.ReadUInt32 () + pAdditional.MemoryFlags <- reader.ReadUInt16 () + pAdditional.LanguageId <- reader.ReadUInt16 () + pAdditional.Version <- reader.ReadUInt32 () + pAdditional.Characteristics <- reader.ReadUInt32 () + pAdditional.data <- Array.zeroCreate (int pAdditional.DataSize) + reader.Read (pAdditional.data, 0, pAdditional.data.Length) |> ignore + stream.Position <- stream.Position + 3L &&& ~~~3L + if pAdditional.pstringType.theString = Unchecked.defaultof<_> && (pAdditional.pstringType.Ordinal = uint16 CvtResFile.RT_DLGINCLUDE) + then () (* ERROR ContinueNotSupported *) + else resourceNames.Add (pAdditional) resourceNames static member private ReadStringOrID(fhIn : BinaryReader) = let mutable (pstring : RESOURCE_STRING) = RESOURCE_STRING() From 4d6e7691b83c3baea5bfb07d94f5b64cbb49e107 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Thu, 29 Aug 2019 10:45:20 -0700 Subject: [PATCH 243/286] Update src/absil/cvtres.fs Co-Authored-By: Phillip Carter --- src/absil/cvtres.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/absil/cvtres.fs b/src/absil/cvtres.fs index cf448b9561..0f03a51328 100644 --- a/src/absil/cvtres.fs +++ b/src/absil/cvtres.fs @@ -54,7 +54,7 @@ type CvtResFile() = static member ReadResFile(stream : Stream) = let mutable reader = new BinaryReader(stream, Encoding.Unicode) let mutable resourceNames = new List() - // The stream might be empty ... so lets check + // The stream might be empty, so let's check if not (reader.PeekChar() = -1) then let mutable startPos = stream.Position let mutable initial32Bits = reader.ReadUInt32 () @@ -722,4 +722,4 @@ type Win32ResourceConversions() = resWriter.Write (0x0000us) resWriter.Write (0x00000000u) resWriter.Write (0x00000000u) - manifestStream.CopyTo (resStream) \ No newline at end of file + manifestStream.CopyTo (resStream) From 589bbbbb65b961fcceeb1f10abce2c5ee645ecc4 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Fri, 30 Aug 2019 21:01:18 +0300 Subject: [PATCH 244/286] Fix record pattern ranges (#7471) * Fix record pattern ranges * Update baseline --- src/fsharp/pars.fsy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsharp/pars.fsy b/src/fsharp/pars.fsy index 56e6dbfb40..66d72782e3 100644 --- a/src/fsharp/pars.fsy +++ b/src/fsharp/pars.fsy @@ -2850,7 +2850,7 @@ atomicPattern: { SynPat.QuoteExpr($1,lhs parseState) } | CHAR DOT_DOT CHAR { SynPat.DeprecatedCharRange ($1,$3,rhs2 parseState 1 3) } | LBRACE recordPatternElementsAux rbrace - { let rs,m = $2 in SynPat.Record (rs,m) } + { let rs, m = $2 in SynPat.Record (rs, rhs2 parseState 1 3) } | LBRACK listPatternElements RBRACK { SynPat.ArrayOrList(false,$2,lhs parseState) } | LBRACK_BAR listPatternElements BAR_RBRACK From d982322d4e7fdc1d46934c0d4d6a664edcb5bedb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sun, 1 Sep 2019 11:07:17 -0700 Subject: [PATCH 245/286] [master] Update dependencies from dotnet/arcade (#7452) * Update dependencies from https://github.com/dotnet/arcade build 20190825.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19425.1 * Update dependencies from https://github.com/dotnet/arcade build 20190826.12 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19426.12 * Update dependencies from https://github.com/dotnet/arcade build 20190827.8 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19427.8 * Update dependencies from https://github.com/dotnet/arcade build 20190828.9 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19428.9 * Update dependencies from https://github.com/dotnet/arcade build 20190829.16 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19429.16 * Update dependencies from https://github.com/dotnet/arcade build 20190830.3 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19430.3 --- eng/Version.Details.xml | 4 ++-- eng/common/darc-init.ps1 | 4 ++-- eng/common/darc-init.sh | 6 +++++- eng/common/native/CommonLibrary.psm1 | 2 ++ eng/common/performance/perfhelixpublish.proj | 8 ++++---- eng/common/post-build/symbols-validation.ps1 | 20 +++++++++---------- eng/common/sdl/execute-all-sdl-tools.ps1 | 4 ++-- eng/common/sdl/init-sdl.ps1 | 3 +++ eng/common/sdl/packages.config | 4 ++-- eng/common/sdl/run-sdl.ps1 | 10 +++++----- eng/common/templates/job/execute-sdl.yml | 15 ++++++++------ .../templates/post-build/common-variables.yml | 4 ++-- .../templates/post-build/post-build.yml | 6 ++++-- eng/common/tools.ps1 | 2 ++ eng/common/tools.sh | 15 ++++++++++---- global.json | 2 +- 16 files changed, 66 insertions(+), 43 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a290e42803..5c37dee817 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - a7b5eb8de300b6a30bd797c4ecc8769f7028aeec + 316c80d0c373be63f991cc4d586db85273c1c553 diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 8854d979f3..46d175fdfd 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -1,9 +1,9 @@ param ( $darcVersion = $null, - $versionEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16" + $versionEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16", + $verbosity = "m" ) -$verbosity = "m" . $PSScriptRoot\tools.ps1 function InstallDarcCli ($darcVersion) { diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index abdd0bc05a..242429bca6 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -3,6 +3,7 @@ source="${BASH_SOURCE[0]}" darcVersion='' versionEndpoint="https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16" +verbosity=m while [[ $# > 0 ]]; do opt="$(echo "$1" | awk '{print tolower($0)}')" @@ -15,6 +16,10 @@ while [[ $# > 0 ]]; do versionEndpoint=$2 shift ;; + --verbosity) + verbosity=$2 + shift + ;; *) echo "Invalid argument: $1" usage @@ -34,7 +39,6 @@ while [[ -h "$source" ]]; do [[ $source != /* ]] && source="$scriptroot/$source" done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -verbosity=m . "$scriptroot/tools.sh" diff --git a/eng/common/native/CommonLibrary.psm1 b/eng/common/native/CommonLibrary.psm1 index 2a08d5246e..41416862d9 100644 --- a/eng/common/native/CommonLibrary.psm1 +++ b/eng/common/native/CommonLibrary.psm1 @@ -152,6 +152,8 @@ function Get-File { } else { Write-Verbose "Downloading $Uri" + # Don't display the console progress UI - it's a huge perf hit + $ProgressPreference = 'SilentlyContinue' while($Attempt -Lt $DownloadRetries) { try { diff --git a/eng/common/performance/perfhelixpublish.proj b/eng/common/performance/perfhelixpublish.proj index d07b1fa6e2..e5826b5323 100644 --- a/eng/common/performance/perfhelixpublish.proj +++ b/eng/common/performance/perfhelixpublish.proj @@ -83,8 +83,8 @@ $(WorkItemDirectory) - $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(BaselineCoreRunArgument) --artifacts $(BaselineArtifactsDirectory) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" - $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --artifacts $(ArtifactsDirectory) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" + $(WorkItemCommand) --bdn-artifacts $(BaselineArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(BaselineCoreRunArgument) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" + $(WorkItemCommand) --bdn-artifacts $(ArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --partition-count $(PartitionCount) --partition-index %(HelixWorkItem.Index)" $(DotnetExe) run -f $(_Framework) -p $(ResultsComparer) --base $(BaselineArtifactsDirectory) --diff $(ArtifactsDirectory) --threshold 2$(Percent) --xml $(XMLResults);$(FinalCommand) 4:00 @@ -93,8 +93,8 @@ $(WorkItemDirectory) - $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(BaselineCoreRunArgument) --artifacts $(ArtifactsDirectory)" - $(WorkItemCommand) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument) --artifacts $(ArtifactsDirectory)" + $(WorkItemCommand) --bdn-artifacts $(BaselineArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(BaselineCoreRunArgument)" + $(WorkItemCommand) --bdn-artifacts $(ArtifactsDirectory) --bdn-arguments="--anyCategories $(BDNCategories) $(ExtraBenchmarkDotNetArguments) $(CoreRunArgument)" $(DotnetExe) run -f $(_Framework) -p $(ResultsComparer) --base $(BaselineArtifactsDirectory) --diff $(ArtifactsDirectory) --threshold 2$(Percent) --xml $(XMLResults) 4:00 diff --git a/eng/common/post-build/symbols-validation.ps1 b/eng/common/post-build/symbols-validation.ps1 index d5ec51b150..096ac321d1 100644 --- a/eng/common/post-build/symbols-validation.ps1 +++ b/eng/common/post-build/symbols-validation.ps1 @@ -37,10 +37,10 @@ function FirstMatchingSymbolDescriptionOrDefault { # DWARF file for a .dylib $DylibDwarf = $SymbolPath.Replace($Extension, ".dylib.dwarf") - $dotnetsymbolExe = "$env:USERPROFILE\.dotnet\tools" - $dotnetsymbolExe = Resolve-Path "$dotnetsymbolExe\dotnet-symbol.exe" + $dotnetSymbolExe = "$env:USERPROFILE\.dotnet\tools" + $dotnetSymbolExe = Resolve-Path "$dotnetSymbolExe\dotnet-symbol.exe" - & $dotnetsymbolExe --symbols --modules --windows-pdbs $TargetServerParam $FullPath -o $SymbolsPath | Out-Null + & $dotnetSymbolExe --symbols --modules --windows-pdbs $TargetServerParam $FullPath -o $SymbolsPath | Out-Null if (Test-Path $PdbPath) { return "PDB" @@ -159,25 +159,25 @@ function CheckSymbolsAvailable { } } -function Installdotnetsymbol { - $dotnetsymbolPackageName = "dotnet-symbol" +function InstallDotnetSymbol { + $dotnetSymbolPackageName = "dotnet-symbol" $dotnetRoot = InitializeDotNetCli -install:$true $dotnet = "$dotnetRoot\dotnet.exe" $toolList = & "$dotnet" tool list --global - if (($toolList -like "*$dotnetsymbolPackageName*") -and ($toolList -like "*$dotnetsymbolVersion*")) { - Write-Host "dotnet-symbol version $dotnetsymbolVersion is already installed." + if (($toolList -like "*$dotnetSymbolPackageName*") -and ($toolList -like "*$dotnetSymbolVersion*")) { + Write-Host "dotnet-symbol version $dotnetSymbolVersion is already installed." } else { - Write-Host "Installing dotnet-symbol version $dotnetsymbolVersion..." + Write-Host "Installing dotnet-symbol version $dotnetSymbolVersion..." Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." - & "$dotnet" tool install $dotnetsymbolPackageName --version $dotnetsymbolVersion --verbosity "minimal" --global + & "$dotnet" tool install $dotnetSymbolPackageName --version $dotnetSymbolVersion --verbosity "minimal" --global } } try { - Installdotnetsymbol + InstallDotnetSymbol CheckSymbolsAvailable } diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 index 6d9bdcf72b..fa239484f2 100644 --- a/eng/common/sdl/execute-all-sdl-tools.ps1 +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -53,8 +53,8 @@ if ($ValidPath -eq $False) exit 1 } -& $(Join-Path $PSScriptRoot "init-sdl.ps1") -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $ArtifactsDirectory -AzureDevOpsAccessToken $AzureDevOpsAccessToken -GuardianLoggerLevel $GuardianLoggerLevel -$gdnFolder = Join-Path $ArtifactsDirectory ".gdn" +& $(Join-Path $PSScriptRoot "init-sdl.ps1") -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory (Split-Path $SourceDirectory -Parent) -AzureDevOpsAccessToken $AzureDevOpsAccessToken -GuardianLoggerLevel $GuardianLoggerLevel +$gdnFolder = Join-Path (Split-Path $SourceDirectory -Parent) ".gdn" if ($TsaOnboard) { if ($TsaCodebaseName -and $TsaNotificationEmail -and $TsaCodebaseAdmin -and $TsaBugAreaPath) { diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1 index 26e01c0673..c737eb0e71 100644 --- a/eng/common/sdl/init-sdl.ps1 +++ b/eng/common/sdl/init-sdl.ps1 @@ -11,6 +11,9 @@ $ErrorActionPreference = "Stop" Set-StrictMode -Version 2.0 $LASTEXITCODE = 0 +# Don't display the console progress UI - it's a huge perf hit +$ProgressPreference = 'SilentlyContinue' + # Construct basic auth from AzDO access token; construct URI to the repository's gdn folder stored in that repository; construct location of zip file $encodedPat = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$AzureDevOpsAccessToken")) $escapedRepository = [Uri]::EscapeDataString("/$Repository/$BranchName/.gdn") diff --git a/eng/common/sdl/packages.config b/eng/common/sdl/packages.config index 3f97ac2f16..256ffbfb93 100644 --- a/eng/common/sdl/packages.config +++ b/eng/common/sdl/packages.config @@ -1,4 +1,4 @@ - + - + diff --git a/eng/common/sdl/run-sdl.ps1 b/eng/common/sdl/run-sdl.ps1 index b90c4399ba..9bc25314ae 100644 --- a/eng/common/sdl/run-sdl.ps1 +++ b/eng/common/sdl/run-sdl.ps1 @@ -32,16 +32,16 @@ foreach ($tool in $ToolsList) { Write-Host $tool # We have to manually configure tools that run on source to look at the source directory only if ($tool -eq "credscan") { - Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory : $TargetDirectory `" `" OutputType : pre `" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams})" - & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory : $TargetDirectory " "OutputType : pre" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams}) + Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" TargetDirectory < $TargetDirectory `" `" OutputType < pre `" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams})" + & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " TargetDirectory < $TargetDirectory " "OutputType < pre" $(If ($CrScanAdditionalRunConfigParams) {$CrScanAdditionalRunConfigParams}) if ($LASTEXITCODE -ne 0) { Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." exit $LASTEXITCODE } } if ($tool -eq "policheck") { - Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target : $TargetDirectory `" $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams})" - & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target : $TargetDirectory " $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams}) + Write-Host "$GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args `" Target < $TargetDirectory `" $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams})" + & $GuardianCliLocation configure --working-directory $WorkingDirectory --tool $tool --output-path $gdnConfigFile --logger-level $GuardianLoggerLevel --noninteractive --force --args " Target < $TargetDirectory " $(If ($PoliCheckAdditionalRunConfigParams) {$PoliCheckAdditionalRunConfigParams}) if ($LASTEXITCODE -ne 0) { Write-Host "Guardian configure for $tool failed with exit code $LASTEXITCODE." exit $LASTEXITCODE @@ -56,4 +56,4 @@ Write-Host "$GuardianCliLocation run --working-directory $WorkingDirectory --bas if ($LASTEXITCODE -ne 0) { Write-Host "Guardian run for $ToolsList using $configParam failed with exit code $LASTEXITCODE." exit $LASTEXITCODE -} \ No newline at end of file +} diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index 91621cf88f..a7f9964195 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -1,7 +1,10 @@ parameters: overrideParameters: '' # Optional: to override values for parameters. additionalParameters: '' # Optional: parameters that need user specific values eg: '-SourceToolsList @("abc","def") -ArtifactToolsList @("ghi","jkl")' - continueOnError: false # optional: determines whether to continue the build if the step errors; + # There is some sort of bug (has been reported) in Azure DevOps where if this parameter is named + # 'continueOnError', the parameter value is not correctly picked up. + # This can also be remedied by the caller (post-build.yml) if it does not use a nested parameter + sdlContinueOnError: false # optional: determines whether to continue the build if the step errors; dependsOn: '' # Optional: dependencies of the job jobs: @@ -26,12 +29,12 @@ jobs: -InputPath $(Build.SourcesDirectory)\artifacts\BlobArtifacts -ExtractPath $(Build.SourcesDirectory)\artifacts\BlobArtifacts displayName: Extract Blob Artifacts - continueOnError: ${{ parameters.continueOnError }} + continueOnError: ${{ parameters.sdlContinueOnError }} - powershell: eng/common/sdl/extract-artifact-packages.ps1 -InputPath $(Build.SourcesDirectory)\artifacts\PackageArtifacts -ExtractPath $(Build.SourcesDirectory)\artifacts\PackageArtifacts displayName: Extract Package Artifacts - continueOnError: ${{ parameters.continueOnError }} + continueOnError: ${{ parameters.sdlContinueOnError }} - task: NuGetToolInstaller@1 displayName: 'Install NuGet.exe' - task: NuGetCommand@2 @@ -45,12 +48,12 @@ jobs: - ${{ if ne(parameters.overrideParameters, '') }}: - powershell: eng/common/sdl/execute-all-sdl-tools.ps1 ${{ parameters.overrideParameters }} displayName: Execute SDL - continueOnError: ${{ parameters.continueOnError }} + continueOnError: ${{ parameters.sdlContinueOnError }} - ${{ if eq(parameters.overrideParameters, '') }}: - powershell: eng/common/sdl/execute-all-sdl-tools.ps1 - -GuardianPackageName Microsoft.Guardian.Cli.0.7.1 + -GuardianPackageName Microsoft.Guardian.Cli.0.7.2 -NugetPackageDirectory $(Build.SourcesDirectory)\.packages -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) ${{ parameters.additionalParameters }} displayName: Execute SDL - continueOnError: ${{ parameters.continueOnError }} + continueOnError: ${{ parameters.sdlContinueOnError }} diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index b00d85d8ce..7b3fdb1361 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -49,6 +49,6 @@ variables: # Default locations for Installers and checksums - name: ChecksumsBlobFeedUrl - value: https://dotnetcli.blob.core.windows.net/dotnet/index.json - - name: InstallersBlobFeedUrl value: https://dotnetclichecksums.blob.core.windows.net/dotnet/index.json + - name: InstallersBlobFeedUrl + value: https://dotnetcli.blob.core.windows.net/dotnet/index.json diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 3f239fae2b..34667b6c09 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -1,11 +1,12 @@ parameters: - enableSourceLinkValidation: true + enableSourceLinkValidation: false enableSigningValidation: true - enableSymbolValidation: true + enableSymbolValidation: false enableNugetValidation: true publishInstallersAndChecksums: false SDLValidationParameters: enable: false + continueOnError: false params: '' # These parameters let the user customize the call to sdk-task.ps1 for publishing @@ -92,6 +93,7 @@ stages: - template: /eng/common/templates/job/execute-sdl.yml parameters: additionalParameters: ${{ parameters.SDLValidationParameters.params }} + continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }} - template: \eng\common\templates\post-build\channels\netcore-dev-5.yml parameters: diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 9c12b1b4fd..bb5638930a 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -163,6 +163,7 @@ function GetDotNetInstallScript([string] $dotnetRoot) { $installScript = Join-Path $dotnetRoot "dotnet-install.ps1" if (!(Test-Path $installScript)) { Create-Directory $dotnetRoot + $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit Invoke-WebRequest "https://dot.net/$dotnetInstallScriptVersion/dotnet-install.ps1" -OutFile $installScript } @@ -282,6 +283,7 @@ function InitializeXCopyMSBuild([string]$packageVersion, [bool]$install) { Create-Directory $packageDir Write-Host "Downloading $packageName $packageVersion" + $ProgressPreference = 'SilentlyContinue' # Don't display the console progress UI - it's a huge perf hit Invoke-WebRequest "https://dotnet.myget.org/F/roslyn-tools/api/v2/package/$packageName/$packageVersion/" -OutFile $packagePath Unzip $packagePath $packageDir } diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 3af9be6157..94a1edd7d0 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -208,12 +208,19 @@ function GetDotNetInstallScript { # Use curl if available, otherwise use wget if command -v curl > /dev/null; then - curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" - else - wget -q -O "$install_script" "$install_script_url" + curl "$install_script_url" -sSL --retry 10 --create-dirs -o "$install_script" || { + local exit_code=$? + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." + ExitWithExitCode $exit_code + } + else + wget -q -O "$install_script" "$install_script_url" || { + local exit_code=$? + Write-PipelineTelemetryError -category 'InitializeToolset' "Failed to acquire dotnet install script (exit code '$exit_code')." + ExitWithExitCode $exit_code + } fi fi - # return value _GetDotNetInstallScript="$install_script" } diff --git a/global.json b/global.json index 44db835d2a..d83c45f986 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19424.1", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19430.3", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 01e02b5d2aa00e6669c03d48c8c5b4ca9b1cc1de Mon Sep 17 00:00:00 2001 From: jb Date: Mon, 2 Sep 2019 18:40:19 -0400 Subject: [PATCH 246/286] fix documentation typos (#7420) --- fcs/docsrc/content/caches.fsx | 4 ++-- fcs/docsrc/content/compiler.fsx | 4 ++-- fcs/docsrc/content/editor.fsx | 2 +- fcs/docsrc/content/interactive.fsx | 10 +++++----- fcs/docsrc/content/project.fsx | 2 +- fcs/docsrc/content/queue.fsx | 2 +- fcs/docsrc/content/react.fsx | 2 +- fcs/docsrc/content/symbols.fsx | 6 +++--- fcs/docsrc/content/tokenizer.fsx | 2 +- fcs/docsrc/content/untypedtree.fsx | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/fcs/docsrc/content/caches.fsx b/fcs/docsrc/content/caches.fsx index a0a198896c..2f63c4b394 100644 --- a/fcs/docsrc/content/caches.fsx +++ b/fcs/docsrc/content/caches.fsx @@ -9,7 +9,7 @@ This is a design note on the FSharpChecker component and its caches. See also t Each FSharpChecker object maintains a set of caches. These are * ``scriptClosureCache`` - an MRU cache of default size ``projectCacheSize`` that caches the - computation of GetProjectOptionsFromScript. This computation can be lengthy as it can involve processing the transative closure + computation of GetProjectOptionsFromScript. This computation can be lengthy as it can involve processing the transitive closure of all ``#load`` directives, which in turn can mean parsing an unbounded number of script files * ``incrementalBuildersCache`` - an MRU cache of projects where a handle is being kept to their incremental checking state, @@ -50,7 +50,7 @@ The sizes of some of these caches can be adjusted by giving parameters to FSharp the cache sizes above indicate the "strong" size of the cache, where memory is held regardless of the memory pressure on the system. Some of the caches can also hold "weak" references which can be collected at will by the GC. -> Note: Because of these caches, uou should generally use one global, shared FSharpChecker for everything in an IDE application. +> Note: Because of these caches, you should generally use one global, shared FSharpChecker for everything in an IDE application. Low-Memory Condition diff --git a/fcs/docsrc/content/compiler.fsx b/fcs/docsrc/content/compiler.fsx index c87f755ed3..a7e5303a06 100644 --- a/fcs/docsrc/content/compiler.fsx +++ b/fcs/docsrc/content/compiler.fsx @@ -85,14 +85,14 @@ is not really an option. You still have to pass the "-o" option to name the output file, but the output file is not actually written to disk. -The 'None' option indicates that the initiatlization code for the assembly is not executed. +The 'None' option indicates that the initialization code for the assembly is not executed. *) let errors2, exitCode2, dynAssembly2 = checker.CompileToDynamicAssembly([| "-o"; fn3; "-a"; fn2 |], execute=None) |> Async.RunSynchronously (* -Passing 'Some' for the 'execute' parameter executes the initiatlization code for the assembly. +Passing 'Some' for the 'execute' parameter executes the initialization code for the assembly. *) let errors3, exitCode3, dynAssembly3 = checker.CompileToDynamicAssembly([| "-o"; fn3; "-a"; fn2 |], Some(stdout,stderr)) diff --git a/fcs/docsrc/content/editor.fsx b/fcs/docsrc/content/editor.fsx index b057e094d4..46ddd882e5 100644 --- a/fcs/docsrc/content/editor.fsx +++ b/fcs/docsrc/content/editor.fsx @@ -160,7 +160,7 @@ list of members of the string value `msg`. To do this, we call `GetDeclarationListInfo` with the location of the `.` symbol on the last line (ending with `printfn "%s" msg.`). The offsets are one-based, so the location is `7, 23`. -We also need to specify a function that says that the text has not changed and the current identifer +We also need to specify a function that says that the text has not changed and the current identifier where we need to perform the completion. *) // Get declarations (autocomplete) for a location diff --git a/fcs/docsrc/content/interactive.fsx b/fcs/docsrc/content/interactive.fsx index 656ae44a69..6226bcbee1 100644 --- a/fcs/docsrc/content/interactive.fsx +++ b/fcs/docsrc/content/interactive.fsx @@ -43,9 +43,9 @@ open System open System.IO open System.Text -// Intialize output and input streams -let sbOut = StringBuilder() -let sbErr = StringBuilder() +// Initialize output and input streams +let sbOut = new StringBuilder() +let sbErr = new StringBuilder() let inStream = new StringReader("") let outStream = new StringWriter(sbOut) let errStream = new StringWriter(sbErr) @@ -121,7 +121,7 @@ result and an exception. The result part of ``EvalExpression`` and ``EvalExpressionNonThrowing`` is an optional ``FSharpValue``. If that value is not present then it just indicates that the expression didn't have a tangible -result that could be represented as a .NET object. This siutation shouldn't actually +result that could be represented as a .NET object. This situation shouldn't actually occur for any normal input expressions, and only for primitives used in libraries. *) @@ -239,7 +239,7 @@ The 'fsi' object ------------------ If you want your scripting code to be able to access the 'fsi' object, you should pass in an implementation of this object explicitly. -Normally the one fromm FSharp.Compiler.Interactive.Settings.dll is used. +Normally the one from FSharp.Compiler.Interactive.Settings.dll is used. *) let fsiConfig2 = FsiEvaluationSession.GetDefaultConfiguration(fsiSession) diff --git a/fcs/docsrc/content/project.fsx b/fcs/docsrc/content/project.fsx index 015563a220..a537000435 100644 --- a/fcs/docsrc/content/project.fsx +++ b/fcs/docsrc/content/project.fsx @@ -314,7 +314,7 @@ F# projects normally use the '.fsproj' project file format. A project cracking facility for legacy old-style .fsproj is provided as a separate NuGet package: FSharp.Compiler.Service.ProjectCracker. -Projecet cracking for modern project files should be done using a library such as DotNetProjInfo. +Project cracking for modern project files should be done using a library such as DotNetProjInfo. See FsAutoComplete for example code. The legacy NuGet package `FSharp.Compiler.Service.ProjectCracker` contains a diff --git a/fcs/docsrc/content/queue.fsx b/fcs/docsrc/content/queue.fsx index ccc7ccabbf..7cf14a7b70 100644 --- a/fcs/docsrc/content/queue.fsx +++ b/fcs/docsrc/content/queue.fsx @@ -36,7 +36,7 @@ These use cross-threaded access to the TAST data produced by other FSharpChecker Some tools throw a lot of interactive work at the FSharpChecker operations queue. If you are writing such a component, consider running your project against a debug build of FSharp.Compiler.Service.dll to see the Trace.WriteInformation messages indicating the length of the -operations queuea and the time to process requests. +operations queue and the time to process requests. For those writing interactive editors which use FCS, you should be cautious about operations that request a check of the entire project. diff --git a/fcs/docsrc/content/react.fsx b/fcs/docsrc/content/react.fsx index ef5ccbf495..be108b92ad 100644 --- a/fcs/docsrc/content/react.fsx +++ b/fcs/docsrc/content/react.fsx @@ -67,7 +67,7 @@ If your host happens to be Visual Studio, then this is one technique you can use ... - // Unadvise file changes... + // Unadvised file changes... Com.ThrowOnFailure0(vsFileWatch.UnadviseFileChange(cookie)) diff --git a/fcs/docsrc/content/symbols.fsx b/fcs/docsrc/content/symbols.fsx index c25f0d1c31..ab6b4657dc 100644 --- a/fcs/docsrc/content/symbols.fsx +++ b/fcs/docsrc/content/symbols.fsx @@ -101,7 +101,7 @@ Now get the value that corresponds to the function defined in the code: let fnVal = moduleEntity.MembersFunctionsAndValues.[0] (** -Now look around at the properties describing the function value. All fo the following evaluate to `true`: +Now look around at the properties describing the function value. All of the following evaluate to `true`: *) fnVal.Attributes.Count = 1 fnVal.CurriedParameterGroups.Count // 1 @@ -178,9 +178,9 @@ for assembly in projectContext.GetReferencedAssemblies() do (** **Notes:** - - If incomplete code is present, some or all of the attirbutes may not be quite as expected. + - If incomplete code is present, some or all of the attributes may not be quite as expected. - If some assembly references are missing (which is actually very, very common), then 'IsUnresolved' may - be true on values, members and/or entites related to external assemblies. You should be sure to make your + be true on values, members and/or entities related to external assemblies. You should be sure to make your code robust against IsUnresolved exceptions. *) diff --git a/fcs/docsrc/content/tokenizer.fsx b/fcs/docsrc/content/tokenizer.fsx index 7a46a3c91f..93a1dd3bf1 100644 --- a/fcs/docsrc/content/tokenizer.fsx +++ b/fcs/docsrc/content/tokenizer.fsx @@ -49,7 +49,7 @@ on the `FSharpSourceTokenizer` object that we created earlier: let tokenizer = sourceTok.CreateLineTokenizer("let answer=42") (** Now, we can write a simple recursive function that calls `ScanToken` on the `tokenizer` -until it returns `None` (indicating the end of line). When the function suceeds, it +until it returns `None` (indicating the end of line). When the function succeeds, it returns `FSharpTokenInfo` object with all the interesting details: *) /// Tokenize a single line of F# code diff --git a/fcs/docsrc/content/untypedtree.fsx b/fcs/docsrc/content/untypedtree.fsx index 3cb4e80765..162fedfa19 100644 --- a/fcs/docsrc/content/untypedtree.fsx +++ b/fcs/docsrc/content/untypedtree.fsx @@ -155,7 +155,7 @@ be another source of calls to `visitExpression`. ### Walking over declarations As mentioned earlier, the AST of a file contains a number of module or namespace declarations -(top-level node) that contain declarations inside a module (let bindings or types) or inisde +(top-level node) that contain declarations inside a module (let bindings or types) or inside a namespace (just types). The following functions walks over declarations - we ignore types, nested modules and all other elements and look only at top-level `let` bindings (values and functions): From c6ee3d22cebca34fa24a8965a1ec9ce89cae78ef Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 3 Sep 2019 17:30:16 +0100 Subject: [PATCH 247/286] cleanup cvtres.fs (#7476) --- src/absil/cvtres.fs | 224 +++++++++++++++++++++++--------------------- 1 file changed, 115 insertions(+), 109 deletions(-) diff --git a/src/absil/cvtres.fs b/src/absil/cvtres.fs index 0f03a51328..aed18b0364 100644 --- a/src/absil/cvtres.fs +++ b/src/absil/cvtres.fs @@ -27,17 +27,13 @@ open Checked // make sure stuff works properly open System.Reflection.PortableExecutable -type ResourceException(name : string, ?inner : Exception) = - inherit Exception(name, defaultArg inner null) - //ew(name : string, ?inner : Exception) as this = - // (ResourceException ()) - // then - // let inner = (defaultArg inner) Unchecked.defaultof<_> - // () +type ResourceException(name: string, ?inner: Exception) = + inherit Exception(name, Option.toObj inner) type RESOURCE_STRING() = member val Ordinal = Unchecked.defaultof with get, set member val theString = Unchecked.defaultof with get, set + type RESOURCE() = member val pstringType = Unchecked.defaultof with get, set member val pstringName = Unchecked.defaultof with get, set @@ -49,6 +45,7 @@ type RESOURCE() = member val Version = Unchecked.defaultof with get, set member val Characteristics = Unchecked.defaultof with get, set member val data = Unchecked.defaultof with get, set + type CvtResFile() = static member val private RT_DLGINCLUDE = 17 with get, set static member ReadResFile(stream : Stream) = @@ -58,16 +55,15 @@ type CvtResFile() = if not (reader.PeekChar() = -1) then let mutable startPos = stream.Position let mutable initial32Bits = reader.ReadUInt32 () - if initial32Bits <> uint32 0 - then raise <| ResourceException("Stream does not begin with a null resource and is not in .RES format.") + if initial32Bits <> uint32 0 then + raise <| ResourceException("Stream does not begin with a null resource and is not in .RES format.") stream.Position <- startPos while (stream.Position < stream.Length) do let mutable cbData = reader.ReadUInt32 () let mutable cbHdr = reader.ReadUInt32 () - if cbHdr < 2u * uint32 sizeof - then raise <| ResourceException(String.Format ("Resource header beginning at offset 0x{0:x} is malformed.", (stream.Position - 8L))) - if cbData = 0u - then + if cbHdr < 2u * uint32 sizeof then + raise <| ResourceException(String.Format ("Resource header beginning at offset 0x{0:x} is malformed.", (stream.Position - 8L))) + if cbData = 0u then stream.Position <- stream.Position + int64 cbHdr - 2L * int64 sizeof else let mutable pAdditional = RESOURCE() @@ -84,15 +80,17 @@ type CvtResFile() = pAdditional.data <- Array.zeroCreate (int pAdditional.DataSize) reader.Read (pAdditional.data, 0, pAdditional.data.Length) |> ignore stream.Position <- stream.Position + 3L &&& ~~~3L - if pAdditional.pstringType.theString = Unchecked.defaultof<_> && (pAdditional.pstringType.Ordinal = uint16 CvtResFile.RT_DLGINCLUDE) - then () (* ERROR ContinueNotSupported *) - else resourceNames.Add (pAdditional) + if pAdditional.pstringType.theString = Unchecked.defaultof<_> && (pAdditional.pstringType.Ordinal = uint16 CvtResFile.RT_DLGINCLUDE) then + () (* ERROR ContinueNotSupported *) + else + resourceNames.Add (pAdditional) resourceNames + static member private ReadStringOrID(fhIn : BinaryReader) = let mutable (pstring : RESOURCE_STRING) = RESOURCE_STRING() let mutable (firstWord : WCHAR) = (fhIn.ReadChar ()) - if int firstWord = 0xFFFF - then pstring.Ordinal <- fhIn.ReadUInt16 () + if int firstWord = 0xFFFF then + pstring.Ordinal <- fhIn.ReadUInt16 () else pstring.Ordinal <- uint16 0xFFFF let mutable (sb : StringBuilder) = StringBuilder() @@ -103,7 +101,6 @@ type CvtResFile() = pstring.theString <- sb.ToString () pstring - [] type SectionCharacteristics = | TypeReg = 0u @@ -165,8 +162,10 @@ type ResourceSection() = member val Relocations = Unchecked.defaultof with get,set open System.Runtime.CompilerServices + [] type StreamExtensions () = + [] static member TryReadAll(stream : Stream, buffer : byte[], offset : int, count : int) = Debug.Assert (count > 0) @@ -177,33 +176,32 @@ type StreamExtensions () = totalBytesRead <- 0 while totalBytesRead < count && not isFinished do bytesRead <- stream.Read (buffer, (offset + totalBytesRead), (count - totalBytesRead)) - if bytesRead = 0 - then isFinished <- true // break; + if bytesRead = 0 then + isFinished <- true // break; else totalBytesRead <- totalBytesRead + bytesRead totalBytesRead type COFFResourceReader() = + static member private ConfirmSectionValues(hdr : SectionHeader, fileSize : System.Int64) = - if int64 hdr.PointerToRawData + int64 hdr.SizeOfRawData > fileSize - then raise <| ResourceException("CoffResourceInvalidSectionSize") - () + if int64 hdr.PointerToRawData + int64 hdr.SizeOfRawData > fileSize then + raise <| ResourceException("CoffResourceInvalidSectionSize") + static member ReadWin32ResourcesFromCOFF(stream : Stream) = let mutable peHeaders = new PEHeaders(stream) let mutable rsrc1 = SectionHeader() let mutable rsrc2 = SectionHeader() let mutable (foundCount : int) = 0 for sectionHeader in peHeaders.SectionHeaders do - if sectionHeader.Name = ".rsrc$01" - then + if sectionHeader.Name = ".rsrc$01" then rsrc1 <- sectionHeader foundCount <- foundCount + 1 else - if sectionHeader.Name = ".rsrc$02" - then + if sectionHeader.Name = ".rsrc$02" then rsrc2 <- sectionHeader foundCount <- foundCount + 1 - if foundCount <> 2 - then raise <| ResourceException("CoffResourceMissingSection") + if foundCount <> 2 then + raise <| ResourceException("CoffResourceMissingSection") COFFResourceReader.ConfirmSectionValues (rsrc1, stream.Length) COFFResourceReader.ConfirmSectionValues (rsrc2, stream.Length) let mutable imageResourceSectionBytes = Array.zeroCreate (rsrc1.SizeOfRawData + rsrc2.SizeOfRawData) @@ -214,8 +212,8 @@ type COFFResourceReader() = let mutable (SizeOfRelocationEntry : int) = 10 try let mutable relocLastAddress = rsrc1.PointerToRelocations + (int rsrc1.NumberOfRelocations * SizeOfRelocationEntry) - if int64 relocLastAddress > stream.Length - then raise <| ResourceException("CoffResourceInvalidRelocation") + if int64 relocLastAddress > stream.Length then + raise <| ResourceException("CoffResourceInvalidRelocation") with :? OverflowException -> (raise <| ResourceException("CoffResourceInvalidRelocation")) let mutable relocationOffsets = Array.zeroCreate (int rsrc1.NumberOfRelocations) @@ -233,8 +231,8 @@ type COFFResourceReader() = let mutable (ImageSizeOfSymbol : System.UInt32) = 18u try let mutable lastSymAddress = int64 peHeaders.CoffHeader.PointerToSymbolTable + int64 peHeaders.CoffHeader.NumberOfSymbols * int64 ImageSizeOfSymbol (* ERROR UnknownNode *) - if lastSymAddress > stream.Length - then raise <| ResourceException("CoffResourceInvalidSymbol") + if lastSymAddress > stream.Length then + raise <| ResourceException("CoffResourceInvalidSymbol") with :? OverflowException -> (raise <| ResourceException("CoffResourceInvalidSymbol")) let mutable outputStream = new MemoryStream(imageResourceSectionBytes) @@ -242,8 +240,8 @@ type COFFResourceReader() = do let mutable (i : int) = 0 while (i < relocationSymbolIndices.Length) do - if int relocationSymbolIndices.[i] > peHeaders.CoffHeader.NumberOfSymbols - then raise <| ResourceException("CoffResourceInvalidRelocation") + if int relocationSymbolIndices.[i] > peHeaders.CoffHeader.NumberOfSymbols then + raise <| ResourceException("CoffResourceInvalidRelocation") let mutable offsetOfSymbol = int64 peHeaders.CoffHeader.PointerToSymbolTable + int64 relocationSymbolIndices.[i] * int64 ImageSizeOfSymbol stream.Position <- offsetOfSymbol stream.Position <- stream.Position + 8L @@ -251,27 +249,27 @@ type COFFResourceReader() = let mutable symSection = reader.ReadInt16 () let mutable symType = reader.ReadUInt16 () let mutable (IMAGE_SYM_TYPE_NULL : System.UInt16) = uint16 0x0000 - if symType <> IMAGE_SYM_TYPE_NULL || symSection <> 3s - then raise <| ResourceException("CoffResourceInvalidSymbol") + if symType <> IMAGE_SYM_TYPE_NULL || symSection <> 3s then + raise <| ResourceException("CoffResourceInvalidSymbol") outputStream.Position <- int64 relocationOffsets.[i] writer.Write (uint32 (int64 symValue + int64 rsrc1.SizeOfRawData)) i <- i + 1 ResourceSection(imageResourceSectionBytes, relocationOffsets) +[] type ICONDIRENTRY = - struct - val mutable bWidth: BYTE - val mutable bHeight: BYTE - val mutable bColorCount: BYTE - val mutable bReserved: BYTE - val mutable wPlanes: WORD - val mutable wBitCount: WORD - val mutable dwBytesInRes: DWORD - val mutable dwImageOffset: DWORD - end + val mutable bWidth: BYTE + val mutable bHeight: BYTE + val mutable bColorCount: BYTE + val mutable bReserved: BYTE + val mutable wPlanes: WORD + val mutable wBitCount: WORD + val mutable dwBytesInRes: DWORD + val mutable dwImageOffset: DWORD type VersionHelper() = + /// /// Parses a version string of the form "major [ '.' minor [ '.' build [ '.' revision ] ] ]". /// @@ -280,6 +278,7 @@ type VersionHelper() = /// True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise. static member TryParse(s : string, [] version : byref) = VersionHelper.TryParse (s, false, UInt16.MaxValue, true, ref version) + /// /// Parses a version string of the form "major [ '.' minor [ '.' ( '*' | ( build [ '.' ( '*' | revision ) ] ) ) ] ]" /// as accepted by System.Reflection.AssemblyVersionAttribute. @@ -296,6 +295,7 @@ type VersionHelper() = VersionHelper.TryParse (s, allowWildcard, (UInt16.MaxValue - 1us), false, ref version) static member private NullVersion = new Version(0, 0, 0, 0) + /// /// Parses a version string of the form "major [ '.' minor [ '.' ( '*' | ( build [ '.' ( '*' | revision ) ] ) ) ] ]" /// as accepted by System.Reflection.AssemblyVersionAttribute. @@ -311,22 +311,20 @@ type VersionHelper() = /// True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise. static member private TryParse(s : string, allowWildcard : System.Boolean, maxValue : System.UInt16, allowPartialParse : System.Boolean, [] version : byref) = Debug.Assert (not allowWildcard || maxValue < UInt16.MaxValue) - if String.IsNullOrWhiteSpace (s) - then + if String.IsNullOrWhiteSpace (s) then version <- VersionHelper.NullVersion false else let mutable (elements : string[]) = s.Split ('.') let mutable (hasWildcard : System.Boolean) = allowWildcard && elements.[(int (elements.Length - 1))] = "*" - if hasWildcard && elements.Length < 3 || elements.Length > 4 - then + if hasWildcard && elements.Length < 3 || elements.Length > 4 then version <- VersionHelper.NullVersion false else let mutable (values : uint16[]) = Array.zeroCreate 4 let mutable (lastExplicitValue : int) = - if hasWildcard - then elements.Length - 1 + if hasWildcard then + elements.Length - 1 else elements.Length let mutable (parseError : System.Boolean) = false let mutable earlyReturn = None @@ -334,22 +332,18 @@ type VersionHelper() = let mutable (i : int) = 0 let mutable breakLoop = false while (i < lastExplicitValue) && not breakLoop do - if not (UInt16.TryParse (elements.[i], System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, ref values.[i])) || values.[i] > maxValue - then - if not allowPartialParse - then + if not (UInt16.TryParse (elements.[i], System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, ref values.[i])) || values.[i] > maxValue then + if not allowPartialParse then earlyReturn <- Some false breakLoop <- true version <- VersionHelper.NullVersion else parseError <- true - if String.IsNullOrWhiteSpace (elements.[i]) - then + if String.IsNullOrWhiteSpace (elements.[i]) then values.[i] <- 0us breakLoop <- true else - if values.[i] > maxValue - then + if values.[i] > maxValue then values.[i] <- 0us breakLoop <- true else @@ -359,18 +353,15 @@ type VersionHelper() = let mutable idx = 0 let mutable breakLoop = false while (idx < elements.[i].Length) && not breakLoop do - if not (Char.IsDigit (elements.[i].[idx])) - then + if not (Char.IsDigit (elements.[i].[idx])) then invalidFormat <- true VersionHelper.TryGetValue ((elements.[i].Substring (0, idx)), ref values.[i]) |> ignore breakLoop <- true else idx <- idx + 1 let mutable doBreak = true - if not invalidFormat - then - if VersionHelper.TryGetValue (elements.[i], ref values.[i]) - then + if not invalidFormat then + if VersionHelper.TryGetValue (elements.[i], ref values.[i]) then //For this scenario the old compiler would continue processing the remaining version elements //so continue processing doBreak <- false @@ -378,8 +369,7 @@ type VersionHelper() = (* ERROR BreakNotSupported *) if not breakLoop then i <- i + 1 - if hasWildcard - then + if hasWildcard then do let mutable (i : int) = lastExplicitValue while (i < values.Length) do @@ -387,29 +377,29 @@ type VersionHelper() = i <- i + 1 version <- new Version(int values.[0], int values.[1], int values.[2], int values.[3]) not parseError + static member private TryGetValue(s : string, [] value : byref) : bool = let mutable (number : System.Numerics.BigInteger) = Unchecked.defaultof - if System.Numerics.BigInteger.TryParse (s, System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, ref number) - then + if System.Numerics.BigInteger.TryParse (s, System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, ref number) then value <- uint16 (number % bigint 65536) true else value <- 0us false + static member GenerateVersionFromPatternAndCurrentTime(time : DateTime, pattern : Version) = - if pattern = Unchecked.defaultof<_> || pattern.Revision <> int UInt16.MaxValue - then pattern + if pattern = Unchecked.defaultof<_> || pattern.Revision <> int UInt16.MaxValue then + pattern else let mutable time = time // MSDN doc on the attribute: // "The default build number increments daily. The default revision number is the number of seconds since midnight local time // (without taking into account time zone adjustments for daylight saving time), divided by 2." - if time = Unchecked.defaultof - then time <- DateTime.Now + if time = Unchecked.defaultof then + time <- DateTime.Now let mutable (revision : int) = int time.TimeOfDay.TotalSeconds / 2 Debug.Assert (revision < int UInt16.MaxValue) - if pattern.Build = int UInt16.MaxValue - then + if pattern.Build = int UInt16.MaxValue then let mutable (days : TimeSpan) = time.Date - new DateTime(2000, 1, 1) let mutable (build : int) = Math.Min (int UInt16.MaxValue, (int days.TotalDays)) new Version(pattern.Major, pattern.Minor, int (uint16 build), int (uint16 revision)) @@ -435,6 +425,7 @@ type VersionResourceSerializer() = static member val private CP_WINUNICODE = 1200u static member val private sizeVS_FIXEDFILEINFO = uint16 (sizeof * 13) member val private _isDll = Unchecked.defaultof with get, set + new(isDll : System.Boolean, comments : string, companyName : string, fileDescription : string, fileVersion : string, internalName : string, legalCopyright : string, legalTrademark : string, originalFileName : string, productName : string, productVersion : string, assemblyVersion : Version) as this = (VersionResourceSerializer ()) then @@ -451,35 +442,39 @@ type VersionResourceSerializer() = this._productVersionContents <- productVersion this._assemblyVersionContents <- assemblyVersion this._langIdAndCodePageKey <- System.String.Format ("{0:x4}{1:x4}", 0, VersionResourceSerializer.CP_WINUNICODE) + static member val private VFT_APP = 0x00000001u static member val private VFT_DLL = 0x00000002u + member private this.GetVerStrings() = seq { - if this._commentsContents <> Unchecked.defaultof<_> - then yield KeyValuePair<_,_>("Comments", this._commentsContents) - if this._companyNameContents <> Unchecked.defaultof<_> - then yield KeyValuePair<_,_>("CompanyName", this._companyNameContents) - if this._fileDescriptionContents <> Unchecked.defaultof<_> - then yield KeyValuePair<_,_>("FileDescription", this._fileDescriptionContents) + if this._commentsContents <> Unchecked.defaultof<_> then + yield KeyValuePair<_,_>("Comments", this._commentsContents) + if this._companyNameContents <> Unchecked.defaultof<_> then + yield KeyValuePair<_,_>("CompanyName", this._companyNameContents) + if this._fileDescriptionContents <> Unchecked.defaultof<_> then + yield KeyValuePair<_,_>("FileDescription", this._fileDescriptionContents) yield KeyValuePair<_,_>("FileVersion", this._fileVersionContents) - if this._internalNameContents <> Unchecked.defaultof<_> - then yield KeyValuePair<_,_>("InternalName", this._internalNameContents) - if this._legalCopyrightContents <> Unchecked.defaultof<_> - then yield KeyValuePair<_,_>("LegalCopyright", this._legalCopyrightContents) - if this._legalTrademarksContents <> Unchecked.defaultof<_> - then yield KeyValuePair<_,_>("LegalTrademarks", this._legalTrademarksContents) - if this._originalFileNameContents <> Unchecked.defaultof<_> - then yield KeyValuePair<_,_>("OriginalFilename", this._originalFileNameContents) - if this._productNameContents <> Unchecked.defaultof<_> - then yield KeyValuePair<_,_>("ProductName", this._productNameContents) + if this._internalNameContents <> Unchecked.defaultof<_> then + yield KeyValuePair<_,_>("InternalName", this._internalNameContents) + if this._legalCopyrightContents <> Unchecked.defaultof<_> then + yield KeyValuePair<_,_>("LegalCopyright", this._legalCopyrightContents) + if this._legalTrademarksContents <> Unchecked.defaultof<_> then + yield KeyValuePair<_,_>("LegalTrademarks", this._legalTrademarksContents) + if this._originalFileNameContents <> Unchecked.defaultof<_> then + yield KeyValuePair<_,_>("OriginalFilename", this._originalFileNameContents) + if this._productNameContents <> Unchecked.defaultof<_> then + yield KeyValuePair<_,_>("ProductName", this._productNameContents) yield KeyValuePair<_,_>("ProductVersion", this._fileVersionContents) - if this._assemblyVersionContents <> Unchecked.defaultof<_> - then yield KeyValuePair<_,_>("Assembly Version", this._assemblyVersionContents.ToString()) + if this._assemblyVersionContents <> Unchecked.defaultof<_> then + yield KeyValuePair<_,_>("Assembly Version", this._assemblyVersionContents.ToString()) } - member private this.FileType - with get() : uint32 = - if this._isDll - then VersionResourceSerializer.VFT_DLL - else VersionResourceSerializer.VFT_APP + + member private this.FileType : uint32 = + if this._isDll then + VersionResourceSerializer.VFT_DLL + else + VersionResourceSerializer.VFT_APP + member private this.WriteVSFixedFileInfo(writer : BinaryWriter) = let mutable (fileVersion : Version) = Unchecked.defaultof VersionHelper.TryParse (this._fileVersionContents, ref fileVersion) |> ignore @@ -498,17 +493,22 @@ type VersionResourceSerializer() = writer.Write (0u) writer.Write (0u) writer.Write (0u) + static member private PadKeyLen(cb : int) = VersionResourceSerializer.PadToDword (cb + 3 * sizeof) - 3 * sizeof + static member private PadToDword(cb : int) = cb + 3 &&& ~~~3 + static member val private HDRSIZE = (int (3 * sizeof)) with get, set + static member private SizeofVerString(lpszKey : string, lpszValue : string) = let mutable (cbKey : int) = Unchecked.defaultof let mutable (cbValue : int) = Unchecked.defaultof cbKey <- lpszKey.Length + 1 * 2 cbValue <- lpszValue.Length + 1 * 2 VersionResourceSerializer.PadKeyLen(cbKey) + cbValue + VersionResourceSerializer.HDRSIZE + static member private WriteVersionString(keyValuePair : KeyValuePair, writer : BinaryWriter) = System.Diagnostics.Debug.Assert (keyValuePair.Value <> Unchecked.defaultof<_>) let mutable (cbBlock : System.UInt16) = uint16 <| VersionResourceSerializer.SizeofVerString (keyValuePair.Key, keyValuePair.Value) @@ -526,16 +526,20 @@ type VersionResourceSerializer() = writer.Write (keyValuePair.Value.ToCharArray ()) writer.Write (uint16 0) // (WORD)'\0' System.Diagnostics.Debug.Assert (int64 cbBlock = writer.BaseStream.Position - startPos) + static member private KEYSIZE(sz : string) = VersionResourceSerializer.PadKeyLen (sz.Length + 1 * sizeof) / sizeof + static member private KEYBYTES(sz : string) = VersionResourceSerializer.KEYSIZE (sz) * sizeof + member private this.GetStringsSize() = let mutable (sum : int) = 0 for verString in this.GetVerStrings () do sum <- sum + 3 &&& ~~~3 sum <- sum + VersionResourceSerializer.SizeofVerString (verString.Key, verString.Value) sum + member this.GetDataSize() = let mutable (sizeEXEVERRESOURCE : int) = sizeof * 3 * 5 + 2 * sizeof + @@ -546,6 +550,7 @@ type VersionResourceSerializer() = VersionResourceSerializer.KEYBYTES (this._langIdAndCodePageKey) + int VersionResourceSerializer.sizeVS_FIXEDFILEINFO this.GetStringsSize () + sizeEXEVERRESOURCE + member this.WriteVerResource(writer : BinaryWriter) = let mutable debugPos = writer.BaseStream.Position let mutable dataSize = this.GetDataSize () @@ -596,14 +601,14 @@ type Win32ResourceConversions() = static member AppendIconToResourceStream(resStream : Stream, iconStream : Stream) = let mutable iconReader = new BinaryReader(iconStream) let mutable reserved = iconReader.ReadUInt16 () - if reserved <> 0us - then raise <| ResourceException("IconStreamUnexpectedFormat") + if reserved <> 0us then + raise <| ResourceException("IconStreamUnexpectedFormat") let mutable ``type`` = iconReader.ReadUInt16 () - if ``type`` <> 1us - then raise <| ResourceException("IconStreamUnexpectedFormat") + if ``type`` <> 1us then + raise <| ResourceException("IconStreamUnexpectedFormat") let mutable count = iconReader.ReadUInt16 () - if count = 0us - then raise <| ResourceException("IconStreamUnexpectedFormat") + if count = 0us then + raise <| ResourceException("IconStreamUnexpectedFormat") let mutable iconDirEntries : ICONDIRENTRY [] = Array.zeroCreate (int count) do let mutable (i : System.UInt16) = 0us @@ -622,8 +627,7 @@ type Win32ResourceConversions() = let mutable (i : System.UInt16) = 0us while (i < count) do iconStream.Position <- int64 iconDirEntries.[(int i)].dwImageOffset - if iconReader.ReadUInt32 () = 40u - then + if iconReader.ReadUInt32 () = 40u then iconStream.Position <- iconStream.Position + 8L iconDirEntries.[(int i)].wPlanes <- iconReader.ReadUInt16 () iconDirEntries.[(int i)].wBitCount <- iconReader.ReadUInt16 () @@ -679,6 +683,7 @@ type Win32ResourceConversions() = resWriter.Write ((i + 1us)) i <- i + 1us () + static member AppendVersionToResourceStream(resStream : Stream, isDll : System.Boolean, fileVersion : string, originalFileName : string, internalName : string, productVersion : string, assemblyVersion : Version, ?fileDescription : string, ?legalCopyright : string, ?legalTrademarks : string, ?productName : string, ?comments : string, ?companyName : string) = let fileDescription = (defaultArg fileDescription) " " let legalCopyright = (defaultArg legalCopyright) " " @@ -706,6 +711,7 @@ type Win32ResourceConversions() = resWriter.Write (0x00000000u) ver.WriteVerResource (resWriter) System.Diagnostics.Debug.Assert (resStream.Position - startPos = int64 dataSize + int64 headerSize) + static member AppendManifestToResourceStream(resStream : Stream, manifestStream : Stream, isDll : System.Boolean) = resStream.Position <- resStream.Position + 3L &&& ~~~3L (* ERROR UnknownPrefixOperator "~" *) let mutable (RT_MANIFEST : WORD) = 24us From 6a4ba7ff43382f6e9e678cb2f7a51e0dcede32a9 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Tue, 3 Sep 2019 17:48:07 -0700 Subject: [PATCH 248/286] --standalone type forwarding (#7462) * Add type forwarding to static linker * Type forward using simple matches when required * Fix native resource issue with emptry streams * reduce churn * Use typeref morpher --- src/fsharp/fsc.fs | 93 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 81 insertions(+), 12 deletions(-) diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 7799d409e5..3ea3849026 100755 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -34,8 +34,8 @@ open FSharp.Compiler.AbstractIL.ILBinaryReader open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Library open FSharp.Compiler.AbstractIL.Diagnostics -open FSharp.Compiler.IlxGen +open FSharp.Compiler.IlxGen open FSharp.Compiler.AccessibilityLogic open FSharp.Compiler.AttributeChecking open FSharp.Compiler.Ast @@ -1109,13 +1109,80 @@ module MainModuleBuilder = //---------------------------------------------------------------------------- /// Optional static linking of all DLLs that depend on the F# Library, plus other specified DLLs -module StaticLinker = +module StaticLinker = + + open FSharp.Compiler.AbstractIL + + // Handles TypeForwarding for the generated IL model + type TypeForwarding (tcImports: TcImports) = + + // Make a dictionary of ccus passed to the compiler will be looked up by qualified assembly name + let ccuThunksQualifiedName = + tcImports.GetCcusInDeclOrder() + |> List.filter(fun ccuThunk -> ccuThunk.QualifiedName |> Option.isSome) + |> List.map(fun ccuThunk -> ccuThunk.QualifiedName |> Option.defaultValue "Assembly Name Not Passed", ccuThunk) + |> dict + + // If we can't type forward using exact assembly match, we need to rely on the loader (Policy, Configuration or the coreclr load heuristics), so use try simple name + let ccuThunksSimpleName = + tcImports.GetCcusInDeclOrder() + |> List.filter(fun ccuThunk -> not (String.IsNullOrEmpty(ccuThunk.AssemblyName))) + |> List.map(fun ccuThunk -> ccuThunk.AssemblyName, ccuThunk) + |> dict + + let followTypeForwardForILTypeRef (tref:ILTypeRef) = + let typename = + let parts = tref.FullName.Split([|'.'|]) + match parts.Length with + | 0 -> None + | 1 -> Some (Array.empty, parts.[0]) + | n -> Some (parts.[0..n-2], parts.[n-1]) + + let scoref = tref.Scope + match scoref with + | ILScopeRef.Assembly scope -> + match ccuThunksQualifiedName.TryGetValue(scope.QualifiedName) with + | true, ccu -> + match typename with + | Some (parts, name) -> + let forwarded = ccu.TryForward(parts, name) + let result = + match forwarded with + | Some fwd -> fwd.CompilationPath.ILScopeRef + | None -> scoref + result + | None -> scoref + | false, _ -> + // Couldn't find an assembly with the version so try using a simple name + match ccuThunksSimpleName.TryGetValue(scope.Name) with + | true, ccu -> + match typename with + | Some (parts, name) -> + let forwarded = ccu.TryForward(parts, name) + let result = + match forwarded with + | Some fwd -> fwd.CompilationPath.ILScopeRef + | None -> scoref + result + | None -> scoref + | false, _ -> scoref + | _ -> scoref + + let typeForwardILTypeRef (tref: ILTypeRef) = + let scoref1 = tref.Scope + let scoref2 = followTypeForwardForILTypeRef tref + if scoref1 === scoref2 then tref + else ILTypeRef.Create (scoref2, tref.Enclosing, tref.Name) + + member __.TypeForwardILTypeRef tref = typeForwardILTypeRef tref + let debugStaticLinking = condition "FSHARP_DEBUG_STATIC_LINKING" - let StaticLinkILModules (tcConfig, ilGlobals, ilxMainModule, dependentILModules: (CcuThunk option * ILModuleDef) list) = + let StaticLinkILModules (tcConfig:TcConfig, ilGlobals, tcImports, ilxMainModule, dependentILModules: (CcuThunk option * ILModuleDef) list) = if isNil dependentILModules then ilxMainModule, (fun x -> x) else + let typeForwarding = new TypeForwarding(tcImports) // Check no dependent assemblies use quotations let dependentCcuUsingQuotations = dependentILModules |> List.tryPick (function (Some ccu, _) when ccu.UsesFSharp20PlusQuotations -> Some ccu | _ -> None) @@ -1201,13 +1268,15 @@ module StaticLinker = (mkILMethods (topTypeDefs |> List.collect (fun td -> td.Methods.AsList)), mkILFields (topTypeDefs |> List.collect (fun td -> td.Fields.AsList))) - let ilxMainModule = - { ilxMainModule with - Manifest = (let m = ilxMainModule.ManifestOfAssembly in Some {m with CustomAttrsStored = storeILCustomAttrs (mkILCustomAttrs (m.CustomAttrs.AsList @ savedManifestAttrs)) }) - CustomAttrsStored = storeILCustomAttrs (mkILCustomAttrs [ for m in moduls do yield! m.CustomAttrs.AsArray ]) - TypeDefs = mkILTypeDefs (topTypeDef :: List.concat normalTypeDefs) - Resources = mkILResources (savedResources @ ilxMainModule.Resources.AsList) - NativeResources = savedNativeResources } + let ilxMainModule = + let main = + { ilxMainModule with + Manifest = (let m = ilxMainModule.ManifestOfAssembly in Some {m with CustomAttrsStored = storeILCustomAttrs (mkILCustomAttrs (m.CustomAttrs.AsList @ savedManifestAttrs)) }) + CustomAttrsStored = storeILCustomAttrs (mkILCustomAttrs [ for m in moduls do yield! m.CustomAttrs.AsArray ]) + TypeDefs = mkILTypeDefs (topTypeDef :: List.concat normalTypeDefs) + Resources = mkILResources (savedResources @ ilxMainModule.Resources.AsList) + NativeResources = savedNativeResources } + Morphs.morphILTypeRefsInILModuleMemoized ilGlobals typeForwarding.TypeForwardILTypeRef main ilxMainModule, rewriteExternalRefsToLocalRefs @@ -1578,8 +1647,8 @@ module StaticLinker = // Glue all this stuff into ilxMainModule let ilxMainModule, rewriteExternalRefsToLocalRefs = - StaticLinkILModules (tcConfig, ilGlobals, ilxMainModule, dependentILModules @ providerGeneratedILModules) - + StaticLinkILModules (tcConfig, ilGlobals, tcImports, ilxMainModule, dependentILModules @ providerGeneratedILModules) + // Rewrite type and assembly references let ilxMainModule = let isMscorlib = ilGlobals.primaryAssemblyName = PrimaryAssembly.Mscorlib.Name From 997d0164f22d86e87ef7c6802d3d50654d77ed6e Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Wed, 4 Sep 2019 10:20:07 -0700 Subject: [PATCH 249/286] Remove FX_NO_LINKED_RESOURCES (#7480) --- FSharp.Profiles.props | 1 - .../FSharp.Compiler.Service.fsproj | 15 +- src/absil/{cvtres.fs => ilnativeres.fs} | 501 ++++++++++++------ src/absil/{cvtres.fsi => ilnativeres.fsi} | 31 +- src/absil/ilsupp.fs | 195 +------ src/absil/ilsupp.fsi | 4 +- src/absil/ilwrite.fs | 19 +- src/absil/writenativeres.fs | 192 ------- src/absil/writenativeres.fsi | 34 -- src/fsharp/DotNetFrameworkDependencies.fs | 5 +- src/fsharp/FSComp.txt | 2 + src/fsharp/fsc.fs | 7 +- 12 files changed, 400 insertions(+), 606 deletions(-) rename src/absil/{cvtres.fs => ilnativeres.fs} (62%) rename src/absil/{cvtres.fsi => ilnativeres.fsi} (56%) delete mode 100644 src/absil/writenativeres.fs delete mode 100644 src/absil/writenativeres.fsi diff --git a/FSharp.Profiles.props b/FSharp.Profiles.props index 534ba96c04..bee528e0c2 100644 --- a/FSharp.Profiles.props +++ b/FSharp.Profiles.props @@ -20,7 +20,6 @@ $(DefineConstants);FX_NO_CORHOST_SIGNER $(DefineConstants);FX_NO_EVENTWAITHANDLE_IDISPOSABLE $(DefineConstants);FX_NO_EXIT_CONTEXT_FLAGS - $(DefineConstants);FX_NO_LINKEDRESOURCES $(DefineConstants);FX_NO_PARAMETERIZED_THREAD_START $(DefineConstants);FX_NO_PDB_READER $(DefineConstants);FX_NO_PDB_WRITER diff --git a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index 59d25f7ea0..590fffe39a 100644 --- a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -35,7 +35,6 @@ $(DefineConstants);FX_NO_PDB_READER $(DefineConstants);FX_NO_PDB_WRITER $(DefineConstants);FX_NO_SYMBOLSTORE - $(DefineConstants);FX_NO_LINKEDRESOURCES $(DefineConstants);FX_NO_APP_DOMAINS $(DefineConstants);FX_NO_RUNTIMEENVIRONMENT $(DefineConstants);FX_NO_WIN_REGISTRY @@ -228,17 +227,11 @@ - - AbsIL/writenativeres.fsi + + AbsIL/ilnativeres.fsi - - AbsIL/writenativeres.fs - - - AbsIL/cvtres.fsi - - - AbsIL/cvtres.fs + + AbsIL/ilnativeres.fs AbsIL/ilsupp.fsi diff --git a/src/absil/cvtres.fs b/src/absil/ilnativeres.fs similarity index 62% rename from src/absil/cvtres.fs rename to src/absil/ilnativeres.fs index aed18b0364..7b54df1e6f 100644 --- a/src/absil/cvtres.fs +++ b/src/absil/ilnativeres.fs @@ -1,40 +1,40 @@ -// Quite literal port of https://github.com/dotnet/roslyn/blob/d36121da4b527ee0617e4b0940b9d0b17b584470/src/Compilers/Core/Portable/CvtRes.cs -// And its dependencies (some classes) -module internal FSharp.Compiler.AbstractIL.Internal.CVTres +// Quite literal port of : +// https://github.com/dotnet/roslyn/blob/fab7134296816fc80019c60b0f5bef7400cf23ea/src/Compilers/Core/Portable/PEWriter/NativeResourceWriter.cs +// And https://github.com/dotnet/roslyn/blob/d36121da4b527ee0617e4b0940b9d0b17b584470/src/Compilers/Core/Portable/CvtRes.cs +// And their dependencies (some classes) + +module internal FSharp.Compiler.AbstractIL.Internal.NativeRes open System open System.Collections.Generic +open System.Diagnostics open System.IO open System.Linq +open System.Reflection.Metadata +open System.Reflection.PortableExecutable +open System.Runtime.CompilerServices open System.Text -open System.Diagnostics + +open Checked type BYTE = System.Byte type DWORD = System.UInt32 type WCHAR = System.Char type WORD = System.UInt16 -module CONVHELPER = - let inline WORD s = uint16 s - let inline DWORD s = uint32 s - let inline WCHAR s = char s - let inline BYTE s = byte s - -open CONVHELPER - -open Checked // make sure stuff works properly - -open System.Reflection.PortableExecutable - +let inline WORD s = uint16 s +let inline DWORD s = uint32 s +let inline WCHAR s = char s +let inline BYTE s = byte s type ResourceException(name: string, ?inner: Exception) = - inherit Exception(name, Option.toObj inner) + inherit Exception (name, Option.toObj inner) -type RESOURCE_STRING() = +type RESOURCE_STRING () = member val Ordinal = Unchecked.defaultof with get, set member val theString = Unchecked.defaultof with get, set -type RESOURCE() = +type RESOURCE () = member val pstringType = Unchecked.defaultof with get, set member val pstringName = Unchecked.defaultof with get, set member val DataSize = Unchecked.defaultof with get, set @@ -46,27 +46,34 @@ type RESOURCE() = member val Characteristics = Unchecked.defaultof with get, set member val data = Unchecked.defaultof with get, set -type CvtResFile() = +type CvtResFile () = static member val private RT_DLGINCLUDE = 17 with get, set - static member ReadResFile(stream : Stream) = - let mutable reader = new BinaryReader(stream, Encoding.Unicode) + + static member ReadResFile (stream: Stream) = + let mutable reader = new BinaryReader (stream, Encoding.Unicode) let mutable resourceNames = new List() + // The stream might be empty, so let's check - if not (reader.PeekChar() = -1) then + if not (reader.PeekChar () = -1) then let mutable startPos = stream.Position let mutable initial32Bits = reader.ReadUInt32 () if initial32Bits <> uint32 0 then - raise <| ResourceException("Stream does not begin with a null resource and is not in .RES format.") + raise <| ResourceException(FSComp.SR.nativeResourceFormatError()) stream.Position <- startPos while (stream.Position < stream.Length) do let mutable cbData = reader.ReadUInt32 () let mutable cbHdr = reader.ReadUInt32 () if cbHdr < 2u * uint32 sizeof then - raise <| ResourceException(String.Format ("Resource header beginning at offset 0x{0:x} is malformed.", (stream.Position - 8L))) - if cbData = 0u then + // TODO: + // Current FSComp.txt converter doesn't yet support %x and %lx so format it as a string + // Because the lkg build is out of our control, will need to do it this way until + // The conversion fix flows through to the lkg + let msg = String.Format("0x{0:x}", stream.Position - 8L) + raise <| ResourceException(FSComp.SR.nativeResourceHeaderMalformed msg) + if cbData = 0u then stream.Position <- stream.Position + int64 cbHdr - 2L * int64 sizeof - else - let mutable pAdditional = RESOURCE() + else + let mutable pAdditional = RESOURCE() pAdditional.HeaderSize <- cbHdr pAdditional.DataSize <- cbData pAdditional.pstringType <- CvtResFile.ReadStringOrID (reader) @@ -86,21 +93,22 @@ type CvtResFile() = resourceNames.Add (pAdditional) resourceNames - static member private ReadStringOrID(fhIn : BinaryReader) = - let mutable (pstring : RESOURCE_STRING) = RESOURCE_STRING() - let mutable (firstWord : WCHAR) = (fhIn.ReadChar ()) + static member private ReadStringOrID (fhIn: BinaryReader) = + let mutable (pstring: RESOURCE_STRING) = RESOURCE_STRING () + let mutable (firstWord: WCHAR) = (fhIn.ReadChar ()) if int firstWord = 0xFFFF then pstring.Ordinal <- fhIn.ReadUInt16 () - else + else pstring.Ordinal <- uint16 0xFFFF - let mutable (sb : StringBuilder) = StringBuilder() - let mutable (curChar : WCHAR) = firstWord + let mutable (sb: StringBuilder) = StringBuilder () + let mutable (curChar: WCHAR) = firstWord while (curChar <> char 0) do sb.Append(curChar) |> ignore - curChar <- fhIn.ReadChar() + curChar <- fhIn.ReadChar () pstring.theString <- sb.ToString () pstring + [] type SectionCharacteristics = | TypeReg = 0u @@ -151,27 +159,25 @@ type SectionCharacteristics = | MemWrite = 2147483648u type ResourceSection() = - new(sectionBytes : byte[], relocations : uint32[]) as this = + new(sectionBytes: byte[], relocations: uint32[]) as this = (ResourceSection ()) then Debug.Assert (sectionBytes :> obj <> Unchecked.defaultof<_>) Debug.Assert (relocations :> obj <> Unchecked.defaultof<_>) this.SectionBytes <- sectionBytes this.Relocations <- relocations + member val SectionBytes = Unchecked.defaultof with get,set member val Relocations = Unchecked.defaultof with get,set - -open System.Runtime.CompilerServices [] type StreamExtensions () = - [] - static member TryReadAll(stream : Stream, buffer : byte[], offset : int, count : int) = + static member TryReadAll (stream: Stream, buffer: byte[], offset: int, count: int) = Debug.Assert (count > 0) - let mutable (totalBytesRead : int) = Unchecked.defaultof - let mutable (isFinished : bool) = false - let mutable (bytesRead : int) = 0 + let mutable (totalBytesRead: int) = Unchecked.defaultof + let mutable (isFinished: bool) = false + let mutable (bytesRead: int) = 0 do totalBytesRead <- 0 while totalBytesRead < count && not isFinished do @@ -182,26 +188,25 @@ type StreamExtensions () = totalBytesRead type COFFResourceReader() = - - static member private ConfirmSectionValues(hdr : SectionHeader, fileSize : System.Int64) = + static member private ConfirmSectionValues (hdr: SectionHeader, fileSize: System.Int64) = if int64 hdr.PointerToRawData + int64 hdr.SizeOfRawData > fileSize then - raise <| ResourceException("CoffResourceInvalidSectionSize") + raise <| ResourceException ("CoffResourceInvalidSectionSize") - static member ReadWin32ResourcesFromCOFF(stream : Stream) = - let mutable peHeaders = new PEHeaders(stream) - let mutable rsrc1 = SectionHeader() - let mutable rsrc2 = SectionHeader() - let mutable (foundCount : int) = 0 + static member ReadWin32ResourcesFromCOFF (stream: Stream) = + let mutable peHeaders = new PEHeaders (stream) + let mutable rsrc1 = SectionHeader () + let mutable rsrc2 = SectionHeader () + let mutable (foundCount: int) = 0 for sectionHeader in peHeaders.SectionHeaders do - if sectionHeader.Name = ".rsrc$01" then + if sectionHeader.Name = ".rsrc$01" then rsrc1 <- sectionHeader foundCount <- foundCount + 1 else - if sectionHeader.Name = ".rsrc$02" then + if sectionHeader.Name = ".rsrc$02" then rsrc2 <- sectionHeader foundCount <- foundCount + 1 if foundCount <> 2 then - raise <| ResourceException("CoffResourceMissingSection") + raise <| ResourceException ("CoffResourceMissingSection") COFFResourceReader.ConfirmSectionValues (rsrc1, stream.Length) COFFResourceReader.ConfirmSectionValues (rsrc2, stream.Length) let mutable imageResourceSectionBytes = Array.zeroCreate (rsrc1.SizeOfRawData + rsrc2.SizeOfRawData) @@ -209,46 +214,46 @@ type COFFResourceReader() = stream.TryReadAll (imageResourceSectionBytes, 0, rsrc1.SizeOfRawData) |> ignore stream.Seek (int64 rsrc2.PointerToRawData, SeekOrigin.Begin) |> ignore stream.TryReadAll (imageResourceSectionBytes, rsrc1.SizeOfRawData, rsrc2.SizeOfRawData) |> ignore - let mutable (SizeOfRelocationEntry : int) = 10 + let mutable (SizeOfRelocationEntry: int) = 10 try let mutable relocLastAddress = rsrc1.PointerToRelocations + (int rsrc1.NumberOfRelocations * SizeOfRelocationEntry) if int64 relocLastAddress > stream.Length then - raise <| ResourceException("CoffResourceInvalidRelocation") + raise <| ResourceException ("CoffResourceInvalidRelocation") with :? OverflowException -> (raise <| ResourceException("CoffResourceInvalidRelocation")) let mutable relocationOffsets = Array.zeroCreate (int rsrc1.NumberOfRelocations) let mutable relocationSymbolIndices = Array.zeroCreate (int rsrc1.NumberOfRelocations) - let mutable reader = new BinaryReader(stream, Encoding.Unicode) + let mutable reader = new BinaryReader (stream, Encoding.Unicode) stream.Position <- int64 rsrc1.PointerToRelocations do - let mutable (i : int) = 0 + let mutable (i: int) = 0 while (i < int rsrc1.NumberOfRelocations) do relocationOffsets.[i] <- reader.ReadUInt32 () relocationSymbolIndices.[i] <- reader.ReadUInt32 () reader.ReadUInt16 () |> ignore //we do nothing with the "Type" i <- i + 1 stream.Position <- int64 peHeaders.CoffHeader.PointerToSymbolTable - let mutable (ImageSizeOfSymbol : System.UInt32) = 18u + let mutable (ImageSizeOfSymbol: System.UInt32) = 18u try let mutable lastSymAddress = int64 peHeaders.CoffHeader.PointerToSymbolTable + int64 peHeaders.CoffHeader.NumberOfSymbols * int64 ImageSizeOfSymbol (* ERROR UnknownNode *) if lastSymAddress > stream.Length then - raise <| ResourceException("CoffResourceInvalidSymbol") + raise <| ResourceException ("CoffResourceInvalidSymbol") with :? OverflowException -> (raise <| ResourceException("CoffResourceInvalidSymbol")) - let mutable outputStream = new MemoryStream(imageResourceSectionBytes) - let mutable writer = new BinaryWriter(outputStream) + let mutable outputStream = new MemoryStream (imageResourceSectionBytes) + let mutable writer = new BinaryWriter (outputStream) do - let mutable (i : int) = 0 + let mutable (i: int) = 0 while (i < relocationSymbolIndices.Length) do if int relocationSymbolIndices.[i] > peHeaders.CoffHeader.NumberOfSymbols then - raise <| ResourceException("CoffResourceInvalidRelocation") + raise <| ResourceException ("CoffResourceInvalidRelocation") let mutable offsetOfSymbol = int64 peHeaders.CoffHeader.PointerToSymbolTable + int64 relocationSymbolIndices.[i] * int64 ImageSizeOfSymbol stream.Position <- offsetOfSymbol stream.Position <- stream.Position + 8L let mutable symValue = reader.ReadUInt32 () let mutable symSection = reader.ReadInt16 () let mutable symType = reader.ReadUInt16 () - let mutable (IMAGE_SYM_TYPE_NULL : System.UInt16) = uint16 0x0000 + let mutable (IMAGE_SYM_TYPE_NULL: System.UInt16) = uint16 0x0000 if symType <> IMAGE_SYM_TYPE_NULL || symSection <> 3s then raise <| ResourceException("CoffResourceInvalidSymbol") outputStream.Position <- int64 relocationOffsets.[i] @@ -269,14 +274,13 @@ type ICONDIRENTRY = val mutable dwImageOffset: DWORD type VersionHelper() = - /// /// Parses a version string of the form "major [ '.' minor [ '.' build [ '.' revision ] ] ]". /// /// The version string to parse. /// If parsing succeeds, the parsed version. Otherwise a version that represents as much of the input as could be parsed successfully. /// True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise. - static member TryParse(s : string, [] version : byref) = + static member TryParse(s: string, [] version: byref) = VersionHelper.TryParse (s, false, UInt16.MaxValue, true, ref version) /// @@ -291,10 +295,10 @@ type VersionHelper() = /// /// True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise. - static member TryParseAssemblyVersion(s : string, allowWildcard : System.Boolean, [] version : byref) = + static member TryParseAssemblyVersion (s: string, allowWildcard: System.Boolean, [] version: byref) = VersionHelper.TryParse (s, allowWildcard, (UInt16.MaxValue - 1us), false, ref version) - - static member private NullVersion = new Version(0, 0, 0, 0) + + static member private NullVersion = new Version (0, 0, 0, 0) /// /// Parses a version string of the form "major [ '.' minor [ '.' ( '*' | ( build [ '.' ( '*' | revision ) ] ) ) ] ]" @@ -309,59 +313,59 @@ type VersionHelper() = /// If contains * and wildcard is allowed the version build and/or revision numbers are set to . /// /// True when parsing succeeds completely (i.e. every character in the string was consumed), false otherwise. - static member private TryParse(s : string, allowWildcard : System.Boolean, maxValue : System.UInt16, allowPartialParse : System.Boolean, [] version : byref) = + static member private TryParse(s: string, allowWildcard: System.Boolean, maxValue: System.UInt16, allowPartialParse: System.Boolean, [] version: byref) = Debug.Assert (not allowWildcard || maxValue < UInt16.MaxValue) - if String.IsNullOrWhiteSpace (s) then + if String.IsNullOrWhiteSpace (s) then version <- VersionHelper.NullVersion false else - let mutable (elements : string[]) = s.Split ('.') - let mutable (hasWildcard : System.Boolean) = allowWildcard && elements.[(int (elements.Length - 1))] = "*" - if hasWildcard && elements.Length < 3 || elements.Length > 4 then + let mutable (elements: string[]) = s.Split ('.') + let mutable (hasWildcard: System.Boolean) = allowWildcard && elements.[(int (elements.Length - 1))] = "*" + if hasWildcard && elements.Length < 3 || elements.Length > 4 then version <- VersionHelper.NullVersion false else - let mutable (values : uint16[]) = Array.zeroCreate 4 - let mutable (lastExplicitValue : int) = + let mutable (values: uint16[]) = Array.zeroCreate 4 + let mutable (lastExplicitValue: int) = if hasWildcard then elements.Length - 1 else elements.Length - let mutable (parseError : System.Boolean) = false + let mutable (parseError: System.Boolean) = false let mutable earlyReturn = None do - let mutable (i : int) = 0 + let mutable (i: int) = 0 let mutable breakLoop = false while (i < lastExplicitValue) && not breakLoop do - if not (UInt16.TryParse (elements.[i], System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, ref values.[i])) || values.[i] > maxValue then + if not (UInt16.TryParse (elements.[i], System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, ref values.[i])) || values.[i] > maxValue then if not allowPartialParse then earlyReturn <- Some false breakLoop <- true version <- VersionHelper.NullVersion else parseError <- true - if String.IsNullOrWhiteSpace (elements.[i]) then + if String.IsNullOrWhiteSpace (elements.[i]) then values.[i] <- 0us breakLoop <- true else - if values.[i] > maxValue then + if values.[i] > maxValue then values.[i] <- 0us breakLoop <- true else - let mutable (invalidFormat : System.Boolean) = false - //let mutable (number : System.Numerics.BigInteger) = 0I + let mutable (invalidFormat: System.Boolean) = false + //let mutable (number: System.Numerics.BigInteger) = 0I do let mutable idx = 0 let mutable breakLoop = false while (idx < elements.[i].Length) && not breakLoop do - if not (Char.IsDigit (elements.[i].[idx])) then + if not (Char.IsDigit (elements.[i].[idx])) then invalidFormat <- true VersionHelper.TryGetValue ((elements.[i].Substring (0, idx)), ref values.[i]) |> ignore breakLoop <- true else idx <- idx + 1 let mutable doBreak = true - if not invalidFormat then - if VersionHelper.TryGetValue (elements.[i], ref values.[i]) then + if not invalidFormat then + if VersionHelper.TryGetValue (elements.[i], ref values.[i]) then //For this scenario the old compiler would continue processing the remaining version elements //so continue processing doBreak <- false @@ -369,25 +373,24 @@ type VersionHelper() = (* ERROR BreakNotSupported *) if not breakLoop then i <- i + 1 - if hasWildcard then - do - let mutable (i : int) = lastExplicitValue - while (i < values.Length) do - values.[i] <- UInt16.MaxValue - i <- i + 1 + if hasWildcard then + let mutable (i: int) = lastExplicitValue + while (i < values.Length) do + values.[i] <- UInt16.MaxValue + i <- i + 1 version <- new Version(int values.[0], int values.[1], int values.[2], int values.[3]) not parseError - static member private TryGetValue(s : string, [] value : byref) : bool = - let mutable (number : System.Numerics.BigInteger) = Unchecked.defaultof - if System.Numerics.BigInteger.TryParse (s, System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, ref number) then + static member private TryGetValue(s: string, [] value: byref): bool = + let mutable (number: System.Numerics.BigInteger) = Unchecked.defaultof + if System.Numerics.BigInteger.TryParse (s, System.Globalization.NumberStyles.None, System.Globalization.CultureInfo.InvariantCulture, ref number) then value <- uint16 (number % bigint 65536) true else value <- 0us false - static member GenerateVersionFromPatternAndCurrentTime(time : DateTime, pattern : Version) = + static member GenerateVersionFromPatternAndCurrentTime(time: DateTime, pattern: Version) = if pattern = Unchecked.defaultof<_> || pattern.Revision <> int UInt16.MaxValue then pattern else @@ -397,15 +400,16 @@ type VersionHelper() = // (without taking into account time zone adjustments for daylight saving time), divided by 2." if time = Unchecked.defaultof then time <- DateTime.Now - let mutable (revision : int) = int time.TimeOfDay.TotalSeconds / 2 + let mutable (revision: int) = int time.TimeOfDay.TotalSeconds / 2 Debug.Assert (revision < int UInt16.MaxValue) - if pattern.Build = int UInt16.MaxValue then - let mutable (days : TimeSpan) = time.Date - new DateTime(2000, 1, 1) - let mutable (build : int) = Math.Min (int UInt16.MaxValue, (int days.TotalDays)) + if pattern.Build = int UInt16.MaxValue then + let mutable (days: TimeSpan) = time.Date - new DateTime(2000, 1, 1) + let mutable (build: int) = Math.Min (int UInt16.MaxValue, (int days.TotalDays)) new Version(pattern.Major, pattern.Minor, int (uint16 build), int (uint16 revision)) - else new Version(pattern.Major, pattern.Minor, pattern.Build, int (uint16 revision)) + else + new Version(pattern.Major, pattern.Minor, pattern.Build, int (uint16 revision)) -type VersionResourceSerializer() = +type VersionResourceSerializer () = member val private _commentsContents = Unchecked.defaultof with get, set member val private _companyNameContents = Unchecked.defaultof with get, set member val private _fileDescriptionContents = Unchecked.defaultof with get, set @@ -422,11 +426,13 @@ type VersionResourceSerializer() = static member val private translationKey = "Translation" with get, set static member val private stringFileInfoKey = "StringFileInfo" with get, set member val private _langIdAndCodePageKey = Unchecked.defaultof with get, set + static member val private CP_WINUNICODE = 1200u static member val private sizeVS_FIXEDFILEINFO = uint16 (sizeof * 13) + member val private _isDll = Unchecked.defaultof with get, set - new(isDll : System.Boolean, comments : string, companyName : string, fileDescription : string, fileVersion : string, internalName : string, legalCopyright : string, legalTrademark : string, originalFileName : string, productName : string, productVersion : string, assemblyVersion : Version) as this = + new(isDll: System.Boolean, comments: string, companyName: string, fileDescription: string, fileVersion: string, internalName: string, legalCopyright: string, legalTrademark: string, originalFileName: string, productName: string, productVersion: string, assemblyVersion: Version) as this = (VersionResourceSerializer ()) then this._isDll <- isDll @@ -475,10 +481,10 @@ type VersionResourceSerializer() = else VersionResourceSerializer.VFT_APP - member private this.WriteVSFixedFileInfo(writer : BinaryWriter) = - let mutable (fileVersion : Version) = Unchecked.defaultof + member private this.WriteVSFixedFileInfo(writer: BinaryWriter) = + let mutable (fileVersion: Version) = Unchecked.defaultof VersionHelper.TryParse (this._fileVersionContents, ref fileVersion) |> ignore - let mutable (productVersion : Version) = Unchecked.defaultof + let mutable (productVersion: Version) = Unchecked.defaultof VersionHelper.TryParse (this._productVersionContents, ref productVersion) |> ignore writer.Write (0xFEEF04BDu) writer.Write (0x00010000u) @@ -494,26 +500,26 @@ type VersionResourceSerializer() = writer.Write (0u) writer.Write (0u) - static member private PadKeyLen(cb : int) = + static member private PadKeyLen(cb: int) = VersionResourceSerializer.PadToDword (cb + 3 * sizeof) - 3 * sizeof - static member private PadToDword(cb : int) = + static member private PadToDword(cb: int) = cb + 3 &&& ~~~3 static member val private HDRSIZE = (int (3 * sizeof)) with get, set - static member private SizeofVerString(lpszKey : string, lpszValue : string) = - let mutable (cbKey : int) = Unchecked.defaultof - let mutable (cbValue : int) = Unchecked.defaultof + static member private SizeofVerString(lpszKey: string, lpszValue: string) = + let mutable (cbKey: int) = Unchecked.defaultof + let mutable (cbValue: int) = Unchecked.defaultof cbKey <- lpszKey.Length + 1 * 2 cbValue <- lpszValue.Length + 1 * 2 VersionResourceSerializer.PadKeyLen(cbKey) + cbValue + VersionResourceSerializer.HDRSIZE - static member private WriteVersionString(keyValuePair : KeyValuePair, writer : BinaryWriter) = - System.Diagnostics.Debug.Assert (keyValuePair.Value <> Unchecked.defaultof<_>) - let mutable (cbBlock : System.UInt16) = uint16 <| VersionResourceSerializer.SizeofVerString (keyValuePair.Key, keyValuePair.Value) - let mutable (cbKey : int) = keyValuePair.Key.Length + 1 * 2 - //let mutable (cbVal : int) = keyValuePair.Value.Length + 1 * 2 + static member private WriteVersionString(keyValuePair: KeyValuePair, writer: BinaryWriter) = + Debug.Assert (keyValuePair.Value <> Unchecked.defaultof<_>) + let mutable (cbBlock: System.UInt16) = uint16 <| VersionResourceSerializer.SizeofVerString (keyValuePair.Key, keyValuePair.Value) + let mutable (cbKey: int) = keyValuePair.Key.Length + 1 * 2 + //let mutable (cbVal: int) = keyValuePair.Value.Length + 1 * 2 let mutable startPos = writer.BaseStream.Position Debug.Assert (startPos &&& 3L = 0L) writer.Write (cbBlock) @@ -521,27 +527,27 @@ type VersionResourceSerializer() = writer.Write (1us) writer.Write (keyValuePair.Key.ToCharArray ()) writer.Write (uint16 0) //(WORD)'\0' - writer.Write (Array.zeroCreate (VersionResourceSerializer.PadKeyLen (cbKey) - cbKey) : byte[]) + writer.Write (Array.zeroCreate (VersionResourceSerializer.PadKeyLen (cbKey) - cbKey): byte[]) Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) writer.Write (keyValuePair.Value.ToCharArray ()) writer.Write (uint16 0) // (WORD)'\0' - System.Diagnostics.Debug.Assert (int64 cbBlock = writer.BaseStream.Position - startPos) + Debug.Assert (int64 cbBlock = writer.BaseStream.Position - startPos) - static member private KEYSIZE(sz : string) = + static member private KEYSIZE(sz: string) = VersionResourceSerializer.PadKeyLen (sz.Length + 1 * sizeof) / sizeof - static member private KEYBYTES(sz : string) = + static member private KEYBYTES(sz: string) = VersionResourceSerializer.KEYSIZE (sz) * sizeof member private this.GetStringsSize() = - let mutable (sum : int) = 0 + let mutable (sum: int) = 0 for verString in this.GetVerStrings () do sum <- sum + 3 &&& ~~~3 sum <- sum + VersionResourceSerializer.SizeofVerString (verString.Key, verString.Value) sum - member this.GetDataSize() = - let mutable (sizeEXEVERRESOURCE : int) = + member this.GetDataSize () = + let mutable (sizeEXEVERRESOURCE: int) = sizeof * 3 * 5 + 2 * sizeof + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.vsVersionInfoKey) + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.varFileInfoKey) + @@ -551,54 +557,54 @@ type VersionResourceSerializer() = int VersionResourceSerializer.sizeVS_FIXEDFILEINFO this.GetStringsSize () + sizeEXEVERRESOURCE - member this.WriteVerResource(writer : BinaryWriter) = + member this.WriteVerResource (writer: BinaryWriter) = let mutable debugPos = writer.BaseStream.Position let mutable dataSize = this.GetDataSize () writer.Write (WORD dataSize) writer.Write (WORD VersionResourceSerializer.sizeVS_FIXEDFILEINFO) writer.Write (WORD 0us) writer.Write (VersionResourceSerializer.vsVersionInfoKey.ToCharArray ()) - writer.Write (Array.zeroCreate (VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.vsVersionInfoKey) - VersionResourceSerializer.vsVersionInfoKey.Length * 2) : byte[]) - System.Diagnostics.Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) + writer.Write (Array.zeroCreate (VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.vsVersionInfoKey) - VersionResourceSerializer.vsVersionInfoKey.Length * 2): byte[]) + Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) this.WriteVSFixedFileInfo (writer) writer.Write (WORD (sizeof * 2 + 2 * VersionResourceSerializer.HDRSIZE + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.varFileInfoKey) + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.translationKey))) writer.Write (WORD 0us) writer.Write (WORD 1us) writer.Write (VersionResourceSerializer.varFileInfoKey.ToCharArray ()) writer.Write (Array.zeroCreate (VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.varFileInfoKey) - VersionResourceSerializer.varFileInfoKey.Length * 2): byte[]) - System.Diagnostics.Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) + Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) writer.Write (WORD (sizeof * 2 + VersionResourceSerializer.HDRSIZE + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.translationKey))) writer.Write (WORD (sizeof * 2)) writer.Write (WORD 0us) writer.Write (VersionResourceSerializer.translationKey.ToCharArray ()) writer.Write (Array.zeroCreate (VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.translationKey) - VersionResourceSerializer.translationKey.Length * 2): byte[]) - System.Diagnostics.Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) + Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) writer.Write (0us) writer.Write (WORD VersionResourceSerializer.CP_WINUNICODE) - System.Diagnostics.Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) + Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) writer.Write (WORD (2 * VersionResourceSerializer.HDRSIZE + VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.stringFileInfoKey) + VersionResourceSerializer.KEYBYTES (this._langIdAndCodePageKey) + this.GetStringsSize ())) writer.Write (0us) writer.Write (1us) writer.Write (VersionResourceSerializer.stringFileInfoKey.ToCharArray ()) writer.Write (Array.zeroCreate (VersionResourceSerializer.KEYBYTES (VersionResourceSerializer.stringFileInfoKey) - VersionResourceSerializer.stringFileInfoKey.Length * 2): byte[]) - System.Diagnostics.Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) + Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) writer.Write (WORD (VersionResourceSerializer.HDRSIZE + VersionResourceSerializer.KEYBYTES (this._langIdAndCodePageKey) + this.GetStringsSize ())) writer.Write (0us) writer.Write (1us) writer.Write (this._langIdAndCodePageKey.ToCharArray ()) writer.Write (Array.zeroCreate (VersionResourceSerializer.KEYBYTES (this._langIdAndCodePageKey) - this._langIdAndCodePageKey.Length * 2): byte[]) - System.Diagnostics.Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) - System.Diagnostics.Debug.Assert (writer.BaseStream.Position - debugPos = int64 dataSize - int64 (this.GetStringsSize ())) + Debug.Assert (writer.BaseStream.Position &&& 3L = 0L) + Debug.Assert (writer.BaseStream.Position - debugPos = int64 dataSize - int64 (this.GetStringsSize ())) debugPos <- writer.BaseStream.Position for entry in this.GetVerStrings () do let mutable writerPos = writer.BaseStream.Position writer.Write (Array.zeroCreate (int ((writerPos + 3L) &&& ~~~3L - writerPos)): byte[]) - System.Diagnostics.Debug.Assert (entry.Value <> Unchecked.defaultof<_>) + Debug.Assert (entry.Value <> Unchecked.defaultof<_>) VersionResourceSerializer.WriteVersionString (entry, writer) - System.Diagnostics.Debug.Assert (writer.BaseStream.Position - debugPos = int64 (this.GetStringsSize ())) + Debug.Assert (writer.BaseStream.Position - debugPos = int64 (this.GetStringsSize ())) -type Win32ResourceConversions() = - static member AppendIconToResourceStream(resStream : Stream, iconStream : Stream) = +type Win32ResourceConversions () = + static member AppendIconToResourceStream(resStream: Stream, iconStream: Stream) = let mutable iconReader = new BinaryReader(iconStream) let mutable reserved = iconReader.ReadUInt16 () if reserved <> 0us then @@ -609,9 +615,9 @@ type Win32ResourceConversions() = let mutable count = iconReader.ReadUInt16 () if count = 0us then raise <| ResourceException("IconStreamUnexpectedFormat") - let mutable iconDirEntries : ICONDIRENTRY [] = Array.zeroCreate (int count) + let mutable iconDirEntries: ICONDIRENTRY [] = Array.zeroCreate (int count) do - let mutable (i : System.UInt16) = 0us + let mutable (i: System.UInt16) = 0us while (i < count) do iconDirEntries.[(int i)].bWidth <- iconReader.ReadByte () iconDirEntries.[(int i)].bHeight <- iconReader.ReadByte () @@ -622,9 +628,8 @@ type Win32ResourceConversions() = iconDirEntries.[(int i)].dwBytesInRes <- iconReader.ReadUInt32 () iconDirEntries.[(int i)].dwImageOffset <- iconReader.ReadUInt32 () i <- i + 1us - - do - let mutable (i : System.UInt16) = 0us + do + let mutable (i: System.UInt16) = 0us while (i < count) do iconStream.Position <- int64 iconDirEntries.[(int i)].dwImageOffset if iconReader.ReadUInt32 () = 40u then @@ -632,11 +637,11 @@ type Win32ResourceConversions() = iconDirEntries.[(int i)].wPlanes <- iconReader.ReadUInt16 () iconDirEntries.[(int i)].wBitCount <- iconReader.ReadUInt16 () i <- i + 1us - + let mutable resWriter = new BinaryWriter(resStream) - let mutable (RT_ICON : WORD) = 3us - do - let mutable (i : System.UInt16) = 0us + let mutable (RT_ICON: WORD) = 3us + do + let mutable (i: System.UInt16) = 0us while (i < count) do resStream.Position <- resStream.Position + 3L &&& ~~~3L resWriter.Write (iconDirEntries.[(int i)].dwBytesInRes) @@ -654,7 +659,7 @@ type Win32ResourceConversions() = resWriter.Write (iconReader.ReadBytes (int (iconDirEntries.[int i].dwBytesInRes))) i <- i + 1us - let mutable (RT_GROUP_ICON : WORD) = (RT_ICON + 11us) + let mutable (RT_GROUP_ICON: WORD) = (RT_ICON + 11us) resStream.Position <- resStream.Position + 3L &&& ~~~3L resWriter.Write (uint32 (3 * sizeof + int count * 14)) resWriter.Write (0x00000020u) @@ -670,8 +675,8 @@ type Win32ResourceConversions() = resWriter.Write (0x0000us) resWriter.Write (0x0001us) resWriter.Write (count) - do - let mutable (i : System.UInt16) = 0us + do + let mutable (i: System.UInt16) = 0us while (i < count) do resWriter.Write (iconDirEntries.[(int i)].bWidth) resWriter.Write (iconDirEntries.[(int i)].bHeight) @@ -684,7 +689,7 @@ type Win32ResourceConversions() = i <- i + 1us () - static member AppendVersionToResourceStream(resStream : Stream, isDll : System.Boolean, fileVersion : string, originalFileName : string, internalName : string, productVersion : string, assemblyVersion : Version, ?fileDescription : string, ?legalCopyright : string, ?legalTrademarks : string, ?productName : string, ?comments : string, ?companyName : string) = + static member AppendVersionToResourceStream (resStream: Stream, isDll: System.Boolean, fileVersion: string, originalFileName: string, internalName: string, productVersion: string, assemblyVersion: Version, ?fileDescription: string, ?legalCopyright: string, ?legalTrademarks: string, ?productName: string, ?comments: string, ?companyName: string) = let fileDescription = (defaultArg fileDescription) " " let legalCopyright = (defaultArg legalCopyright) " " let legalTrademarks = (defaultArg legalTrademarks) Unchecked.defaultof<_> @@ -693,11 +698,11 @@ type Win32ResourceConversions() = let companyName = (defaultArg companyName) Unchecked.defaultof<_> let mutable resWriter = new BinaryWriter(resStream, Encoding.Unicode) resStream.Position <- resStream.Position + 3L &&& ~~~3L - let mutable (RT_VERSION : DWORD) = 16u + let mutable (RT_VERSION: DWORD) = 16u let mutable ver = new VersionResourceSerializer(isDll, comments, companyName, fileDescription, fileVersion, internalName, legalCopyright, legalTrademarks, originalFileName, productName, productVersion, assemblyVersion) let mutable startPos = resStream.Position let mutable dataSize = ver.GetDataSize () - let mutable (headerSize : int) = 0x20 + let mutable (headerSize: int) = 0x20 resWriter.Write (uint32 dataSize) resWriter.Write (uint32 headerSize) resWriter.Write (0xFFFFus) @@ -710,22 +715,204 @@ type Win32ResourceConversions() = resWriter.Write (0x00000000u) resWriter.Write (0x00000000u) ver.WriteVerResource (resWriter) - System.Diagnostics.Debug.Assert (resStream.Position - startPos = int64 dataSize + int64 headerSize) + Debug.Assert (resStream.Position - startPos = int64 dataSize + int64 headerSize) - static member AppendManifestToResourceStream(resStream : Stream, manifestStream : Stream, isDll : System.Boolean) = + static member AppendManifestToResourceStream(resStream: Stream, manifestStream: Stream, isDll: System.Boolean) = resStream.Position <- resStream.Position + 3L &&& ~~~3L (* ERROR UnknownPrefixOperator "~" *) - let mutable (RT_MANIFEST : WORD) = 24us + let mutable (RT_MANIFEST: WORD) = 24us let mutable resWriter = new BinaryWriter(resStream) resWriter.Write (uint32 manifestStream.Length) resWriter.Write (0x00000020u) resWriter.Write (0xFFFFus) resWriter.Write (RT_MANIFEST) resWriter.Write (0xFFFFus) - resWriter.Write ( - if isDll then 0x0002us else 0x0001us) + resWriter.Write (if isDll then 0x0002us else 0x0001us) resWriter.Write (0x00000000u) resWriter.Write (0x1030us) resWriter.Write (0x0000us) resWriter.Write (0x00000000u) resWriter.Write (0x00000000u) manifestStream.CopyTo (resStream) + + +type Win32Resource (data: byte[], codePage: DWORD, languageId: DWORD, id: int, name: string, typeId: int, typeName: string) = + member val Data = data + member val CodePage = codePage + member val LanguageId = languageId + member val Id = id + member val Name = name + member val TypeId = typeId + member val TypeName = typeName + +type Directory (name, id) = + member val Name = name + member val ID = id + member val NumberOfNamedEntries = Unchecked.defaultof with get, set + member val NumberOfIdEntries = Unchecked.defaultof with get, set + member val Entries = new List() + +type NativeResourceWriter () = + static member private CompareResources (left: Win32Resource) (right: Win32Resource) = + let mutable (result: int) = NativeResourceWriter.CompareResourceIdentifiers (left.TypeId, left.TypeName, right.TypeId, right.TypeName) + if result = 0 then + NativeResourceWriter.CompareResourceIdentifiers (left.Id, left.Name, right.Id, right.Name) + else result + + static member private CompareResourceIdentifiers (xOrdinal: int, xString: string, yOrdinal: int, yString: string) = + if xString = Unchecked.defaultof<_> then + if yString = Unchecked.defaultof<_> then + xOrdinal - yOrdinal + else + 1 + else + if yString = Unchecked.defaultof<_> then + -1 + else + String.Compare (xString, yString, StringComparison.OrdinalIgnoreCase) + + static member SortResources (resources: IEnumerable) = + resources.OrderBy ((fun d -> d), Comparer<_>.Create(Comparison<_> NativeResourceWriter.CompareResources)) :> IEnumerable + + static member SerializeWin32Resources (builder: BlobBuilder, theResources: IEnumerable, resourcesRva: int) = + let theResources = NativeResourceWriter.SortResources (theResources) + let mutable (typeDirectory: Directory) = new Directory(String.Empty, 0) + let mutable (nameDirectory: Directory) = Unchecked.defaultof<_> + let mutable (languageDirectory: Directory) = Unchecked.defaultof<_> + let mutable (lastTypeID: int) = Int32.MinValue + let mutable (lastTypeName: string) = Unchecked.defaultof<_> + let mutable (lastID: int) = Int32.MinValue + let mutable (lastName: string) = Unchecked.defaultof<_> + let mutable (sizeOfDirectoryTree: System.UInt32) = 16u + for (r: Win32Resource) in theResources do + let mutable (typeDifferent: System.Boolean) = r.TypeId < 0 && r.TypeName <> lastTypeName || r.TypeId > lastTypeID + if typeDifferent then + lastTypeID <- r.TypeId + lastTypeName <- r.TypeName + if lastTypeID < 0 then + Debug.Assert ((typeDirectory.NumberOfIdEntries = 0us), "Not all Win32 resources with types encoded as strings precede those encoded as ints") + typeDirectory.NumberOfNamedEntries <- typeDirectory.NumberOfNamedEntries + 1us + else + typeDirectory.NumberOfIdEntries <- typeDirectory.NumberOfIdEntries + 1us + sizeOfDirectoryTree <- sizeOfDirectoryTree + 24u + nameDirectory <- new Directory(lastTypeName, lastTypeID) + typeDirectory.Entries.Add (nameDirectory) + if typeDifferent || r.Id < 0 && r.Name <> lastName || r.Id > lastID then + lastID <- r.Id + lastName <- r.Name + if lastID < 0 then + Debug.Assert ((nameDirectory.NumberOfIdEntries = 0us), "Not all Win32 resources with names encoded as strings precede those encoded as ints") + nameDirectory.NumberOfNamedEntries <- nameDirectory.NumberOfNamedEntries + 1us + else + nameDirectory.NumberOfIdEntries <- nameDirectory.NumberOfIdEntries + 1us + sizeOfDirectoryTree <- sizeOfDirectoryTree + 24u + languageDirectory <- new Directory (lastName, lastID) + nameDirectory.Entries.Add (languageDirectory) + languageDirectory.NumberOfIdEntries <- languageDirectory.NumberOfIdEntries + 1us + sizeOfDirectoryTree <- sizeOfDirectoryTree + 8u + languageDirectory.Entries.Add (r) + let mutable dataWriter = new BlobBuilder() + NativeResourceWriter.WriteDirectory (typeDirectory, builder, (0u), (0u), sizeOfDirectoryTree, resourcesRva, dataWriter) + builder.LinkSuffix (dataWriter) + builder.WriteByte (0uy) + builder.Align (4) + + static member private WriteDirectory (directory: Directory, writer: BlobBuilder, offset: System.UInt32, level: System.UInt32, sizeOfDirectoryTree: System.UInt32, virtualAddressBase: int, dataWriter: BlobBuilder) = + writer.WriteUInt32 (0u) + writer.WriteUInt32 (0u) + writer.WriteUInt32 (0u) + writer.WriteUInt16 (directory.NumberOfNamedEntries) + writer.WriteUInt16 (directory.NumberOfIdEntries) + let mutable (n: System.UInt32) = uint32 directory.Entries.Count + let mutable (k: System.UInt32) = offset + 16u + n * 8u + do + let mutable (i: uint32) = 0u + while (i < n) do + let mutable (id: int) = Unchecked.defaultof + let mutable (name: string) = Unchecked.defaultof + let mutable (nameOffset: System.UInt32) = uint32 dataWriter.Count + sizeOfDirectoryTree + let mutable (directoryOffset: System.UInt32) = k + let isDir = + match directory.Entries.[int i] with + | :? Directory as subDir -> + id <- subDir.ID + name <- subDir.Name + if level = 0u then k <- k + NativeResourceWriter.SizeOfDirectory (subDir) + else k <- k + 16u + 8u * uint32 subDir.Entries.Count + true + | :? Win32Resource as r -> + id <- + if level = 0u then + r.TypeId + else + if level = 1u then + r.Id + else + int r.LanguageId + name <- + if level = 0u then + r.TypeName + else + if level = 1u then + r.Name + else + Unchecked.defaultof<_> + dataWriter.WriteUInt32 ((uint32 virtualAddressBase + sizeOfDirectoryTree + 16u + uint32 dataWriter.Count)) + let mutable (data: byte[]) = (new List (r.Data)).ToArray () + dataWriter.WriteUInt32 (uint32 data.Length) + dataWriter.WriteUInt32 (r.CodePage) + dataWriter.WriteUInt32 (0u) + dataWriter.WriteBytes (data) + while (dataWriter.Count % 4 <> 0) do + dataWriter.WriteByte (0uy) + false + | e -> failwithf "Unknown entry %s" (if isNull e then "" else e.GetType().FullName) + if id >= 0 then writer.WriteInt32 (id) + else + if name = Unchecked.defaultof<_> then + name <- String.Empty + writer.WriteUInt32 (nameOffset ||| 0x80000000u) + dataWriter.WriteUInt16 (uint16 name.Length) + dataWriter.WriteUTF16 (name) + if isDir then writer.WriteUInt32 (directoryOffset ||| 0x80000000u) + else writer.WriteUInt32 (nameOffset) + i <- i + 1u + + k <- offset + 16u + n * 8u + do + let mutable (i: int) = 0 + while (uint32 i < n) do + match directory.Entries.[i] with + | :? Directory as subDir -> + NativeResourceWriter.WriteDirectory (subDir, writer, k, (level + 1u), sizeOfDirectoryTree, virtualAddressBase, dataWriter) + if level = 0u then + k <- k + NativeResourceWriter.SizeOfDirectory (subDir) + else + k <- k + 16u + 8u * uint32 subDir.Entries.Count + | _ -> () + i <- i + 1 + () + + static member private SizeOfDirectory (directory: Directory) = + let mutable (n: System.UInt32) = uint32 directory.Entries.Count + let mutable (size: System.UInt32) = 16u + 8u * n + do + let mutable (i: int) = 0 + while (uint32 i < n) do + match directory.Entries.[i] with + | :? Directory as subDir -> + size <- size + 16u + 8u * uint32 subDir.Entries.Count + | _ -> () + i <- i + 1 + size + + (* + static member SerializeWin32Resources (builder: BlobBuilder, resourceSections: ResourceSection, resourcesRva: int) = + let mutable sectionWriter = new BlobWriter (builder.ReserveBytes (resourceSections.SectionBytes.Length)) + sectionWriter.WriteBytes (resourceSections.SectionBytes) + let mutable readStream = new MemoryStream (resourceSections.SectionBytes) + let mutable reader = new BinaryReader (readStream) + for (addressToFixup: int) in resourceSections.Relocations do + sectionWriter.Offset <- addressToFixup + reader.BaseStream.Position <- addressToFixup + sectionWriter.WriteUInt32 (reader.ReadUInt32 () + resourcesRva :> System.UInt32) + ()*) \ No newline at end of file diff --git a/src/absil/cvtres.fsi b/src/absil/ilnativeres.fsi similarity index 56% rename from src/absil/cvtres.fsi rename to src/absil/ilnativeres.fsi index 351d45626f..c958240085 100644 --- a/src/absil/cvtres.fsi +++ b/src/absil/ilnativeres.fsi @@ -1,7 +1,12 @@ -module internal FSharp.Compiler.AbstractIL.Internal.CVTres + +module internal FSharp.Compiler.AbstractIL.Internal.NativeRes open System +open System.Collections.Generic +open System.Linq +open System.Diagnostics open System.IO +open System.Reflection.Metadata type BYTE = System.Byte type DWORD = System.UInt32 @@ -26,6 +31,17 @@ type RESOURCE = member Characteristics : DWORD with get, set member data : byte[] with get, set +type Win32Resource = + new : data:byte [] * codePage: DWORD * languageId: DWORD * id: int * + name: string * typeId:int * typeName : string -> Win32Resource + member CodePage: DWORD + member Data: byte [] + member Id: int + member LanguageId : DWORD + member Name: string + member TypeId: int + member TypeName: string + [] type CvtResFile = static member ReadResFile : stream:Stream -> System.Collections.Generic.List @@ -33,5 +49,14 @@ type CvtResFile = [] type Win32ResourceConversions = static member AppendIconToResourceStream : resStream:Stream * iconStream:Stream -> unit - static member AppendVersionToResourceStream : resStream:Stream * isDll:System.Boolean * fileVersion:string * originalFileName:string * internalName:string * productVersion:string * assemblyVersion:Version * ?fileDescription:string * ?legalCopyright:string * ?legalTrademarks:string * ?productName:string * ?comments:string * ?companyName:string -> unit - static member AppendManifestToResourceStream : resStream:Stream * manifestStream:Stream * isDll:System.Boolean -> unit + static member AppendVersionToResourceStream : resStream:Stream * isDll:System.Boolean * fileVersion:string * originalFileName:string * internalName:string * productVersion:string * assemblyVersion:Version * ?fileDescription:string * ?legalCopyright:string * ?legalTrademarks:string * ?productName:string * ?comments:string * ?companyName:string -> unit + static member AppendManifestToResourceStream : resStream:Stream * manifestStream:Stream * isDll:System.Boolean -> unit + +// Write native resources +[] +type NativeResourceWriter = + static member SortResources: resources: IEnumerable -> IEnumerable + static member SerializeWin32Resources: builder:BlobBuilder * theResources: IEnumerable * resourcesRva: int -> unit + (* + static member SerializeWin32Resources (builder : BlobBuilder, resourceSections : ResourceSection, resourcesRva : int) -> unit + ()*) \ No newline at end of file diff --git a/src/absil/ilsupp.fs b/src/absil/ilsupp.fs index 42d8b13ac6..a3eca5b110 100755 --- a/src/absil/ilsupp.fs +++ b/src/absil/ilsupp.fs @@ -8,9 +8,11 @@ open FSharp.Compiler.AbstractIL.Internal open FSharp.Compiler.AbstractIL.Internal.Bytes open FSharp.Compiler.AbstractIL.Diagnostics open FSharp.Compiler.AbstractIL.Internal.Library +open FSharp.Compiler.AbstractIL.Internal.NativeRes #if FX_NO_CORHOST_SIGNER open FSharp.Compiler.AbstractIL.Internal.StrongNameSign #endif + open System open System.IO open System.Text @@ -37,8 +39,6 @@ let check _action (hresult) = System.Runtime.InteropServices.Marshal.ThrowExceptionForHR hresult //printf "action = %s, hresult = 0x%nx \n" action hresult -type PEFileType = X86 | X64 - let MAX_PATH = 260 let E_FAIL = 0x80004005 @@ -570,207 +570,24 @@ type ResFormatNode(tid: int32, nid: int32, lid: int32, dataOffset: int32, pbLink !size -let linkNativeResourcesViaCVTres (unlinkedResources: byte[] list) (ulLinkedResourceBaseRVA: int32) (fileType: PEFileType) (outputFilePath: string) = - let nPEFileType = match fileType with X86 -> 0 | X64 -> 2 - let mutable tempResFiles: string list = [] - let mutable objBytes: byte[] = [||] - - let unlinkedResources = unlinkedResources |> List.filter (fun arr -> arr.Length > 0) - if isNil unlinkedResources then // bail if there's nothing to link - objBytes - else - // Part 1: Write unlinked resources to an object file for linking - // check if the first dword is 0x0 - let firstDWord = bytesToDWord(unlinkedResources.[0].[0], unlinkedResources.[0].[1], unlinkedResources.[0].[2], unlinkedResources.[0].[3]) - if firstDWord = 0 then - // build the command line invocation string for cvtres.exe - let corSystemDir = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory() - // We'll use the current dir and a random file name rather than System.IO.Path.GetTempFileName - // to try and prevent the command line invocation string from being > MAX_PATH - - let outputFilePaths = - if outputFilePath = "" then - [ FileSystem.GetTempPathShim() ] - else - [ FileSystem.GetTempPathShim() ; (outputFilePath + "\\") ] - - // Get a unique random file - let rec GetUniqueRandomFileName path = - let tfn = path + System.IO.Path.GetRandomFileName() - if FileSystem.SafeExists tfn then - GetUniqueRandomFileName path - else - tfn - - - let machine = if 2 = nPEFileType then "X64" else "X86" - let cmdLineArgsPreamble = sprintf "/NOLOGO /READONLY /MACHINE:%s" machine - - let cvtres = corSystemDir + "cvtres.exe " - - let createCvtresArgs path = - let tempObjFileName = GetUniqueRandomFileName path - let mutable cmdLineArgs = sprintf "%s \"/Out:%s\"" cmdLineArgsPreamble tempObjFileName - let mutable resFiles: string list = [] - - for _ulr in unlinkedResources do - let tempResFileName = GetUniqueRandomFileName path - resFiles <- tempResFileName :: resFiles - cmdLineArgs <- cmdLineArgs + " \"" + tempResFileName + "\"" - let trf = resFiles - let cmd = cmdLineArgs - cmd, tempObjFileName, trf - - let cmdLineArgs, tempObjFileName, tempResFileNames = - let attempts = - outputFilePaths |> - List.map (fun path -> createCvtresArgs path) |> - List.filter (fun ((argstring: string), (_t: string), (_f: string list)) -> (cvtres.Length + argstring.Length) < MAX_PATH) - let invoc, tmp, files = - match attempts with - | [] -> createCvtresArgs ".\\" // hope for the best... - | (i, t, f) :: _rest -> i, t, f // use the first one, since they're listed in order of precedence - tempResFiles <- files - (invoc, tmp, files) - - let cvtresInvocation = cvtres + cmdLineArgs - - try - let mutable iFiles = 0 - - for ulr in unlinkedResources do - // REVIEW: What can go wrong here? What happens when the various file calls fail - // dump the unlinked resource bytes into the temp file - System.IO.File.WriteAllBytes(tempResFileNames.[iFiles], ulr) - iFiles <- iFiles + 1 - - // call cvtres.exe using the full cmd line string we've generated - - // check to see if the generated string is too long - if it is, fail with E_FAIL - if cvtresInvocation.Length >= MAX_PATH then - System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(E_FAIL) - - // REVIEW: We really shouldn't be calling out to cvtres - let mutable psi = System.Diagnostics.ProcessStartInfo cvtres - psi.Arguments <- cmdLineArgs - psi.CreateNoWindow <- true ; // REVIEW: For some reason, this still creates a window unless WindowStyle is set to hidden - psi.WindowStyle <- System.Diagnostics.ProcessWindowStyle.Hidden - let p = System.Diagnostics.Process.Start psi - - // Wait for the process to finish - p.WaitForExit() - - check "Process.Start" p.ExitCode // TODO: really need to check against 0 - - // Conversion was successful, so read the object file - objBytes <- FileSystem.ReadAllBytesShim tempObjFileName - //Array.Copy(objBytes, pbUnlinkedResource, pbUnlinkedResource.Length) - FileSystem.FileDelete tempObjFileName - finally - // clean up the temp files - List.iter (fun tempResFileName -> FileSystem.FileDelete tempResFileName) tempResFiles - - // Part 2: Read the COFF file held in pbUnlinkedResource, spit it out into pResBuffer and apply the COFF fixups - // pResBuffer will become the .rsrc section of the PE file - if (objBytes = Unchecked.defaultof) then - System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(E_FAIL) - - let hMod = bytesToIFH objBytes 0 - - if hMod.SizeOfOptionalHeader <> 0s then - System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(E_FAIL) - - let rsrc01Name = 0x313024637273722eL // ".rsrc$01" - let rsrc02Name = 0x323024637273722eL // ".rsrc$02" - let nullHdr = Unchecked.defaultof - let mutable rsrc01 = nullHdr - let mutable rsrc02 = nullHdr - - for i = 0 to int hMod.NumberOfSections do - let pSection = bytesToISH objBytes (IMAGE_FILE_HEADER.Width + (IMAGE_SECTION_HEADER.Width * i)) - if pSection.Name = rsrc01Name then - rsrc01 <- pSection - else if pSection.Name = rsrc02Name then - rsrc02 <- pSection - - if (nullHdr = rsrc01) || (nullHdr = rsrc02) then - // One of the rsrc sections wasn't found - System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(E_FAIL) - - let size = rsrc01.SizeOfRawData + rsrc02.SizeOfRawData - - let pResBuffer = Bytes.zeroCreate size - - // Copy over the raw data - Bytes.blit objBytes rsrc01.PointerToRawData pResBuffer 0 rsrc01.SizeOfRawData - - // map all the relocs in .rsrc$01 using the reloc and symbol tables in the COFF object - let symbolTableHead = hMod.PointerToSymbolTable - let IMAGE_SYM_CLASS_STATIC = 0x3uy - let IMAGE_SYM_TYPE_NULL = 0x0s - - let GetSymbolEntry (buffer: byte[]) (idx: int) = - bytesToIS buffer (symbolTableHead + (idx * IMAGE_SYMBOL.Width) ) - - for iReloc = 0 to int (rsrc01.NumberOfRelocations - 1s) do - let pReloc = bytesToIR objBytes (rsrc01.PointerToRelocations + (iReloc * IMAGE_RELOCATION.Width)) - let IdxSymbol = pReloc.SymbolTableIndex - let pSymbolEntry = GetSymbolEntry objBytes IdxSymbol - - // Ensure the symbol entry is valid for a resource - if ((pSymbolEntry.StorageClass <> IMAGE_SYM_CLASS_STATIC) || - (pSymbolEntry.Type <> IMAGE_SYM_TYPE_NULL) || - (pSymbolEntry.SectionNumber <> 3s)) then - System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(E_FAIL) - - // Ensure that RVA is a valid address inside rsrc02 - if pSymbolEntry.Value >= rsrc02.SizeOfRawData then - // pSymbolEntry.Value is too big - System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(E_FAIL) - - // store the value - let vBuff, vSize = dwToBytes (ulLinkedResourceBaseRVA + rsrc01.SizeOfRawData + pSymbolEntry.Value) - //Bytes.blit objBytes rsrc02.PointerToRawData pResBuffer pReloc.VirtualAddress rsrc02.SizeOfRawData - Bytes.blit vBuff 0 pResBuffer pReloc.VirtualAddress vSize - // Copy $02 (resource raw into pResBuffer - Bytes.blit objBytes rsrc02.PointerToRawData pResBuffer rsrc01.SizeOfRawData rsrc02.SizeOfRawData - - // return the buffer - pResBuffer - -let linkNativeResourcesManaged (unlinkedResources: byte[] list) (ulLinkedResourceBaseRVA: int32) (fileType: PEFileType) (outputFilePath: string) = - ignore fileType - ignore outputFilePath - +let linkNativeResources (unlinkedResources: byte[] list) (ulLinkedResourceBaseRVA: int32) = let resources = unlinkedResources |> Seq.map (fun s -> new MemoryStream(s)) |> Seq.map (fun s -> - let res = CVTres.CvtResFile.ReadResFile s + let res = CvtResFile.ReadResFile s s.Dispose() res) |> Seq.collect id // See MakeWin32ResourceList https://github.com/dotnet/roslyn/blob/f40b89234db51da1e1153c14af184e618504be41/src/Compilers/Core/Portable/Compilation/Compilation.cs |> Seq.map (fun r -> - WriteNativeRes.Win32Resource(data = r.data, codePage = 0u, languageId = uint32 r.LanguageId, + Win32Resource(data = r.data, codePage = 0u, languageId = uint32 r.LanguageId, id = int (int16 r.pstringName.Ordinal), name = r.pstringName.theString, typeId = int (int16 r.pstringType.Ordinal), typeName = r.pstringType.theString)) let bb = new System.Reflection.Metadata.BlobBuilder() - WriteNativeRes.NativeResourceWriter.SerializeWin32Resources(bb, resources, ulLinkedResourceBaseRVA) + NativeResourceWriter.SerializeWin32Resources(bb, resources, ulLinkedResourceBaseRVA) bb.ToArray() -let linkNativeResources (unlinkedResources: byte[] list) (ulLinkedResourceBaseRVA: int32) (fileType: PEFileType) (outputFilePath: string) = -#if ENABLE_MONO_SUPPORT - if IL.runningOnMono then - linkNativeResourcesManaged unlinkedResources ulLinkedResourceBaseRVA fileType outputFilePath - else -#endif -#if !FX_NO_LINKEDRESOURCES - linkNativeResourcesViaCVTres unlinkedResources ulLinkedResourceBaseRVA fileType outputFilePath -#else - linkNativeResourcesManaged unlinkedResources ulLinkedResourceBaseRVA fileType outputFilePath -#endif - let unlinkResource (ulLinkedResourceBaseRVA: int32) (pbLinkedResource: byte[]) = let mutable nResNodes = 0 diff --git a/src/absil/ilsupp.fsi b/src/absil/ilsupp.fsi index 6b70a89b45..a32cdb605f 100755 --- a/src/absil/ilsupp.fsi +++ b/src/absil/ilsupp.fsi @@ -35,9 +35,7 @@ type IStream = System.Runtime.InteropServices.ComTypes.IStream /// The function may be called twice, once with a zero-RVA and /// arbitrary buffer, and once with the real buffer. The size of the /// required buffer is returned. -type PEFileType = X86 | X64 - -val linkNativeResources: unlinkedResources:byte[] list -> rva:int32 -> PEFileType -> tempFilePath:string -> byte[] +val linkNativeResources: unlinkedResources:byte[] list -> rva:int32 -> byte[] val unlinkResource: int32 -> byte[] -> byte[] #if !FX_NO_PDB_WRITER diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index 561d250e5b..e475f5032b 100755 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -3732,27 +3732,24 @@ let writeBinaryAndReportMappings (outfile, let nextPhys = align alignPhys (textSectionPhysLoc + textSectionSize) let textSectionPhysSize = nextPhys - textSectionPhysLoc let next = align alignVirt (textSectionAddr + textSectionSize) - - // .RSRC SECTION (DATA) + + // .RSRC SECTION (DATA) let dataSectionPhysLoc = nextPhys let dataSectionAddr = next let dataSectionVirtToPhys v = v - dataSectionAddr + dataSectionPhysLoc - - let resourceFormat = if modul.Is64Bit then Support.X64 else Support.X86 - - let nativeResources = + let nativeResources = match modul.NativeResources with | [] -> [||] | resources -> - let unlinkedResources = - resources |> List.map (function + let unlinkedResources = + resources |> List.map (function | ILNativeResource.Out bytes -> bytes - | ILNativeResource.In (fileName, linkedResourceBase, start, len) -> + | ILNativeResource.In (fileName, linkedResourceBase, start, len) -> let linkedResource = File.ReadBinaryChunk (fileName, start, len) unlinkResource linkedResourceBase linkedResource) - + begin - try linkNativeResources unlinkedResources next resourceFormat (Path.GetDirectoryName outfile) + try linkNativeResources unlinkedResources next with e -> failwith ("Linking a native resource failed: "+e.Message+"") end diff --git a/src/absil/writenativeres.fs b/src/absil/writenativeres.fs deleted file mode 100644 index b2a7badf10..0000000000 --- a/src/absil/writenativeres.fs +++ /dev/null @@ -1,192 +0,0 @@ -// Quite literal port of https://github.com/dotnet/roslyn/blob/fab7134296816fc80019c60b0f5bef7400cf23ea/src/Compilers/Core/Portable/PEWriter/NativeResourceWriter.cs -// And its dependencies (some classes) -module internal FSharp.Compiler.AbstractIL.Internal.WriteNativeRes - -open System -open System.Collections.Generic -open System.Linq -open System.Diagnostics -open System.IO -open System.Reflection.Metadata -//open Roslyn.Utilities; - -type DWORD = System.UInt32 - -type Win32Resource(data : byte[], codePage : DWORD, languageId : DWORD, id : int, name : string, typeId : int, typeName : string) = - member val Data = data - member val CodePage = codePage - member val LanguageId = languageId - member val Id = id - member val Name = name - member val TypeId = typeId - member val TypeName = typeName - -type Directory(name, id) = - member val Name = name - member val ID = id - member val NumberOfNamedEntries = Unchecked.defaultof with get, set - member val NumberOfIdEntries = Unchecked.defaultof with get, set - member val Entries = new List() - -type NativeResourceWriter() = - static member private CompareResources (left : Win32Resource) (right : Win32Resource) = - let mutable (result : int) = NativeResourceWriter.CompareResourceIdentifiers (left.TypeId, left.TypeName, right.TypeId, right.TypeName) - if result = 0 - then NativeResourceWriter.CompareResourceIdentifiers (left.Id, left.Name, right.Id, right.Name) - else result - static member private CompareResourceIdentifiers(xOrdinal : int, xString : string, yOrdinal : int, yString : string) = - if xString = Unchecked.defaultof<_> - then - if yString = Unchecked.defaultof<_> - then xOrdinal - yOrdinal - else 1 - else - if yString = Unchecked.defaultof<_> - then - 1 - else String.Compare (xString, yString, StringComparison.OrdinalIgnoreCase) - static member SortResources(resources : IEnumerable) = - resources.OrderBy ((fun d -> d), Comparer<_>.Create(Comparison<_> NativeResourceWriter.CompareResources)) :> IEnumerable - static member SerializeWin32Resources(builder : BlobBuilder, theResources : IEnumerable, resourcesRva : int) = - let theResources = NativeResourceWriter.SortResources (theResources) - let mutable (typeDirectory : Directory) = new Directory(String.Empty, 0) - let mutable (nameDirectory : Directory) = Unchecked.defaultof<_> - let mutable (languageDirectory : Directory) = Unchecked.defaultof<_> - let mutable (lastTypeID : int) = Int32.MinValue - let mutable (lastTypeName : string) = Unchecked.defaultof<_> - let mutable (lastID : int) = Int32.MinValue - let mutable (lastName : string) = Unchecked.defaultof<_> - let mutable (sizeOfDirectoryTree : System.UInt32) = 16u - for (r : Win32Resource) in theResources do - let mutable (typeDifferent : System.Boolean) = r.TypeId < 0 && r.TypeName <> lastTypeName || r.TypeId > lastTypeID - if typeDifferent - then - lastTypeID <- r.TypeId - lastTypeName <- r.TypeName - if lastTypeID < 0 - then - Debug.Assert ((typeDirectory.NumberOfIdEntries = 0us), "Not all Win32 resources with types encoded as strings precede those encoded as ints") - typeDirectory.NumberOfNamedEntries <- typeDirectory.NumberOfNamedEntries + 1us - else - typeDirectory.NumberOfIdEntries <- typeDirectory.NumberOfIdEntries + 1us - sizeOfDirectoryTree <- sizeOfDirectoryTree + 24u - nameDirectory <- new Directory(lastTypeName, lastTypeID) - typeDirectory.Entries.Add (nameDirectory) - if typeDifferent || r.Id < 0 && r.Name <> lastName || r.Id > lastID - then - lastID <- r.Id - lastName <- r.Name - if lastID < 0 - then - Debug.Assert ((nameDirectory.NumberOfIdEntries = 0us), "Not all Win32 resources with names encoded as strings precede those encoded as ints") - nameDirectory.NumberOfNamedEntries <- nameDirectory.NumberOfNamedEntries + 1us - else - nameDirectory.NumberOfIdEntries <- nameDirectory.NumberOfIdEntries + 1us - sizeOfDirectoryTree <- sizeOfDirectoryTree + 24u - languageDirectory <- new Directory(lastName, lastID) - nameDirectory.Entries.Add (languageDirectory) - languageDirectory.NumberOfIdEntries <- languageDirectory.NumberOfIdEntries + 1us - sizeOfDirectoryTree <- sizeOfDirectoryTree + 8u - languageDirectory.Entries.Add (r) - let mutable dataWriter = new BlobBuilder() - NativeResourceWriter.WriteDirectory (typeDirectory, builder, (0u), (0u), sizeOfDirectoryTree, resourcesRva, dataWriter) - builder.LinkSuffix (dataWriter) - builder.WriteByte (0uy) - builder.Align (4) - static member private WriteDirectory(directory : Directory, writer : BlobBuilder, offset : System.UInt32, level : System.UInt32, sizeOfDirectoryTree : System.UInt32, virtualAddressBase : int, dataWriter : BlobBuilder) = - writer.WriteUInt32 (0u) - writer.WriteUInt32 (0u) - writer.WriteUInt32 (0u) - writer.WriteUInt16 (directory.NumberOfNamedEntries) - writer.WriteUInt16 (directory.NumberOfIdEntries) - let mutable (n : System.UInt32) = uint32 directory.Entries.Count - let mutable (k : System.UInt32) = offset + 16u + n * 8u - do - let mutable (i : uint32) = 0u - while (i < n) do - let mutable (id : int) = Unchecked.defaultof - let mutable (name : string) = Unchecked.defaultof - let mutable (nameOffset : System.UInt32) = uint32 dataWriter.Count + sizeOfDirectoryTree - let mutable (directoryOffset : System.UInt32) = k - let isDir = - match directory.Entries.[int i] with - | :? Directory as subDir -> - id <- subDir.ID - name <- subDir.Name - if level = 0u - then k <- k + NativeResourceWriter.SizeOfDirectory (subDir) - else k <- k + 16u + 8u * uint32 subDir.Entries.Count - true - | :? Win32Resource as r -> - id <- - if level = 0u - then r.TypeId - else - if level = 1u - then r.Id - else int r.LanguageId - name <- - if level = 0u - then r.TypeName - else - if level = 1u - then r.Name - else Unchecked.defaultof<_> - dataWriter.WriteUInt32 ((uint32 virtualAddressBase + sizeOfDirectoryTree + 16u + uint32 dataWriter.Count)) - let mutable (data : byte[]) = (new List(r.Data)).ToArray () - dataWriter.WriteUInt32 (uint32 data.Length) - dataWriter.WriteUInt32 (r.CodePage) - dataWriter.WriteUInt32 (0u) - dataWriter.WriteBytes (data) - while (dataWriter.Count % 4 <> 0) do - dataWriter.WriteByte (0uy) - false - | e -> failwithf "Unknown entry %s" (if isNull e then "" else e.GetType().FullName) - if id >= 0 - then writer.WriteInt32 (id) - else - if name = Unchecked.defaultof<_> - then name <- String.Empty - writer.WriteUInt32 (nameOffset ||| 0x80000000u) - dataWriter.WriteUInt16 (uint16 name.Length) - dataWriter.WriteUTF16 (name) - if isDir - then writer.WriteUInt32 (directoryOffset ||| 0x80000000u) - else writer.WriteUInt32 (nameOffset) - i <- i + 1u - - k <- offset + 16u + n * 8u - do - let mutable (i : int) = 0 - while (uint32 i < n) do - match directory.Entries.[i] with - | :? Directory as subDir -> - NativeResourceWriter.WriteDirectory (subDir, writer, k, (level + 1u), sizeOfDirectoryTree, virtualAddressBase, dataWriter) - if level = 0u - then k <- k + NativeResourceWriter.SizeOfDirectory (subDir) - else k <- k + 16u + 8u * uint32 subDir.Entries.Count - | _ -> () - i <- i + 1 - () - static member private SizeOfDirectory(directory : Directory) = - let mutable (n : System.UInt32) = uint32 directory.Entries.Count - let mutable (size : System.UInt32) = 16u + 8u * n - do - let mutable (i : int) = 0 - while (uint32 i < n) do - match directory.Entries.[i] with - | :? Directory as subDir -> - size <- size + 16u + 8u * uint32 subDir.Entries.Count - | _ -> () - i <- i + 1 - size - (* - static member SerializeWin32Resources(builder : BlobBuilder, resourceSections : ResourceSection, resourcesRva : int) = - let mutable sectionWriter = new BlobWriter(builder.ReserveBytes (resourceSections.SectionBytes.Length)) - sectionWriter.WriteBytes (resourceSections.SectionBytes) - let mutable readStream = new MemoryStream(resourceSections.SectionBytes) - let mutable reader = new BinaryReader(readStream) - for (addressToFixup : int) in resourceSections.Relocations do - sectionWriter.Offset <- addressToFixup - reader.BaseStream.Position <- addressToFixup - sectionWriter.WriteUInt32 (reader.ReadUInt32 () + resourcesRva :> System.UInt32) - ()*) \ No newline at end of file diff --git a/src/absil/writenativeres.fsi b/src/absil/writenativeres.fsi deleted file mode 100644 index 8728e5d538..0000000000 --- a/src/absil/writenativeres.fsi +++ /dev/null @@ -1,34 +0,0 @@ - -module internal FSharp.Compiler.AbstractIL.Internal.WriteNativeRes - - -open System -open System.Collections.Generic -open System.Linq -open System.Diagnostics -open System.IO -open System.Reflection.Metadata -//open Roslyn.Utilities; - -type DWORD = System.UInt32 - -type Win32Resource = - class - new : data:byte [] * codePage:DWORD * languageId:DWORD * id:int * - name:string * typeId:int * typeName:string -> Win32Resource - member CodePage : DWORD - member Data : byte [] - member Id : int - member LanguageId : DWORD - member Name : string - member TypeId : int - member TypeName : string - end - -[] -type NativeResourceWriter = - static member SortResources : resources : IEnumerable -> IEnumerable - static member SerializeWin32Resources : builder:BlobBuilder * theResources:IEnumerable * resourcesRva:int -> unit - (* - static member SerializeWin32Resources(builder : BlobBuilder, resourceSections : ResourceSection, resourcesRva : int) -> unit - ()*) \ No newline at end of file diff --git a/src/fsharp/DotNetFrameworkDependencies.fs b/src/fsharp/DotNetFrameworkDependencies.fs index 504bde5fa3..3d8e33082c 100644 --- a/src/fsharp/DotNetFrameworkDependencies.fs +++ b/src/fsharp/DotNetFrameworkDependencies.fs @@ -82,7 +82,10 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies let file = try let depsJsonPath = Path.ChangeExtension(Assembly.GetEntryAssembly().Location, "deps.json") - File.ReadAllText(depsJsonPath) + if File.Exists(depsJsonPath) then + File.ReadAllText(depsJsonPath) + else + "" with _ -> "" let tfmPrefix=".NETCoreApp,Version=v" diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 831597c031..416e6967e5 100755 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1465,3 +1465,5 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl 3301,chkInvalidFunctionReturnType,"The function or method has an invalid return type '%s'. This is not permitted by the rules of Common IL." useSdkRefs,"Use reference assemblies for .NET framework references when available (Enabled by default)." fSharpBannerVersion,"%s for F# %s" +nativeResourceFormatError,"Stream does not begin with a null resource and is not in '.RES' format." +nativeResourceHeaderMalformed,"Resource header beginning at offset %s is malformed." \ No newline at end of file diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 3ea3849026..b733a67973 100755 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -496,11 +496,10 @@ module BinaryGenerationUtilities = for _ in 1..(4 - (initialAlignment + v.Length) % 4) % 4 do yield 0x0uy |] -// Generate nodes in a .res file format. These are then linked by Abstract IL using the -// linkNativeResources function, which invokes the cvtres.exe utility -module ResFileFormat = +// Generate nodes in a .res file format. These are then linked by Abstract IL using linkNativeResources +module ResFileFormat = open BinaryGenerationUtilities - + let ResFileNode(dwTypeID, dwNameID, wMemFlags, wLangID, data: byte[]) = [| yield! i32 data.Length // DWORD ResHdr.dwDataSize yield! i32 0x00000020 // dwHeaderSize From 8e044aa11423a327bfbf2032f4f60a5c6306a63d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2019 10:28:17 -0700 Subject: [PATCH 250/286] Update dependencies from https://github.com/dotnet/arcade build 20190903.5 (#7493) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19453.5 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5c37dee817..06195809bc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 316c80d0c373be63f991cc4d586db85273c1c553 + 6e94f0da0f12c7663ab39ce5bd6a67c4ab58b5ee diff --git a/global.json b/global.json index d83c45f986..4ec640a5ac 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19430.3", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19453.5", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 88911b9cb0c8ea0c040b44e8f8cda8043dc41995 Mon Sep 17 00:00:00 2001 From: Nelson Wu Date: Wed, 4 Sep 2019 14:24:15 -0700 Subject: [PATCH 251/286] Disallow attributes on type extensions (#7481) * add test for feature * add error logic to typechecker * update strings * address comments * update tests --- src/fsharp/FSComp.txt | 1 + src/fsharp/TypeChecker.fs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 416e6967e5..12b93344bc 100755 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1461,6 +1461,7 @@ notAFunctionButMaybeDeclaration,"This value is not a function and cannot be appl 3243,parsInvalidAnonRecdExpr,"Invalid anonymous record expression" 3244,parsInvalidAnonRecdType,"Invalid anonymous record type" 3245,tcCopyAndUpdateNeedsRecordType,"The input to a copy-and-update expression that creates an anonymous record must be either an anonymous record or a record" +3246,tcAugmentationsCannotHaveAttributes,"Attributes cannot be applied to type extensions." 3300,chkInvalidFunctionParameterType,"The parameter '%s' has an invalid type '%s'. This is not permitted by the rules of Common IL." 3301,chkInvalidFunctionReturnType,"The function or method has an invalid return type '%s'. This is not permitted by the rules of Common IL." useSdkRefs,"Use reference assemblies for .NET framework references when available (Enabled by default)." diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 7610c4f209..091b2f6873 100644 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -16429,6 +16429,11 @@ module TcDeclarations = if not (isNil members) && tcref.IsTypeAbbrev then errorR(Error(FSComp.SR.tcTypeAbbreviationsCannotHaveAugmentations(), tyDeclRange)) + let (ComponentInfo (attributes, _, _, _, _, _, _, _)) = synTyconInfo + if not (List.isEmpty attributes) && (declKind = ExtrinsicExtensionBinding || declKind = IntrinsicExtensionBinding) then + let attributeRange = (List.head attributes).Range + error(Error(FSComp.SR.tcAugmentationsCannotHaveAttributes(), attributeRange)) + MutRecDefnsPhase2DataForTycon(tyconOpt, innerParent, declKind, tcref, baseValOpt, safeInitInfo, declaredTyconTypars, members, tyDeclRange, newslotsOK, fixupFinalAttrs)) // By now we've established the full contents of type definitions apart from their From 78cd5d2af3e0b7cb380a7b843d63a4c9385ecc5a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 5 Sep 2019 09:45:42 -0700 Subject: [PATCH 252/286] Update dependencies from https://github.com/dotnet/arcade build 20190904.31 (#7497) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19454.31 --- eng/Version.Details.xml | 4 +- eng/common/sdl/execute-all-sdl-tools.ps1 | 17 +- ...lic-dev-release.yml => netcore-dev-30.yml} | 44 ++--- .../post-build/channels/netcore-dev-31.yml | 165 ++++++++++++++++++ .../post-build/channels/netcore-dev-5.yml | 40 ++--- ...-servicing.yml => netcore-internal-30.yml} | 36 ++-- ...lic-release.yml => netcore-release-30.yml} | 39 +++-- .../channels/netcore-release-31.yml | 160 +++++++++++++++++ .../channels/netcore-tools-latest.yml | 45 +++-- .../channels/public-validation-release.yml | 37 ++-- .../templates/post-build/common-variables.yml | 8 + .../templates/post-build/post-build.yml | 21 ++- global.json | 2 +- 13 files changed, 491 insertions(+), 127 deletions(-) rename eng/common/templates/post-build/channels/{public-dev-release.yml => netcore-dev-30.yml} (91%) create mode 100644 eng/common/templates/post-build/channels/netcore-dev-31.yml rename eng/common/templates/post-build/channels/{internal-servicing.yml => netcore-internal-30.yml} (91%) rename eng/common/templates/post-build/channels/{public-release.yml => netcore-release-30.yml} (87%) create mode 100644 eng/common/templates/post-build/channels/netcore-release-31.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 06195809bc..6d55461513 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 6e94f0da0f12c7663ab39ce5bd6a67c4ab58b5ee + 00d8aa82b488f321204a0e69a81399af9df276a1 diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 index fa239484f2..01799d63ff 100644 --- a/eng/common/sdl/execute-all-sdl-tools.ps1 +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -45,6 +45,7 @@ if ($GuardianPackageName) { $guardianCliLocation = $GuardianCliLocation } +$workingDirectory = (Split-Path $SourceDirectory -Parent) $ValidPath = Test-Path $guardianCliLocation if ($ValidPath -eq $False) @@ -53,13 +54,13 @@ if ($ValidPath -eq $False) exit 1 } -& $(Join-Path $PSScriptRoot "init-sdl.ps1") -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory (Split-Path $SourceDirectory -Parent) -AzureDevOpsAccessToken $AzureDevOpsAccessToken -GuardianLoggerLevel $GuardianLoggerLevel -$gdnFolder = Join-Path (Split-Path $SourceDirectory -Parent) ".gdn" +& $(Join-Path $PSScriptRoot "init-sdl.ps1") -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $workingDirectory -AzureDevOpsAccessToken $AzureDevOpsAccessToken -GuardianLoggerLevel $GuardianLoggerLevel +$gdnFolder = Join-Path $workingDirectory ".gdn" if ($TsaOnboard) { if ($TsaCodebaseName -and $TsaNotificationEmail -and $TsaCodebaseAdmin -and $TsaBugAreaPath) { - Write-Host "$guardianCliLocation tsa-onboard --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel" - & $guardianCliLocation tsa-onboard --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel + Write-Host "$guardianCliLocation tsa-onboard --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $workingDirectory --logger-level $GuardianLoggerLevel" + & $guardianCliLocation tsa-onboard --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $workingDirectory --logger-level $GuardianLoggerLevel if ($LASTEXITCODE -ne 0) { Write-Host "Guardian tsa-onboard failed with exit code $LASTEXITCODE." exit $LASTEXITCODE @@ -71,10 +72,10 @@ if ($TsaOnboard) { } if ($ArtifactToolsList -and $ArtifactToolsList.Count -gt 0) { - & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $ArtifactsDirectory -GdnFolder $gdnFolder -ToolsList $ArtifactToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams + & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $workingDirectory -TargetDirectory $ArtifactsDirectory -GdnFolder $gdnFolder -ToolsList $ArtifactToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams } if ($SourceToolsList -and $SourceToolsList.Count -gt 0) { - & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $ArtifactsDirectory -TargetDirectory $SourceDirectory -GdnFolder $gdnFolder -ToolsList $SourceToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams + & $(Join-Path $PSScriptRoot "run-sdl.ps1") -GuardianCliLocation $guardianCliLocation -WorkingDirectory $workingDirectory -TargetDirectory $SourceDirectory -GdnFolder $gdnFolder -ToolsList $SourceToolsList -AzureDevOpsAccessToken $AzureDevOpsAccessToken -UpdateBaseline $UpdateBaseline -GuardianLoggerLevel $GuardianLoggerLevel -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams } if ($UpdateBaseline) { @@ -86,8 +87,8 @@ if ($TsaPublish) { if (-not $TsaRepositoryName) { $TsaRepositoryName = "$($Repository)-$($BranchName)" } - Write-Host "$guardianCliLocation tsa-publish --all-tools --repository-name `"$TsaRepositoryName`" --branch-name `"$TsaBranchName`" --build-number `"$BuildNumber`" --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel" - & $guardianCliLocation tsa-publish --all-tools --repository-name "$TsaRepositoryName" --branch-name "$TsaBranchName" --build-number "$BuildNumber" --onboard $True --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $ArtifactsDirectory --logger-level $GuardianLoggerLevel + Write-Host "$guardianCliLocation tsa-publish --all-tools --repository-name `"$TsaRepositoryName`" --branch-name `"$TsaBranchName`" --build-number `"$BuildNumber`" --codebase-name `"$TsaCodebaseName`" --notification-alias `"$TsaNotificationEmail`" --codebase-admin `"$TsaCodebaseAdmin`" --instance-url `"$TsaInstanceUrl`" --project-name `"$TsaProjectName`" --area-path `"$TsaBugAreaPath`" --iteration-path `"$TsaIterationPath`" --working-directory $workingDirectory --logger-level $GuardianLoggerLevel" + & $guardianCliLocation tsa-publish --all-tools --repository-name "$TsaRepositoryName" --branch-name "$TsaBranchName" --build-number "$BuildNumber" --onboard $True --codebase-name "$TsaCodebaseName" --notification-alias "$TsaNotificationEmail" --codebase-admin "$TsaCodebaseAdmin" --instance-url "$TsaInstanceUrl" --project-name "$TsaProjectName" --area-path "$TsaBugAreaPath" --iteration-path "$TsaIterationPath" --working-directory $workingDirectory --logger-level $GuardianLoggerLevel if ($LASTEXITCODE -ne 0) { Write-Host "Guardian tsa-publish failed with exit code $LASTEXITCODE." exit $LASTEXITCODE diff --git a/eng/common/templates/post-build/channels/public-dev-release.yml b/eng/common/templates/post-build/channels/netcore-dev-30.yml similarity index 91% rename from eng/common/templates/post-build/channels/public-dev-release.yml rename to eng/common/templates/post-build/channels/netcore-dev-30.yml index afa9542148..3ce7ce4d6e 100644 --- a/eng/common/templates/post-build/channels/public-dev-release.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-30.yml @@ -5,11 +5,11 @@ parameters: publishInstallersAndChecksums: false stages: -- stage: Publish +- stage: NetCore_Dev30_Publish dependsOn: validate variables: - template: ../common-variables.yml - displayName: Developer Channel + displayName: .NET Core 3.0 Dev Publishing jobs: - template: ../setup-maestro-vars.yml @@ -39,8 +39,8 @@ stages: inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' @@ -85,7 +85,7 @@ stages: AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ChannelId=$(PublicDevRelease_30_Channel_Id) /p:ArtifactsCategory=$(_DotNetArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) @@ -93,23 +93,23 @@ stages: /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:Configuration=Release /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) ${{ parameters.artifactsPublishingAdditionalParameters }} - + - task: NuGetCommand@2 displayName: Publish Packages to AzDO Feed condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') @@ -123,16 +123,16 @@ stages: displayName: Publish Blobs to AzDO Feed inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) + arguments: -FeedName $(AzDoFeedName) -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) enabled: false -- stage: PublishValidation - displayName: Publish Validation +- stage: NetCore_Dev30_Publish_Validation + displayName: .NET Core 3.0 Dev Publish Validation variables: - - template: ../common-variables.yml + - template: ../common-variables.yml jobs: - template: ../setup-maestro-vars.yml @@ -160,6 +160,6 @@ stages: parameters: ChannelId: ${{ variables.PublicDevRelease_30_Channel_Id }} - - template: ../promote-build.yml - parameters: + - template: ../promote-build.yml + parameters: ChannelId: ${{ variables.PublicDevRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-dev-31.yml b/eng/common/templates/post-build/channels/netcore-dev-31.yml new file mode 100644 index 0000000000..d40aaacc4f --- /dev/null +++ b/eng/common/templates/post-build/channels/netcore-dev-31.yml @@ -0,0 +1,165 @@ +parameters: + enableSymbolValidation: true + symbolPublishingAdditionalParameters: '' + artifactsPublishingAdditionalParameters: '' + publishInstallersAndChecksums: false + +stages: +- stage: NetCore_Dev31_Publish + dependsOn: validate + variables: + - template: ../common-variables.yml + displayName: .NET Core 3.1 Dev Publishing + jobs: + - template: ../setup-maestro-vars.yml + + - job: + displayName: Symbol Publishing + dependsOn: setupMaestroVars + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicDevRelease_31_Channel_Id)) + variables: + - group: DotNet-Symbol-Server-Pats + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + artifactName: 'BlobArtifacts' + continueOnError: true + + - task: DownloadBuildArtifacts@0 + displayName: Download PDB Artifacts + inputs: + artifactName: 'PDBArtifacts' + continueOnError: true + + - task: PowerShell@2 + displayName: Publish + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' + /p:Configuration=Release + ${{ parameters.symbolPublishingAdditionalParameters }} + + - job: + displayName: Publish Assets + dependsOn: setupMaestroVars + variables: + - group: DotNet-Blob-Feed + - group: AzureDevOps-Artifact-Feeds-Pats + - name: BARBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + - name: IsStableBuild + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicDevRelease_31_Channel_Id)) + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: current + artifactName: PackageArtifacts + + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: current + artifactName: BlobArtifacts + + - task: DownloadBuildArtifacts@0 + displayName: Download Asset Manifests + inputs: + buildType: current + artifactName: AssetManifests + + - task: PowerShell@2 + displayName: Add Assets Location + env: + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + /p:ChannelId=$(PublicDevRelease_31_Channel_Id) + /p:ArtifactsCategory=$(_DotNetArtifactsCategory) + /p:IsStableBuild=$(IsStableBuild) + /p:IsInternalBuild=$(IsInternalBuild) + /p:RepositoryName=$(Build.Repository.Name) + /p:CommitSha=$(Build.SourceVersion) + /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:Configuration=Release + /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} + /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) + /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) + /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) + /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) + ${{ parameters.artifactsPublishingAdditionalParameters }} + + - task: NuGetCommand@2 + displayName: Publish Packages to AzDO Feed + condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') + inputs: + command: push + vstsFeed: $(AzDoFeedName) + packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg + publishVstsFeed: $(AzDoFeedName) + + - task: PowerShell@2 + displayName: Publish Blobs to AzDO Feed + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 + arguments: -FeedName $(AzDoFeedName) + -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) + enabled: false + + +- stage: NetCore_Dev31_Publish_Validation + displayName: .NET Core 3.1 Dev Publish Validation + variables: + - template: ../common-variables.yml + jobs: + - template: ../setup-maestro-vars.yml + + - ${{ if eq(parameters.enableSymbolValidation, 'true') }}: + - job: + displayName: Symbol Availability + dependsOn: setupMaestroVars + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicDevRelease_31_Channel_Id)) + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: current + artifactName: PackageArtifacts + + - task: PowerShell@2 + displayName: Check Symbol Availability + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) + + - template: ../darc-gather-drop.yml + parameters: + ChannelId: ${{ variables.PublicDevRelease_31_Channel_Id }} + + - template: ../promote-build.yml + parameters: + ChannelId: ${{ variables.PublicDevRelease_31_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-dev-5.yml b/eng/common/templates/post-build/channels/netcore-dev-5.yml index 812def3154..584185c2a7 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-5.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-5.yml @@ -9,7 +9,7 @@ stages: dependsOn: validate variables: - template: ../common-variables.yml - displayName: .NET Core 5 Dev Channel + displayName: .NET Core 5 Dev Publishing jobs: - template: ../setup-maestro-vars.yml @@ -39,8 +39,8 @@ stages: inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' @@ -85,7 +85,7 @@ stages: AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ChannelId=$(NetCore_5_Dev_Channel_Id) /p:ArtifactsCategory=$(_DotNetArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) @@ -93,15 +93,15 @@ stages: /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) @@ -109,7 +109,7 @@ stages: /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) ${{ parameters.artifactsPublishingAdditionalParameters }} - + - task: NuGetCommand@2 displayName: Publish Packages to AzDO Feed condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') @@ -123,16 +123,16 @@ stages: displayName: Publish Blobs to AzDO Feed inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) + arguments: -FeedName $(AzDoFeedName) -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) enabled: false -- stage: NetCore_Dev5_PublishValidation - displayName: Publish Validation +- stage: NetCore_Dev5_Publish_Validation + displayName: .NET Core 5 Dev Publish Validation variables: - - template: ../common-variables.yml + - template: ../common-variables.yml jobs: - template: ../setup-maestro-vars.yml @@ -160,6 +160,6 @@ stages: parameters: ChannelId: ${{ variables.NetCore_5_Dev_Channel_Id }} - - template: ../promote-build.yml - parameters: + - template: ../promote-build.yml + parameters: ChannelId: ${{ variables.NetCore_5_Dev_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/internal-servicing.yml b/eng/common/templates/post-build/channels/netcore-internal-30.yml similarity index 91% rename from eng/common/templates/post-build/channels/internal-servicing.yml rename to eng/common/templates/post-build/channels/netcore-internal-30.yml index 4ca36358d9..8bf88fd49e 100644 --- a/eng/common/templates/post-build/channels/internal-servicing.yml +++ b/eng/common/templates/post-build/channels/netcore-internal-30.yml @@ -4,11 +4,11 @@ parameters: artifactsPublishingAdditionalParameters: '' stages: -- stage: IS_Publish +- stage: NetCore_30_Internal_Servicing_Publishing dependsOn: validate variables: - template: ../common-variables.yml - displayName: Internal Servicing + displayName: .NET Core 3.0 Internal Servicing Publishing jobs: - template: ../setup-maestro-vars.yml @@ -38,8 +38,8 @@ stages: inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' @@ -84,7 +84,7 @@ stages: AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ChannelId=$(InternalServicing_30_Channel_Id) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) @@ -95,15 +95,15 @@ stages: /p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url) /p:StaticInternalFeed=$(dotnetfeed-internal-nonstable-feed-url) /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' - /p:Configuration=Release + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' + /p:Configuration=Release ${{ parameters.artifactsPublishingAdditionalParameters }} - + - task: NuGetCommand@2 displayName: Publish Packages to AzDO Feed condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') @@ -117,7 +117,7 @@ stages: displayName: Publish Blobs to AzDO Feed inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) + arguments: -FeedName $(AzDoFeedName) -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) enabled: false @@ -125,11 +125,11 @@ stages: - template: ../trigger-subscription.yml parameters: ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} - -- stage: IS_PublishValidation - displayName: Publish Validation + +- stage: NetCore_30_Internal_Servicing_Publish_Validation + displayName: .NET Core 3.0 Internal Servicing Publish Validation variables: - - template: ../common-variables.yml + - template: ../common-variables.yml jobs: - template: ../setup-maestro-vars.yml diff --git a/eng/common/templates/post-build/channels/public-release.yml b/eng/common/templates/post-build/channels/netcore-release-30.yml similarity index 87% rename from eng/common/templates/post-build/channels/public-release.yml rename to eng/common/templates/post-build/channels/netcore-release-30.yml index 7ec1f89c08..dc9541d9ec 100644 --- a/eng/common/templates/post-build/channels/public-release.yml +++ b/eng/common/templates/post-build/channels/netcore-release-30.yml @@ -4,11 +4,11 @@ parameters: artifactsPublishingAdditionalParameters: '' stages: -- stage: PubRel_Publish +- stage: NetCore_Release30_Publish dependsOn: validate variables: - template: ../common-variables.yml - displayName: Public Release + displayName: .NET Core 3.0 Release Publishing jobs: - template: ../setup-maestro-vars.yml @@ -38,8 +38,8 @@ stages: inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' @@ -84,27 +84,27 @@ stages: AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ChannelId=$(PublicRelease_30_Channel_Id) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' /p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName) /p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1) /p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url) /p:StaticInternalFeed=$(dotnetfeed-internal-nonstable-feed-url) /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' - /p:Configuration=Release + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' + /p:Configuration=Release ${{ parameters.artifactsPublishingAdditionalParameters }} - + - task: NuGetCommand@2 displayName: Publish Packages to AzDO Feed condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') @@ -118,7 +118,7 @@ stages: displayName: Publish Blobs to AzDO Feed inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) + arguments: -FeedName $(AzDoFeedName) -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) enabled: false @@ -127,10 +127,10 @@ stages: parameters: ChannelId: ${{ variables.PublicRelease_30_Channel_Id }} -- stage: PubRel_PublishValidation - displayName: Publish Validation +- stage: NetCore_Release30_Publish_Validation + displayName: .NET Core 3.0 Release Publish Validation variables: - - template: ../common-variables.yml + - template: ../common-variables.yml jobs: - template: ../setup-maestro-vars.yml @@ -138,7 +138,8 @@ stages: - job: displayName: Symbol Availability dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_30_Channel_Id)) + condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_30_Channel_Id)), + contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id))) pool: vmImage: 'windows-2019' steps: diff --git a/eng/common/templates/post-build/channels/netcore-release-31.yml b/eng/common/templates/post-build/channels/netcore-release-31.yml new file mode 100644 index 0000000000..4dcf4ba9c8 --- /dev/null +++ b/eng/common/templates/post-build/channels/netcore-release-31.yml @@ -0,0 +1,160 @@ +parameters: + enableSymbolValidation: true + symbolPublishingAdditionalParameters: '' + artifactsPublishingAdditionalParameters: '' + +stages: +- stage: NetCore_Release31_Publish + dependsOn: validate + variables: + - template: ../common-variables.yml + displayName: .NET Core 3.1 Release Publishing + jobs: + - template: ../setup-maestro-vars.yml + + - job: + displayName: Symbol Publishing + dependsOn: setupMaestroVars + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id)) + variables: + - group: DotNet-Symbol-Server-Pats + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + artifactName: 'BlobArtifacts' + continueOnError: true + + - task: DownloadBuildArtifacts@0 + displayName: Download PDB Artifacts + inputs: + artifactName: 'PDBArtifacts' + continueOnError: true + + - task: PowerShell@2 + displayName: Publish + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' + /p:Configuration=Release + ${{ parameters.symbolPublishingAdditionalParameters }} + + - job: publish_assets + displayName: Publish Assets + dependsOn: setupMaestroVars + variables: + - group: DotNet-Blob-Feed + - group: AzureDevOps-Artifact-Feeds-Pats + - name: BARBuildId + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] + - name: IsStableBuild + value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id)) + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: current + artifactName: PackageArtifacts + + - task: DownloadBuildArtifacts@0 + displayName: Download Blob Artifacts + inputs: + buildType: current + artifactName: BlobArtifacts + + - task: DownloadBuildArtifacts@0 + displayName: Download Asset Manifests + inputs: + buildType: current + artifactName: AssetManifests + + - task: PowerShell@2 + displayName: Publish + env: + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) + inputs: + filePath: eng\common\sdk-task.ps1 + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + /p:ChannelId=$(PublicRelease_31_Channel_Id) + /p:IsStableBuild=$(IsStableBuild) + /p:IsInternalBuild=$(IsInternalBuild) + /p:RepositoryName=$(Build.Repository.Name) + /p:CommitSha=$(Build.SourceVersion) + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName) + /p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1) + /p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url) + /p:StaticInternalFeed=$(dotnetfeed-internal-nonstable-feed-url) + /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' + /p:Configuration=Release + ${{ parameters.artifactsPublishingAdditionalParameters }} + + - task: NuGetCommand@2 + displayName: Publish Packages to AzDO Feed + condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') + inputs: + command: push + vstsFeed: $(AzDoFeedName) + packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg + publishVstsFeed: $(AzDoFeedName) + + - task: PowerShell@2 + displayName: Publish Blobs to AzDO Feed + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 + arguments: -FeedName $(AzDoFeedName) + -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ + -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) + enabled: false + + - template: ../trigger-subscription.yml + parameters: + ChannelId: ${{ variables.PublicRelease_31_Channel_Id }} + +- stage: NetCore_Release31_Publish_Validation + displayName: .NET Core 3.1 Release Publish Validation + variables: + - template: ../common-variables.yml + jobs: + - template: ../setup-maestro-vars.yml + + - ${{ if eq(parameters.enableSymbolValidation, 'true') }}: + - job: + displayName: Symbol Availability + dependsOn: setupMaestroVars + condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id)), + contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id))) + pool: + vmImage: 'windows-2019' + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Package Artifacts + inputs: + buildType: current + artifactName: PackageArtifacts + + - task: PowerShell@2 + displayName: Check Symbol Availability + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 + arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) + + - template: ../promote-build.yml + parameters: + ChannelId: ${{ variables.PublicRelease_31_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-tools-latest.yml b/eng/common/templates/post-build/channels/netcore-tools-latest.yml index c2d2076730..4d9f197d43 100644 --- a/eng/common/templates/post-build/channels/netcore-tools-latest.yml +++ b/eng/common/templates/post-build/channels/netcore-tools-latest.yml @@ -3,13 +3,15 @@ parameters: symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' publishInstallersAndChecksums: false + publishToAzureDevOpsFeeds: false + azureDevOpsToolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' stages: - stage: NetCore_Tools_Latest_Publish dependsOn: validate variables: - template: ../common-variables.yml - displayName: .NET Tools - Latest + displayName: .NET Tools - Latest Publishing jobs: - template: ../setup-maestro-vars.yml @@ -39,8 +41,8 @@ stages: inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' @@ -85,7 +87,7 @@ stages: AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ChannelId=$(NetCore_Tools_Latest_Channel_Id) /p:ArtifactsCategory=$(_DotNetArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) @@ -93,23 +95,28 @@ stages: /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) + /p:PublishToAzureDevOpsNuGetFeeds=${{ parameters.publishToAzureDevOpsFeeds }} + /p:AzureDevOpsStaticShippingFeed=${{ parameters.azureDevOpsToolsFeed }} + /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticTransportFeed=${{ parameters.azureDevOpsToolsFeed }} + /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw) ${{ parameters.artifactsPublishingAdditionalParameters }} - + - task: NuGetCommand@2 displayName: Publish Packages to AzDO Feed condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') @@ -123,16 +130,16 @@ stages: displayName: Publish Blobs to AzDO Feed inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) + arguments: -FeedName $(AzDoFeedName) -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) enabled: false - stage: NetCore_Tools_Latest_PublishValidation - displayName: Publish Validation + displayName: .NET Tools - Latest Publish Validation variables: - - template: ../common-variables.yml + - template: ../common-variables.yml jobs: - template: ../setup-maestro-vars.yml @@ -160,6 +167,6 @@ stages: parameters: ChannelId: ${{ variables.NetCore_Tools_Latest_Channel_Id }} - - template: ../promote-build.yml - parameters: + - template: ../promote-build.yml + parameters: ChannelId: ${{ variables.NetCore_Tools_Latest_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index 12124d6215..e306fa87bf 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -1,13 +1,15 @@ parameters: artifactsPublishingAdditionalParameters: '' publishInstallersAndChecksums: false + publishToAzureDevOpsFeeds: false + azureDevOpsToolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' stages: - stage: PVR_Publish dependsOn: validate variables: - template: ../common-variables.yml - displayName: Validation Channel + displayName: .NET Tools - Validation Publishing jobs: - template: ../setup-maestro-vars.yml @@ -49,7 +51,7 @@ stages: AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ChannelId=$(PublicValidationRelease_30_Channel_Id) /p:ArtifactsCategory=$(_DotNetValidationArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) @@ -57,21 +59,26 @@ stages: /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' /p:Configuration=Release /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) + /p:PublishToAzureDevOpsNuGetFeeds=${{ parameters.publishToAzureDevOpsFeeds }} + /p:AzureDevOpsStaticShippingFeed=${{ parameters.azureDevOpsToolsFeed }} + /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticTransportFeed=${{ parameters.azureDevOpsToolsFeed }} + /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} - task: NuGetCommand@2 @@ -87,14 +94,14 @@ stages: displayName: Publish Blobs to AzDO Feed inputs: filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) + arguments: -FeedName $(AzDoFeedName) -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) enabled: false - stage: PVR_PublishValidation - displayName: Publish Validation + displayName: .NET Tools - Validation Publish Validation variables: - template: ../common-variables.yml jobs: @@ -104,6 +111,6 @@ stages: parameters: ChannelId: ${{ variables.PublicValidationRelease_30_Channel_Id }} - - template: ../promote-build.yml - parameters: + - template: ../promote-build.yml + parameters: ChannelId: ${{ variables.PublicValidationRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index 7b3fdb1361..49712b3a60 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -6,6 +6,10 @@ variables: - name: PublicDevRelease_30_Channel_Id value: 3 + # .NET Core 3.1 Dev + - name: PublicDevRelease_31_Channel_Id + value: 260 + # .NET Core 5 Dev - name: NetCore_5_Dev_Channel_Id value: 131 @@ -26,6 +30,10 @@ variables: - name: PublicRelease_30_Channel_Id value: 19 + # .NET Core 3.1 Release + - name: PublicRelease_31_Channel_Id + value: 129 + # Whether the build is internal or not - name: IsInternalBuild value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 34667b6c09..ae376b7747 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -4,6 +4,7 @@ parameters: enableSymbolValidation: false enableNugetValidation: true publishInstallersAndChecksums: false + enableAzDONuGetFeeds: true SDLValidationParameters: enable: false continueOnError: false @@ -102,7 +103,14 @@ stages: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} -- template: \eng\common\templates\post-build\channels\public-dev-release.yml +- template: \eng\common\templates\post-build\channels\netcore-dev-30.yml + parameters: + enableSymbolValidation: ${{ parameters.enableSymbolValidation }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + +- template: \eng\common\templates\post-build\channels\netcore-dev-31.yml parameters: enableSymbolValidation: ${{ parameters.enableSymbolValidation }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} @@ -115,18 +123,25 @@ stages: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + enableAzDONuGetFeeds: ${{ parameters.enableAzDONuGetFeeds }} - template: \eng\common\templates\post-build\channels\public-validation-release.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + enableAzDONuGetFeeds: ${{ parameters.enableAzDONuGetFeeds }} + +- template: \eng\common\templates\post-build\channels\netcore-release-30.yml + parameters: + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} + artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} -- template: \eng\common\templates\post-build\channels\public-release.yml +- template: \eng\common\templates\post-build\channels\netcore-release-31.yml parameters: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} -- template: \eng\common\templates\post-build\channels\internal-servicing.yml +- template: \eng\common\templates\post-build\channels\netcore-internal-30.yml parameters: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} diff --git a/global.json b/global.json index 4ec640a5ac..0ac104d10c 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19453.5", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19454.31", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 44ec439910f55e894f6be5a3abc875ece483450d Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Thu, 5 Sep 2019 15:35:49 -0700 Subject: [PATCH 253/286] add VS insertion logic to build pipeline (#7500) --- eng/release/insert-into-vs.yml | 54 ++++++++++++++++++ eng/release/scripts/GetAssemblyVersions.ps1 | 28 +++++++++ .../scripts/GetDefaultConfigVersions.ps1 | 29 ++++++++++ eng/release/scripts/GetPublishUrls.ps1 | 57 +++++++++++++++++++ 4 files changed, 168 insertions(+) create mode 100644 eng/release/insert-into-vs.yml create mode 100644 eng/release/scripts/GetAssemblyVersions.ps1 create mode 100644 eng/release/scripts/GetDefaultConfigVersions.ps1 create mode 100644 eng/release/scripts/GetPublishUrls.ps1 diff --git a/eng/release/insert-into-vs.yml b/eng/release/insert-into-vs.yml new file mode 100644 index 0000000000..d78e5d9a22 --- /dev/null +++ b/eng/release/insert-into-vs.yml @@ -0,0 +1,54 @@ +parameters: + componentBranchName: '' + insertBuildPolicy: 'CloudBuild - Request RPS' + insertTargetBranch: '' + insertTeamEmail: '' + insertTeamName: '' + dependsOn: [build] + +stages: +- stage: insert + dependsOn: build + displayName: Insert into VS + jobs: + - job: Insert_VS + pool: + vmImage: vs2017-win2016 + variables: + - group: DotNet-VSTS-Infra-Access + - name: InsertAccessToken + value: $(dn-bot-devdiv-build-rw-code-rw-release-rw) + - name: InsertBuildPolicy + value: ${{ parameters.insertBuildPolicy }} + - name: InsertTargetBranch + value: ${{ parameters.insertTargetBranch }} + - name: InsertTeamEmail + value: ${{ parameters.insertTeamEmail }} + - name: InsertTeamName + value: ${{ parameters.insertTeamName }} + steps: + - task: DownloadBuildArtifacts@0 + displayName: Download Insertion Artifacts + inputs: + buildType: current + artifactName: VSSetup + - task: PowerShell@2 + displayName: Get Publish URLs + inputs: + filePath: $(Build.SourcesDirectory)/eng/release/scripts/GetPublishUrls.ps1 + arguments: -accessToken $(System.AccessToken) -buildId $(Build.BuildId) -insertionDir $(Build.ArtifactStagingDirectory)\VSSetup + - task: PowerShell@2 + displayName: Get versions for default.config + inputs: + filePath: $(Build.SourcesDirectory)/eng/release/scripts/GetDefaultConfigVersions.ps1 + arguments: -packagesDir $(Build.ArtifactStagingDirectory)\VSSetup\DevDivPackages + - task: PowerShell@2 + displayName: Get versions for AssemblyVersions.tt + inputs: + filePath: $(Build.SourcesDirectory)/eng/release/scripts/GetAssemblyVersions.ps1 + arguments: -assemblyVersionsPath $(Build.ArtifactStagingDirectory)\VSSetup\DevDivPackages\DependentAssemblyVersions.csv + - task: ms-vseng.MicroBuildShipTasks.55100717-a81d-45ea-a363-b8fe3ec375ad.MicroBuildInsertVsPayload@2 + displayName: 'Insert VS Payload' + inputs: + LinkWorkItemsToPR: false + condition: and(succeeded(), eq(variables['Build.SourceBranch'], '${{ parameters.componentBranchName }}')) diff --git a/eng/release/scripts/GetAssemblyVersions.ps1 b/eng/release/scripts/GetAssemblyVersions.ps1 new file mode 100644 index 0000000000..2b75ac1dd5 --- /dev/null +++ b/eng/release/scripts/GetAssemblyVersions.ps1 @@ -0,0 +1,28 @@ +[CmdletBinding(PositionalBinding=$false)] +param ( + [string]$assemblyVersionsPath +) + +Set-StrictMode -version 2.0 +$ErrorActionPreference = "Stop" + +try { + [string[]]$lines = Get-Content -Path $assemblyVersionsPath | ForEach-Object { + $parts = $_ -Split ",",2 + $asm = $parts[0] + $ver = $parts[1] + $asmConst = ($asm -Replace "\.","") + "Version" + $output = "$asmConst=$ver" + $output + } + + $final = $lines -Join "," + Write-Host "Setting InsertVersionsValues to $final" + Write-Host "##vso[task.setvariable variable=InsertVersionsValues]$final" +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + exit 1 +} diff --git a/eng/release/scripts/GetDefaultConfigVersions.ps1 b/eng/release/scripts/GetDefaultConfigVersions.ps1 new file mode 100644 index 0000000000..d0f1f67fc5 --- /dev/null +++ b/eng/release/scripts/GetDefaultConfigVersions.ps1 @@ -0,0 +1,29 @@ +[CmdletBinding(PositionalBinding=$false)] +param ( + [string]$packagesDir +) + +Set-StrictMode -version 2.0 +$ErrorActionPreference = "Stop" + +try { + $packages = @() + $regex = "^(.*?)\.((?:\.?[0-9]+){3,}(?:[-a-z0-9]+)?)\.nupkg$" + Get-Item -Path "$packagesDir\*" -Filter "*.nupkg" | ForEach-Object { + $fileName = Split-Path $_ -Leaf + If ($fileName -Match $regex) { + $entry = $Matches[1] + "=" + $Matches[2] + $packages += $entry + } + } + + $final = $packages -Join "," + Write-Host "Setting InsertConfigValues to $final" + Write-Host "##vso[task.setvariable variable=InsertConfigValues]$final" +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + exit 1 +} diff --git a/eng/release/scripts/GetPublishUrls.ps1 b/eng/release/scripts/GetPublishUrls.ps1 new file mode 100644 index 0000000000..758c20ea51 --- /dev/null +++ b/eng/release/scripts/GetPublishUrls.ps1 @@ -0,0 +1,57 @@ +[CmdletBinding(PositionalBinding=$false)] +param ( + [string]$accessToken, + [string]$buildId, + [string]$insertionDir +) + +Set-StrictMode -version 2.0 +$ErrorActionPreference = "Stop" + +try { + # build map of all *.vsman files to their `info.buildVersion` values + $manifestVersionMap = @{} + Get-ChildItem -Path "$insertionDir\*" -Filter "*.vsman" | ForEach-Object { + $manifestName = Split-Path $_ -Leaf + $vsmanContents = Get-Content $_ | ConvertFrom-Json + $buildVersion = $vsmanContents.info.buildVersion + $manifestVersionMap.Add($manifestName, $buildVersion) + } + + # find all publish URLs + $manifests = @() + $seenManifests = @{} + $url = "https://dev.azure.com/dnceng/internal/_apis/build/builds/$buildId/logs?api-version=5.1" + $base64 = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$accessToken")) + $headers = @{ + Authorization = "Basic $base64" + } + Write-Host "Fetching log from $url" + $json = Invoke-WebRequest -Method Get -Uri $url -Headers $headers -UseBasicParsing | ConvertFrom-Json + foreach ($l in $json.value) { + $logUrl = $l.url + Write-Host "Fetching log from $logUrl" + $log = (Invoke-WebRequest -Method Get -Uri $logUrl -Headers $headers -UseBasicParsing).Content + If ($log -Match "(https://vsdrop\.corp\.microsoft\.com/[^\r\n;]+);([^\r\n]+)\r?\n") { + $manifestShortUrl = $Matches[1] + $manifestName = $Matches[2] + $manifestUrl = "$manifestShortUrl;$manifestName" + If (-Not $seenManifests.Contains($manifestUrl)) { + $seenManifests.Add($manifestUrl, $true) + $buildVersion = $manifestVersionMap[$manifestName] + $manifestEntry = "$manifestName{$buildVersion}=$manifestUrl" + $manifests += $manifestEntry + } + } + } + + $final = $manifests -Join "," + Write-Host "Setting InsertJsonValues to $final" + Write-Host "##vso[task.setvariable variable=InsertJsonValues]$final" +} +catch { + Write-Host $_ + Write-Host $_.Exception + Write-Host $_.ScriptStackTrace + exit 1 +} From c8b57126f080f1698d8811358c8ee4baefa60676 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Thu, 5 Sep 2019 21:37:39 -0700 Subject: [PATCH 254/286] add doc with links to all internal build definitions, etc. (#7505) --- INTERNAL.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 INTERNAL.md diff --git a/INTERNAL.md b/INTERNAL.md new file mode 100644 index 0000000000..b62e757de6 --- /dev/null +++ b/INTERNAL.md @@ -0,0 +1,60 @@ +# Links for internal team members to find build definitions, etc. + +Note that usually only the most recent link in each section is interesting. Older links are included for reference only. + +## PR Build Definition + +The PR build definition can be found [here](https://dev.azure.com/dnceng/public/_build?definitionId=496) or by +navigating through an existing PR. + +## Signed Build Definitions + +[VS 16.4 to current](https://dev.azure.com/dnceng/internal/_build?definitionId=499&_a=summary) + +[VS 15.7 to 16.3](https://dev.azure.com/devdiv/DevDiv/_build/index?definitionId=8978) + +[VS 15.6](https://dev.azure.com/devdiv/DevDiv/_build?definitionId=7239) + +[VS 15.0 to 15.5](https://dev.azure.com/devdiv/DevDiv/_build?definitionId=5037) + +## VS Insertion Generators + +VS 16.4 to current - part of the build definition. [See below](#vs-insertions-as-part-of-the-build-definition). + +The following insertion generators are automatically invoked upon successful completion of a signed build in each of +their respective branches. + +[VS 16.3](https://dev.azure.com/devdiv/DevDiv/_release?definitionId=1839&_a=releases) + +[VS 16.2](https://dev.azure.com/devdiv/DevDiv/_release?definitionId=1699&_a=releases) + +[VS 16.1](https://dev.azure.com/devdiv/DevDiv/_release?definitionId=1669&_a=releases) + +VS 16.0 and prior were done manually + +## VS Insertions as part of the build definition + +Starting with the 16.4 release and moving forwards, the VS insertion is generated as part of the build. The relevant +bits can be found near the bottom of [`azure-pipelines.yml`](azure-pipelines.yml) under the `VS Insertion` header. The +interesting parameters are `componentBranchName` and `insertTargetBranch`. In short, when an internal signed build +completes and the name of the branch built exactly equals the value in the `componentBranchName` parameter, a component +insertion into VS will be created into the `insertTargetBranch` branch. The link to the insertion PR will be found +near the bottom of the build under the title 'Insert into VS'. Examine the log for 'Insert VS Payload' and near the +bottom you'll see a line that looks like `Created request #xxxxxx at https://...`. + +To see all insertions created this way (possibly including for other internal teams), check +[here](https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequests?creatorId=122d5278-3e55-4868-9d40-1e28c2515fc4&_a=active). + +## Less interesting links + +[Nightly VSIX (master) uploader](https://dev.azure.com/dnceng/internal/_release?_a=releases&definitionId=70). Uploads +a package from every build of `master` to the [Nightly VSIX feed](README.md#using-nightly-releases-in-visual-studio). + +[Nightly VSIX (preview) uploader](https://dev.azure.com/dnceng/internal/_release?_a=releases&definitionId=71). Uploads +a package from every build of the branch that corresponds to the current Visual Studio preview to the +[Preview VSIX feed](README.md#using-nightly-releases-in-visual-studio). + +[MyGet package uploader](https://dev.azure.com/dnceng/internal/_release?_a=releases&definitionId=69). Uploads various +packages for internal consumption. Feed URL is `https://dotnet.myget.org/F/fsharp/api/v3/index.json`. + +[Internal source mirror](https://dev.azure.com/dnceng/internal/_git/dotnet-fsharp). From 5b12870944bf1498f6a252515998e15d949c8380 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Thu, 5 Sep 2019 21:47:44 -0700 Subject: [PATCH 255/286] Fix ctrl - c handling on the coreclr (#7495) * fix ctrlchandler * remove nativemethods --- src/fsharp/fsi/fsi.fs | 183 +++++++++++------------------------------- 1 file changed, 45 insertions(+), 138 deletions(-) diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index d36f442e58..b5d0b09821 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -787,14 +787,12 @@ type internal FsiCommandLineOptions(fsi: FsiEvaluationSessionHostConfig, argv: s member __.Gui = gui /// Set the current ui culture for the current thread. -#if FX_LCIDFROMCODEPAGE let internal SetCurrentUICultureForThread (lcid : int option) = let culture = Thread.CurrentThread.CurrentUICulture match lcid with | Some n -> Thread.CurrentThread.CurrentUICulture <- new CultureInfo(n) | None -> () { new IDisposable with member x.Dispose() = Thread.CurrentThread.CurrentUICulture <- culture } -#endif //---------------------------------------------------------------------------- // Reporting - warnings, errors @@ -1336,22 +1334,18 @@ type internal FsiDynamicCompiler member __.FormatValue(obj:obj, objTy) = valuePrinter.FormatValue(obj, objTy) - //---------------------------------------------------------------------------- // ctrl-c handling //---------------------------------------------------------------------------- -module internal NativeMethods = - - type ControlEventHandler = delegate of int -> bool +type ControlEventHandler = delegate of int -> bool - [] - extern bool SetConsoleCtrlHandler(ControlEventHandler _callback,bool _add) // One strange case: when a TAE happens a strange thing // occurs the next read from stdin always returns // 0 bytes, i.e. the channel will look as if it has been closed. So we check // for this condition explicitly. We also recreate the lexbuf whenever CtrlC kicks. + type internal FsiInterruptStdinState = | StdinEOFPermittedBecauseCtrlCRecentlyPressed | StdinNormal @@ -1366,149 +1360,74 @@ type internal FsiInterruptControllerKillerThreadRequest = | ExitRequest | PrintInterruptRequest -type internal FsiInterruptController(fsiOptions : FsiCommandLineOptions, - fsiConsoleOutput: FsiConsoleOutput) = +type internal FsiInterruptController(fsiOptions: FsiCommandLineOptions, fsiConsoleOutput: FsiConsoleOutput) = let mutable stdinInterruptState = StdinNormal let CTRL_C = 0 let mutable interruptAllowed = InterruptIgnored let mutable killThreadRequest = NoRequest - let mutable ctrlEventHandlers = [] : NativeMethods.ControlEventHandler list - let mutable ctrlEventActions = [] : (unit -> unit) list + + let mutable ctrlEventHandlers = []: ControlEventHandler list + let mutable ctrlEventActions = []: (unit -> unit) list let mutable exitViaKillThread = false let mutable posixReinstate = (fun () -> ()) - member __.Exit() = - if exitViaKillThread then + member __.Exit() = + if exitViaKillThread then killThreadRequest <- ExitRequest Thread.Sleep(1000) exit 0 - member __.FsiInterruptStdinState with get () = stdinInterruptState and set v = stdinInterruptState <- v + member __.FsiInterruptStdinState + with get () = stdinInterruptState + and set v = stdinInterruptState <- v member __.ClearInterruptRequest() = killThreadRequest <- NoRequest - - member __.InterruptAllowed with set v = interruptAllowed <- v - + + member __.InterruptAllowed + with set v = interruptAllowed <- v + member __.Interrupt() = ctrlEventActions |> List.iter (fun act -> act()) - + member __.EventHandlers = ctrlEventHandlers - // REVIEW: streamline all this code to use the same code on Windows and Posix. - member controller.InstallKillThread(threadToKill:Thread, pauseMilliseconds:int) = -#if DYNAMIC_CODE_EMITS_INTERRUPT_CHECKS - let action() = - Microsoft.FSharp.Silverlight.InterruptThread(threadToKill.ManagedThreadId) + member controller.InstallKillThread(threadToKill:Thread, pauseMilliseconds:int) = - ctrlEventActions <- action :: ctrlEventActions; -#else -#if FX_NO_THREADABORT - ignore threadToKill - ignore pauseMilliseconds - ignore fsiConsoleOutput - ignore CTRL_C - ignore fsiOptions - exitViaKillThread <- false -#else - if !progress then fprintfn fsiConsoleOutput.Out "installing CtrlC handler" - // WINDOWS TECHNIQUE: .NET has more safe points, and you can do more when a safe point. - // Hence we actually start up the killer thread within the handler. - try - let raiseCtrlC() = -#if FX_LCIDFROMCODEPAGE - use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID -#else - ignore fsiOptions -#endif - fprintf fsiConsoleOutput.Error "%s" (FSIstrings.SR.fsiInterrupt()) - stdinInterruptState <- StdinEOFPermittedBecauseCtrlCRecentlyPressed - if (interruptAllowed = InterruptCanRaiseException) then - killThreadRequest <- ThreadAbortRequest - let killerThread = - new Thread(new ThreadStart(fun () -> -#if FX_LCIDFROMCODEPAGE - use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID -#endif - // sleep long enough to allow ControlEventHandler handler on main thread to return - // Also sleep to give computations a bit of time to terminate - Thread.Sleep(pauseMilliseconds) - if (killThreadRequest = ThreadAbortRequest) then - if !progress then fsiConsoleOutput.uprintnfn "%s" (FSIstrings.SR.fsiAbortingMainThread()) - killThreadRequest <- NoRequest - threadToKill.Abort() - ()),Name="ControlCAbortThread") - killerThread.IsBackground <- true - killerThread.Start() - - let ctrlEventHandler = new NativeMethods.ControlEventHandler(fun i -> if i = CTRL_C then (raiseCtrlC(); true) else false ) - ctrlEventHandlers <- ctrlEventHandler :: ctrlEventHandlers - ctrlEventActions <- raiseCtrlC :: ctrlEventActions - let _resultOK = NativeMethods.SetConsoleCtrlHandler(ctrlEventHandler,true) - exitViaKillThread <- false // don't exit via kill thread - with e -> - if !progress then fprintfn fsiConsoleOutput.Error "Failed to install ctrl-c handler using Windows technique - trying to install one using Unix signal handling..."; - // UNIX TECHNIQUE: We start up a killer thread, and it watches the mutable reference location. - // We can't have a dependency on Mono DLLs (indeed we don't even have them!) - // So SOFT BIND the following code: - // Mono.Unix.Native.Stdlib.signal(Mono.Unix.Native.Signum.SIGINT,new Mono.Unix.Native.SignalHandler(fun n -> PosixSignalProcessor.PosixInvoke(n))) |> ignore; - match (try Choice1Of2(Assembly.Load(new System.Reflection.AssemblyName("Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756"))) with e -> Choice2Of2 e) with - | Choice1Of2(monoPosix) -> - try - if !progress then fprintfn fsiConsoleOutput.Error "loading type Mono.Unix.Native.Stdlib..." - let monoUnixStdlib = monoPosix.GetType("Mono.Unix.Native.Stdlib") - if !progress then fprintfn fsiConsoleOutput.Error "loading type Mono.Unix.Native.SignalHandler..." - let monoUnixSignalHandler = monoPosix.GetType("Mono.Unix.Native.SignalHandler") - if !progress then fprintfn fsiConsoleOutput.Error "creating delegate..." - controller.PosixInvoke(-1) - let monoHandler = System.Delegate.CreateDelegate(monoUnixSignalHandler,controller,"PosixInvoke") - if !progress then fprintfn fsiConsoleOutput.Error "registering signal handler..." - let monoSignalNumber = System.Enum.Parse(monoPosix.GetType("Mono.Unix.Native.Signum"),"SIGINT") - let register () = Utilities.callStaticMethod monoUnixStdlib "signal" [ monoSignalNumber; box monoHandler ] |> ignore - posixReinstate <- register - register() + // Fsi Interupt handler + let raiseCtrlC() = + use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID + fprintf fsiConsoleOutput.Error "%s" (FSIstrings.SR.fsiInterrupt()) + + stdinInterruptState <- StdinEOFPermittedBecauseCtrlCRecentlyPressed + if (interruptAllowed = InterruptCanRaiseException) then + killThreadRequest <- ThreadAbortRequest let killerThread = new Thread(new ThreadStart(fun () -> -#if FX_LCIDFROMCODEPAGE use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID -#endif - while true do - //fprintf fsiConsoleOutput.Error "\n- kill thread loop...\n"; errorWriter.Flush(); - Thread.Sleep(pauseMilliseconds*2) - match killThreadRequest with - | PrintInterruptRequest -> - fprintf fsiConsoleOutput.Error "%s" (FSIstrings.SR.fsiInterrupt()); fsiConsoleOutput.Error.Flush() - killThreadRequest <- NoRequest - | ThreadAbortRequest -> - fprintf fsiConsoleOutput.Error "%s" (FSIstrings.SR.fsiInterrupt()); fsiConsoleOutput.Error.Flush() - if !progress then fsiConsoleOutput.uprintnfn "%s" (FSIstrings.SR.fsiAbortingMainThread()) - killThreadRequest <- NoRequest - threadToKill.Abort() - | ExitRequest -> - // Mono has some weird behaviour where it blocks on exit - // once CtrlC has ever been pressed. Who knows why? Perhaps something - // to do with having a signal handler installed, but it only happens _after_ - // at least one CtrLC has been pressed. Maybe raising a ThreadAbort causes - // exiting to have problems. - // - // Anyway, we make "#q" work this case by setting ExitRequest and brutally calling - // the process-wide 'exit' - fprintf fsiConsoleOutput.Error "%s" (FSIstrings.SR.fsiExit()); fsiConsoleOutput.Error.Flush() - Utilities.callStaticMethod monoUnixStdlib "exit" [ box 0 ] |> ignore - | _ -> () - done),Name="ControlCAbortAlternativeThread") + // sleep long enough to allow ControlEventHandler handler on main thread to return + // Also sleep to give computations a bit of time to terminate + Thread.Sleep(pauseMilliseconds) + if (killThreadRequest = ThreadAbortRequest) then + if !progress then fsiConsoleOutput.uprintnfn "%s" (FSIstrings.SR.fsiAbortingMainThread()) + killThreadRequest <- NoRequest + threadToKill.Abort() + ()),Name="ControlCAbortThread") killerThread.IsBackground <- true killerThread.Start() - // exit via kill thread to workaround block-on-exit bugs with Mono once a CtrlC has been pressed - exitViaKillThread <- true - with e -> - fprintf fsiConsoleOutput.Error "%s" (FSIstrings.SR.fsiCouldNotInstallCtrlCHandler(e.Message)) - exitViaKillThread <- false - | Choice2Of2 e -> - fprintf fsiConsoleOutput.Error "%s" (FSIstrings.SR.fsiCouldNotInstallCtrlCHandler(e.Message)) - exitViaKillThread <- false -#endif + let fsiInterruptHandler (args:ConsoleCancelEventArgs) = + args.Cancel <- true + ctrlEventHandlers |> List.iter(fun handler -> handler.Invoke(CTRL_C) |> ignore) + + do Console.CancelKeyPress.Add(fsiInterruptHandler) + + // WINDOWS TECHNIQUE: .NET has more safe points, and you can do more when a safe point. + // Hence we actually start up the killer thread within the handler. + let ctrlEventHandler = new ControlEventHandler(fun i -> if i = CTRL_C then (raiseCtrlC(); true) else false ) + ctrlEventHandlers <- ctrlEventHandler :: ctrlEventHandlers + ctrlEventActions <- raiseCtrlC :: ctrlEventActions + exitViaKillThread <- false // don't exit via kill thread member x.PosixInvoke(n:int) = // we run this code once with n = -1 to make sure it is JITted before execution begins @@ -1519,8 +1438,6 @@ type internal FsiInterruptController(fsiOptions : FsiCommandLineOptions, stdinInterruptState <- StdinEOFPermittedBecauseCtrlCRecentlyPressed killThreadRequest <- if (interruptAllowed = InterruptCanRaiseException) then ThreadAbortRequest else PrintInterruptRequest -#endif - //---------------------------------------------------------------------------- // assembly finder //---------------------------------------------------------------------------- @@ -1809,9 +1726,7 @@ type internal FsiInteractionProcessor // FSI error logging on switched to thread InstallErrorLoggingOnThisThread errorLogger -#if FX_LCIDFROMCODEPAGE use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID -#endif f ctok istate) with _ -> (istate,Completed None) @@ -2185,9 +2100,7 @@ type internal FsiInteractionProcessor member __.EvalInteraction(ctok, sourceText, scriptFileName, errorLogger) = use _unwind1 = ErrorLogger.PushThreadBuildPhaseUntilUnwind(ErrorLogger.BuildPhase.Interactive) use _unwind2 = ErrorLogger.PushErrorLoggerPhaseUntilUnwind(fun _ -> errorLogger) -#if FX_LCIDFROMCODEPAGE use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID -#endif let lexbuf = UnicodeLexing.StringAsLexbuf(sourceText) let tokenizer = fsiStdinLexerProvider.CreateBufferLexer(scriptFileName, lexbuf, errorLogger) currState @@ -2204,9 +2117,7 @@ type internal FsiInteractionProcessor member __.EvalExpression (ctok, sourceText, scriptFileName, errorLogger) = use _unwind1 = ErrorLogger.PushThreadBuildPhaseUntilUnwind(ErrorLogger.BuildPhase.Interactive) use _unwind2 = ErrorLogger.PushErrorLoggerPhaseUntilUnwind(fun _ -> errorLogger) -#if FX_LCIDFROMCODEPAGE use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID -#endif let lexbuf = UnicodeLexing.StringAsLexbuf(sourceText) let tokenizer = fsiStdinLexerProvider.CreateBufferLexer(scriptFileName, lexbuf, errorLogger) currState @@ -2235,9 +2146,7 @@ type internal FsiInteractionProcessor let stdinReaderThread = new Thread(new ThreadStart(fun () -> InstallErrorLoggingOnThisThread errorLogger // FSI error logging on stdinReaderThread, e.g. parse errors. -#if FX_LCIDFROMCODEPAGE use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID -#endif try try let initialTokenizer = fsiStdinLexerProvider.CreateStdinLexer(errorLogger) @@ -2341,9 +2250,7 @@ let internal SpawnInteractiveServer fsiConsoleOutput: FsiConsoleOutput) = //printf "Spawning fsi server on channel '%s'" !fsiServerName; SpawnThread "ServerThread" (fun () -> -#if FX_LCIDFROMCODEPAGE use _scope = SetCurrentUICultureForThread fsiOptions.FsiLCID -#endif try fsi.StartServer(fsiOptions.FsiServerName) with e -> From c11b9d1cf964c431e9f82c0d7201a582c16ebec8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2019 10:12:33 -0700 Subject: [PATCH 256/286] Update dependencies from https://github.com/dotnet/arcade build 20190905.21 (#7507) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19455.21 --- eng/Version.Details.xml | 4 +- eng/common/templates/job/job.yml | 5 +- .../templates/job/publish-build-assets.yml | 7 ++ .../post-build/channels/netcore-dev-30.yml | 65 +++++++--------- .../post-build/channels/netcore-dev-31.yml | 45 +++++------ .../post-build/channels/netcore-dev-5.yml | 71 +++++++++--------- .../channels/netcore-internal-30.yml | 60 +++++++-------- .../channels/netcore-release-30.yml | 61 +++++++-------- .../channels/netcore-release-31.yml | 56 +++++++------- .../channels/netcore-tools-latest.yml | 74 ++++++++----------- .../channels/public-validation-release.yml | 67 +++++++---------- .../templates/post-build/common-variables.yml | 26 +++++-- .../templates/post-build/post-build.yml | 1 + global.json | 2 +- 14 files changed, 247 insertions(+), 297 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6d55461513..9d3b7fd63c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 00d8aa82b488f321204a0e69a81399af9df276a1 + e99f81b0e3289cfd851be0d927c1fcffa43af6b5 diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 8db456bb7f..ffda80a197 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -24,7 +24,7 @@ parameters: workspace: '' -# Job base template specific parameters + # Job base template specific parameters # Optional: Enable installing Microbuild plugin # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix # _TeamName - the name of your team @@ -151,6 +151,9 @@ jobs: continueOnError: ${{ parameters.continueOnError }} condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: NuGetAuthenticate@0 + - ${{ each step in parameters.steps }}: - ${{ step }} diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 9e77ef1b54..b722975f9c 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -47,6 +47,10 @@ jobs: downloadPath: '$(Build.StagingDirectory)/Download' condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} + + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: NuGetAuthenticate@0 + - task: PowerShell@2 displayName: Publish Build Assets inputs: @@ -59,6 +63,7 @@ jobs: /p:Configuration=$(_BuildConfig) condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} + - task: powershell@2 displayName: Create ReleaseConfigs Artifact inputs: @@ -67,12 +72,14 @@ jobs: Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(BARBuildId) Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value "$(DefaultChannels)" Add-Content -Path "$(Build.StagingDirectory)/ReleaseConfigs.txt" -Value $(IsStableBuild) + - task: PublishBuildArtifacts@1 displayName: Publish ReleaseConfigs Artifact inputs: PathtoPublish: '$(Build.StagingDirectory)/ReleaseConfigs.txt' PublishLocation: Container ArtifactName: ReleaseConfigs + - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: - task: PublishBuildArtifacts@1 displayName: Publish Logs to VSTS diff --git a/eng/common/templates/post-build/channels/netcore-dev-30.yml b/eng/common/templates/post-build/channels/netcore-dev-30.yml index 3ce7ce4d6e..16e4eff7d0 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-30.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-30.yml @@ -47,7 +47,7 @@ stages: /p:Configuration=Release ${{ parameters.symbolPublishingAdditionalParameters }} - - job: + - job: publish_assets displayName: Publish Assets dependsOn: setupMaestroVars variables: @@ -79,30 +79,41 @@ stages: buildType: current artifactName: AssetManifests + - task: NuGetToolInstaller@1 + displayName: 'Install NuGet.exe' + + # This is necessary whenever we want to publish/restore to an AzDO private feed + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 - displayName: Add Assets Location + displayName: Publish Assets env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ChannelId=$(PublicDevRelease_30_Channel_Id) + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ArtifactsCategory=$(_DotNetArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release + /p:StaticInternalFeed=$(StaticInternalFeed) + /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) + /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) + /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) + /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) + /p:NugetPath=$(NuGetExeToolPath) + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:Configuration=Release /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) @@ -110,24 +121,6 @@ stages: /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) ${{ parameters.artifactsPublishingAdditionalParameters }} - - task: NuGetCommand@2 - displayName: Publish Packages to AzDO Feed - condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') - inputs: - command: push - vstsFeed: $(AzDoFeedName) - packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg - publishVstsFeed: $(AzDoFeedName) - - - task: PowerShell@2 - displayName: Publish Blobs to AzDO Feed - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) - -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) - enabled: false - - stage: NetCore_Dev30_Publish_Validation displayName: .NET Core 3.0 Dev Publish Validation @@ -156,10 +149,6 @@ stages: filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - template: ../darc-gather-drop.yml - parameters: - ChannelId: ${{ variables.PublicDevRelease_30_Channel_Id }} - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.PublicDevRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-dev-31.yml b/eng/common/templates/post-build/channels/netcore-dev-31.yml index d40aaacc4f..52322b128e 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-31.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-31.yml @@ -79,22 +79,33 @@ stages: buildType: current artifactName: AssetManifests + - task: NuGetToolInstaller@1 + displayName: 'Install NuGet.exe' + + # This is necessary whenever we want to publish/restore to an AzDO private feed + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 - displayName: Add Assets Location + displayName: Publish Assets env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ChannelId=$(PublicDevRelease_31_Channel_Id) /p:ArtifactsCategory=$(_DotNetArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' + /p:StaticInternalFeed=$(StaticInternalFeed) + /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) + /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) + /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) + /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) + /p:NugetPath=$(NuGetExeToolPath) + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' /p:BARBuildId=$(BARBuildId) /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' @@ -110,24 +121,6 @@ stages: /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) ${{ parameters.artifactsPublishingAdditionalParameters }} - - task: NuGetCommand@2 - displayName: Publish Packages to AzDO Feed - condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') - inputs: - command: push - vstsFeed: $(AzDoFeedName) - packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg - publishVstsFeed: $(AzDoFeedName) - - - task: PowerShell@2 - displayName: Publish Blobs to AzDO Feed - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) - -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) - enabled: false - - stage: NetCore_Dev31_Publish_Validation displayName: .NET Core 3.1 Dev Publish Validation @@ -156,10 +149,6 @@ stages: filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - template: ../darc-gather-drop.yml - parameters: - ChannelId: ${{ variables.PublicDevRelease_31_Channel_Id }} - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.PublicDevRelease_31_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-dev-5.yml b/eng/common/templates/post-build/channels/netcore-dev-5.yml index 584185c2a7..4d77d26690 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-5.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-5.yml @@ -3,6 +3,7 @@ parameters: symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' publishInstallersAndChecksums: false + publishToAzureDevOpsFeeds: true stages: - stage: NetCore_Dev5_Publish @@ -47,7 +48,7 @@ stages: /p:Configuration=Release ${{ parameters.symbolPublishingAdditionalParameters }} - - job: + - job: publish_assets displayName: Publish Assets dependsOn: setupMaestroVars variables: @@ -79,55 +80,53 @@ stages: buildType: current artifactName: AssetManifests + - task: NuGetToolInstaller@1 + displayName: 'Install NuGet.exe' + + # This is necessary whenever we want to publish/restore to an AzDO private feed + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 - displayName: Add Assets Location + displayName: Publish Assets env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ChannelId=$(NetCore_5_Dev_Channel_Id) + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ArtifactsCategory=$(_DotNetArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:StaticInternalFeed=$(StaticInternalFeed) + /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) + /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) + /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) + /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) + /p:NugetPath=$(NuGetExeToolPath) + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release + /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) - /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) + /p:PublishToAzureDevOpsNuGetFeeds=${{ parameters.publishToAzureDevOpsFeeds }} + /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' + /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' + /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw) ${{ parameters.artifactsPublishingAdditionalParameters }} - - task: NuGetCommand@2 - displayName: Publish Packages to AzDO Feed - condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') - inputs: - command: push - vstsFeed: $(AzDoFeedName) - packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg - publishVstsFeed: $(AzDoFeedName) - - - task: PowerShell@2 - displayName: Publish Blobs to AzDO Feed - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) - -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) - enabled: false - - stage: NetCore_Dev5_Publish_Validation displayName: .NET Core 5 Dev Publish Validation @@ -156,10 +155,6 @@ stages: filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - template: ../darc-gather-drop.yml - parameters: - ChannelId: ${{ variables.NetCore_5_Dev_Channel_Id }} - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.NetCore_5_Dev_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-internal-30.yml b/eng/common/templates/post-build/channels/netcore-internal-30.yml index 8bf88fd49e..ad36501274 100644 --- a/eng/common/templates/post-build/channels/netcore-internal-30.yml +++ b/eng/common/templates/post-build/channels/netcore-internal-30.yml @@ -78,50 +78,42 @@ stages: buildType: current artifactName: AssetManifests + - task: NuGetToolInstaller@1 + displayName: 'Install NuGet.exe' + + # This is necessary whenever we want to publish/restore to an AzDO private feed + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 - displayName: Add Assets Location + displayName: Publish Assets env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ChannelId=$(InternalServicing_30_Channel_Id) + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName) - /p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1) - /p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url) - /p:StaticInternalFeed=$(dotnetfeed-internal-nonstable-feed-url) - /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' - /p:Configuration=Release + /p:StaticInternalFeed=$(StaticInternalFeed) + /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) + /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) + /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) + /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) + /p:NugetPath=$(NuGetExeToolPath) + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:Configuration=Release ${{ parameters.artifactsPublishingAdditionalParameters }} - - task: NuGetCommand@2 - displayName: Publish Packages to AzDO Feed - condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') - inputs: - command: push - vstsFeed: $(AzDoFeedName) - packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg - publishVstsFeed: $(AzDoFeedName) - - - task: PowerShell@2 - displayName: Publish Blobs to AzDO Feed - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) - -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) - enabled: false - - template: ../trigger-subscription.yml parameters: ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-release-30.yml b/eng/common/templates/post-build/channels/netcore-release-30.yml index dc9541d9ec..8c4bb6005b 100644 --- a/eng/common/templates/post-build/channels/netcore-release-30.yml +++ b/eng/common/templates/post-build/channels/netcore-release-30.yml @@ -78,51 +78,42 @@ stages: buildType: current artifactName: AssetManifests + - task: NuGetToolInstaller@1 + displayName: 'Install NuGet.exe' + + # This is necessary whenever we want to publish/restore to an AzDO private feed + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 - displayName: Publish + displayName: Publish Assets env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ChannelId=$(PublicRelease_30_Channel_Id) + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName) - /p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1) - /p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url) - /p:StaticInternalFeed=$(dotnetfeed-internal-nonstable-feed-url) - /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' - /p:Configuration=Release + /p:StaticInternalFeed=$(StaticInternalFeed) + /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) + /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) + /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) + /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) + /p:NugetPath=$(NuGetExeToolPath) + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:Configuration=Release ${{ parameters.artifactsPublishingAdditionalParameters }} - - task: NuGetCommand@2 - displayName: Publish Packages to AzDO Feed - condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') - inputs: - command: push - vstsFeed: $(AzDoFeedName) - packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg - publishVstsFeed: $(AzDoFeedName) - - - task: PowerShell@2 - displayName: Publish Blobs to AzDO Feed - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) - -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) - enabled: false - - template: ../trigger-subscription.yml parameters: ChannelId: ${{ variables.PublicRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-release-31.yml b/eng/common/templates/post-build/channels/netcore-release-31.yml index 4dcf4ba9c8..cfe6386daf 100644 --- a/eng/common/templates/post-build/channels/netcore-release-31.yml +++ b/eng/common/templates/post-build/channels/netcore-release-31.yml @@ -78,51 +78,48 @@ stages: buildType: current artifactName: AssetManifests + - task: NuGetToolInstaller@1 + displayName: 'Install NuGet.exe' + + # This is necessary whenever we want to publish/restore to an AzDO private feed + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 - displayName: Publish + displayName: Publish Assets env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ChannelId=$(PublicRelease_31_Channel_Id) + /p:ArtifactsCategory=$(_DotNetArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) + /p:StaticInternalFeed=$(StaticInternalFeed) + /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) + /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) + /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) + /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) + /p:NugetPath=$(NuGetExeToolPath) + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:AzureStorageAccountName=$(ProxyBackedFeedsAccountName) - /p:AzureStorageAccountKey=$(dotnetfeed-storage-access-key-1) - /p:AzureDevOpsFeedsBaseUrl=$(dotnetfeed-internal-private-feed-url) - /p:StaticInternalFeed=$(dotnetfeed-internal-nonstable-feed-url) - /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe /p:BARBuildId=$(BARBuildId) /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release + /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} + /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) + /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) + /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) + /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) ${{ parameters.artifactsPublishingAdditionalParameters }} - - task: NuGetCommand@2 - displayName: Publish Packages to AzDO Feed - condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') - inputs: - command: push - vstsFeed: $(AzDoFeedName) - packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg - publishVstsFeed: $(AzDoFeedName) - - - task: PowerShell@2 - displayName: Publish Blobs to AzDO Feed - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) - -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) - enabled: false - - template: ../trigger-subscription.yml parameters: ChannelId: ${{ variables.PublicRelease_31_Channel_Id }} @@ -138,8 +135,7 @@ stages: - job: displayName: Symbol Availability dependsOn: setupMaestroVars - condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id)), - contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id))) + condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id)) pool: vmImage: 'windows-2019' steps: diff --git a/eng/common/templates/post-build/channels/netcore-tools-latest.yml b/eng/common/templates/post-build/channels/netcore-tools-latest.yml index 4d9f197d43..83dbdeea12 100644 --- a/eng/common/templates/post-build/channels/netcore-tools-latest.yml +++ b/eng/common/templates/post-build/channels/netcore-tools-latest.yml @@ -3,8 +3,7 @@ parameters: symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' publishInstallersAndChecksums: false - publishToAzureDevOpsFeeds: false - azureDevOpsToolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' + publishToAzureDevOpsFeeds: true stages: - stage: NetCore_Tools_Latest_Publish @@ -49,7 +48,7 @@ stages: /p:Configuration=Release ${{ parameters.symbolPublishingAdditionalParameters }} - - job: + - job: publish_assets displayName: Publish Assets dependsOn: setupMaestroVars variables: @@ -81,60 +80,53 @@ stages: buildType: current artifactName: AssetManifests + - task: NuGetToolInstaller@1 + displayName: 'Install NuGet.exe' + + # This is necessary whenever we want to publish/restore to an AzDO private feed + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 - displayName: Add Assets Location + displayName: Publish Assets env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ChannelId=$(NetCore_Tools_Latest_Channel_Id) + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ArtifactsCategory=$(_DotNetArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:StaticInternalFeed=$(StaticInternalFeed) + /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) + /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) + /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) + /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) + /p:NugetPath=$(NuGetExeToolPath) + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release - /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} + /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) /p:PublishToAzureDevOpsNuGetFeeds=${{ parameters.publishToAzureDevOpsFeeds }} - /p:AzureDevOpsStaticShippingFeed=${{ parameters.azureDevOpsToolsFeed }} + /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticTransportFeed=${{ parameters.azureDevOpsToolsFeed }} + /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw) ${{ parameters.artifactsPublishingAdditionalParameters }} - - - task: NuGetCommand@2 - displayName: Publish Packages to AzDO Feed - condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') - inputs: - command: push - vstsFeed: $(AzDoFeedName) - packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg - publishVstsFeed: $(AzDoFeedName) - - - task: PowerShell@2 - displayName: Publish Blobs to AzDO Feed - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) - -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) - enabled: false - + - stage: NetCore_Tools_Latest_PublishValidation displayName: .NET Tools - Latest Publish Validation @@ -163,10 +155,6 @@ stages: filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - template: ../darc-gather-drop.yml - parameters: - ChannelId: ${{ variables.NetCore_Tools_Latest_Channel_Id }} - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.NetCore_Tools_Latest_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index e306fa87bf..a5fcdc581a 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -1,8 +1,7 @@ parameters: artifactsPublishingAdditionalParameters: '' publishInstallersAndChecksums: false - publishToAzureDevOpsFeeds: false - azureDevOpsToolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' + publishToAzureDevOpsFeeds: true stages: - stage: PVR_Publish @@ -13,7 +12,7 @@ stages: jobs: - template: ../setup-maestro-vars.yml - - job: + - job: publish_assets displayName: Publish Assets dependsOn: setupMaestroVars variables: @@ -45,60 +44,48 @@ stages: buildType: current artifactName: AssetManifests + - task: NuGetToolInstaller@1 + displayName: 'Install NuGet.exe' + + # This is necessary whenever we want to publish/restore to an AzDO private feed + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 - displayName: Add Assets Location + displayName: Publish Assets env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-unviersal-packages-rw) + AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ChannelId=$(PublicValidationRelease_30_Channel_Id) + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ArtifactsCategory=$(_DotNetValidationArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(Agent.BuildDirectory)\Nuget\NuGet.exe - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-unviersal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)\BlobArtifacts' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)\PackageArtifacts' + /p:NugetPath=$(NuGetExeToolPath) + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release + /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) - /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) /p:PublishToAzureDevOpsNuGetFeeds=${{ parameters.publishToAzureDevOpsFeeds }} - /p:AzureDevOpsStaticShippingFeed=${{ parameters.azureDevOpsToolsFeed }} + /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticTransportFeed=${{ parameters.azureDevOpsToolsFeed }} + /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} - - task: NuGetCommand@2 - displayName: Publish Packages to AzDO Feed - condition: contains(variables['TargetAzDOFeed'], 'pkgs.visualstudio.com') - inputs: - command: push - vstsFeed: $(AzDoFeedName) - packagesToPush: $(Build.ArtifactStagingDirectory)\PackageArtifacts\*.nupkg - publishVstsFeed: $(AzDoFeedName) - - - task: PowerShell@2 - displayName: Publish Blobs to AzDO Feed - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-blobs-to-azdo.ps1 - arguments: -FeedName $(AzDoFeedName) - -SourceFolderCollection $(Build.ArtifactStagingDirectory)/BlobArtifacts/ - -PersonalAccessToken $(dn-bot-dnceng-unviersal-packages-rw) - enabled: false - - stage: PVR_PublishValidation displayName: .NET Tools - Validation Publish Validation @@ -107,10 +94,6 @@ stages: jobs: - template: ../setup-maestro-vars.yml - - template: ../darc-gather-drop.yml - parameters: - ChannelId: ${{ variables.PublicValidationRelease_30_Channel_Id }} - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.PublicValidationRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index 49712b3a60..c134764496 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -1,6 +1,7 @@ variables: - group: Publish-Build-Assets - group: DotNet-DotNetCli-Storage + - group: DotNet-MSRC-Storage # .NET Core 3 Dev - name: PublicDevRelease_30_Channel_Id @@ -8,7 +9,7 @@ variables: # .NET Core 3.1 Dev - name: PublicDevRelease_31_Channel_Id - value: 260 + value: 128 # .NET Core 5 Dev - name: NetCore_5_Dev_Channel_Id @@ -38,10 +39,6 @@ variables: - name: IsInternalBuild value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} - # Storage account name for proxy-backed feeds - - name: ProxyBackedFeedsAccountName - value: dotnetfeed - # Default Maestro++ API Endpoint and API Version - name: MaestroApiEndPoint value: "https://maestro-prod.westus2.cloudapp.azure.com" @@ -55,8 +52,27 @@ variables: - name: SymbolToolVersion value: 1.0.1 + # Feed Configurations + # These should include the suffix "/index.json" + + # Configuration for the feed where packages from internal non-stable builds will be published to + - name: StaticInternalFeed + value: 'https://dnceng.pkgs.visualstudio.com/_packaging/dotnet-core-internal/nuget/v3/index.json' + # Default locations for Installers and checksums + # Public Locations - name: ChecksumsBlobFeedUrl value: https://dotnetclichecksums.blob.core.windows.net/dotnet/index.json - name: InstallersBlobFeedUrl value: https://dotnetcli.blob.core.windows.net/dotnet/index.json + + # Private Locations + - name: InternalChecksumsBlobFeedUrl + value: https://dotnetclichecksumsmsrc.blob.core.windows.net/dotnet/index.json + - name: InternalChecksumsBlobFeedKey + value: $(dotnetclichecksumsmsrc-storage-key) + + - name: InternalInstallersBlobFeedUrl + value: https://dotnetclimsrc.blob.core.windows.net/dotnet/index.json + - name: InternalInstallersBlobFeedKey + value: $(dotnetclimsrc-access-key) diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index ae376b7747..5770bb21cc 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -102,6 +102,7 @@ stages: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + enableAzDONuGetFeeds: ${{ parameters.enableAzDONuGetFeeds }} - template: \eng\common\templates\post-build\channels\netcore-dev-30.yml parameters: diff --git a/global.json b/global.json index 0ac104d10c..c219ffe154 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19454.31", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19455.21", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 2a240203e24b442bfccb777b83430196fd985a14 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2019 20:15:24 +0000 Subject: [PATCH 257/286] Update dependencies from https://github.com/dotnet/arcade build 20190906.2 (#7508) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19456.2 --- eng/Version.Details.xml | 4 ++-- eng/common/templates/post-build/channels/netcore-dev-5.yml | 2 +- global.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9d3b7fd63c..992465b3e8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - e99f81b0e3289cfd851be0d927c1fcffa43af6b5 + 397060df67388da56b50de7e6f7292a5dccc2de6 diff --git a/eng/common/templates/post-build/channels/netcore-dev-5.yml b/eng/common/templates/post-build/channels/netcore-dev-5.yml index 4d77d26690..839121dec6 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-5.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-5.yml @@ -124,7 +124,7 @@ stages: /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' - /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw) + /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} diff --git a/global.json b/global.json index c219ffe154..f74675b05f 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19455.21", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19456.2", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From f28daf02ea33855485ebb9a91e35cc3a4e990d23 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Sat, 7 Sep 2019 10:23:49 -0700 Subject: [PATCH 258/286] Update dependencies from https://github.com/dotnet/arcade build 20190906.10 (#7516) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19456.10 --- eng/Version.Details.xml | 4 ++-- eng/common/build.ps1 | 4 ++++ eng/common/performance/performance-setup.ps1 | 2 +- eng/common/performance/performance-setup.sh | 2 +- eng/common/templates/job/performance.yml | 6 +++-- .../post-build/channels/netcore-dev-30.yml | 21 ------------------ .../post-build/channels/netcore-dev-31.yml | 21 ------------------ .../post-build/channels/netcore-dev-5.yml | 21 ------------------ .../channels/netcore-internal-30.yml | 21 ------------------ .../channels/netcore-release-30.yml | 22 ------------------- .../channels/netcore-release-31.yml | 21 ------------------ .../channels/netcore-tools-latest.yml | 21 ------------------ .../templates/post-build/post-build.yml | 4 ---- global.json | 2 +- 14 files changed, 13 insertions(+), 159 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 992465b3e8..1769a2aa7b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 397060df67388da56b50de7e6f7292a5dccc2de6 + 2d393243ba4a0c95c2c18aa266df6e0f43ffe22d diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index feb58d1419..e001ccb481 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -85,6 +85,10 @@ function Build { # Re-assign properties to a new variable because PowerShell doesn't let us append properties directly for unclear reasons. # Explicitly set the type as string[] because otherwise PowerShell would make this char[] if $properties is empty. [string[]] $msbuildArgs = $properties + + # Resolve relative project paths into full paths + $projects = ($projects.Split(';').ForEach({Resolve-Path $_}) -join ';') + $msbuildArgs += "/p:Projects=$projects" $properties = $msbuildArgs } diff --git a/eng/common/performance/performance-setup.ps1 b/eng/common/performance/performance-setup.ps1 index 268986246e..ec41965fc8 100644 --- a/eng/common/performance/performance-setup.ps1 +++ b/eng/common/performance/performance-setup.ps1 @@ -17,7 +17,7 @@ Param( [string] $Configurations="CompilationMode=$CompilationMode" ) -$RunFromPerformanceRepo = ($Repository -eq "dotnet/performance") +$RunFromPerformanceRepo = ($Repository -eq "dotnet/performance") -or ($Repository -eq "dotnet-performance") $UseCoreRun = ($CoreRootDirectory -ne [string]::Empty) $UseBaselineCoreRun = ($BaselineCoreRootDirectory -ne [string]::Empty) diff --git a/eng/common/performance/performance-setup.sh b/eng/common/performance/performance-setup.sh index 550b3ebf18..2f2092166e 100755 --- a/eng/common/performance/performance-setup.sh +++ b/eng/common/performance/performance-setup.sh @@ -113,7 +113,7 @@ while (($# > 0)); do esac done -if [[ "$repository" == "dotnet/performance" ]]; then +if [ "$repository" == "dotnet/performance" ] || [ "$repository" == "dotnet-performance" ]; then run_from_perf_repo=true fi diff --git a/eng/common/templates/job/performance.yml b/eng/common/templates/job/performance.yml index ef809253d1..f877fd7a89 100644 --- a/eng/common/templates/job/performance.yml +++ b/eng/common/templates/job/performance.yml @@ -5,6 +5,7 @@ parameters: displayName: '' # optional -- display name for the job. Will use jobName if not passed pool: '' # required -- name of the Build pool container: '' # required -- name of the container + osGroup: '' # required -- operating system for the job extraSetupParameters: '' # optional -- extra arguments to pass to the setup script frameworks: ['netcoreapp3.0'] # optional -- list of frameworks to run against continueOnError: 'false' # optional -- determines whether to continue the build if the step errors @@ -44,12 +45,13 @@ jobs: - HelixPreCommand: '' - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - ${{ if eq(variables['Agent.Os'], 'Windows_NT') }}: + - ${{ if eq( parameters.osGroup, 'Windows_NT') }}: - HelixPreCommand: 'set "PERFLAB_UPLOAD_TOKEN=$(PerfCommandUploadToken)"' - IsInternal: -Internal - - ${{ if ne(variables['Agent.Os'], 'Windows_NT') }}: + - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: - HelixPreCommand: 'export PERFLAB_UPLOAD_TOKEN="$(PerfCommandUploadTokenLinux)"' - IsInternal: --internal + - group: DotNet-HelixApi-Access - group: dotnet-benchview diff --git a/eng/common/templates/post-build/channels/netcore-dev-30.yml b/eng/common/templates/post-build/channels/netcore-dev-30.yml index 16e4eff7d0..7984f06d1b 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-30.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-30.yml @@ -1,5 +1,4 @@ parameters: - enableSymbolValidation: true symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' publishInstallersAndChecksums: false @@ -129,26 +128,6 @@ stages: jobs: - template: ../setup-maestro-vars.yml - - ${{ if eq(parameters.enableSymbolValidation, 'true') }}: - - job: - displayName: Symbol Availability - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicDevRelease_30_Channel_Id)) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: PowerShell@2 - displayName: Check Symbol Availability - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.PublicDevRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-dev-31.yml b/eng/common/templates/post-build/channels/netcore-dev-31.yml index 52322b128e..bcedd0f075 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-31.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-31.yml @@ -1,5 +1,4 @@ parameters: - enableSymbolValidation: true symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' publishInstallersAndChecksums: false @@ -129,26 +128,6 @@ stages: jobs: - template: ../setup-maestro-vars.yml - - ${{ if eq(parameters.enableSymbolValidation, 'true') }}: - - job: - displayName: Symbol Availability - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicDevRelease_31_Channel_Id)) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: PowerShell@2 - displayName: Check Symbol Availability - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.PublicDevRelease_31_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-dev-5.yml b/eng/common/templates/post-build/channels/netcore-dev-5.yml index 839121dec6..18432cc60b 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-5.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-5.yml @@ -1,5 +1,4 @@ parameters: - enableSymbolValidation: true symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' publishInstallersAndChecksums: false @@ -135,26 +134,6 @@ stages: jobs: - template: ../setup-maestro-vars.yml - - ${{ if eq(parameters.enableSymbolValidation, 'true') }}: - - job: - displayName: Symbol Availability - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NetCore_5_Dev_Channel_Id)) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: PowerShell@2 - displayName: Check Symbol Availability - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.NetCore_5_Dev_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-internal-30.yml b/eng/common/templates/post-build/channels/netcore-internal-30.yml index ad36501274..36e1d1188b 100644 --- a/eng/common/templates/post-build/channels/netcore-internal-30.yml +++ b/eng/common/templates/post-build/channels/netcore-internal-30.yml @@ -1,5 +1,4 @@ parameters: - enableSymbolValidation: true symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' @@ -125,26 +124,6 @@ stages: jobs: - template: ../setup-maestro-vars.yml - - ${{ if eq(parameters.enableSymbolValidation, 'true') }}: - - job: - displayName: Symbol Availability - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.InternalServicing_30_Channel_Id)) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: PowerShell@2 - displayName: Check Symbol Availability - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-release-30.yml b/eng/common/templates/post-build/channels/netcore-release-30.yml index 8c4bb6005b..abae985ab0 100644 --- a/eng/common/templates/post-build/channels/netcore-release-30.yml +++ b/eng/common/templates/post-build/channels/netcore-release-30.yml @@ -1,5 +1,4 @@ parameters: - enableSymbolValidation: true symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' @@ -125,27 +124,6 @@ stages: jobs: - template: ../setup-maestro-vars.yml - - ${{ if eq(parameters.enableSymbolValidation, 'true') }}: - - job: - displayName: Symbol Availability - dependsOn: setupMaestroVars - condition: or(contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_30_Channel_Id)), - contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id))) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: PowerShell@2 - displayName: Check Symbol Availability - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.PublicRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-release-31.yml b/eng/common/templates/post-build/channels/netcore-release-31.yml index cfe6386daf..b2a6c7659d 100644 --- a/eng/common/templates/post-build/channels/netcore-release-31.yml +++ b/eng/common/templates/post-build/channels/netcore-release-31.yml @@ -1,5 +1,4 @@ parameters: - enableSymbolValidation: true symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' @@ -131,26 +130,6 @@ stages: jobs: - template: ../setup-maestro-vars.yml - - ${{ if eq(parameters.enableSymbolValidation, 'true') }}: - - job: - displayName: Symbol Availability - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id)) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: PowerShell@2 - displayName: Check Symbol Availability - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.PublicRelease_31_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-tools-latest.yml b/eng/common/templates/post-build/channels/netcore-tools-latest.yml index 83dbdeea12..36f6dea628 100644 --- a/eng/common/templates/post-build/channels/netcore-tools-latest.yml +++ b/eng/common/templates/post-build/channels/netcore-tools-latest.yml @@ -1,5 +1,4 @@ parameters: - enableSymbolValidation: true symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' publishInstallersAndChecksums: false @@ -135,26 +134,6 @@ stages: jobs: - template: ../setup-maestro-vars.yml - - ${{ if eq(parameters.enableSymbolValidation, 'true') }}: - - job: - displayName: Symbol Availability - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NetCore_Tools_Latest_Channel_Id)) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: PowerShell@2 - displayName: Check Symbol Availability - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/symbols-validation.ps1 - arguments: -InputPath $(Build.ArtifactStagingDirectory)/PackageArtifacts/ -ExtractPath $(Agent.BuildDirectory)/Temp/ -DotnetSymbolVersion $(SymbolToolVersion) - - template: ../promote-build.yml parameters: ChannelId: ${{ variables.NetCore_Tools_Latest_Channel_Id }} diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 5770bb21cc..e473cadbcc 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -98,7 +98,6 @@ stages: - template: \eng\common\templates\post-build\channels\netcore-dev-5.yml parameters: - enableSymbolValidation: ${{ parameters.enableSymbolValidation }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} @@ -106,21 +105,18 @@ stages: - template: \eng\common\templates\post-build\channels\netcore-dev-30.yml parameters: - enableSymbolValidation: ${{ parameters.enableSymbolValidation }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - template: \eng\common\templates\post-build\channels\netcore-dev-31.yml parameters: - enableSymbolValidation: ${{ parameters.enableSymbolValidation }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - template: \eng\common\templates\post-build\channels\netcore-tools-latest.yml parameters: - enableSymbolValidation: ${{ parameters.enableSymbolValidation }} symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} diff --git a/global.json b/global.json index f74675b05f..e1c60f0174 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19456.2", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19456.10", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From f9f6027d3cde1458d525f5bb9ffc1e74b76b6925 Mon Sep 17 00:00:00 2001 From: Friedrich von Never Date: Sun, 8 Sep 2019 06:43:22 +0700 Subject: [PATCH 259/286] Add a missing word to the comment (#7517) --- src/fsharp/FSharp.Core/async.fsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/FSharp.Core/async.fsi b/src/fsharp/FSharp.Core/async.fsi index b3312c6990..ae2cc882a5 100644 --- a/src/fsharp/FSharp.Core/async.fsi +++ b/src/fsharp/FSharp.Core/async.fsi @@ -415,8 +415,8 @@ namespace Microsoft.FSharp.Control static member StartImmediate: computation:Async * ?cancellationToken:CancellationToken-> unit - /// Runs an asynchronous computation, starting immediately on the current operating system, - /// but also returns the execution as System.Threading.Tasks.Task + /// Runs an asynchronous computation, starting immediately on the current operating system + /// thread, but also returns the execution as System.Threading.Tasks.Task /// /// If no cancellation token is provided then the default cancellation token is used. /// You may prefer using this method if you want to achive a similar behviour to async await in C# as From 60074cb98a161cdc519c5d635f4e8f62dbf3d037 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2019 10:20:59 -0700 Subject: [PATCH 260/286] [master] Update dependencies from dotnet/arcade (#7522) * Update dependencies from https://github.com/dotnet/arcade build 20190907.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19457.1 * Update dependencies from https://github.com/dotnet/arcade build 20190908.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19458.2 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1769a2aa7b..34c82619f1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 2d393243ba4a0c95c2c18aa266df6e0f43ffe22d + 29ee79a10c58dd6863a46157e374521cac610ad8 diff --git a/global.json b/global.json index e1c60f0174..5c889d6f2e 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19456.10", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19458.2", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 5d2bd222ca67e9354d6dd626f3114c8e5441e9fb Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Mon, 9 Sep 2019 12:12:35 -0700 Subject: [PATCH 261/286] cleanup FX_LCIDFROMCODEPAGE (#7509) --- FSharp.Profiles.props | 1 - src/fsharp/fsc.fs | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/FSharp.Profiles.props b/FSharp.Profiles.props index bee528e0c2..bc6988d0ba 100644 --- a/FSharp.Profiles.props +++ b/FSharp.Profiles.props @@ -6,7 +6,6 @@ $(DefineConstants);CROSS_PLATFORM_COMPILER $(DefineConstants);ENABLE_MONO_SUPPORT $(DefineConstants);BE_SECURITY_TRANSPARENT - $(DefineConstants);FX_LCIDFROMCODEPAGE diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index b733a67973..35f8080e9d 100755 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1774,15 +1774,13 @@ let main0(ctok, argv, legacyReferenceResolver, bannerAlreadyPrinted, exiter: Exiter, errorLoggerProvider : ErrorLoggerProvider, disposables : DisposablesTracker) = // See Bug 735819 - let lcidFromCodePage = -#if FX_LCIDFROMCODEPAGE + let lcidFromCodePage = if (Console.OutputEncoding.CodePage <> 65001) && (Console.OutputEncoding.CodePage <> Thread.CurrentThread.CurrentUICulture.TextInfo.OEMCodePage) && (Console.OutputEncoding.CodePage <> Thread.CurrentThread.CurrentUICulture.TextInfo.ANSICodePage) then Thread.CurrentThread.CurrentUICulture <- new CultureInfo("en-US") Some 1033 else -#endif None let directoryBuildingFrom = Directory.GetCurrentDirectory() From 0a6cf6f7ad7bc3801ae0de7d946ef0ceb7a25f3d Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Mon, 9 Sep 2019 12:40:14 -0700 Subject: [PATCH 262/286] cleanup compilingFsLib (#7510) --- src/fsharp/CompileOps.fs | 9 ----- src/fsharp/CompileOps.fsi | 6 --- src/fsharp/CompileOptions.fs | 34 ++++++----------- src/fsharp/fsc.fs | 73 +++--------------------------------- 4 files changed, 17 insertions(+), 105 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 5b75cf1077..b8b7fcdc93 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2015,9 +2015,6 @@ type TcConfigBuilder = mutable openDebugInformationForLaterStaticLinking: bool (* only for --standalone *) defaultFSharpBinariesDir: string mutable compilingFslib: bool - mutable compilingFslib20: string option - mutable compilingFslib40: bool - mutable compilingFslibNoBigInt: bool mutable useIncrementalBuilder: bool mutable includes: string list mutable implicitOpens: string list @@ -2180,9 +2177,6 @@ type TcConfigBuilder = openDebugInformationForLaterStaticLinking = false defaultFSharpBinariesDir = String.Empty compilingFslib = false - compilingFslib20 = None - compilingFslib40 = false - compilingFslibNoBigInt = false useIncrementalBuilder = false useFsiAuxLib = false implicitOpens = [] @@ -2665,9 +2659,6 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = member x.openDebugInformationForLaterStaticLinking = data.openDebugInformationForLaterStaticLinking member x.fsharpBinariesDir = fsharpBinariesDirValue member x.compilingFslib = data.compilingFslib - member x.compilingFslib20 = data.compilingFslib20 - member x.compilingFslib40 = data.compilingFslib40 - member x.compilingFslibNoBigInt = data.compilingFslibNoBigInt member x.useIncrementalBuilder = data.useIncrementalBuilder member x.includes = data.includes member x.implicitOpens = data.implicitOpens diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 1262542cd9..ff5555e8f3 100644 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -256,9 +256,6 @@ type TcConfigBuilder = mutable openDebugInformationForLaterStaticLinking: bool defaultFSharpBinariesDir: string mutable compilingFslib: bool - mutable compilingFslib20: string option - mutable compilingFslib40: bool - mutable compilingFslibNoBigInt: bool mutable useIncrementalBuilder: bool mutable includes: string list mutable implicitOpens: string list @@ -424,9 +421,6 @@ type TcConfig = member openDebugInformationForLaterStaticLinking: bool member fsharpBinariesDir: string member compilingFslib: bool - member compilingFslib20: string option - member compilingFslib40: bool - member compilingFslibNoBigInt: bool member useIncrementalBuilder: bool member includes: string list member implicitOpens: string list diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index e548a49e71..a3c0f5c327 100755 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -1217,10 +1217,9 @@ let internalFlags (tcConfigB:TcConfigBuilder) = Some(InternalCommandLineOption("metadataversion", rangeCmdArgs)), None) ] - // OptionBlock: Deprecated flags (fsc, service only) //-------------------------------------------------- - + let compilingFsLibFlag (tcConfigB: TcConfigBuilder) = CompilerOption ("compiling-fslib", tagNone, @@ -1231,23 +1230,14 @@ let compilingFsLibFlag (tcConfigB: TcConfigBuilder) = IlxSettings.ilxCompilingFSharpCoreLib := true), Some(InternalCommandLineOption("--compiling-fslib", rangeCmdArgs)), None) -let compilingFsLib20Flag (tcConfigB: TcConfigBuilder) = - CompilerOption - ("compiling-fslib-20", tagNone, - OptionString (fun s -> tcConfigB.compilingFslib20 <- Some s ), - Some(InternalCommandLineOption("--compiling-fslib-20", rangeCmdArgs)), None) +let compilingFsLib20Flag = + CompilerOption ("compiling-fslib-20", tagNone, OptionString (fun _ -> () ), None, None) -let compilingFsLib40Flag (tcConfigB: TcConfigBuilder) = - CompilerOption - ("compiling-fslib-40", tagNone, - OptionUnit (fun () -> tcConfigB.compilingFslib40 <- true ), - Some(InternalCommandLineOption("--compiling-fslib-40", rangeCmdArgs)), None) +let compilingFsLib40Flag = + CompilerOption ("compiling-fslib-40", tagNone, OptionUnit (fun () -> ()), None, None) -let compilingFsLibNoBigIntFlag (tcConfigB: TcConfigBuilder) = - CompilerOption - ("compiling-fslib-nobigint", tagNone, - OptionUnit (fun () -> tcConfigB.compilingFslibNoBigInt <- true ), - Some(InternalCommandLineOption("--compiling-fslib-nobigint", rangeCmdArgs)), None) +let compilingFsLibNoBigIntFlag = + CompilerOption ("compiling-fslib-nobigint", tagNone, OptionUnit (fun () -> () ), None, None) let mlKeywordsFlag = CompilerOption @@ -1262,7 +1252,7 @@ let gnuStyleErrorsFlag tcConfigB = Some(DeprecatedCommandLineOptionNoDescription("--gnu-style-errors", rangeCmdArgs)), None) let deprecatedFlagsBoth tcConfigB = - [ + [ CompilerOption ("light", tagNone, OptionUnit (fun () -> tcConfigB.light <- Some true), @@ -1278,7 +1268,7 @@ let deprecatedFlagsBoth tcConfigB = OptionUnit (fun () -> tcConfigB.light <- Some false), Some(DeprecatedCommandLineOptionNoDescription("--no-indentation-syntax", rangeCmdArgs)), None) ] - + let deprecatedFlagsFsi tcConfigB = deprecatedFlagsBoth tcConfigB let deprecatedFlagsFsc tcConfigB = @@ -1311,9 +1301,9 @@ let deprecatedFlagsFsc tcConfigB = Some(DeprecatedCommandLineOptionNoDescription("--progress", rangeCmdArgs)), None) compilingFsLibFlag tcConfigB - compilingFsLib20Flag tcConfigB - compilingFsLib40Flag tcConfigB - compilingFsLibNoBigIntFlag tcConfigB + compilingFsLib20Flag + compilingFsLib40Flag + compilingFsLibNoBigIntFlag CompilerOption ("version", tagString, diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 35f8080e9d..e3177acd7f 100755 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -869,11 +869,9 @@ module MainModuleBuilder = error(Error(FSComp.SR.fscAssemblyCultureAttributeError(), rangeCmdArgs)) // Add the type forwarders to any .NET DLL post-.NET-2.0, to give binary compatibility - let exportedTypesList = - if (tcConfig.compilingFslib && tcConfig.compilingFslib40) then - (List.append (createMscorlibExportList tcGlobals) - (if tcConfig.compilingFslibNoBigInt then [] else (createSystemNumericsExportList tcConfig tcImports)) - ) + let exportedTypesList = + if tcConfig.compilingFslib then + List.append (createMscorlibExportList tcGlobals) (createSystemNumericsExportList tcConfig tcImports) else [] @@ -1279,64 +1277,6 @@ module StaticLinker = ilxMainModule, rewriteExternalRefsToLocalRefs - - // LEGACY: This is only used when compiling an FSharp.Core for .NET 2.0 (FSharp.Core 2.3.0.0). We no longer - // build new FSharp.Core for that configuration. - // - // Find all IL modules that are to be statically linked given the static linking roots. - let LegacyFindAndAddMscorlibTypesForStaticLinkingIntoFSharpCoreLibraryForNet20 (tcConfig: TcConfig, ilGlobals: ILGlobals, ilxMainModule) = - let mscorlib40 = tcConfig.compilingFslib20.Value - - let ilBinaryReader = - let ilGlobals = mkILGlobals ILScopeRef.Local - let opts : ILReaderOptions = - { ilGlobals = ilGlobals - reduceMemoryUsage = tcConfig.reduceMemoryUsage - metadataOnly = MetadataOnlyFlag.No - tryGetMetadataSnapshot = (fun _ -> None) - pdbDirPath = None } - ILBinaryReader.OpenILModuleReader mscorlib40 opts - - let tdefs1 = ilxMainModule.TypeDefs.AsList |> List.filter (fun td -> not (MainModuleBuilder.injectedCompatTypes.Contains(td.Name))) - let tdefs2 = ilBinaryReader.ILModuleDef.TypeDefs.AsList |> List.filter (fun td -> MainModuleBuilder.injectedCompatTypes.Contains(td.Name)) - //printfn "tdefs2 = %A" (tdefs2 |> List.map (fun tdef -> tdef.Name)) - - // rewrite the mscorlib references - let tdefs2 = - let fakeModule = mkILSimpleModule "" "" true (4, 0) false (mkILTypeDefs tdefs2) None None 0 (mkILExportedTypes []) "" - let fakeModule = - fakeModule |> Morphs.morphILTypeRefsInILModuleMemoized ilGlobals (fun tref -> - if MainModuleBuilder.injectedCompatTypes.Contains(tref.Name) || (tref.Enclosing |> List.exists (fun x -> MainModuleBuilder.injectedCompatTypes.Contains x)) then - tref - //|> Morphs.morphILScopeRefsInILTypeRef (function ILScopeRef.Local -> ilGlobals.mscorlibScopeRef | x -> x) - // The implementations of Tuple use two private methods from System.Environment to get a resource string. Remap it - elif tref.Name = "System.Environment" then - ILTypeRef.Create(ILScopeRef.Local, [], "Microsoft.FSharp.Core.PrivateEnvironment") //|> Morphs.morphILScopeRefsInILTypeRef (function ILScopeRef.Local -> ilGlobals.mscorlibScopeRef | x -> x) - else - tref |> Morphs.morphILScopeRefsInILTypeRef (fun _ -> ilGlobals.primaryAssemblyScopeRef) ) - - // strip out System.Runtime.TargetedPatchingOptOutAttribute, which doesn't exist for 2.0 - let fakeModule = - {fakeModule with - TypeDefs = - mkILTypeDefs - ([ for td in fakeModule.TypeDefs do - let meths = td.Methods.AsList - |> List.map (fun md -> - md.With(customAttrs = - mkILCustomAttrs (td.CustomAttrs.AsList |> List.filter (fun ilattr -> - ilattr.Method.DeclaringType.TypeRef.FullName <> "System.Runtime.TargetedPatchingOptOutAttribute")))) - |> mkILMethods - let td = td.With(methods=meths) - yield td.With(methods=meths) ])} - //ILAsciiWriter.output_module stdout fakeModule - fakeModule.TypeDefs.AsList - - let ilxMainModule = - { ilxMainModule with - TypeDefs = mkILTypeDefs (tdefs1 @ tdefs2) } - ilxMainModule - [] type Node = { name: string @@ -1481,7 +1421,7 @@ module StaticLinker = let StaticLink (ctok, tcConfig: TcConfig, tcImports: TcImports, ilGlobals: ILGlobals) = #if !NO_EXTENSIONTYPING - let providerGeneratedAssemblies = + let providerGeneratedAssemblies = [ // Add all EST-generated assemblies into the static linking set for KeyValue(_, importedBinary: ImportedBinary) in tcImports.DllTable do @@ -1490,10 +1430,7 @@ module StaticLinker = | None -> () | Some provAssemStaticLinkInfo -> yield (importedBinary, provAssemStaticLinkInfo) ] #endif - if tcConfig.compilingFslib && tcConfig.compilingFslib20.IsSome then - (fun ilxMainModule -> LegacyFindAndAddMscorlibTypesForStaticLinkingIntoFSharpCoreLibraryForNet20 (tcConfig, ilGlobals, ilxMainModule)) - - elif not tcConfig.standalone && tcConfig.extraStaticLinkRoots.IsEmpty + if not tcConfig.standalone && tcConfig.extraStaticLinkRoots.IsEmpty #if !NO_EXTENSIONTYPING && providerGeneratedAssemblies.IsEmpty #endif From f2d168642eabb210c92aae53f9f5aa447478374e Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Mon, 9 Sep 2019 16:43:34 -0700 Subject: [PATCH 263/286] Remove Dead code --- BigInteger (#7511) * Remove Dead code --- BigInteger * Put back FSharp.Math namespace ... even though it's empty * Improve empty namespace comment --- src/fsharp/FSharp.Core/FSharp.Core.fsproj | 6 - .../FSharp.Core/fslib-extra-pervasives.fsi | 1 - src/fsharp/FSharp.Core/math/n.fs | 1599 ----------------- src/fsharp/FSharp.Core/math/n.fsi | 59 - src/fsharp/FSharp.Core/math/z.fs | 356 +--- src/fsharp/FSharp.Core/math/z.fsi | 86 +- 6 files changed, 16 insertions(+), 2091 deletions(-) delete mode 100644 src/fsharp/FSharp.Core/math/n.fs delete mode 100644 src/fsharp/FSharp.Core/math/n.fsi diff --git a/src/fsharp/FSharp.Core/FSharp.Core.fsproj b/src/fsharp/FSharp.Core/FSharp.Core.fsproj index 588f72eaed..03a83fca87 100644 --- a/src/fsharp/FSharp.Core/FSharp.Core.fsproj +++ b/src/fsharp/FSharp.Core/FSharp.Core.fsproj @@ -122,12 +122,6 @@ Reflection/reflect.fs - - Numerics/n.fsi - - - Numerics/n.fs - Numerics/z.fsi diff --git a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi index 6cfbd860c4..804d48bc3d 100644 --- a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi +++ b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi @@ -11,7 +11,6 @@ module ExtraTopLevelOperators = open Microsoft.FSharp.Control open Microsoft.FSharp.Collections open Microsoft.FSharp.Text - open Microsoft.FSharp.Math #if !FX_NO_SYSTEM_CONSOLE /// Print to stdout using the given format. diff --git a/src/fsharp/FSharp.Core/math/n.fs b/src/fsharp/FSharp.Core/math/n.fs deleted file mode 100644 index f448940a8b..0000000000 --- a/src/fsharp/FSharp.Core/math/n.fs +++ /dev/null @@ -1,1599 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Microsoft.FSharp.Math - -#if FX_NO_BIGINT -open System -open System.Diagnostics.CodeAnalysis -open Microsoft.FSharp.Core -open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators -open Microsoft.FSharp.Core.Operators -open Microsoft.FSharp.Collections -open Microsoft.FSharp.Primitives.Basics - -type ints = int array - -[] -type internal BigNat = - - // Have n = sum (from i=0 to bound) a.[i] * baseN ^ i - // Have 0 <= a.[i] < baseN. - //------ - // Invariant: bound is least such, i.e. bound=0 or (a.[bound-1] is highest coeff). - // Zero is {bound=0,a=...}. - // Naturals are a normal form, - // but not structurally so, - // since arrays may have non-contributing cells at a.[bound] and beyond. - // - { mutable bound : int; // non-zero coeff must be 0...(bound-1) - digits : ints // must have at least elts 0...(bound-1), - // maybe more (which should be zero!). - // Actually, the "zero" condition may be relaxed. - // - } - - -module internal BigNatModule = - - //------------------------------------------------------------------------- - // misc - //----------------------------------------------------------------------- - - #if SELFTEST - let check b = if not b then failwith "assertion failwith" - #endif - - module FFT = - let rec pow32 x n = - if n=0 then 1 - elif n % 2 = 0 then pow32 (x*x) (n / 2) - else x* pow32 (x*x) (n / 2) - - let leastBounding2Power b = - let rec findBounding2Power b tp i = if b<=tp then tp,i else findBounding2Power b (tp*2) (i+1) in - findBounding2Power b 1 0 - - //------------------------------------------------------------------------- - // p = 2^k.m + 1 prime and w primitive 2^k root of 1 mod p - //----------------------------------------------------------------------- - - // Given p = 2^k.m + 1 prime and w a primitive 2^k root of unity (mod p). - // Required to define arithmetic ops for Fp = field modulo p. - // The following are possible choices for p. - - // p, k, m, g, w - // let p,k,m,g,w = 97L, 4, 6, 5, 8 // p is 7 bit - // let p,k,m,g,w = 769L, 8, 3, 7, 7 // p is 10 bit - // let p,k,m,g,w = 7681L, 8, 30, 13, 198 // p is 13 bit - // let p,k,m,g,w = 12289L, 10, 12, 11, 49 // p is 14 bit - // let p,k,m,g,w = 167772161L, 25, 5, 557092, 39162105 // p is 28 bit - // let p,k,m,g,w = 469762049L, 26, 7, 1226571, 288772249 // p is 29 bit - - - let p,k,m,g,w = 2013265921L, 27, 15, 31, 440564289 // p is 31 bit - let primeP = p - - let maxBitsInsideFp = 30 - - - //------------------------------------------------------------------------- - // Fp = finite field mod p - rep is uint32 - //----------------------------------------------------------------------- - - - type fp = uint32 - // operations in Fp (finite field size p) - module Fp = - //module I = UInt32 - let p = 2013265921ul : fp - let p64 = 2013265921UL : uint64 - let toInt (x:fp) : int = int32 x - let ofInt32 (x:int) : fp = uint32 x - - let mzero : fp = 0ul - let mone : fp = 1ul - let mtwo : fp = 2ul - let inline madd (x:fp) (y:fp) : fp = (x + y) % p - let inline msub (x:fp) (y:fp) : fp = (x + p - y) % p - let inline mmul (x:fp) (y:fp) : fp = uint32 ((uint64 x * uint64 y) % p64) - - let rec mpow x n = - if n=0 then mone - elif n % 2=0 then mpow (mmul x x) (n / 2) - else mmul x (mpow (mmul x x) (n / 2)) - - let rec mpowL x n = - if n = 0L then mone - elif n % 2L = 0L then mpowL (mmul x x) (n / 2L) - else mmul x (mpowL (mmul x x) (n / 2L)) - - // Have the w is primitive 2^kth root of 1 in Zp - let m2PowNthRoot n = - // Find x s.t. x is (2^n)th root of unity. - // - // pow w (pow 2 k) = 1 primitively. - // = pow w (pow 2 ((k-n)+n)) - // = pow w (pow 2 (k-n) * pow 2 n) - // = pow (pow w (pow 2 (k-n))) (pow 2 n) - // - // Take wn = pow (pow w (pow 2 (k-n))) - - mpow (uint32 w) (pow32 2 (k-n)) - - let minv x = mpowL x (primeP - 2L) - - - //------------------------------------------------------------------------- - // FFT - in place low garbage - //----------------------------------------------------------------------- - - open Fp - let rec computeFFT lambda mu n w (u: _[]) (res: _[]) offset = - // Given n a 2-power, - // w an nth root of 1 in Fp, and - // lambda, mu and u(x) defining - // poly(lambda,mu,x) = sum(i pow32 2 i) - - let computeFftPaddedPolynomialProduct bigK k u v = - // REQUIRES: bigK = 2^k - // REQUIRES: Array lengths of u and v = bigK. - // REQUIRES: degree(uv) <= bigK-1 - // --- - // Given u,v polynomials. - // Computes the product polynomial by FFT. - // For correctness, - // require the result coeff to be in range [0,p-1], for p defining Fp above. - - #if SELFTEST - check ( k <= maxTwoPower ); - check ( bigK = twoPowerTable.[k] ); - check ( u.Length = bigK ); - check ( v.Length = bigK ); - #endif - // Find 2^k primitive root of 1 - let w = m2PowNthRoot k - // FFT - let n = bigK - let uT = computFftInPlace n w u - let vT = computFftInPlace n w v - // Evaluate - let rT = Array.init n (fun i -> mmul uT.[i] vT.[i]) - // INV FFT - let r = computeInverseFftInPlace n w rT - r - - let padTo n (u: _ array) = - let uBound = u.Length - Array.init n (fun i -> if i mmul uT.[i] vT.[i]) - // INV FFT - let r = computeInverseFftInPlace n w rT - Array.map Fp.toInt r - - - //------------------------------------------------------------------------- - // fp exports - //----------------------------------------------------------------------- - - open Fp - let mzero = mzero - let mone = mone - let maxFp = msub Fp.p mone - - //------------------------------------------------------------------------- - // FFT - reference implementation - //----------------------------------------------------------------------- - - #if SELFTEST - open Fp - let rec computeFftReference n w u = - // Given n a 2-power, - // w an nth root of 1 in Fp, and - // u(x) = sum(i u.[2*i]) - let uodd = Array.init (n/2) (fun i -> u.[2*i+1]) - let uevenFT = computeFftReference (n/2) (mmul w w) ueven - let uoddFT = computeFftReference (n/2) (mmul w w) uodd - Array.init n - (fun j -> - if j < n/2 then - madd - (uevenFT.[j]) - (mmul - (mpow w j) - (uoddFT.[j])) - else - let j = j - (n/2) - msub - (uevenFT.[j]) - (mmul - (mpow w j) - (uoddFT.[j]))) - #endif - - open FFT - - type n = BigNat - - let bound (n: n) = n.bound - let setBound (n: n) (v:int32) = n.bound <- v - let coeff (n:n) i = n.digits.[i] - let coeff64 (n:n) i = int64 (coeff n i) - let setCoeff (n:n) i v = n.digits.[i] <- v - - let rec pow64 x n = - if n=0 then 1L - elif n % 2 = 0 then pow64 (x * x) (n / 2) - else x * (pow64 (x * x) (n / 2)) - - let rec pow32 x n = - if n=0 then 1 - elif n % 2 = 0 then pow32 (x*x) (n / 2) - else x* pow32 (x*x) (n / 2) - - let hash(n) = - let mutable res = 0 - for i = 0 to n.bound - 1 do // could stop soon, it's "hash" - res <- n.digits.[i] + (res <<< 3) - done; - res - - //---------------------------------------------------------------------------- - // misc - //-------------------------------------------------------------------------- - -#if CHECKED - let check b str = if not b then failwith ("check failed: " + str) -#endif - let maxInt a b = if a int32 - let inline div64base (x:int64) = int64 (uint64 x >>> baseBits) - - let divbase x = int32 (uint32 x >>> baseBits) - let modbase x = (x &&& baseMask) - - let inline index z i = if i < z.bound then z.digits.[i] else 0 - - let createN b = { bound = b; - digits = Array.zeroCreate b } - let copyN x = { bound = x.bound; - digits = Array.copy x.digits } // could copy just enough... - - let normN n = - // normalises bound - let rec findLeastBound (na:ints) i = if i = -1 || na.[i]<>0 then i+1 else findLeastBound na (i-1) - let bound = findLeastBound n.digits (n.bound-1) - n.bound <- bound; - n - - let boundInt = 2 // int will fit with bound=2 - let boundInt64 = 3 // int64 will fit with bound=3 - let boundBase = 1 // base will fit with bound=1 - obviously! - -//---------------------------------------------------------------------------- -// base, coefficients, poly -//-------------------------------------------------------------------------- - - let embed x = - let x = if x<0 then 0 else x // no -ve naturals - if x < baseN then - let r = createN 1 - r.digits.[0] <- x; - normN r - else - let r = createN boundInt - for i = 0 to boundInt - 1 do - r.digits.[i] <- (x / pow32 baseN i) % baseN - done; - normN r - - let embed64 x = - let x = if x<0L then 0L else x // no -ve naturals - let r = createN boundInt64 - for i = 0 to boundInt64-1 do - r.digits.[i] <- int32 ( (x / pow64 baseNi64 i) % baseNi64) - done; - normN r - - let eval n = - if n.bound = 1 - then n.digits.[0] - else - let mutable acc = 0 - for i = n.bound-1 downto 0 do - acc <- n.digits.[i] + baseN * acc - done; - acc - - let eval64 n = - if n.bound = 1 - then int64 n.digits.[0] - else - let mutable acc = 0L - for i = n.bound-1 downto 0 do - acc <- int64 (n.digits.[i]) + baseNi64 * acc - done; - acc - - let one = embed 1 - let zero = embed 0 - - let restrictTo d n = - { bound = minInt d n.bound; digits = n.digits} - - let shiftUp d n = - let m = createN (n.bound+d) - for i = 0 to n.bound-1 do - m.digits.[i+d] <- n.digits.[i] - done; - m - - let shiftDown d n = - if n.bound-d<=0 then - zero - else - let m = createN (n.bound-d) - for i = 0 to m.bound-1 do - m.digits.[i] <- n.digits.[i+d] - done; - m - - let degree n = n.bound-1 - - -//---------------------------------------------------------------------------- -// add, sub -//-------------------------------------------------------------------------- - - // addition - let rec addP i n c p q r = // p+q + c - if i0 then - r.digits.[i] <- modbase x; - let c = divbase x - // if p (or q) exhausted and c zero could switch to copying mode - subP (i+1) n c p q r - else - let x = x + baseN // add baseN - r.digits.[i] <- modbase x; - let c = divbase x - 1 // sub baseN - // if p (or q) exhausted and c zero could switch to copying mode - subP (i+1) n c p q r - else - let underflow = c<>0 - underflow - - let sub p q = - // NOTE: x-y=0 when x<=y, it is natural subtraction - let rbound = maxInt p.bound q.bound - let r = createN rbound - let carry = 0 - let underflow = subP 0 rbound carry p q r - if underflow then - embed 0 - else - normN r - - -//---------------------------------------------------------------------------- -// isZero, equal, ordering, sign, min, max -//-------------------------------------------------------------------------- - - let isZero p = p.bound=0 - let IsZero p = isZero p - let isOne p = p.bound=1 && p.digits.[0] = 1 - - let equal p q = - (p.bound = q.bound) && - (let rec check (pa:ints) (qa:ints) i = - // HAVE: pa.[j] = qa.[j] for i < j < p.bound - (i = -1) || (pa.[i]=qa.[i] && check pa qa (i-1)) - - check p.digits q.digits (p.bound-1)) - - let shiftCompare p pn q qn = - if p.bound + pn < q.bound + qn then -1 - elif p.bound + pn > q.bound + pn then 1 - else - let rec check (pa:ints) (qa:ints) i = - // HAVE: pa.[j-pn] = qa.[j-qn] for i < j < p.bound - // Looking for most significant differing coeffs to determine ordering - if i = -1 then - 0 - else - let pai = if i < pn then 0 else pa.[i-pn] - let qai = if i < qn then 0 else qa.[i-qn] - if pai = qai then check pa qa (i-1) - elif pai < qai then -1 - else 1 - - check p.digits q.digits (p.bound + pn - 1) - - let compare p q = - if p.bound < q.bound then -1 - elif p.bound > q.bound then 1 - else - let rec check (pa:ints) (qa:ints) i = - // HAVE: pa.[j] = qa.[j] for i < j < p.bound - // Looking for most significant differing coeffs to determine ordering - if i = -1 then 0 - elif pa.[i]=qa.[i] then check pa qa (i-1) - elif pa.[i]] - let lt p q = compare p q = -1 - [] - let gt p q = compare p q = 1 - [] - let lte p q = compare p q <> 1 - [] - let gte p q = compare p q <> -1 - - [] - let min a b = if lt a b then a else b - [] - let max a b = if lt a b then b else a - - -//---------------------------------------------------------------------------- -// scale -//-------------------------------------------------------------------------- - - // REQUIRE: baseN + baseN.2^32 < Int64.maxInt - let rec contributeArr (a:ints) i (c:int64) = - // Given c and require c < baseN.2^32 - // Compute: r <- r + c . B^i - // via r.digits.[i] <- r.digits.[i] + c and normalised - let x = int64 a.[i] + c - // HAVE: x < baseN + baseN.2^32 - let c = div64base x - let x = mod64base x - // HAVE: c < 1 + 2^32 < baseN.2^32, recursive call ok - // HAVE: x < baseN - a.[i] <- x; // store residue x - if c>0L then - contributeArr a (i+1) c // contribute carry next position - - let inline contribute r i c = contributeArr r.digits i c - - // REQUIRE: maxInt < 2^32 - [] - let rec scale (k:int) (p:n) = - // Given k and p and require k < 2^32 - // Computes "scalar" product k.p - // - let rbound = p.bound + boundInt - let r = createN rbound - let k = int64 k - for i = 0 to p.bound-1 do - let kpi = k * int64 p.digits.[i] - // HAVE: kpi < 2^32 * baseN which meets "contribute" requirement - contribute r i kpi - done; - normN r - - -//---------------------------------------------------------------------------- -// mulSchoolBook -//-------------------------------------------------------------------------- - - // multiplication: naively O(n^2) -(* - let mulSchoolBook' p q = - let rbound = p.bound + q.bound + boundBase*2 - let r = createN rbound - let pa = p.digits - let qa = q.digits - for i = 0 to p.bound-1 do - for j = 0 to q.bound-1 do - contribute r (i+j) (int64 pa.[i] * int64 qa.[j]) - done - done; - normN r -*) - - let mulSchoolBookBothSmall p q = - let r = createN 2 - let rak = int64 p * int64 q - setCoeff r 0 (mod64base rak); - setCoeff r 1 (int32 (div64base rak)) - normN r - - let rec mulSchoolBookCarry r c k = - if ( c > 0L ) then - // ToAdd = c.B^k - let rak = (coeff64 r k) + c - setCoeff r k (mod64base rak); - mulSchoolBookCarry r (div64base rak) (k + 1) - - let mulSchoolBookOneSmall p q = - let bp = bound(p) - let rbound = bp + 1 - let r = createN rbound - let q = int64 q - let mutable c = 0L - for i = 0 to bp-1 do - let rak = c + (coeff64 r i) + (coeff64 p i) * q - setCoeff r i (mod64base rak); - c <- div64base rak; - mulSchoolBookCarry r c bp - normN r - - - // multiplication: naively O(n^2) -- this version - unchecked - is faster - let mulSchoolBookNeitherSmall p q = - let rbound = p.bound + q.bound - let r = createN rbound - let ra = r.digits - let pa = p.digits - let qa = q.digits - // ToAdd p*q - for i = 0 to p.bound-1 do - // ToAdd p.[i] * q * B^i - let pai = int64 pa.[i] - let mutable c = 0L - let mutable k = i // k = i + j - // ToAdd = pi.qj.B^(i+j) for j = 0,j+1... - for j = 0 to q.bound-1 do - // ToAdd = c.B^k + pi.qj.B^(i+j) for j = j,j+1... and k = i+j - let qaj = int64 qa.[j] - let rak = int64 ra.[k] + c + pai * qaj - ra.[k] <- int32 (mod64base rak); - c <- div64base rak; - k <- k + 1; - mulSchoolBookCarry r c k - normN r - - let mulSchoolBook p q = - let pSmall = (bound(p) = 1) - let qSmall = (bound(q) = 1) - if (pSmall && qSmall) then mulSchoolBookBothSmall (coeff p 0) (coeff q 0) - elif pSmall then mulSchoolBookOneSmall q (coeff p 0) - elif qSmall then mulSchoolBookOneSmall p (coeff q 0) - else mulSchoolBookNeitherSmall p q - - -//---------------------------------------------------------------------------- -// quickMulUsingFft -//-------------------------------------------------------------------------- - - // The FFT polynomial multiplier requires the result coeffs fit inside Fp. - // - // OVERVIEW: - // The numbers are recoded as polynomials to be evaluated at (x=2^bigL). - // The polynomials are FFT multiplied, requiring result coeff to fit Fp. - // The result product is recovered by evaluating the poly at (x=2^bigL). - // - // REF: - // QuickMul: Practical FFT-base Integer Multiplication, - // Chee Yap and Chen Yi. - // - // There is choice of how to encode the nats polynomials. - // The choice is the (2^bigL) base to use. - // For bigL=1, the FFT will cater for a product of upto 256M bits. - // Larger bigL have less reach, but compute faster. - // So plan to choose bigL depending on the number of bits product. - // - // DETERMINING THE K,L BOUNDS. - // - // Given representing using K-vectors, K a power of 2, K=2^k, and - // If choosing inputs to have L-bit coefficients. - // - // The result coeff are: - // - // res(i) = sum (j] - type encoding = - { bigL : int; // bits per input coeff - twoToBigL : int; // 2^bigL - k : int; - bigK : int; // bigK = 2^k, number of terms polynomials - bigN : int; // bits result (under-estimate of limit) - split : int; // baseBits / bigL - splits : int array; - } - -#if CHECKED - let _ = check (baseBits=24) "24bit" -#endif - // Requiring baseN mod 2^bigL = 0 gave quick encoding, but... - // also a terrible drop performance when the bigK jumped by more than needed! - // Below, it choose a minimal bigK to hold the product. - - let mkEncoding (bigL,k,bigK,bigN) = -#if CHECKED - check (bigK = pow32 2 k) "bigK"; - check (bigN = bigK * bigL) "bigN"; - check (2 * bigL + k <= maxBitsInsideFp) "constraint"; -#endif - { bigL = bigL; - twoToBigL = pow32 2 bigL; - k = k; - bigK = bigK; - bigN = bigN; - split = baseBits/bigL; // should divide exactly - splits = Array.init (baseBits/bigL) (fun i -> pow32 2 (bigL*i)) - } - - let table = - [| // bigL , k , bigK , bigN // - mkEncoding ( 1 , 28 , 268435456 , 268435456 ) ; - mkEncoding ( 2 , 26 , 67108864 , 134217728 ) ; - mkEncoding ( 3 , 24 , 16777216 , 50331648 ) ; - mkEncoding ( 4 , 22 , 4194304 , 16777216 ) ; - mkEncoding ( 5 , 20 , 1048576 , 5242880 ) ; - mkEncoding ( 6 , 18 , 262144 , 1572864 ) ; - mkEncoding ( 7 , 16 , 65536 , 458752 ) ; - mkEncoding ( 8 , 14 , 16384 , 131072 ) ; - mkEncoding ( 9 , 12 , 4096 , 36864 ) ; - mkEncoding ( 10 , 10 , 1024 , 10240 ) ; - mkEncoding ( 11 , 8 , 256 , 2816 ) ; - mkEncoding ( 12 , 6 , 64 , 768 ) ; - mkEncoding ( 13 , 4 , 16 , 208 ) ; - |] - - let calculateTableTow bigL = - // Given L. - // Have L via "log2 K <= maxBitsInsideFp - 2L". - // Have N via "N = K.L" - // - let k = maxBitsInsideFp - 2*bigL - let bigK = pow64 2L k - let N = bigK * int64 bigL - bigL,k,bigK,N - - let encodingGivenResultBits bitsRes = - // choose maximum bigL s.t. bitsRes < bigN - // EXCEPTION: fails is bitsRes exceeds 2^28 (largest bigN table) - let rec selectFrom i = - if i+1 < table.Length && bitsRes < table.[i+1].bigN then - selectFrom (i+1) - else - table.[i] - - if bitsRes >= table.[0].bigN then - failwith "Product is huge, around 268435456 bits, beyond quickmul" - else - selectFrom 0 - - let bitmask = Array.init baseBits (fun i -> (pow32 2 i - 1)) - let twopowers = Array.init baseBits (fun i -> (pow32 2 i)) - let twopowersI64 = Array.init baseBits (fun i -> (pow64 2L i)) - // bitmask(k) = 2^k - 1 - // twopowers(k) = 2^k // - - let wordBits word = - let rec hi k = - if k=0 then 0 - elif (word &&& twopowers.[k-1]) <> 0 then k - else hi (k-1) - - hi baseBits - - let bits u = - if u.bound=0 then 0 - else degree u * baseBits + wordBits u.digits.[degree u] - - let extractBits n enc bi = - let bj = bi + enc.bigL - 1 // the last bit (inclusive) - let biw = bi / baseBits // first bit is this index pos - let bjw = bj / baseBits // last bit is this index pos - if biw <> bjw then - // two words - let x = index n biw - let y = index n bjw // bjw = biw+1 - let xbit = bi % baseBits // start bit x - let nxbits = baseBits - xbit // number of bitsin x - let x = x >>> xbit // shift down x so bit0 is first - let y = y <<< nxbits // shift up y so it starts where x finished - let x = x ||| y // combine them - let x = x &&& bitmask.[enc.bigL] // mask out (high y bits) to get required bits - x - else - // one word - let x = index n biw - let xbit = bi % baseBits // start bit x - let x = x >>> xbit - let x = x &&& bitmask.[enc.bigL] - x - - let encodePoly enc n = - // Find poly s.t. n = poly evaluated at x=2^bigL - // with 0 <= pi < 2^bigL. - // - let poly = Array.create enc.bigK (Fp.ofInt32 0) - let biMax = n.bound * baseBits - let rec encoder i bi = - // bi = i * bigL - if i=enc.bigK || bi > biMax then - () // done - else - ( let pi = extractBits n enc bi - poly.[i] <- Fp.ofInt32 pi; - let i = i + 1 - let bi = bi + enc.bigL - encoder i bi - ) - - encoder 0 0; - poly - - let decodeResultBits enc (poly : fp array) = - // Decoding evaluates poly(x) (coeff Fp) at X = 2^bigL. - // A bound on number of result bits is "enc.bigN + boundInt", but that takes HUGE STEPS. - // Garbage has a cost, so we minimize it by working out a tight bound. - // - // poly(X) = sum i=0..n coeff_i * X^i where n is highest non-zero coeff. - // <= 2^maxBitsInsideFp * (1 + X + ... X^n) - // <= 2^maxBitsInsideFp * (X^(n+1) - 1) / (X - 1) - // <= 2^maxBitsInsideFp * X^(n+1) / (X - 1) - // <= 2^maxBitsInsideFp * X^(n+1) / (X/2) provided X/2 <= X-1 - // <= 2^maxBitsInsideFp * X^n * 2 - // <= 2^maxBitsInsideFp * (2^bigL)^n * 2 - // <= 2^(maxBitsInsideFp + bigL.n + 1) - // - let mutable n = 0 - for i = 0 to poly.Length-1 do - if poly.[i] <> mzero then n <- i - done; - let rbits = maxBitsInsideFp + enc.bigL * n + 1 - rbits + 1 // +1 since 2^1 requires 2 bits not 1 - - // REQUIRE: bigL <= baseBits - let decodePoly enc poly = - // Find n = poly evaluated at x=2^bigL - // Note, 0 <= pi < maxFp. - // - let rbound = (decodeResultBits enc poly) / baseBits + 1 - let r = createN rbound - let rec evaluate i j d = - // HAVE: bigL.i = j * baseBits + d and d= rbound then -#if CHECKED - check (poly.[i] = mzero) "decodePoly"; -#endif - () - else ( - let x = int64 (Fp.toInt poly.[i]) * twopowersI64.[d] - // HAVE: x < 2^32 . 2^baseBits = 2^32.baseN - contribute r j x - ); - let i = i + 1 - let d = d + enc.bigL - let j,d = if d >= baseBits then j+1 , d-baseBits else j,d - // HAVE: d < baseBits, note: bigL minDigitsKaratsuba then - let k = bmax / 2 - let a0 = restrictTo k p - let a1 = shiftDown k p - let b0 = restrictTo k q - let b1 = shiftDown k q - let q0 = mul a0 b0 - let q1 = mul (add a0 a1) (add b0 b1) - let q2 = mul a1 b1 - let p0 = q0 - let p1 = sub q1 (add q0 q2) - let p2 = q2 - let r = add p0 (shiftUp k (add p1 (shiftUp k p2))) - r - else - mulSchoolBook p q - - let rec mulKaratsuba x y = recMulKaratsuba mulKaratsuba x y - - -//---------------------------------------------------------------------------- -// mul - composite -//-------------------------------------------------------------------------- - - let productDigitsUpperSchoolBook = (64000 / baseBits) - // When is it worth switching away from SchoolBook? - // SchoolBook overhead is low, so although it's O(n^2) it remains competitive. - // - // 28/3/2006: - // The FFT can take over from SchoolBook at around 64000 bits. - // Note, FFT performance is stepwise, according to enc from table. - // The steps are big steps (meaning sudden jumps/drops perf). - // - - let singleDigitForceSchoolBook = (32000 / baseBits) - // If either argument is "small" then stay with SchoolBook. - // - - let productDigitsUpperFft = (table.[0].bigN / baseBits) - // QuickMul is good upto a finite (but huge) limit: - // Limit 268,435,456 bits product. - // - // From the code: - // let bitsRes = bits u + bits v - // fails when bitsRes >= table.[0].bigN - // So, not applicable when: - // P1: table.[0].bigN <= bits(u) + bits(v) - // P2: table.[0].bigN <= .. <= baseBits * (u.bound + v.bound) - // P3: table.[0].bigN <= .. <= baseBits * (u.bound + v.bound) - // P4: table.[0].bigN / baseBits <= u.bound + v.bound - // - - // Summary of mul algorithm choice: - // 0 <= uv_bound < upper_school_book - Schoolbook - // upper_school_book <= uv_bound < upper_fft - QuickMul - // upper_fft <= uv_bound < ... - Karatsuba - // - // NOTE: - // - Karatsuba current implementation has high garbage cost. - // - However, a linear space cost is possible... - // - Meantime, switch to Karatsuba only beyond FFT range. - // - - let rec mul p q = - let pqBound = p.bound + q.bound - if pqBound < productDigitsUpperSchoolBook || - p.bound < singleDigitForceSchoolBook || - q.bound < singleDigitForceSchoolBook - then - // Within school-book initial range: - mulSchoolBook p q - else - if pqBound < productDigitsUpperFft then - // Inside QuickMul FFT range: - quickMulUsingFft p q - else - // Beyond QuickMul FFT range, or maybe between Schoolbook and QuickMul (no!): - // Use karatsuba method, with "mul" as recursive multiplier, - // so will reduce sizes of products on recursive calls, - // and QuickMul will take over if they fall within it's range. - // - recMulKaratsuba mul p q - - -//---------------------------------------------------------------------------- -// division - scaleSubInPlace -//-------------------------------------------------------------------------- - - let scaleSubInPlace x f a n = - // Have x = sumR 0 xd (\i.xi.B^i) where xd = degree x - // a = sumR 0 ad (\i.digitsi.B^i) where ad = degree a - // f < B - // n < xd - // Assumes "f.digits.B^n < x". - // Required to remove f.digits.B^n from x place. - //------ - // Result = x_initial - f.digits.B^n - // = x_initial - f.[sumR 0 ad (\i.digitsi.B^(i+n))] - // State: j = 0 - // z = f * a0 - // Invariant(x,z,j,n): - // P1: x_result = x - z.B^(j+n) - f.[sumR (j+1) ad (\i.digitsi.B^i+n)] - // P2: z < B^2 - 1, and so has form z = zHi.B + zLo for zHi,zLo < B. - // Base: Invariant holds initially. - // Step: (a) Remove zLo from x: - // If zLo <= x_(j+n) then zLo <- 0 - // x_(j+n) <- x_(j+n) - zLo - // else zLo <- 0 - // x_(j+n) <- x_(j+n) + (B - zLo) - // = x_(j+n) - zLo + B - // zHi <- zHi + 1 - // Here, invariant P1 still holds, P2 may break. - // (b) Advance j: - // Have z = zHi.B since zLo = 0. - // j <- j + 1 - // z <- zHi + f * a_(j+1) - // P2 holds: - // Have z <= B + (B-1)*(B-1) = B + B^2 - 2B + 1 = B^2 - B + 1 - // Have z <= B^2 - 1 when B >= 2 which is required for B being a base. - // P1 holds, - // moved f.digits_(j+1).B^(j+1+n) factor over. - // - // Once j+1 exceeds ad, summation is zero and it contributes no more terms (b). - // Continue until z = 0, which happens since z decreases towards 0. - // Done. - // - let invariant (_,_,_) = () - #if CHECKED - let x_initial = copyN x - let x_result = sub x_initial (shiftUp n (scale f a)) - let invariant (z,j,n) = - let P1 = - equal - x_result - (sub x (add (shiftUp (j+n) (embed64 z)) - (mul (embed f) - (shiftUp (j+1+n) (shiftDown (j+1) a))))) - let P2 = z < baseNi64 * baseNi64 - 1L - check P1 "P1"; - check P2 "P2" - - #endif - let xres = x - let x,xd = x.digits,degree x - let a,ad = a.digits,degree a - let f = int64 f - let mutable j = 0 - let mutable z = f * int64 a.[0] - while( z > 0L || j < ad ) do - if j > xd then failwith "scaleSubInPlace: pre-condition did not apply, result would be -ve"; - invariant(z,j,n); // P1,P2 hold - let mutable zLo = mod64base z |> int32 - let mutable zHi = div64base z - if zLo <= x.[j+n] then - x.[j+n] <- x.[j+n] - zLo - else ( - x.[j+n] <- x.[j+n] + (baseN - zLo); - zHi <- zHi + 1L - ); - // P1 holds - if j < ad then - z <- zHi + f * int64 a.[j+1] - else - z <- zHi; - j <- j + 1; - // P1,P2 hold - done; - ignore (normN xres) - - // - let scaleSub x f a n = - let freshx = add x zero - scaleSubInPlace freshx f a n; - normN freshx -(* - - let scaleSub2 x f a n = sub x (shiftUp n (mul (embed f) a)) - - let x = (mul (embed 234234234) (pow (embed 10) (embed 20))) - let f = 2 - let a = (embed 1231231231) - let n = 2 - let res = scaleSub x f a n - let res2 = scaleSub2 x f a n - - let x, xd, f, a, ad, n = freshx.digits, freshx.bound, f, a.digits, a.bound, n - *) - - -//---------------------------------------------------------------------------- -// division - scaleAddInPlace -//-------------------------------------------------------------------------- - - let scaleAddInPlace x f a n = - // Have x = sumR 0 xd (\i.xi.B^i) - // a = sumR 0 ad (\i.digitsi.B^i) - // f < B - // n < xd - // Required to add f.digits.B^n to x place. - // Assumes result will fit with x (0...xd). - //------ - // Result = x_initial + f.digits.B^n - // = x_initial + f.[sumR 0 ad (\i.digitsi.B^i+n)] - // State: j = 0 - // z = f * a0 - // Invariant(x,z,j,n): - // P1: x_result = x + z.B^(j+n) + f.[sumR (j+1) ad (\i.digitsi.B^i+n)] - // P2: z < B^2 - 1, and so has form z = zHi.B + zLo for zHi,zLo < B. - // Base: Invariant holds initially. - // Step: (a) Add zLo to x: - // If zLo < B - x_(j+n) then zLo <- 0 - // x_(j+n) <- x_(j+n) + zLo - // else zLo <- 0 - // x_(j+n) <- zLo - (B - x_(j+n)) - // = x_(j+n) + zLo - B - // zHi <- zHi + 1 - // Here, invariant P1 still holds, P2 may break. - // (b) Advance j: - // Have z = zHi.B since zLo = 0. - // j <- j + 1 - // z <- zHi + f * a_(j+1) - // P2 holds: - // Have z <= B + (B-1)*(B-1) = B + B^2 - 2B + 1 = B^2 - B + 1 - // Have z <= B^2 - 1 when B >= 2 which is required for B being a base. - // P1 holds, - // moved f.digits_(j+1).B^(j+1+n) factor over. - // - // Once j+1 exceeds ad, summation is zero and it contributes no more terms (b). - // Continue until z = 0, which happens since z decreases towards 0. - // Done. - // - let invariant (_,_,_) = () -#if CHECKED - let x_initial = copyN x - let x_result = add x_initial (shiftUp n (scale f a)) - let invariant (z,j,n) = - let P1 = - equal - x_result - (add x (add (shiftUp (j+n) (embed64 z)) - (mul (embed f) - (shiftUp (j+1+n) (shiftDown (j+1) a))))) - let P2 = z < baseNi64 * baseNi64 - 1L - check P1 "P1"; - check P2 "P2" - -#endif - let xres = x - let x,xd = x.digits,degree x - let a,ad = a.digits,degree a - let f = int64 f - let mutable j = 0 - let mutable z = f * int64 a.[0] - while( z > 0L || j < ad ) do - if j > xd then failwith "scaleSubInPlace: pre-condition did not apply, result would be -ve"; - invariant(z,j,n); // P1,P2 hold - let mutable zLo = mod64base z |> int32 - let mutable zHi = div64base z - if zLo < baseN - x.[j+n] then - x.[j+n] <- x.[j+n] + zLo - else ( - x.[j+n] <- zLo - (baseN - x.[j+n]); - zHi <- zHi + 1L - ); - // P1 holds - if j < ad then - z <- zHi + f * int64 a.[j+1] - else - z <- zHi; - j <- j + 1; - // P1,P2 hold - done; - ignore (normN xres) - - // - let scaleAdd x f a n = - let freshx = add x zero - scaleAddInPlace freshx f a n; - normN freshx - -(* - let scaleAdd2 x f a n = add x (shiftUp n (mul (embed f) a)) - - let x = (mul (embed 234234234) (pow (embed 10) (embed 20))) - let f = 2 - let a = (embed 1231231231) - let n = 2 - let res = scaleAdd x f a n - let res2 = scaleAdd2 x f a n - - let x, xd, f, a, ad, n = freshx.digits, freshx.bound, f, a.digits, a.bound, n -*) - -//---------------------------------------------------------------------------- -// division - removeFactor -//-------------------------------------------------------------------------- - - (* - let removeFactorReference x a n = - let ff = div x (shiftUp n a) - toInt ff - *) - - let removeFactor x a n = - // Assumes x < a.B^(n+1) - // Choose f s.t. - // (a) f.digits.B^n <= x - // (b) f=0 iff x < a.B^n - // - let dega,degx = degree a,degree x - if degx < dega + n then 0 else // possible with "normalisation" - let aa,xa = a.digits,x.digits - let f = - if dega = 0 then // a = a0 - if degx = n then - xa.[n] / aa.[0] - else ( -#if CHECKED - check (degx = n+1) "removeFactor degx#1"; -#endif - let f64 = (int64 xa.[degx] * baseNi64 + int64 xa.[degx-1]) / int64 aa.[0] - int32 f64 - ) - else // a = sumR 0 dega (\i.digitsi.B^i) - if degx = dega + n then - xa.[degx] / (aa.[dega] + 1) // +1 to bound above a - else ( -#if CHECKED - check (degx = dega+n+1) "removeFactor degx#2"; -#endif - let f64 = (int64 xa.[degx] * baseNi64 + int64 xa.[degx-1]) - / (int64 aa.[dega] + 1L) // +1 to bound above a - int32 f64 - ) - - if f = 0 then - let lte = (shiftCompare a n x 0) <> 1 - if lte then 1 else 0 - else - f - - -//---------------------------------------------------------------------------- -// division - divmod -//-------------------------------------------------------------------------- - - let divmod b a = - // Returns d,r where b = d.digits + r and r0 then - scaleSubInPlace x f a n; - scaleAddInPlace d f one n; - Invariant(d,x,n,p) - else - finished <- f=0 && n=0; - if not finished then - if p = m+n then - Invariant(d,x,n-1,p); - n <- n-1 - else - Invariant(d,x,n-1,p-1); - n <- n-1; - p <- p-1 - // Have: "b = d.digits + x" return d,x - normN d,normN x - - //---------------------------------------------------------------------------- - // div, mod - //-------------------------------------------------------------------------- - - [] - let div b a = fst (divmod b a) - [] - let rem b a = snd (divmod b a) - // rem b a, for small a can do (base mod a) trick - O(N) - - - //---------------------------------------------------------------------------- - // hcf - //-------------------------------------------------------------------------- - - let hcf a b = - // Have: 0 <= a,b since naturals - let rec hcfloop a b = // Require: 0 <= a <= b - if equal zero a then b - else - // Have: 0 < a <= b - let _,r = divmod b a - // Have: r < a from divmod - hcfloop r a // Have: 0 <= r < a - - if lt a b then hcfloop a b // Have: 0 <= a < b - else hcfloop b a // Have: 0 <= b <= a - - //---------------------------------------------------------------------------- - // pow - //-------------------------------------------------------------------------- - - let two = embed 2 - let powi x n = - let rec power acc x n = - if n=0 then acc - elif n % 2=0 then power acc (mul x x) (n / 2) - else power (mul x acc) (mul x x) (n / 2) - - power one x n - - let pow x n = - let rec power acc x n = - if isZero n then acc - else - let ndiv2,nmod2 = divmod n two // use: intdivmod when available - if isZero nmod2 then power acc (mul x x) ndiv2 - else power (mul x acc) (mul x x) ndiv2 - - power one x n - -//---------------------------------------------------------------------------- -// float n -//-------------------------------------------------------------------------- - - let toFloat n = - let basef = float baseN - let rec evalFloat acc k i = - if i = n.bound then - acc - else - evalFloat (acc + k * float n.digits.[i]) (k * basef) (i+1) - evalFloat 0.0 1.0 0 - -//---------------------------------------------------------------------------- -// n <-> int -//-------------------------------------------------------------------------- - - let ofInt32 n = embed n - let ofInt64 n = embed64 n - - /// Convert BigNat to uint32 otherwise OverflowException. - let toUInt32 n = - match n.bound with - | 0 -> 0u - | 1 -> n.digits.[0] |> uint32 - | 2 -> let xA,xB = n.digits.[0],n.digits.[1] - if xB > baseMask32B then raise (System.OverflowException()) - ( uint32 (xA &&& baseMask32A)) + - ((uint32 (xB &&& baseMask32B)) <<< baseShift32B) - | _ -> raise (System.OverflowException()) - - /// Convert BigNat to uint64 otherwise OverflowException. - let toUInt64 n = - match n.bound with - | 0 -> 0UL - | 1 -> n.digits.[0] |> uint64 - | 2 -> let xA,xB = n.digits.[0],n.digits.[1] - ( uint64 (xA &&& baseMask64A)) + - ((uint64 (xB &&& baseMask64B)) <<< baseShift64B) - | 3 -> let xA,xB,xC = n.digits.[0],n.digits.[1],n.digits.[2] - if xC > baseMask64C then raise (System.OverflowException()) - ( uint64 (xA &&& baseMask64A)) + - ((uint64 (xB &&& baseMask64B)) <<< baseShift64B) + - ((uint64 (xC &&& baseMask64C)) <<< baseShift64C) - | _ -> raise (System.OverflowException()) - - -//---------------------------------------------------------------------------- -// n -> string -//-------------------------------------------------------------------------- - - -#if CHECKED - let checks = false -#endif - let toString n = - // Much better complexity than naive_string_of_z. - // It still does "nDigit" calls to (int)divmod, - // but the degree on which it is called halves (not decrements) each time. - // - let degn = degree n - let rec route prior k ten2k = - if degree ten2k > degn - then (k,ten2k) :: prior - else route ((k,ten2k) :: prior) (k+1) (mul ten2k ten2k) - let kten2ks = route [] 0 (embed 10) - let rec collect isLeading digits n = function - | [] -> - // Have 0 <= n < 10^1, so collect a single digit (if needed) - let n = eval n -#if CHECKED - if checks then check (0 <= n) "toString: digit0"; - if checks then check (n <= 9) "toString: digit9"; -#endif - if isLeading && n=0 then digits // suppress leading 0 - else string n :: digits - | (_,ten2k) :: prior -> -#if CHECKED - if checks then check (lt n (mul ten2k ten2k)) "string_of_int: bound n"; -#endif - // Have 0 <= n < (ten2k)^2 and ten2k = 10^(2^k) - let nH,nL = divmod n ten2k -#if CHECKED - if checks then check (lt nH ten2k) "string_of_int: bound nH"; - if checks then check (lt nL ten2k) "string_of_int: bound nL"; -#endif - // Have 0 <= nH,nL < (ten2k) and ten2k = 10^(2^k) - if isLeading && isZero nH then - // suppress leading 0s - let digits = collect isLeading digits nL prior - digits - else - let digits = collect false digits nL prior - let digits = collect isLeading digits nH prior - digits - - let prior = kten2ks - let digits = collect true [] n prior - match digits with - | [] -> "0" - | _ -> digits |> Array.ofList |> System.String.Concat - -//---------------------------------------------------------------------------- -// n <- string -//-------------------------------------------------------------------------- - - let ofString (str:string) = - // Would it be better to split string half and combine results? - let len = str.Length - if System.String.IsNullOrEmpty str then invalidArg "str" "empty string"; - let ten = embed 10 - let rec build acc i = - if i=len then - acc - else - let c = str.[i] - let d = int c - int '0' - if 0 <= d && d <= 9 then - build (add (mul ten acc) (embed d)) (i+1) - else - raise (new System.FormatException(SR.GetString(SR.badFormatString))) - - build (embed 0) 0 - - let isSmall n = (n.bound <= 1) - let getSmall n = index n 0 - - //---------------------------------------------------------------------------- - // factorial - //-------------------------------------------------------------------------- - - let factorial n = - //***** - // Factorial(n) = 1.2.3.....(n-1).n - // - // Factorial is sometimes used as a test for multiplication. - // The QuickMul FFT multiplier takes over only when both operands reach a given size. - // How to compute factorial? - // - // (a) Factorial(n) = factorial(n-1).n - // This is unlikely to make use of the FFT (n never large enough). - // (b) Factorial(n) = (1.2.3.4....k) . (k.[k+1]...(n-1).n) - // Applied recursively QuickMul FFT will take over on large products. - // - //**** - let rec productR a b = - if equal a b then a - else - let m = div (add a b) (ofInt32 2) - mul (productR a m) (productR (add m one) b) - - productR one n - - -#endif diff --git a/src/fsharp/FSharp.Core/math/n.fsi b/src/fsharp/FSharp.Core/math/n.fsi deleted file mode 100644 index 78f44e6d4f..0000000000 --- a/src/fsharp/FSharp.Core/math/n.fsi +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Microsoft.FSharp.Math - -#if FX_NO_BIGINT -open Microsoft.FSharp.Collections -open Microsoft.FSharp.Core - -/// Abstract internal type -[] -type internal BigNat - -module internal BigNatModule = - - val zero : BigNat - val one : BigNat - val two : BigNat - - val add : BigNat -> BigNat -> BigNat - val sub : BigNat -> BigNat -> BigNat - val mul : BigNat -> BigNat -> BigNat - val divmod : BigNat -> BigNat -> BigNat * BigNat - val div : BigNat -> BigNat -> BigNat - val rem : BigNat -> BigNat -> BigNat - val hcf : BigNat -> BigNat -> BigNat - - val min : BigNat -> BigNat -> BigNat - val max : BigNat -> BigNat -> BigNat - val scale : int -> BigNat -> BigNat - val powi : BigNat -> int -> BigNat - val pow : BigNat -> BigNat -> BigNat - - val IsZero : BigNat -> bool - val isZero : BigNat -> bool - val isOne : BigNat -> bool - val equal : BigNat -> BigNat -> bool - val compare : BigNat -> BigNat -> int - val lt : BigNat -> BigNat -> bool - val gt : BigNat -> BigNat -> bool - val lte : BigNat -> BigNat -> bool - val gte : BigNat -> BigNat -> bool - - val hash : BigNat -> int - val toFloat : BigNat -> float - val ofInt32 : int -> BigNat - val ofInt64 : int64 -> BigNat - val toString : BigNat -> string - val ofString : string -> BigNat - - val toUInt32 : BigNat -> uint32 - val toUInt64 : BigNat -> uint64 - - val factorial : BigNat -> BigNat - // val randomBits : int -> BigNat - val bits : BigNat -> int - val isSmall : BigNat -> bool (* will fit in int32 (but not nec all int32) *) - val getSmall : BigNat -> int32 (* get the value, if it satisfies isSmall *) - -#endif diff --git a/src/fsharp/FSharp.Core/math/z.fs b/src/fsharp/FSharp.Core/math/z.fs index c9e9614b3d..fa65994315 100644 --- a/src/fsharp/FSharp.Core/math/z.fs +++ b/src/fsharp/FSharp.Core/math/z.fs @@ -1,337 +1,19 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. #nowarn "44" // This construct is deprecated. This function is for use by compiled F# code and should not be used directly -namespace System.Numerics -#if FX_NO_BIGINT - open Microsoft.FSharp.Collections - open Microsoft.FSharp.Core - open Microsoft.FSharp.Core.Operators - open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators - open Microsoft.FSharp.Primitives.Basics - open Microsoft.FSharp.Math - open System - open System.Globalization - - - // INVARIANT: signInt = 1 or -1 - // value(z) = signInt * v - // NOTE: 0 has two repns (+1,0) or (-1,0). - [] - [] -#if !NETSTANDARD - [] -#endif - type BigInteger(signInt:int, v : BigNat) = - - static let smallLim = 4096 - static let smallPosTab = Array.init smallLim BigNatModule.ofInt32 - static let one = BigInteger(1) - static let zero = BigInteger(0) - - static member internal nat n = - if BigNatModule.isSmall n && BigNatModule.getSmall n < smallLim - then smallPosTab.[BigNatModule.getSmall n] - else n - - static member internal create (s,n) = BigInteger(s,BigInteger.nat n) - - static member internal posn n = BigInteger(1,BigInteger.nat n) - - static member internal negn n = BigInteger(-1,BigInteger.nat n) - - member x.Sign = if x.IsZero then 0 else signInt - - member x.SignInt = signInt - - member internal x.V = v - - static member op_Equality (x:BigInteger, y:BigInteger) = - //System.Console.WriteLine("x = {0}",box x) - //System.Console.WriteLine("y = {0}",box y) - match x.SignInt,y.SignInt with - | 1, 1 -> BigNatModule.equal x.V y.V // +1.xv = +1.yv iff xv = yv - | -1, -1 -> BigNatModule.equal x.V y.V // -1.xv = -1.yv iff xv = yv - | 1,-1 -> BigNatModule.isZero x.V && BigNatModule.isZero y.V // 1.xv = -1.yv iff xv=0 and yv=0 - | -1, 1 -> BigNatModule.isZero x.V && BigNatModule.isZero y.V // -1.xv = 1.yv iff xv=0 and yv=0 - | 0, 0 -> true - | 0, 1 -> BigNatModule.isZero y.V - | 0, -1 -> BigNatModule.isZero y.V - | 1, 0 -> BigNatModule.isZero x.V - | -1, 0 -> BigNatModule.isZero x.V - | _ -> invalidArg "x" "signs should be +/- 1 or 0" - - static member op_Inequality (x:BigInteger, y:BigInteger) = not (BigInteger.op_Equality(x,y)) // CA2226: OperatorsShouldHaveSymmetricalOverloads - - static member op_LessThan (x:BigInteger, y:BigInteger) = - match x.SignInt,y.SignInt with - | 1, 1 -> BigNatModule.lt x.V y.V // 1.xv < 1.yv iff xv < yv - | -1,-1 -> BigNatModule.lt y.V x.V // -1.xv < -1.yv iff yv < xv - | 1,-1 -> false // 1.xv < -1.yv iff 0 <= 1.xv < -1.yv <= 0 iff false - | -1, 1 -> not (BigNatModule.isZero x.V) || not (BigNatModule.isZero y.V) - // -1.xv < 1.yv - // (a) xv=0 and yv=0, then false - // (b) xv<>0, -1.xv < 0 <= 1.yv, so true - // (c) yv<>0, -1.xv <= 0 < 1.yv, so true - | 0, 0 -> false - | 0, 1 -> not (BigNatModule.isZero y.V) - | 0,-1 -> false - | 1, 0 -> false - | -1, 0 -> not (BigNatModule.isZero x.V) - | _ -> invalidArg "x" "signs should be +/- 1 or 0" - - static member op_GreaterThan (x:BigInteger, y:BigInteger) = // Follow lt by +/- symmetry - match x.SignInt,y.SignInt with - | 1, 1 -> BigNatModule.gt x.V y.V - | -1,-1 -> BigNatModule.gt y.V x.V - | 1,-1 -> not (BigNatModule.isZero x.V) || not (BigNatModule.isZero y.V) - | -1, 1 -> false - | 0, 0 -> false - | 0, 1 -> false - | 0,-1 -> not (BigNatModule.isZero y.V) - | 1, 0 -> not (BigNatModule.isZero x.V) - | -1, 0 -> false - | _ -> invalidArg "x" "signs should be +/- 1 or 0" - - static member internal compare(n,nn) = if BigInteger.op_LessThan(n,nn) then -1 elif BigInteger.op_Equality(n,nn) then 0 else 1 - - static member internal hash (z:BigInteger) = - if z.SignInt = 0 then 1 // 1 is hashcode for initialized BigInteger.Zero - else z.SignInt + BigNatModule.hash(z.V) - - override x.ToString() = - match x.SignInt with - | 1 -> BigNatModule.toString x.V // positive - | -1 -> - if BigNatModule.isZero x.V - then "0" // not negative in fact, but zero. - else "-" + BigNatModule.toString x.V // negative - | 0 -> "0" - | _ -> invalidOp "signs should be +/- 1 or 0" - - member x.StructuredDisplayString = x.ToString() - - interface System.IComparable with - member this.CompareTo(obj:obj) = - match obj with - | :? BigInteger as that -> BigInteger.compare(this,that) - | _ -> invalidArg "obj" "the objects are not comparable" - - override this.Equals(obj) = - match obj with - | :? BigInteger as that -> BigInteger.op_Equality(this, that) - | _ -> false - - override x.GetHashCode() = BigInteger.hash(x) - - new (n:int) = - if n>=0 - then BigInteger (1,BigInteger.nat(BigNatModule.ofInt32 n)) - elif (n = System.Int32.MinValue) - then BigInteger(-1,BigInteger.nat(BigNatModule.ofInt64 (-(int64 n)))) - else BigInteger(-1,BigInteger.nat(BigNatModule.ofInt32 (-n))) - - new (n:int64) = - if n>=0L - then BigInteger(1,BigInteger.nat (BigNatModule.ofInt64 n)) - elif (n = System.Int64.MinValue) - then BigInteger(-1,BigInteger.nat (BigNatModule.add (BigNatModule.ofInt64 System.Int64.MaxValue) BigNatModule.one) ) - else BigInteger(-1,BigInteger.nat (BigNatModule.ofInt64 (-n))) - - static member One = one +namespace Microsoft.FSharp.Math - static member Zero = zero - - static member (~-) (z:BigInteger) = - match z.SignInt with - | 0 -> BigInteger.Zero - | i -> BigInteger.create(-i, z.V) - - static member Scale(k, z:BigInteger) = - if z.SignInt = 0 then BigInteger.Zero else - if k<0 - then BigInteger.create(-z.SignInt, (BigNatModule.scale (-k) z.V)) // k.zsign.zv = -zsign.(-k.zv) - else BigInteger.create(z.SignInt, (BigNatModule.scale k z.V)) // k.zsign.zv = zsign.k.zv - - // Result: 1.nx - 1.ny (integer subtraction) - static member internal subnn (nx,ny) = - if BigNatModule.gte nx ny - then BigInteger.posn (BigNatModule.sub nx ny) // nx >= ny, result +ve, +1.(nx - ny) - else BigInteger.negn (BigNatModule.sub ny nx) // nx < ny, result -ve, -1.(ny - nx) - - static member internal addnn (nx,ny) = - BigInteger.posn (BigNatModule.add nx ny) // Compute "nx + ny" to be integer - - member x.IsZero = x.SignInt = 0 || BigNatModule.isZero x.V - - member x.IsOne = (x.SignInt = 1) && BigNatModule.isOne x.V // signx.xv = 1 iff signx = +1 and xv = 1 - - static member (+) (x:BigInteger,y:BigInteger) = - if y.IsZero then x else - if x.IsZero then y else - match x.SignInt,y.SignInt with - | 1, 1 -> BigInteger.addnn(x.V,y.V) // 1.xv + 1.yv = (xv + yv) - | -1,-1 -> -(BigInteger.addnn(x.V,y.V)) // -1.xv + -1.yv = -(xv + yv) - | 1,-1 -> BigInteger.subnn (x.V,y.V) // 1.xv + -1.yv = (xv - yv) - | -1, 1 -> BigInteger.subnn(y.V,x.V) // -1.xv + 1.yv = (yv - xv) - | _ -> invalidArg "x" "signs should be +/- 1" - - static member (-) (x:BigInteger,y:BigInteger) = - if y.IsZero then x else - if x.IsZero then -y else - match x.SignInt,y.SignInt with - | 1, 1 -> BigInteger.subnn(x.V,y.V) // 1.xv - 1.yv = (xv - yv) - | -1,-1 -> BigInteger.subnn(y.V,x.V) // -1.xv - -1.yv = (yv - xv) - | 1,-1 -> BigInteger.addnn(x.V,y.V) // 1.xv - -1.yv = (xv + yv) - | -1, 1 -> -(BigInteger.addnn(x.V,y.V)) // -1.xv - 1.yv = -(xv + yv) - | _ -> invalidArg "x" "signs should be +/- 1" - - static member ( * ) (x:BigInteger,y:BigInteger) = - if x.IsZero then x - elif y.IsZero then y - elif x.IsOne then y - elif y.IsOne then x - else - let m = (BigNatModule.mul x.V y.V) - BigInteger.create (x.SignInt * y.SignInt,m) // xsign.xv * ysign.yv = (xsign.ysign).(xv.yv) - - static member DivRem (x:BigInteger, y:BigInteger, []rem:BigInteger byref) = - if y.IsZero then raise (new System.DivideByZeroException()) - if x.IsZero then - rem <- BigInteger.Zero - BigInteger.Zero - else - let d,r = BigNatModule.divmod x.V y.V - // HAVE: |x| = d.|y| + r and 0 <= r < |y| - // HAVE: xv = d.yv + r and 0 <= r < yv - match x.SignInt,y.SignInt with - | 1, 1 -> rem <- BigInteger.posn r ; BigInteger.posn d // 1.xv = 1.d.( 1.yv) + ( 1.r) - | -1,-1 -> rem <- BigInteger.negn r ; BigInteger.posn d // -1.xv = 1.d.(-1.yv) + (-1.r) - | 1,-1 -> rem <- BigInteger.posn r ; BigInteger.negn d // 1.xv = -1.d.(-1.yv) + ( 1.r) - | -1, 1 -> rem <- BigInteger.negn r ; BigInteger.negn d // -1.xv = -1.d.( 1.yv) + (-1.r) - | _ -> invalidArg "x" "signs should be +/- 1" - - static member (/) (x:BigInteger,y:BigInteger) = - let mutable rem = new BigInteger(0) - BigInteger.DivRem(x,y,&rem) - - static member (%) (x:BigInteger,y:BigInteger) = - let mutable rem = new BigInteger(0) - BigInteger.DivRem(x,y,&rem) |> ignore ; rem - - static member GreatestCommonDivisor (x:BigInteger,y:BigInteger) = - match x.SignInt,y.SignInt with - | 0, 0 -> BigInteger.Zero - | 0, _ -> BigInteger.posn y.V - | _, 0 -> BigInteger.posn x.V - | _ -> BigInteger.posn (BigNatModule.hcf x.V y.V) // hcf (xsign.xv,ysign.yv) = hcf (xv,yv) - - member x.IsNegative = x.SignInt = -1 && not (x.IsZero) // signx.xv < 0 iff signx = -1 and xv<>0 - - member x.IsPositive = x.SignInt = 1 && not (x.IsZero) // signx.xv > 0 iff signx = +1 and xv<>0 - - static member Abs (x:BigInteger) = if x.SignInt = -1 then -x else x - - static member op_LessThanOrEqual (x:BigInteger,y:BigInteger) = - match x.SignInt,y.SignInt with - | 1, 1 -> BigNatModule.lte x.V y.V // 1.xv <= 1.yv iff xv <= yv - | -1,-1 -> BigNatModule.lte y.V x.V // -1.xv <= -1.yv iff yv <= xv - | 1,-1 -> BigNatModule.isZero x.V && BigNatModule.isZero y.V // 1.xv <= -1.yv, - // (a) if xv=0 and yv=0 then true - // (b) otherwise false, only meet at zero. - - | -1, 1 -> true // -1.xv <= 1.yv, true - | 0, 0 -> true - | 1, 0 -> BigNatModule.isZero x.V - | -1, 0 -> true - | 0, 1 -> true - | 0,-1 -> BigNatModule.isZero y.V - | _ -> invalidArg "x" "signs should be +/- 1 or 0" - - static member op_GreaterThanOrEqual (x:BigInteger,y:BigInteger) = // Follow lte by +/- symmetry - match x.SignInt,y.SignInt with - | 1, 1 -> BigNatModule.gte x.V y.V - | -1,-1 -> BigNatModule.gte y.V x.V - | 1,-1 -> true - | -1, 1 -> BigNatModule.isZero x.V && BigNatModule.isZero y.V - | 0, 0 -> true - | 1, 0 -> true - | -1, 0 -> BigNatModule.isZero x.V - | 0, 1 -> BigNatModule.isZero y.V - | 0,-1 -> true - | _ -> invalidArg "x" "signs should be +/- 1 or 0" - - static member Pow (x:BigInteger,y:int32) = - if y < 0 then raise (new System.ArgumentOutOfRangeException("y", (SR.GetString(SR.inputMustBeNonNegative)))) - match x.IsZero, y with - | true, 0 -> BigInteger.One - | true, _ -> BigInteger.Zero - | _ -> - let yval = BigInteger(y) - BigInteger.create ((if BigNatModule.isZero (BigNatModule.rem yval.V BigNatModule.two) then 1 else x.SignInt), BigNatModule.pow x.V yval.V) - - static member op_Explicit (x:BigInteger) = - if x.IsZero then 0 else - let u = BigNatModule.toUInt32 x.V - if u <= uint32 System.Int32.MaxValue then - // Handle range [-MaxValue,MaxValue] - x.SignInt * int32 u - elif x.SignInt = -1 && u = uint32 (System.Int32.MaxValue + 1) then - //assert(System.Int32.MinValue = 0 - System.Int32.MaxValue - 1) - // Handle MinValue = -(MaxValue+1) special case not covered by the above - System.Int32.MinValue - else - raise (System.OverflowException()) - - static member op_Explicit (x:BigInteger) = - if x.IsZero then 0L else - let u = BigNatModule.toUInt64 x.V - if u <= uint64 System.Int64.MaxValue then - (* Handle range [-MaxValue,MaxValue] *) - int64 x.SignInt * int64 u - elif x.SignInt = -1 && u = uint64 (System.Int64.MaxValue + 1L) then - //assert(System.Int64.MinValue = 0 - System.Int64.MaxValue - 1L) - (* Handle MinValue = -(MaxValue+1) special case not covered by the above *) - System.Int64.MinValue - else - raise (System.OverflowException()) - - static member op_Explicit (x:BigInteger) = - match x.SignInt with - | 1 -> BigNatModule.toFloat x.V // float (1.xv) = float (xv) - | -1 -> - (BigNatModule.toFloat x.V) // float (-1.xv) = - float (xv) - | 0 -> 0. - | _ -> invalidArg "x" "signs should be +/- 1 or 0" - - static member Parse(text:string) = - if isNull text then raise (new ArgumentNullException("text")) - let text = text.Trim() - let len = text.Length - if len = 0 then raise (new System.FormatException(SR.GetString(SR.badFormatString))) - match text.[0], len with - | '-', 1 -> raise (new System.FormatException(SR.GetString(SR.badFormatString))) - | '-', _ -> BigInteger.negn (BigNatModule.ofString text.[1..len-1]) - | '+', 1 -> raise (new System.FormatException(SR.GetString(SR.badFormatString))) - | '+', _ -> BigInteger.posn (BigNatModule.ofString text.[1..len-1]) - | _ -> BigInteger.posn (BigNatModule.ofString text) - - member internal x.IsSmall = x.IsZero || BigNatModule.isSmall (x.V) - - static member Factorial (x:BigInteger) = - if x.IsNegative then invalidArg "x" (SR.GetString(SR.inputMustBeNonNegative)) - if x.IsPositive then BigInteger.posn (BigNatModule.factorial x.V) - else BigInteger.One - - static member ( ~+ )(n1:BigInteger) = n1 - - static member FromInt64(x:int64) = new BigInteger(x) - - static member FromInt32(x:int32) = new BigInteger(x) -#endif +// Deliberately left empty +// +// FSharp.Core previously exposed the namespace Microsoft.FSharp.Math even though there were no types in it. +// This retains that. +// Existing programs could, and did contain the line: +// open FSharp.Math +// namespace Microsoft.FSharp.Core - type bigint = System.Numerics.BigInteger open System @@ -341,22 +23,6 @@ namespace Microsoft.FSharp.Core open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators open System.Numerics -#if FX_NO_BIGINT - // FxCop suppressions - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - [] - do() -#endif - [] module NumericLiterals = @@ -402,14 +68,10 @@ namespace Microsoft.FSharp.Core res else let v = -#if FX_NO_BIGINT - BigInteger.Parse s -#else if isOX s then BigInteger.Parse (s.[2..],NumberStyles.AllowHexSpecifier,CultureInfo.InvariantCulture) else BigInteger.Parse (s,NumberStyles.AllowLeadingSign,CultureInfo.InvariantCulture) -#endif res <- v tabParse.[s] <- res res) @@ -421,5 +83,3 @@ namespace Microsoft.FSharp.Core (FromStringDynamic text :?> 'T) when 'T : BigInteger = getParse text - - diff --git a/src/fsharp/FSharp.Core/math/z.fsi b/src/fsharp/FSharp.Core/math/z.fsi index 3ea6327638..e49b1b3d53 100644 --- a/src/fsharp/FSharp.Core/math/z.fsi +++ b/src/fsharp/FSharp.Core/math/z.fsi @@ -1,82 +1,14 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -namespace System.Numerics -#if FX_NO_BIGINT - - open System - open Microsoft.FSharp.Collections - open Microsoft.FSharp.Core - - /// The type of arbitrary-sized integers - [] - [] - type BigInteger = - /// Return the sum of two big integers - static member ( + ) : x:BigInteger * y:BigInteger -> BigInteger - /// Return the modulus of big integers - static member ( % ) : x:BigInteger * y:BigInteger -> BigInteger - /// Return the product of big integers - static member ( * ) : x:BigInteger * y:BigInteger -> BigInteger - /// Return the difference of two big integers - static member ( - ) : x:BigInteger * y:BigInteger -> BigInteger - /// Return the ratio of two big integers - static member ( / ) : x:BigInteger * y:BigInteger -> BigInteger - /// Return the negation of a big integer - static member (~-) : x:BigInteger -> BigInteger - /// Return the given big integer - static member (~+) : x:BigInteger -> BigInteger - /// Convert a big integer to a floating point number - static member op_Explicit : x:BigInteger -> float - /// Convert a big integer to a 64-bit signed integer - static member op_Explicit : x:BigInteger -> int64 - /// Convert a big integer to a 32-bit signed integer - static member op_Explicit : x:BigInteger -> int32 - /// Parse a big integer from a string format - static member Parse : text:string -> BigInteger - /// Return the sign of a big integer: 0, +1 or -1 - member Sign : int - /// Compute the ratio and remainder of two big integers - static member DivRem : x:BigInteger * y:BigInteger * []rem:BigInteger byref -> BigInteger - - /// This operator is for consistency when this type be used from other CLI languages - static member op_LessThan : x:BigInteger * y:BigInteger -> bool - /// This operator is for consistency when this type be used from other CLI languages - static member op_LessThanOrEqual : x:BigInteger * y:BigInteger -> bool - /// This operator is for consistency when this type be used from other CLI languages - static member op_GreaterThan : x:BigInteger * y:BigInteger -> bool - /// This operator is for consistency when this type be used from other CLI languages - static member op_GreaterThanOrEqual : x:BigInteger * y:BigInteger -> bool - /// This operator is for consistency when this type be used from other CLI languages - static member op_Equality : x:BigInteger * y:BigInteger -> bool - /// This operator is for consistency when this type be used from other CLI languages - static member op_Inequality : x:BigInteger * y:BigInteger -> bool - - /// Return the greatest common divisor of two big integers - static member GreatestCommonDivisor : x:BigInteger * y:BigInteger -> BigInteger - /// Return n^m for two big integers - static member Pow : x:BigInteger * y:int32 -> BigInteger - /// Compute the absolute value of a big integer - static member Abs : x:BigInteger -> BigInteger - /// Get the big integer for zero - static member Zero : BigInteger - /// Get the big integer for one - static member One : BigInteger - - /// Return true if a big integer is 'zero' - member IsZero : bool - /// Return true if a big integer is 'one' - member IsOne : bool - interface System.IComparable - override Equals : obj -> bool - override GetHashCode : unit -> int - override ToString : unit -> string - - /// Construct a BigInteger value for the given integer - new : x:int -> BigInteger - /// Construct a BigInteger value for the given 64-bit integer - new : x:int64 -> BigInteger -#endif +namespace Microsoft.FSharp.Math +// Deliberately left empty +// +// FSharp.Core previously exposed the namespace Microsoft.FSharp.Math even though there were no types in it. +// This retains that. +// Existing programs could, and did contain the line: +// open FSharp.Math +// namespace Microsoft.FSharp.Core @@ -104,5 +36,3 @@ namespace Microsoft.FSharp.Core val FromInt64Dynamic : value:int64 -> obj /// Provides a default implementations of F# numeric literal syntax for literals of the form 'dddI' val FromStringDynamic : text:string -> obj - - From f06e0ac84fa93bd2c95325ad00c7d69b3ad7a539 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2019 10:53:39 -0700 Subject: [PATCH 264/286] Update dependencies from https://github.com/dotnet/arcade build 20190909.10 (#7527) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19459.10 --- eng/Version.Details.xml | 4 ++-- .../post-build/channels/netcore-dev-30.yml | 14 +++----------- .../post-build/channels/netcore-dev-31.yml | 14 +++----------- .../post-build/channels/netcore-dev-5.yml | 14 +++----------- .../post-build/channels/netcore-internal-30.yml | 15 ++------------- .../post-build/channels/netcore-release-30.yml | 13 +------------ .../post-build/channels/netcore-release-31.yml | 13 +------------ .../post-build/channels/netcore-tools-latest.yml | 16 ++++------------ .../channels/public-validation-release.yml | 16 ++++------------ eng/common/templates/steps/promote-build.yml | 13 +++++++++++++ global.json | 2 +- 11 files changed, 37 insertions(+), 97 deletions(-) create mode 100644 eng/common/templates/steps/promote-build.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 34c82619f1..b891c1a7c1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 29ee79a10c58dd6863a46157e374521cac610ad8 + f5ccfdcbd828383d39cf583086ef42d72ca5b320 diff --git a/eng/common/templates/post-build/channels/netcore-dev-30.yml b/eng/common/templates/post-build/channels/netcore-dev-30.yml index 7984f06d1b..3c5eb83988 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-30.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-30.yml @@ -120,14 +120,6 @@ stages: /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) ${{ parameters.artifactsPublishingAdditionalParameters }} - -- stage: NetCore_Dev30_Publish_Validation - displayName: .NET Core 3.0 Dev Publish Validation - variables: - - template: ../common-variables.yml - jobs: - - template: ../setup-maestro-vars.yml - - - template: ../promote-build.yml - parameters: - ChannelId: ${{ variables.PublicDevRelease_30_Channel_Id }} + - template: ../../steps/promote-build.yml + parameters: + ChannelId: ${{ variables.PublicDevRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-dev-31.yml b/eng/common/templates/post-build/channels/netcore-dev-31.yml index bcedd0f075..965309d154 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-31.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-31.yml @@ -120,14 +120,6 @@ stages: /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) ${{ parameters.artifactsPublishingAdditionalParameters }} - -- stage: NetCore_Dev31_Publish_Validation - displayName: .NET Core 3.1 Dev Publish Validation - variables: - - template: ../common-variables.yml - jobs: - - template: ../setup-maestro-vars.yml - - - template: ../promote-build.yml - parameters: - ChannelId: ${{ variables.PublicDevRelease_31_Channel_Id }} + - template: ../../steps/promote-build.yml + parameters: + ChannelId: ${{ variables.PublicDevRelease_31_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-dev-5.yml b/eng/common/templates/post-build/channels/netcore-dev-5.yml index 18432cc60b..9975dda4e8 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-5.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-5.yml @@ -126,14 +126,6 @@ stages: /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} - -- stage: NetCore_Dev5_Publish_Validation - displayName: .NET Core 5 Dev Publish Validation - variables: - - template: ../common-variables.yml - jobs: - - template: ../setup-maestro-vars.yml - - - template: ../promote-build.yml - parameters: - ChannelId: ${{ variables.NetCore_5_Dev_Channel_Id }} + - template: ../../steps/promote-build.yml + parameters: + ChannelId: ${{ variables.NetCore_5_Dev_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-internal-30.yml b/eng/common/templates/post-build/channels/netcore-internal-30.yml index 36e1d1188b..20eef377b2 100644 --- a/eng/common/templates/post-build/channels/netcore-internal-30.yml +++ b/eng/common/templates/post-build/channels/netcore-internal-30.yml @@ -113,17 +113,6 @@ stages: /p:Configuration=Release ${{ parameters.artifactsPublishingAdditionalParameters }} - - template: ../trigger-subscription.yml + - template: ../../steps/promote-build.yml parameters: - ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} - -- stage: NetCore_30_Internal_Servicing_Publish_Validation - displayName: .NET Core 3.0 Internal Servicing Publish Validation - variables: - - template: ../common-variables.yml - jobs: - - template: ../setup-maestro-vars.yml - - - template: ../promote-build.yml - parameters: - ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} + ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} \ No newline at end of file diff --git a/eng/common/templates/post-build/channels/netcore-release-30.yml b/eng/common/templates/post-build/channels/netcore-release-30.yml index abae985ab0..5a5c28e1b6 100644 --- a/eng/common/templates/post-build/channels/netcore-release-30.yml +++ b/eng/common/templates/post-build/channels/netcore-release-30.yml @@ -113,17 +113,6 @@ stages: /p:Configuration=Release ${{ parameters.artifactsPublishingAdditionalParameters }} - - template: ../trigger-subscription.yml + - template: ../../steps/promote-build.yml parameters: ChannelId: ${{ variables.PublicRelease_30_Channel_Id }} - -- stage: NetCore_Release30_Publish_Validation - displayName: .NET Core 3.0 Release Publish Validation - variables: - - template: ../common-variables.yml - jobs: - - template: ../setup-maestro-vars.yml - - - template: ../promote-build.yml - parameters: - ChannelId: ${{ variables.PublicRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-release-31.yml b/eng/common/templates/post-build/channels/netcore-release-31.yml index b2a6c7659d..2945215883 100644 --- a/eng/common/templates/post-build/channels/netcore-release-31.yml +++ b/eng/common/templates/post-build/channels/netcore-release-31.yml @@ -119,17 +119,6 @@ stages: /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) ${{ parameters.artifactsPublishingAdditionalParameters }} - - template: ../trigger-subscription.yml + - template: ../../steps/promote-build.yml parameters: ChannelId: ${{ variables.PublicRelease_31_Channel_Id }} - -- stage: NetCore_Release31_Publish_Validation - displayName: .NET Core 3.1 Release Publish Validation - variables: - - template: ../common-variables.yml - jobs: - - template: ../setup-maestro-vars.yml - - - template: ../promote-build.yml - parameters: - ChannelId: ${{ variables.PublicRelease_31_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-tools-latest.yml b/eng/common/templates/post-build/channels/netcore-tools-latest.yml index 36f6dea628..09445aee0e 100644 --- a/eng/common/templates/post-build/channels/netcore-tools-latest.yml +++ b/eng/common/templates/post-build/channels/netcore-tools-latest.yml @@ -125,15 +125,7 @@ stages: /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw) ${{ parameters.artifactsPublishingAdditionalParameters }} - - -- stage: NetCore_Tools_Latest_PublishValidation - displayName: .NET Tools - Latest Publish Validation - variables: - - template: ../common-variables.yml - jobs: - - template: ../setup-maestro-vars.yml - - - template: ../promote-build.yml - parameters: - ChannelId: ${{ variables.NetCore_Tools_Latest_Channel_Id }} + + - template: ../../steps/promote-build.yml + parameters: + ChannelId: ${{ variables.NetCore_Tools_Latest_Channel_Id }} \ No newline at end of file diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index a5fcdc581a..4feed32971 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -85,15 +85,7 @@ stages: /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} - - -- stage: PVR_PublishValidation - displayName: .NET Tools - Validation Publish Validation - variables: - - template: ../common-variables.yml - jobs: - - template: ../setup-maestro-vars.yml - - - template: ../promote-build.yml - parameters: - ChannelId: ${{ variables.PublicValidationRelease_30_Channel_Id }} + + - template: ../../steps/promote-build.yml + parameters: + ChannelId: ${{ variables.PublicValidationRelease_30_Channel_Id }} diff --git a/eng/common/templates/steps/promote-build.yml b/eng/common/templates/steps/promote-build.yml new file mode 100644 index 0000000000..b90404435d --- /dev/null +++ b/eng/common/templates/steps/promote-build.yml @@ -0,0 +1,13 @@ +parameters: + ChannelId: 0 + +steps: +- task: PowerShell@2 + displayName: Add Build to Channel + inputs: + filePath: $(Build.SourcesDirectory)/eng/common/post-build/promote-build.ps1 + arguments: -BuildId $(BARBuildId) + -ChannelId ${{ parameters.ChannelId }} + -MaestroApiAccessToken $(MaestroApiAccessToken) + -MaestroApiEndPoint $(MaestroApiEndPoint) + -MaestroApiVersion $(MaestroApiVersion) diff --git a/global.json b/global.json index 5c889d6f2e..a325659e95 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19458.2", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19459.10", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From a18c253c70b1522dba94d9e99c284ff329eee16c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 11 Sep 2019 12:27:51 +0000 Subject: [PATCH 265/286] Update dependencies from https://github.com/dotnet/arcade build 20190910.3 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19460.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b891c1a7c1..9db5c0d007 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - f5ccfdcbd828383d39cf583086ef42d72ca5b320 + 0f5cfb20a355c27bc84cedd049c946b44a7fc1da diff --git a/global.json b/global.json index a325659e95..c1c4de8567 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19459.10", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19460.3", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From f5d149956c0e8103c9539f195e8efa62e7ee812f Mon Sep 17 00:00:00 2001 From: Will Smith Date: Wed, 11 Sep 2019 12:19:26 -0700 Subject: [PATCH 266/286] Minor cleanup, do not check assembly for string concat optimization (#7532) --- src/fsharp/Optimizer.fs | 48 +++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/src/fsharp/Optimizer.fs b/src/fsharp/Optimizer.fs index cfa1a9a49d..e89f3e4284 100644 --- a/src/fsharp/Optimizer.fs +++ b/src/fsharp/Optimizer.fs @@ -1830,22 +1830,27 @@ let TryDetectQueryQuoteAndRun cenv (expr: Expr) = //printfn "Not eliminating because no Run found" None -let IsILMethodRefDeclaringTypeSystemString (ilg: ILGlobals) (mref: ILMethodRef) = - mref.DeclaringTypeRef.Scope.IsAssemblyRef && - mref.DeclaringTypeRef.Scope.AssemblyRef.Name = ilg.typ_String.TypeRef.Scope.AssemblyRef.Name && - mref.DeclaringTypeRef.BasicQualifiedName = ilg.typ_String.BasicQualifiedName - -let IsILMethodRefSystemStringConcatOverload (ilg: ILGlobals) (mref: ILMethodRef) = - IsILMethodRefDeclaringTypeSystemString ilg mref && +let IsILMethodRefSystemStringConcat (mref: ILMethodRef) = mref.Name = "Concat" && - mref.ReturnType.BasicQualifiedName = ilg.typ_String.BasicQualifiedName && - mref.ArgCount >= 2 && mref.ArgCount <= 4 && mref.ArgTypes |> List.forall(fun ilty -> ilty.BasicQualifiedName = ilg.typ_String.BasicQualifiedName) - -let IsILMethodRefSystemStringConcatArray (ilg: ILGlobals) (mref: ILMethodRef) = - IsILMethodRefDeclaringTypeSystemString ilg mref && + mref.DeclaringTypeRef.Name = "System.String" && + (mref.ReturnType.IsNominal && mref.ReturnType.TypeRef.Name = "System.String") && + (mref.ArgCount >= 2 && mref.ArgCount <= 4 && + mref.ArgTypes + |> List.forall (fun ilTy -> + ilTy.IsNominal && ilTy.TypeRef.Name = "System.String")) + +let IsILMethodRefSystemStringConcatArray (mref: ILMethodRef) = mref.Name = "Concat" && - mref.ReturnType.BasicQualifiedName = ilg.typ_String.BasicQualifiedName && - mref.ArgCount = 1 && mref.ArgTypes.Head.BasicQualifiedName = "System.String[]" + mref.DeclaringTypeRef.Name = "System.String" && + (mref.ReturnType.IsNominal && mref.ReturnType.TypeRef.Name = "System.String") && + (mref.ArgCount = 1 && + mref.ArgTypes + |> List.forall (fun ilTy -> + match ilTy with + | ILType.Array (shape, ilTy) when shape = ILArrayShape.SingleDimensional && + ilTy.IsNominal && + ilTy.TypeRef.Name = "System.String" -> true + | _ -> false)) /// Optimize/analyze an expression let rec OptimizeExpr cenv (env: IncrementalOptimizationEnv) expr = @@ -1972,10 +1977,12 @@ and OptimizeInterfaceImpl cenv env baseValOpt (ty, overrides) = and MakeOptimizedSystemStringConcatCall cenv env m args = let rec optimizeArg argExpr accArgs = match argExpr, accArgs with - | Expr.Op(TOp.ILCall(_, _, _, _, _, _, _, methRef, _, _, _), _, [ Expr.Op(TOp.Array, _, args, _) ], _), _ when IsILMethodRefSystemStringConcatArray cenv.g.ilg methRef -> + | Expr.Op(TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), _, [ Expr.Op(TOp.Array, _, args, _) ], _), _ + when IsILMethodRefSystemStringConcatArray mref -> optimizeArgs args accArgs - | Expr.Op(TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), _, args, _), _ when IsILMethodRefSystemStringConcatOverload cenv.g.ilg mref -> + | Expr.Op(TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), _, args, _), _ + when IsILMethodRefSystemStringConcat mref -> optimizeArgs args accArgs // Optimize string constants, e.g. "1" + "2" will turn into "12" @@ -2005,7 +2012,8 @@ and MakeOptimizedSystemStringConcatCall cenv env m args = mkStaticCall_String_Concat_Array cenv.g m arg match expr with - | Expr.Op(TOp.ILCall(_, _, _, _, _, _, _, methRef, _, _, _) as op, tyargs, args, m) when IsILMethodRefSystemStringConcatOverload cenv.g.ilg methRef || IsILMethodRefSystemStringConcatArray cenv.g.ilg methRef -> + | Expr.Op(TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _) as op, tyargs, args, m) + when IsILMethodRefSystemStringConcat mref || IsILMethodRefSystemStringConcatArray mref -> OptimizeExprOpReductions cenv env (op, tyargs, args, m) | _ -> OptimizeExpr cenv env expr @@ -2074,9 +2082,11 @@ and OptimizeExprOp cenv env (op, tyargs, args, m) = | TOp.ILAsm ([], [ty]), _, [a] when typeEquiv cenv.g (tyOfExpr cenv.g a) ty -> OptimizeExpr cenv env a // Optimize calls when concatenating strings, e.g. "1" + "2" + "3" + "4" .. etc. - | TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), _, [ Expr.Op(TOp.Array, _, args, _) ] when IsILMethodRefSystemStringConcatArray cenv.g.ilg mref -> + | TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), _, [ Expr.Op(TOp.Array, _, args, _) ] + when IsILMethodRefSystemStringConcatArray mref -> MakeOptimizedSystemStringConcatCall cenv env m args - | TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), _, args when IsILMethodRefSystemStringConcatOverload cenv.g.ilg mref -> + | TOp.ILCall(_, _, _, _, _, _, _, mref, _, _, _), _, args + when IsILMethodRefSystemStringConcat mref -> MakeOptimizedSystemStringConcatCall cenv env m args | _ -> From 44ca3eb34744d165f30c460b632fd600c97e7e0a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2019 16:48:46 +0000 Subject: [PATCH 267/286] Update dependencies from https://github.com/dotnet/arcade build 20190911.7 (#7545) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19461.7 --- eng/Version.Details.xml | 4 +- .../post-build/channels/netcore-dev-30.yml | 13 ++++--- .../post-build/channels/netcore-dev-31.yml | 15 ++++---- .../post-build/channels/netcore-dev-5.yml | 29 ++++++-------- .../channels/netcore-internal-30.yml | 38 +++++++++++-------- .../channels/netcore-release-30.yml | 38 +++++++++++-------- .../channels/netcore-release-31.yml | 14 ++++--- .../channels/netcore-tools-latest.yml | 33 +++++++--------- .../channels/public-validation-release.yml | 26 ++++++------- .../templates/post-build/common-variables.yml | 4 -- .../templates/post-build/post-build.yml | 6 +-- global.json | 2 +- 12 files changed, 112 insertions(+), 110 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9db5c0d007..b51173650b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 0f5cfb20a355c27bc84cedd049c946b44a7fc1da + 8eb29ba860a3cfcfe68f9a8256caa7efc1f1aaba diff --git a/eng/common/templates/post-build/channels/netcore-dev-30.yml b/eng/common/templates/post-build/channels/netcore-dev-30.yml index 3c5eb83988..69f1a9013e 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-30.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-30.yml @@ -97,14 +97,8 @@ stages: /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:StaticInternalFeed=$(StaticInternalFeed) - /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) - /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) - /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) - /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) /p:NugetPath=$(NuGetExeToolPath) /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' /p:BARBuildId=$(BARBuildId) /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' @@ -118,6 +112,13 @@ stages: /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) + /p:PublishToAzureDevOpsNuGetFeeds=true + /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3/nuget/v3/index.json' + /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3-transport/nuget/v3/index.json' + /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3-symbols/nuget/v3/index.json' + /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} - template: ../../steps/promote-build.yml diff --git a/eng/common/templates/post-build/channels/netcore-dev-31.yml b/eng/common/templates/post-build/channels/netcore-dev-31.yml index 965309d154..720a0ab08a 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-31.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-31.yml @@ -46,7 +46,7 @@ stages: /p:Configuration=Release ${{ parameters.symbolPublishingAdditionalParameters }} - - job: + - job: publish_assets displayName: Publish Assets dependsOn: setupMaestroVars variables: @@ -97,14 +97,8 @@ stages: /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:StaticInternalFeed=$(StaticInternalFeed) - /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) - /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) - /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) - /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) /p:NugetPath=$(NuGetExeToolPath) /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' /p:BARBuildId=$(BARBuildId) /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' @@ -118,6 +112,13 @@ stages: /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) + /p:PublishToAzureDevOpsNuGetFeeds=true + /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json' + /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json' + /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json' + /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} - template: ../../steps/promote-build.yml diff --git a/eng/common/templates/post-build/channels/netcore-dev-5.yml b/eng/common/templates/post-build/channels/netcore-dev-5.yml index 9975dda4e8..9c81e39e9c 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-5.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-5.yml @@ -2,7 +2,6 @@ parameters: symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' publishInstallersAndChecksums: false - publishToAzureDevOpsFeeds: true stages: - stage: NetCore_Dev5_Publish @@ -92,38 +91,34 @@ stages: AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ArtifactsCategory=$(_DotNetArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:StaticInternalFeed=$(StaticInternalFeed) - /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) - /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) - /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) - /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) /p:NugetPath=$(NuGetExeToolPath) - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) - /p:PublishToAzureDevOpsNuGetFeeds=${{ parameters.publishToAzureDevOpsFeeds }} + /p:PublishToAzureDevOpsNuGetFeeds=true /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json' /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json' /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json' + /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} - template: ../../steps/promote-build.yml diff --git a/eng/common/templates/post-build/channels/netcore-internal-30.yml b/eng/common/templates/post-build/channels/netcore-internal-30.yml index 20eef377b2..594a1a9a78 100644 --- a/eng/common/templates/post-build/channels/netcore-internal-30.yml +++ b/eng/common/templates/post-build/channels/netcore-internal-30.yml @@ -90,27 +90,33 @@ stages: AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:StaticInternalFeed=$(StaticInternalFeed) - /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) - /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) - /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) - /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) /p:NugetPath=$(NuGetExeToolPath) - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:Configuration=Release + /p:PublishInstallersAndChecksums=true + /p:ChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) + /p:ChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) + /p:InstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) + /p:InstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) + /p:PublishToAzureDevOpsNuGetFeeds=true + /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v3/index.json' + /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v3/index.json' + /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-symbols/nuget/v3/index.json' + /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} - template: ../../steps/promote-build.yml diff --git a/eng/common/templates/post-build/channels/netcore-release-30.yml b/eng/common/templates/post-build/channels/netcore-release-30.yml index 5a5c28e1b6..8ba9237ffc 100644 --- a/eng/common/templates/post-build/channels/netcore-release-30.yml +++ b/eng/common/templates/post-build/channels/netcore-release-30.yml @@ -1,6 +1,7 @@ parameters: symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + publishInstallersAndChecksums: false stages: - stage: NetCore_Release30_Publish @@ -90,27 +91,34 @@ stages: AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + /p:ArtifactsCategory=$(_DotNetArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:StaticInternalFeed=$(StaticInternalFeed) - /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) - /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) - /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) - /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) /p:NugetPath=$(NuGetExeToolPath) /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:Configuration=Release + /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} + /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) + /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) + /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) + /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) + /p:PublishToAzureDevOpsNuGetFeeds=true + /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3/nuget/v3/index.json' + /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3-transport/nuget/v3/index.json' + /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3-symbols/nuget/v3/index.json' + /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} - template: ../../steps/promote-build.yml diff --git a/eng/common/templates/post-build/channels/netcore-release-31.yml b/eng/common/templates/post-build/channels/netcore-release-31.yml index 2945215883..d8270eadae 100644 --- a/eng/common/templates/post-build/channels/netcore-release-31.yml +++ b/eng/common/templates/post-build/channels/netcore-release-31.yml @@ -1,6 +1,7 @@ parameters: symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + publishInstallersAndChecksums: false stages: - stage: NetCore_Release31_Publish @@ -96,14 +97,8 @@ stages: /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:StaticInternalFeed=$(StaticInternalFeed) - /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) - /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) - /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) - /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) /p:NugetPath=$(NuGetExeToolPath) /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' /p:BARBuildId=$(BARBuildId) /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' @@ -117,6 +112,13 @@ stages: /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) + /p:PublishToAzureDevOpsNuGetFeeds=true + /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json' + /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json' + /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json' + /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} - template: ../../steps/promote-build.yml diff --git a/eng/common/templates/post-build/channels/netcore-tools-latest.yml b/eng/common/templates/post-build/channels/netcore-tools-latest.yml index 09445aee0e..c75d186733 100644 --- a/eng/common/templates/post-build/channels/netcore-tools-latest.yml +++ b/eng/common/templates/post-build/channels/netcore-tools-latest.yml @@ -2,7 +2,6 @@ parameters: symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' publishInstallersAndChecksums: false - publishToAzureDevOpsFeeds: true stages: - stage: NetCore_Tools_Latest_Publish @@ -92,40 +91,36 @@ stages: AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ArtifactsCategory=$(_DotNetArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) - /p:StaticInternalFeed=$(StaticInternalFeed) - /p:InternalChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) - /p:InternalChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) - /p:InternalInstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) - /p:InternalInstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) /p:NugetPath=$(NuGetExeToolPath) - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) - /p:PublishToAzureDevOpsNuGetFeeds=${{ parameters.publishToAzureDevOpsFeeds }} + /p:PublishToAzureDevOpsNuGetFeeds=true /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' - /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw) + /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' + /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} - + - template: ../../steps/promote-build.yml parameters: ChannelId: ${{ variables.NetCore_Tools_Latest_Channel_Id }} \ No newline at end of file diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index 4feed32971..fb2c23d0f4 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -1,7 +1,6 @@ parameters: artifactsPublishingAdditionalParameters: '' publishInstallersAndChecksums: false - publishToAzureDevOpsFeeds: true stages: - stage: PVR_Publish @@ -57,35 +56,36 @@ stages: AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet + arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet /p:ArtifactsCategory=$(_DotNetValidationArtifactsCategory) /p:IsStableBuild=$(IsStableBuild) /p:IsInternalBuild=$(IsInternalBuild) /p:RepositoryName=$(Build.Repository.Name) /p:CommitSha=$(Build.SourceVersion) /p:NugetPath=$(NuGetExeToolPath) - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:TargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' + /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' + /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' + /p:BARBuildId=$(BARBuildId) + /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' + /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' + /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' + /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' + /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' /p:Configuration=Release /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) - /p:PublishToAzureDevOpsNuGetFeeds=${{ parameters.publishToAzureDevOpsFeeds }} + /p:PublishToAzureDevOpsNuGetFeeds=true /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json' /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' + /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json' + /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' ${{ parameters.artifactsPublishingAdditionalParameters }} - + - template: ../../steps/promote-build.yml parameters: ChannelId: ${{ variables.PublicValidationRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index c134764496..adb2a854f2 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -55,10 +55,6 @@ variables: # Feed Configurations # These should include the suffix "/index.json" - # Configuration for the feed where packages from internal non-stable builds will be published to - - name: StaticInternalFeed - value: 'https://dnceng.pkgs.visualstudio.com/_packaging/dotnet-core-internal/nuget/v3/index.json' - # Default locations for Installers and checksums # Public Locations - name: ChecksumsBlobFeedUrl diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index e473cadbcc..5b9d0a5d99 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -4,7 +4,6 @@ parameters: enableSymbolValidation: false enableNugetValidation: true publishInstallersAndChecksums: false - enableAzDONuGetFeeds: true SDLValidationParameters: enable: false continueOnError: false @@ -101,7 +100,6 @@ stages: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - enableAzDONuGetFeeds: ${{ parameters.enableAzDONuGetFeeds }} - template: \eng\common\templates\post-build\channels\netcore-dev-30.yml parameters: @@ -120,23 +118,23 @@ stages: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - enableAzDONuGetFeeds: ${{ parameters.enableAzDONuGetFeeds }} - template: \eng\common\templates\post-build\channels\public-validation-release.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - enableAzDONuGetFeeds: ${{ parameters.enableAzDONuGetFeeds }} - template: \eng\common\templates\post-build\channels\netcore-release-30.yml parameters: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - template: \eng\common\templates\post-build\channels\netcore-release-31.yml parameters: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - template: \eng\common\templates\post-build\channels\netcore-internal-30.yml parameters: diff --git a/global.json b/global.json index c1c4de8567..5c4eb05505 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19460.3", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19461.7", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 1bea321013ca0cdf5cce39a13c3244ce4a5eb299 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Thu, 12 Sep 2019 22:01:30 -0700 Subject: [PATCH 268/286] FX_NO_SYSTEM_CONSOLE and EXTRAS_FOR_SILVERLIGHT_COMPILER are never set (#7549) --- src/fsharp/FSharp.Core/Query.fs | 4 ---- src/fsharp/FSharp.Core/fslib-extra-pervasives.fs | 2 -- .../FSharp.Core/fslib-extra-pervasives.fsi | 2 -- src/fsharp/FSharp.Core/prim-types.fs | 5 +---- src/fsharp/FSharp.Core/prim-types.fsi | 4 +--- src/fsharp/FSharp.Core/printf.fs | 16 ---------------- src/fsharp/FSharp.Core/printf.fsi | 3 +-- 7 files changed, 3 insertions(+), 33 deletions(-) diff --git a/src/fsharp/FSharp.Core/Query.fs b/src/fsharp/FSharp.Core/Query.fs index 742f04b32d..cd681e7793 100644 --- a/src/fsharp/FSharp.Core/Query.fs +++ b/src/fsharp/FSharp.Core/Query.fs @@ -1804,7 +1804,6 @@ module Query = let linqQuery = TransInnerWithFinalConsume canElim queryProducingSequence let linqQueryAfterEliminatingNestedQueries = EliminateNestedQueries linqQuery -#if !FX_NO_SYSTEM_CONSOLE #if DEBUG let debug() = Printf.printfn "----------------------queryProducingSequence-------------------------" @@ -1814,20 +1813,17 @@ module Query = Printf.printfn "--------------------------linqQuery (after nested)-------------------" Printf.printfn "%A" linqQueryAfterEliminatingNestedQueries #endif -#endif let result = try LeafExpressionConverter.EvaluateQuotation linqQueryAfterEliminatingNestedQueries with e -> -#if !FX_NO_SYSTEM_CONSOLE #if DEBUG debug() Printf.printfn "--------------------------error--------------------------------------" Printf.printfn "%A" (e.ToString()) Printf.printfn "---------------------------------------------------------------------" -#endif #endif reraise () diff --git a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs index dd8d087345..0d6c3772c1 100644 --- a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs +++ b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fs @@ -227,7 +227,6 @@ module ExtraTopLevelOperators = [] let fprintfn (textWriter:TextWriter) format = Printf.fprintfn textWriter format -#if !FX_NO_SYSTEM_CONSOLE [] let printf format = Printf.printf format @@ -239,7 +238,6 @@ module ExtraTopLevelOperators = [] let eprintfn format = Printf.eprintfn format -#endif [] let failwith s = raise (Failure s) diff --git a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi index 804d48bc3d..6b43ddef90 100644 --- a/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi +++ b/src/fsharp/FSharp.Core/fslib-extra-pervasives.fsi @@ -12,7 +12,6 @@ module ExtraTopLevelOperators = open Microsoft.FSharp.Collections open Microsoft.FSharp.Text -#if !FX_NO_SYSTEM_CONSOLE /// Print to stdout using the given format. /// The formatter. /// The formatted result. @@ -36,7 +35,6 @@ module ExtraTopLevelOperators = /// The formatted result. [] val eprintfn : format:Printf.TextWriterFormat<'T> -> 'T -#endif /// Print to a string using the given format. /// The formatter. diff --git a/src/fsharp/FSharp.Core/prim-types.fs b/src/fsharp/FSharp.Core/prim-types.fs index bfd5bdacc9..5c053e8ba9 100644 --- a/src/fsharp/FSharp.Core/prim-types.fs +++ b/src/fsharp/FSharp.Core/prim-types.fs @@ -4335,7 +4335,6 @@ namespace Microsoft.FSharp.Core [] let id x = x -#if !FX_NO_SYSTEM_CONSOLE // std* are TypeFunctions with the effect of reading the property on instantiation. // So, direct uses of stdout should capture the current System.Console.Out at that point. [] @@ -4346,10 +4345,8 @@ namespace Microsoft.FSharp.Core [] let stderr<'T> = System.Console.Error -#endif - - module Unchecked = + module Unchecked = [] let inline unbox<'T> (v:obj) = unboxPrim<'T> v diff --git a/src/fsharp/FSharp.Core/prim-types.fsi b/src/fsharp/FSharp.Core/prim-types.fsi index c977af4541..6d345a2cfd 100644 --- a/src/fsharp/FSharp.Core/prim-types.fsi +++ b/src/fsharp/FSharp.Core/prim-types.fsi @@ -2360,10 +2360,9 @@ namespace Microsoft.FSharp.Core [] val nanf: float32 -#if !FX_NO_SYSTEM_CONSOLE /// Reads the value of the property System.Console.In. [] - val stdin<'T> : System.IO.TextReader + val stdin<'T> : System.IO.TextReader /// Reads the value of the property System.Console.Error. [] @@ -2372,7 +2371,6 @@ namespace Microsoft.FSharp.Core /// Reads the value of the property System.Console.Out. [] val stdout<'T> : System.IO.TextWriter -#endif /// The standard overloaded range operator, e.g. [n..m] for lists, seq {n..m} for sequences /// The start value of the range. diff --git a/src/fsharp/FSharp.Core/printf.fs b/src/fsharp/FSharp.Core/printf.fs index 141c9752da..3913eeeba5 100644 --- a/src/fsharp/FSharp.Core/printf.fs +++ b/src/fsharp/FSharp.Core/printf.fs @@ -1645,20 +1645,6 @@ module Printf = [] let failwithf format = ksprintf failwith format -#if !FX_NO_SYSTEM_CONSOLE -#if EXTRAS_FOR_SILVERLIGHT_COMPILER - [] - let printf format = fprintf (!outWriter) format - - [] - let eprintf format = fprintf (!errorWriter) format - - [] - let printfn format = fprintfn (!outWriter) format - - [] - let eprintfn format = fprintfn (!errorWriter) format -#else [] let printf format = fprintf Console.Out format @@ -1670,5 +1656,3 @@ module Printf = [] let eprintfn format = fprintfn Console.Error format -#endif -#endif diff --git a/src/fsharp/FSharp.Core/printf.fsi b/src/fsharp/FSharp.Core/printf.fsi index c8f7b2dcae..10e17ec68d 100644 --- a/src/fsharp/FSharp.Core/printf.fsi +++ b/src/fsharp/FSharp.Core/printf.fsi @@ -183,7 +183,6 @@ module Printf = [] val fprintfn : textWriter:TextWriter -> format:TextWriterFormat<'T> -> 'T -#if !FX_NO_SYSTEM_CONSOLE /// Formatted printing to stderr /// The input formatter. /// The return type and arguments of the formatter. @@ -207,7 +206,7 @@ module Printf = /// The return type and arguments of the formatter. [] val printfn : format:TextWriterFormat<'T> -> 'T -#endif + /// Print to a string via an internal string buffer and return /// the result as a string. Helper printers must return strings. /// The input formatter. From 2c4ed90bb467f771bdd4ab080497b9204950bb8e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2019 17:04:37 +0000 Subject: [PATCH 269/286] Update dependencies from https://github.com/dotnet/arcade build 20190912.5 (#7555) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19462.5 --- eng/Version.Details.xml | 4 ++-- .../channels/netcore-internal-30.yml | 6 +++--- eng/common/tools.ps1 | 18 +++++++++++++++++- eng/common/tools.sh | 16 ++++++++++++++++ global.json | 2 +- 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b51173650b..436e00c958 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 8eb29ba860a3cfcfe68f9a8256caa7efc1f1aaba + 6003ee189f456c92a18b097f226d4927309def27 diff --git a/eng/common/templates/post-build/channels/netcore-internal-30.yml b/eng/common/templates/post-build/channels/netcore-internal-30.yml index 594a1a9a78..053163cf6a 100644 --- a/eng/common/templates/post-build/channels/netcore-internal-30.yml +++ b/eng/common/templates/post-build/channels/netcore-internal-30.yml @@ -107,9 +107,9 @@ stages: /p:Configuration=Release /p:PublishInstallersAndChecksums=true /p:ChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl) - /p:ChecksumsTargetStaticFeedKey=$(InternalChecksumsBlobFeedKey) + /p:ChecksumsAzureAccountKey=$(InternalChecksumsBlobFeedKey) /p:InstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl) - /p:InstallersTargetStaticFeedKey=$(InternalInstallersBlobFeedKey) + /p:InstallersAzureAccountKey=$(InternalInstallersBlobFeedKey) /p:PublishToAzureDevOpsNuGetFeeds=true /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v3/index.json' /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' @@ -121,4 +121,4 @@ stages: - template: ../../steps/promote-build.yml parameters: - ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} \ No newline at end of file + ChannelId: ${{ variables.InternalServicing_30_Channel_Id }} diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index bb5638930a..91efea9405 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -153,6 +153,16 @@ function InitializeDotNetCli([bool]$install) { # Make Sure that our bootstrapped dotnet cli is available in future steps of the Azure Pipelines build Write-PipelinePrependPath -Path $dotnetRoot + + # Work around issues with Azure Artifacts credential provider + # https://github.com/dotnet/arcade/issues/3932 + if ($ci) { + $env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS = 20 + $env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS = 20 + Write-PipelineSetVariable -Name 'NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS' -Value '20' + Write-PipelineSetVariable -Name 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS' -Value '20' + } + Write-PipelineSetVariable -Name 'DOTNET_MULTILEVEL_LOOKUP' -Value '0' Write-PipelineSetVariable -Name 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' -Value '1' @@ -365,7 +375,6 @@ function InitializeBuildTool() { Write-PipelineTelemetryError -Category "InitializeToolset" -Message "/global.json must specify 'tools.dotnet'." ExitWithExitCode 1 } - $buildTool = @{ Path = Join-Path $dotnetRoot "dotnet.exe"; Command = "msbuild"; Tool = "dotnet"; Framework = "netcoreapp2.1" } } elseif ($msbuildEngine -eq "vs") { try { @@ -490,6 +499,13 @@ function Stop-Processes() { function MSBuild() { if ($pipelinesLog) { $buildTool = InitializeBuildTool + + # Work around issues with Azure Artifacts credential provider + # https://github.com/dotnet/arcade/issues/3932 + if ($ci -and $buildTool.Tool -eq "dotnet") { + dotnet nuget locals http-cache -c + } + $toolsetBuildProject = InitializeToolset $path = Split-Path -parent $toolsetBuildProject $path = Join-Path $path (Join-Path $buildTool.Framework "Microsoft.DotNet.Arcade.Sdk.dll") diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 94a1edd7d0..757d5b9ea4 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -152,6 +152,15 @@ function InitializeDotNetCli { # build steps from using anything other than what we've downloaded. Write-PipelinePrependPath -path "$dotnet_root" + # Work around issues with Azure Artifacts credential provider + # https://github.com/dotnet/arcade/issues/3932 + if [[ "$ci" == true ]]; then + export NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20 + export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 + Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20" + Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20" + fi + Write-PipelineSetVariable -name "DOTNET_MULTILEVEL_LOOKUP" -value "0" Write-PipelineSetVariable -name "DOTNET_SKIP_FIRST_TIME_EXPERIENCE" -value "1" @@ -328,6 +337,13 @@ function MSBuild { if [[ "$pipelines_log" == true ]]; then InitializeBuildTool InitializeToolset + + # Work around issues with Azure Artifacts credential provider + # https://github.com/dotnet/arcade/issues/3932 + if [[ "$ci" == true ]]; then + dotnet nuget locals http-cache -c + fi + local toolset_dir="${_InitializeToolset%/*}" local logger_path="$toolset_dir/$_InitializeBuildToolFramework/Microsoft.DotNet.Arcade.Sdk.dll" args=( "${args[@]}" "-logger:$logger_path" ) diff --git a/global.json b/global.json index 5c4eb05505..ff2ad6fe78 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19461.7", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19462.5", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 92a5b36b853c32970d944c2ef4ba5c3c80a6fa27 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2019 10:22:38 -0700 Subject: [PATCH 270/286] Update dependencies from https://github.com/dotnet/arcade build 20190913.3 (#7563) - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19463.3 --- eng/Version.Details.xml | 4 ++-- global.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 436e00c958..32461002c4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 6003ee189f456c92a18b097f226d4927309def27 + 7b731032220c21a3ed0021c72757b1f3122579b2 diff --git a/global.json b/global.json index ff2ad6fe78..1e7325d768 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19462.5", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19463.3", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From d6afc7bee35a930a52a032f7d042b806fe645fd4 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Mon, 16 Sep 2019 18:29:25 -0700 Subject: [PATCH 271/286] fire events when script host resolves assembly reference (#7571) * add event every time `#r` is invoked * pass additional args to script host --- src/fsharp/CompileOps.fs | 10 ++++++++-- src/fsharp/CompileOps.fsi | 2 +- src/fsharp/fsi/fsi.fs | 9 ++++++++- src/fsharp/fsi/fsi.fsi | 3 +++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index b8b7fcdc93..379c8fcac2 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -4775,7 +4775,7 @@ and [] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse /// Process #r in F# Interactive. /// Adds the reference to the tcImports and add the ccu to the type checking environment. -let RequireDLL (ctok, tcImports: TcImports, tcEnv, thisAssemblyName, m, file) = +let RequireDLL (ctok, tcImports: TcImports, tcEnv, thisAssemblyName, m, file, assemblyReferenceAdded: string -> unit) = let resolutions = CommitOperationResult(tcImports.TryResolveAssemblyReference(ctok, AssemblyReference(m, file, None), ResolveAssemblyReferenceMode.ReportErrors)) let dllinfos, ccuinfos = tcImports.RegisterAndImportReferencedAssemblies(ctok, resolutions) |> Cancellable.runWithoutCancellation @@ -4786,7 +4786,13 @@ let RequireDLL (ctok, tcImports: TcImports, tcEnv, thisAssemblyName, m, file) = let g = tcImports.GetTcGlobals() let amap = tcImports.GetImportMap() - let tcEnv = (tcEnv, asms) ||> List.fold (fun tcEnv asm -> AddCcuToTcEnv(g, amap, m, tcEnv, thisAssemblyName, asm.FSharpViewOfMetadata, asm.AssemblyAutoOpenAttributes, asm.AssemblyInternalsVisibleToAttributes)) + let buildTcEnv tcEnv asm = + let tcEnv = AddCcuToTcEnv(g, amap, m, tcEnv, thisAssemblyName, asm.FSharpViewOfMetadata, asm.AssemblyAutoOpenAttributes, asm.AssemblyInternalsVisibleToAttributes) + match asm.FSharpViewOfMetadata.FileName with + | Some asmPath -> assemblyReferenceAdded asmPath + | None -> () + tcEnv + let tcEnv = (tcEnv, asms) ||> List.fold buildTcEnv tcEnv, (dllinfos, asms) diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index ff5555e8f3..8a017c1e32 100644 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -672,7 +672,7 @@ val WriteOptimizationData: TcGlobals * filename: string * inMem: bool * CcuThunk /// Process #r in F# Interactive. /// Adds the reference to the tcImports and add the ccu to the type checking environment. -val RequireDLL: CompilationThreadToken * TcImports * TcEnv * thisAssemblyName: string * referenceRange: range * file: string -> TcEnv * (ImportedBinary list * ImportedAssembly list) +val RequireDLL: CompilationThreadToken * TcImports * TcEnv * thisAssemblyName: string * referenceRange: range * file: string * assemblyReferenceAdded: (string -> unit) -> TcEnv * (ImportedBinary list * ImportedAssembly list) /// Processing # commands val ProcessMetaCommandsFromInput: diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index b5d0b09821..974fc15e79 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -962,6 +962,8 @@ type internal FsiDynamicCompiler let outfile = "TMPFSCI.exe" let assemblyName = "FSI-ASSEMBLY" + let assemblyReferenceAddedEvent = Control.Event() + let mutable fragmentId = 0 let mutable prevIt : ValRef option = None @@ -1245,7 +1247,7 @@ type internal FsiDynamicCompiler let tcState = istate.tcState let tcEnv,(_dllinfos,ccuinfos) = try - RequireDLL (ctok, tcImports, tcState.TcEnvFromImpls, assemblyName, m, path) + RequireDLL (ctok, tcImports, tcState.TcEnvFromImpls, assemblyName, m, path, assemblyReferenceAddedEvent.Trigger) with e -> tcConfigB.RemoveReferencedAssemblyByPath(m,path) reraise() @@ -1334,6 +1336,8 @@ type internal FsiDynamicCompiler member __.FormatValue(obj:obj, objTy) = valuePrinter.FormatValue(obj, objTy) + member __.AssemblyReferenceAdded = assemblyReferenceAddedEvent.Publish + //---------------------------------------------------------------------------- // ctrl-c handling //---------------------------------------------------------------------------- @@ -2640,6 +2644,9 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i fsiInteractionProcessor.EvalScript(ctok, scriptPath, errorLogger) |> commitResultNonThrowing errorOptions scriptPath errorLogger |> function Choice1Of2 (_), errs -> Choice1Of2 (), errs | Choice2Of2 exn, errs -> Choice2Of2 exn, errs + + /// Event fires every time an assembly reference is added to the execution environment, e.g., via `#r`. + member __.AssemblyReferenceAdded = fsiDynamicCompiler.AssemblyReferenceAdded /// Performs these steps: /// - Load the dummy interaction, if any diff --git a/src/fsharp/fsi/fsi.fsi b/src/fsharp/fsi/fsi.fsi index 918afe85f9..2897e36484 100644 --- a/src/fsharp/fsi/fsi.fsi +++ b/src/fsharp/fsi/fsi.fsi @@ -227,6 +227,9 @@ type FsiEvaluationSession = /// A host calls this to report an unhandled exception in a standard way, e.g. an exception on the GUI thread gets printed to stderr member ReportUnhandledException : exn: exn -> unit + /// Event fires every time an assembly reference is added to the execution environment, e.g., via `#r`. + member AssemblyReferenceAdded : IEvent + /// Load the dummy interaction, load the initial files, and, /// if interacting, start the background thread to read the standard input. /// From b18cb9da151dc2a6eab7ada202c8cc50880a7a9f Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Mon, 16 Sep 2019 18:29:56 -0700 Subject: [PATCH 272/286] update insert task to v3 (#7574) --- eng/release/insert-into-vs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/release/insert-into-vs.yml b/eng/release/insert-into-vs.yml index d78e5d9a22..89650f190d 100644 --- a/eng/release/insert-into-vs.yml +++ b/eng/release/insert-into-vs.yml @@ -47,7 +47,7 @@ stages: inputs: filePath: $(Build.SourcesDirectory)/eng/release/scripts/GetAssemblyVersions.ps1 arguments: -assemblyVersionsPath $(Build.ArtifactStagingDirectory)\VSSetup\DevDivPackages\DependentAssemblyVersions.csv - - task: ms-vseng.MicroBuildShipTasks.55100717-a81d-45ea-a363-b8fe3ec375ad.MicroBuildInsertVsPayload@2 + - task: ms-vseng.MicroBuildShipTasks.55100717-a81d-45ea-a363-b8fe3ec375ad.MicroBuildInsertVsPayload@3 displayName: 'Insert VS Payload' inputs: LinkWorkItemsToPR: false From b7c486c525df135237cac9523972334a9df081e9 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Wed, 18 Sep 2019 14:47:52 -0700 Subject: [PATCH 273/286] Remove the requirement for explicit FSharp.Core reference need --noframework (#7572) * Remove the requirement that an explicit FSharp.Core reference requires --noframework * fsharpqa --- src/fsharp/CompileOps.fs | 43 ++++++++-------------------------------- src/fsharp/FSComp.txt | 2 +- 2 files changed, 9 insertions(+), 36 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 379c8fcac2..0f39af500b 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2580,24 +2580,21 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = errorR(Error(FSComp.SR.buildMultipleReferencesNotAllowed libraryName, rangeCmdArgs)) nameOfDll r - // Look for an explicit reference to mscorlib and use that to compute clrRoot and targetFrameworkVersion + // Look for an explicit reference to mscorlib/netstandard.dll or System.Runtime.dll and use that to compute clrRoot and targetFrameworkVersion let primaryAssemblyReference, primaryAssemblyExplicitFilenameOpt = computeKnownDllReference(data.primaryAssembly.Name) - let fslibReference, fslibExplicitFilenameOpt = - let (_, fileNameOpt) as res = computeKnownDllReference getFSharpCoreLibraryName + let fslibReference = + // Look for explict FSharp.Core reference otherwise use version that was referenced by compiler + let dllReference, fileNameOpt = computeKnownDllReference getFSharpCoreLibraryName match fileNameOpt with - | None -> - // if FSharp.Core was not provided explicitly - use version that was referenced by compiler - AssemblyReference(range0, getDefaultFSharpCoreReference, None), None - | _ -> res + | Some _ -> dllReference + | None -> AssemblyReference(range0, getDefaultFSharpCoreReference, None) // If either mscorlib.dll/System.Runtime.dll/netstandard.dll or FSharp.Core.dll are explicitly specified then we require the --noframework flag. // The reason is that some non-default frameworks may not have the default dlls. For example, Client profile does // not have System.Web.dll. - do if ((primaryAssemblyExplicitFilenameOpt.IsSome || fslibExplicitFilenameOpt.IsSome) && data.framework) then + do if (primaryAssemblyExplicitFilenameOpt.IsSome && data.framework) then error(Error(FSComp.SR.buildExplicitCoreLibRequiresNoFramework("--noframework"), rangeStartup)) - let ilGlobals = mkILGlobals ILScopeRef.Local - // clrRoot: the location of the primary assembly (mscorlib.dll or netstandard.dll or System.Runtime.dll) // // targetFrameworkVersionValue: Normally just HighestInstalledNetFrameworkVersion() @@ -2627,37 +2624,13 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = let systemAssemblies = systemAssemblies - // Look for an explicit reference to FSharp.Core and use that to compute fsharpBinariesDir - // FUTURE: remove this, we only read the binary for the exception it raises - let fsharpBinariesDirValue = -// NOTE: It's not clear why this behaviour has been changed for the NETSTANDARD compilations of the F# compiler -#if NETSTANDARD - ignore ilGlobals - data.defaultFSharpBinariesDir -#else - match fslibExplicitFilenameOpt with - | Some fslibFilename -> - let filename = ComputeMakePathAbsolute data.implicitIncludeDir fslibFilename - if fslibReference.ProjectReference.IsNone then - try - use ilReader = OpenILBinary(filename, data.reduceMemoryUsage, ilGlobals, None, data.shadowCopyReferences, data.tryGetMetadataSnapshot) - () - with e -> - error(Error(FSComp.SR.buildErrorOpeningBinaryFile(filename, e.Message), rangeStartup)) - - let fslibRoot = Path.GetDirectoryName(FileSystem.GetFullPathShim filename) - fslibRoot - | _ -> - data.defaultFSharpBinariesDir -#endif - member x.primaryAssembly = data.primaryAssembly member x.autoResolveOpenDirectivesToDlls = data.autoResolveOpenDirectivesToDlls member x.noFeedback = data.noFeedback member x.stackReserveSize = data.stackReserveSize member x.implicitIncludeDir = data.implicitIncludeDir member x.openDebugInformationForLaterStaticLinking = data.openDebugInformationForLaterStaticLinking - member x.fsharpBinariesDir = fsharpBinariesDirValue + member x.fsharpBinariesDir = data.defaultFSharpBinariesDir member x.compilingFslib = data.compilingFslib member x.useIncrementalBuilder = data.useIncrementalBuilder member x.includes = data.includes diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 12b93344bc..65cdd47d5b 100755 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1085,7 +1085,7 @@ lexIndentOffForML,"Consider using a file with extension '.ml' or '.mli' instead" 1219,tcUnionCaseNameConflictsWithGeneratedType,"The union case named '%s' conflicts with the generated type '%s'" 1220,chkNoReflectedDefinitionOnStructMember,"ReflectedDefinitionAttribute may not be applied to an instance member on a struct type, because the instance member takes an implicit 'this' byref parameter" 1221,tcDllImportNotAllowed,"DLLImport bindings must be static members in a class or function definitions in a module" -1222,buildExplicitCoreLibRequiresNoFramework,"When mscorlib.dll or FSharp.Core.dll is explicitly referenced the %s option must also be passed" +1222,buildExplicitCoreLibRequiresNoFramework,"When mscorlib.dll is explicitly referenced the %s option must also be passed" 1223,buildExpectedSigdataFile,"FSharp.Core.sigdata not found alongside FSharp.Core. File expected in %s. Consider upgrading to a more recent version of FSharp.Core, where this file is no longer be required." 1225,buildExpectedFileAlongSideFSharpCore,"File '%s' not found alongside FSharp.Core. File expected in %s. Consider upgrading to a more recent version of FSharp.Core, where this file is no longer be required." 1227,buildUnexpectedFileNameCharacter,"Filename '%s' contains invalid character '%s'" From d6b5b1b5109d9ad9a9077df6814ef358817071a2 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Thu, 19 Sep 2019 15:00:42 -0700 Subject: [PATCH 274/286] Re-enable magic-resolver in fsi for coreclr (#7598) --- src/fsharp/fsi/fsi.fs | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index 974fc15e79..bce19588be 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -1498,22 +1498,14 @@ module internal MagicAssemblyResolution = let Install(tcConfigB, tcImports: TcImports, fsiDynamicCompiler: FsiDynamicCompiler, fsiConsoleOutput: FsiConsoleOutput) = -#if NETSTANDARD - ignore tcConfigB - ignore tcImports - ignore fsiDynamicCompiler - ignore fsiConsoleOutput - { new System.IDisposable with - member x.Dispose() = () } -#else let ResolveAssembly (ctok, m, tcConfigB, tcImports: TcImports, fsiDynamicCompiler: FsiDynamicCompiler, fsiConsoleOutput: FsiConsoleOutput, fullAssemName:string) = try // Grab the name of the assembly let tcConfig = TcConfig.Create(tcConfigB,validate=false) - let simpleAssemName = fullAssemName.Split([| ',' |]).[0] + let simpleAssemName = fullAssemName.Split([| ',' |]).[0] if !progress then fsiConsoleOutput.uprintfn "ATTEMPT MAGIC LOAD ON ASSEMBLY, simpleAssemName = %s" simpleAssemName // "Attempting to load a dynamically required assembly in response to an AssemblyResolve event by using known static assembly references..." - + // Special case: Mono Windows Forms attempts to load an assembly called something like "Windows.Forms.resources" // We can't resolve this, so don't try. // REVIEW: Suggest 4481, delete this special case. @@ -1529,7 +1521,7 @@ module internal MagicAssemblyResolution = // Otherwise continue let assemblyReferenceTextDll = (simpleAssemName + ".dll") let assemblyReferenceTextExe = (simpleAssemName + ".exe") - let overallSearchResult = + let overallSearchResult = // OK, try to resolve as an existing DLL in the resolved reference set. This does unification by assembly name // once an assembly has been referenced. @@ -1573,15 +1565,15 @@ module internal MagicAssemblyResolution = | Some(assembly) -> OkResult([],Choice2Of2 assembly) | None -> #endif - + // As a last resort, try to find the reference without an extension match tcImports.TryFindExistingFullyQualifiedPathByExactAssemblyRef(ctok, ILAssemblyRef.Create(simpleAssemName,None,None,false,None,None)) with | Some(resolvedPath) -> OkResult([],Choice1Of2 resolvedPath) | None -> - + ErrorResult([],Failure (FSIstrings.SR.fsiFailedToResolveAssembly(simpleAssemName))) - + match overallSearchResult with | ErrorResult _ -> null | OkResult _ -> @@ -1592,8 +1584,8 @@ module internal MagicAssemblyResolution = assemblyLoadFrom assemblyName | Choice2Of2 assembly -> assembly - - with e -> + + with e -> stopProcessingRecovery e range0 null @@ -1604,12 +1596,11 @@ module internal MagicAssemblyResolution = // during compilation. So we recover the CompilationThreadToken here. let ctok = AssumeCompilationThreadWithoutEvidence () ResolveAssembly (ctok, rangeStdin, tcConfigB, tcImports, fsiDynamicCompiler, fsiConsoleOutput, args.Name)) - + AppDomain.CurrentDomain.add_AssemblyResolve(handler) { new System.IDisposable with member x.Dispose() = AppDomain.CurrentDomain.remove_AssemblyResolve(handler) } -#endif //---------------------------------------------------------------------------- // Reading stdin From 62e5dd841fa66e7d0d4bd2dd8f381480810a8aa1 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Tue, 24 Sep 2019 12:15:04 -0700 Subject: [PATCH 275/286] relax multiple load objection (#7613) --- src/fsharp/CompileOps.fs | 12 ++++-------- src/fsharp/FSComp.txt | 1 - 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 624a27f92d..e2cbf4474f 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2572,17 +2572,13 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = let filename = ComputeMakePathAbsolute data.implicitIncludeDir r.Text if FileSystem.SafeExists filename then r, Some filename - else + else // If the file doesn't exist, let reference resolution logic report the error later... defaultCoreLibraryReference, if Range.equals r.Range rangeStartup then Some(filename) else None match data.referencedDLLs |> List.filter (fun assemblyReference -> assemblyReference.SimpleAssemblyNameIs libraryName) with - | [r] -> nameOfDll r - | [] -> - defaultCoreLibraryReference, None - | r :: _ -> - // Recover by picking the first one. - errorR(Error(FSComp.SR.buildMultipleReferencesNotAllowed libraryName, rangeCmdArgs)) - nameOfDll r + | [] -> defaultCoreLibraryReference, None + | [r] + | r :: _ -> nameOfDll r // Look for an explicit reference to mscorlib/netstandard.dll or System.Runtime.dll and use that to compute clrRoot and targetFrameworkVersion let primaryAssemblyReference, primaryAssemblyExplicitFilenameOpt = computeKnownDllReference(data.primaryAssembly.Name) diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 096da0a7cc..703a8cd3a1 100755 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -43,7 +43,6 @@ buildProductNameCommunity,"F# Compiler for F# %s" 212,buildInvalidFilename,"'%s' is not a valid filename" 213,buildInvalidAssemblyName,"'%s' is not a valid assembly name" 214,buildInvalidPrivacy,"Unrecognized privacy setting '%s' for managed resource, valid options are 'public' and 'private'" -215,buildMultipleReferencesNotAllowed,"Multiple references to '%s.dll' are not permitted" 218,buildCannotReadAssembly,"Unable to read assembly '%s'" 220,buildAssemblyResolutionFailed,"Assembly resolution failure at or near this location" 221,buildImplicitModuleIsNotLegalIdentifier,"The declarations in this file will be placed in an implicit module '%s' based on the file name '%s'. However this is not a valid F# identifier, so the contents will not be accessible from other files. Consider renaming the file or adding a 'module' or 'namespace' declaration at the top of the file." From 495dc778831e0c9cec0b1c6d2e4982d3379be628 Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Tue, 24 Sep 2019 12:20:18 -0700 Subject: [PATCH 276/286] Relax --noframework for mscorlib, netstandard and system.runtime (#7612) * Eliminate Relax requirement to apply --noframework when referencing mscorlib/system.runtime.dll/netstandard.dll * Relax requirement to pass --noframework with System.Runtime, netstandard and mscorlib.dll --- src/fsharp/CompileOps.fs | 6 ------ src/fsharp/DotNetFrameworkDependencies.fs | 1 - src/fsharp/FSComp.txt | 1 - 3 files changed, 8 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index e2cbf4474f..239015820a 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2589,12 +2589,6 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) = | Some _ -> dllReference | None -> AssemblyReference(range0, getDefaultFSharpCoreReference, None) - // If either mscorlib.dll/System.Runtime.dll/netstandard.dll or FSharp.Core.dll are explicitly specified then we require the --noframework flag. - // The reason is that some non-default frameworks may not have the default dlls. For example, Client profile does - // not have System.Web.dll. - do if (primaryAssemblyExplicitFilenameOpt.IsSome && data.framework) then - error(Error(FSComp.SR.buildExplicitCoreLibRequiresNoFramework("--noframework"), rangeStartup)) - // clrRoot: the location of the primary assembly (mscorlib.dll or netstandard.dll or System.Runtime.dll) // // targetFrameworkVersionValue: Normally just HighestInstalledNetFrameworkVersion() diff --git a/src/fsharp/DotNetFrameworkDependencies.fs b/src/fsharp/DotNetFrameworkDependencies.fs index 3d8e33082c..2e96dcd367 100644 --- a/src/fsharp/DotNetFrameworkDependencies.fs +++ b/src/fsharp/DotNetFrameworkDependencies.fs @@ -182,7 +182,6 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies // (a) included in the environment used for all .fsx files (see service.fs) // (b) included in environment for files 'orphaned' from a project context // -- for orphaned files (files in VS without a project context) - // -- for files given on a command line without --noframework set let getDesktopDefaultReferences useFsiAuxLib = [ yield "mscorlib" yield "System" diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 703a8cd3a1..c1ab22ab6a 100755 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -1086,7 +1086,6 @@ lexIndentOffForML,"Consider using a file with extension '.ml' or '.mli' instead" 1219,tcUnionCaseNameConflictsWithGeneratedType,"The union case named '%s' conflicts with the generated type '%s'" 1220,chkNoReflectedDefinitionOnStructMember,"ReflectedDefinitionAttribute may not be applied to an instance member on a struct type, because the instance member takes an implicit 'this' byref parameter" 1221,tcDllImportNotAllowed,"DLLImport bindings must be static members in a class or function definitions in a module" -1222,buildExplicitCoreLibRequiresNoFramework,"When mscorlib.dll is explicitly referenced the %s option must also be passed" 1223,buildExpectedSigdataFile,"FSharp.Core.sigdata not found alongside FSharp.Core. File expected in %s. Consider upgrading to a more recent version of FSharp.Core, where this file is no longer be required." 1225,buildExpectedFileAlongSideFSharpCore,"File '%s' not found alongside FSharp.Core. File expected in %s. Consider upgrading to a more recent version of FSharp.Core, where this file is no longer be required." 1227,buildUnexpectedFileNameCharacter,"Filename '%s' contains invalid character '%s'" From bb9d4b9c54f6278557c2445918ed87f561f32810 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Thu, 26 Sep 2019 13:24:21 -0700 Subject: [PATCH 277/286] add build telemetry for Linux/MacOS builds --- eng/build.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/eng/build.sh b/eng/build.sh index cda4795f87..81363af5db 100755 --- a/eng/build.sh +++ b/eng/build.sh @@ -178,7 +178,7 @@ function TestUsingNUnit() { args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"nunit;LogFilePath=$testlogpath\"" "$DOTNET_INSTALL_DIR/dotnet" $args || { local exit_code=$? - echo "dotnet test failed (exit code '$exit_code')." >&2 + Write-PipelineTelemetryError -category 'Test' "dotnet test failed for $testproject:$targetframework (exit code $exit_code)." ExitWithExitCode $exit_code } } @@ -228,7 +228,11 @@ function BuildSolution { MSBuild "$repo_root/src/buildtools/buildtools.proj" \ /restore \ /p:Configuration=$bootstrap_config \ - /t:Publish + /t:Publish || { + local exit_code=$? + Write-PipelineTelemetryError -category 'Build' "Error building buildtools (exit code '$exit_code')." + ExitWithExitCode $exit_code + } mkdir -p "$bootstrap_dir" cp -pr $artifacts_dir/bin/fslex/$bootstrap_config/netcoreapp2.1/publish $bootstrap_dir/fslex @@ -238,7 +242,11 @@ function BuildSolution { MSBuild "$repo_root/proto.proj" \ /restore \ /p:Configuration=$bootstrap_config \ - /t:Publish + /t:Publish || { + local exit_code=$? + Write-PipelineTelemetryError -category 'Build' "Error building bootstrap compiler (exit code '$exit_code')." + ExitWithExitCode $exit_code + } cp -pr $artifacts_dir/bin/fsc/$bootstrap_config/netcoreapp2.1/publish $bootstrap_dir/fsc fi @@ -259,7 +267,11 @@ function BuildSolution { /p:ContinuousIntegrationBuild=$ci \ /p:QuietRestore=$quiet_restore \ /p:QuietRestoreBinaryLog="$binary_log" \ - $properties + $properties || { + local exit_code=$? + Write-PipelineTelemetryError -category 'Build' "Error building solution (exit code '$exit_code')." + ExitWithExitCode $exit_code + } } InitializeDotNetCli $restore From 04d4c51f8c7c8375ae12ccb8ccdc509e2911513d Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Fri, 27 Sep 2019 09:35:22 -0700 Subject: [PATCH 278/286] add workspace and diagnostics to lsp (#7006) --- ...rp.Compiler.LanguageServer.DesignTime.proj | 49 +++++ ...Compiler.LanguageServer.DesignTime.targets | 52 +++++ .../FSharp.Compiler.LanguageServer.fsproj | 9 + .../LspExternalAccess.fs | 12 +- .../LspTypes.fs | 9 +- .../FSharp.Compiler.LanguageServer/Methods.fs | 13 +- .../FSharp.Compiler.LanguageServer/Server.fs | 8 +- .../FSharp.Compiler.LanguageServer/State.fs | 207 ++++++++++++++++++ .../TextDocument.fs | 59 ++++- 9 files changed, 397 insertions(+), 21 deletions(-) create mode 100644 src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.DesignTime.proj create mode 100644 src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.DesignTime.targets diff --git a/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.DesignTime.proj b/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.DesignTime.proj new file mode 100644 index 0000000000..d02ae419bc --- /dev/null +++ b/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.DesignTime.proj @@ -0,0 +1,49 @@ + + + + + + + $(MSBuildThisFileDirectory)FSharp.Compiler.LanguageServer.DesignTime.targets + + + + + + + + + + + + + + diff --git a/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.DesignTime.targets b/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.DesignTime.targets new file mode 100644 index 0000000000..ea8f3e2866 --- /dev/null +++ b/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.DesignTime.targets @@ -0,0 +1,52 @@ + + + + + true + false + true + true + false + false + false + true + false + true + false + + + + + + + _ComputeTargetFrameworkItems + _PopulateTargetFrameworks + + + + + <_TargetFramework Include="$(TargetFramework)" /> + + + + + + + + + + + + + + diff --git a/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.fsproj b/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.fsproj index fd6e517e54..0bb0899140 100644 --- a/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.fsproj +++ b/src/fsharp/FSharp.Compiler.LanguageServer/FSharp.Compiler.LanguageServer.fsproj @@ -23,6 +23,15 @@ + + + + + + + + + diff --git a/src/fsharp/FSharp.Compiler.LanguageServer/LspExternalAccess.fs b/src/fsharp/FSharp.Compiler.LanguageServer/LspExternalAccess.fs index e6fa760d1c..48e4b0b405 100644 --- a/src/fsharp/FSharp.Compiler.LanguageServer/LspExternalAccess.fs +++ b/src/fsharp/FSharp.Compiler.LanguageServer/LspExternalAccess.fs @@ -9,10 +9,18 @@ module FunctionNames = [] let OptionsSet = "options/set" + [] + let TextDocumentPublishDiagnostics = "textDocument/publishDiagnostics" + type Options = - { usePreviewTextHover: bool } + { usePreviewTextHover: bool + usePreviewDiagnostics: bool } static member Default() = - { usePreviewTextHover = false } + { usePreviewTextHover = false + usePreviewDiagnostics = false } + static member AllOn() = + { usePreviewTextHover = true + usePreviewDiagnostics = true } module Extensions = type JsonRpc with diff --git a/src/fsharp/FSharp.Compiler.LanguageServer/LspTypes.fs b/src/fsharp/FSharp.Compiler.LanguageServer/LspTypes.fs index 97479eef26..264e526fcd 100644 --- a/src/fsharp/FSharp.Compiler.LanguageServer/LspTypes.fs +++ b/src/fsharp/FSharp.Compiler.LanguageServer/LspTypes.fs @@ -5,8 +5,9 @@ namespace FSharp.Compiler.LanguageServer open Newtonsoft.Json.Linq open Newtonsoft.Json -// Interfaces as defined at https://microsoft.github.io/language-server-protocol/specification. The properties on -// these types are camlCased to match the underlying JSON properties to avoid attributes on every field: +// Interfaces as defined at https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/. +// The properties on these types are camlCased to match the underlying JSON properties to avoid attributes on every +// field: // [] /// Represents a zero-based line and column of a text document. @@ -32,7 +33,7 @@ type Diagnostic = { range: Range severity: int option code: string - source: string option // "F#" + source: string option message: string relatedInformation: DiagnosticRelatedInformation[] option } static member Error = 1 @@ -46,7 +47,7 @@ type PublishDiagnosticsParams = type ClientCapabilities = { workspace: JToken option // TODO: WorkspaceClientCapabilities - textDocument: JToken option // TODO: TextDocumentCapabilities + textDocument: JToken option // TODO: TextDocumentClientCapabilities, publishDiagnostics: { relatedInformation: bool option } experimental: JToken option supportsVisualStudioExtensions: bool option } diff --git a/src/fsharp/FSharp.Compiler.LanguageServer/Methods.fs b/src/fsharp/FSharp.Compiler.LanguageServer/Methods.fs index d1e614cb29..453b7f8228 100644 --- a/src/fsharp/FSharp.Compiler.LanguageServer/Methods.fs +++ b/src/fsharp/FSharp.Compiler.LanguageServer/Methods.fs @@ -8,8 +8,10 @@ open System.Threading open Newtonsoft.Json.Linq open StreamJsonRpc -// https://microsoft.github.io/language-server-protocol/specification -type Methods(state: State) = +// https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/ +type Methods() = + + let state = State() /// Helper to run Async<'T> with a CancellationToken. let runAsync (cancellationToken: CancellationToken) (computation: Async<'T>) = Async.StartAsTask(computation, cancellationToken=cancellationToken) @@ -29,8 +31,10 @@ type Methods(state: State) = [] initializationOptions: JToken, capabilities: ClientCapabilities, [] trace: string, - [] workspaceFolders: WorkspaceFolder[] + [] workspaceFolders: WorkspaceFolder[], + [] cancellationToken: CancellationToken ) = + state.Initialize rootPath rootUri (fun projectOptions -> TextDocument.PublishDiagnostics(state, projectOptions) |> Async.Start) { InitializeResult.capabilities = ServerCapabilities.DefaultCapabilities() } [] @@ -63,5 +67,6 @@ type Methods(state: State) = ( options: Options ) = - sprintf "got options %A" options |> Console.Error.WriteLine + eprintfn "got options %A" options state.Options <- options + state.InvalidateAllProjects() diff --git a/src/fsharp/FSharp.Compiler.LanguageServer/Server.fs b/src/fsharp/FSharp.Compiler.LanguageServer/Server.fs index 071ad6b226..28d5e49a58 100644 --- a/src/fsharp/FSharp.Compiler.LanguageServer/Server.fs +++ b/src/fsharp/FSharp.Compiler.LanguageServer/Server.fs @@ -12,17 +12,17 @@ type Server(sendingStream: Stream, receivingStream: Stream) = let converter = JsonOptionConverter() // special handler to convert between `Option<'T>` and `obj/null`. do formatter.JsonSerializer.Converters.Add(converter) let handler = new HeaderDelimitedMessageHandler(sendingStream, receivingStream, formatter) - let state = State() - let methods = Methods(state) + let methods = Methods() let rpc = new JsonRpc(handler, methods) + do methods.State.JsonRpc <- Some rpc member __.StartListening() = rpc.StartListening() member __.WaitForExitAsync() = async { - do! Async.AwaitEvent (state.Shutdown) - do! Async.AwaitEvent (state.Exit) + do! Async.AwaitEvent (methods.State.Shutdown) + do! Async.AwaitEvent (methods.State.Exit) } interface IDisposable with diff --git a/src/fsharp/FSharp.Compiler.LanguageServer/State.fs b/src/fsharp/FSharp.Compiler.LanguageServer/State.fs index 5ca2d3f845..0812bb9a7f 100644 --- a/src/fsharp/FSharp.Compiler.LanguageServer/State.fs +++ b/src/fsharp/FSharp.Compiler.LanguageServer/State.fs @@ -2,11 +2,209 @@ namespace FSharp.Compiler.LanguageServer +open System +open System.Collections.Concurrent +open System.Collections.Generic +open System.Diagnostics +open System.IO +open System.Text.RegularExpressions +open FSharp.Compiler.SourceCodeServices +open StreamJsonRpc + +module internal Solution = + // easy unit testing + let getProjectPaths (solutionContent: string) (solutionDir: string) = + // This looks scary, but is much more lightweight than carrying along MSBuild just to have it parse the solution file. + // + // A valid line in .sln looks like: + // Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "ConsoleApp2", "ConsoleApp2\ConsoleApp2.fsproj", "{60A4BE67-7E03-4200-AD38-B0E5E8E049C1}" + // and we're hoping to extract this: ------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + // + // therefore: + // ^Project text 'Project' at the start of the line + // .* any number of characters + // \"" double quote character (it's doubled up to escape from the raw string literal here) + // ( start of capture group + // [^\""] not a quote + // * many of those + // \.fsproj literal string ".fsproj" + // ) end of capture group + // \"" double quote + let pattern = Regex(@"^Project.*\""([^\""]*\.fsproj)\""") + let lines = solutionContent.Split('\n') + let relativeProjects = + lines + |> Array.map pattern.Match + |> Array.filter (fun m -> m.Success) + |> Array.map (fun m -> m.Groups.[1].Value) + // .sln files by convention uses backslashes, which might not be appropriate at runtime + |> Array.map (fun p -> p.Replace('\\', Path.DirectorySeparatorChar)) + let projects = + relativeProjects + |> Array.map (fun p -> if Path.IsPathRooted(p) then p else Path.Combine(solutionDir, p)) + projects + type State() = + let checker = FSharpChecker.Create() + + let sourceFileToProjectMap = ConcurrentDictionary() + let shutdownEvent = new Event<_>() let exitEvent = new Event<_>() let cancelEvent = new Event<_>() + let projectInvalidatedEvent = new Event<_>() + + let fileChanged (args: FileSystemEventArgs) = + match sourceFileToProjectMap.TryGetValue args.FullPath with + | true, projectOptions -> projectInvalidatedEvent.Trigger(projectOptions) + | false, _ -> () + let fileRenamed (args: RenamedEventArgs) = + match sourceFileToProjectMap.TryGetValue args.FullPath with + | true, projectOptions -> projectInvalidatedEvent.Trigger(projectOptions) + | false, _ -> () + let fileWatcher = new FileSystemWatcher() + do fileWatcher.IncludeSubdirectories <- true + do fileWatcher.Changed.Add(fileChanged) + do fileWatcher.Created.Add(fileChanged) + do fileWatcher.Deleted.Add(fileChanged) + do fileWatcher.Renamed.Add(fileRenamed) + + let execProcess (name: string) (args: string) = + let startInfo = ProcessStartInfo(name, args) + eprintfn "executing: %s %s" name args + startInfo.CreateNoWindow <- true + startInfo.RedirectStandardOutput <- true + startInfo.UseShellExecute <- false + let lines = List() + use proc = new Process() + proc.StartInfo <- startInfo + proc.OutputDataReceived.Add(fun args -> lines.Add(args.Data)) + proc.Start() |> ignore + proc.BeginOutputReadLine() + proc.WaitForExit() + lines.ToArray() + + let linesWithPrefixClean (prefix: string) (lines: string[]) = + lines + |> Array.filter (isNull >> not) + |> Array.map (fun line -> line.TrimStart(' ')) + |> Array.filter (fun line -> line.StartsWith(prefix)) + |> Array.map (fun line -> line.Substring(prefix.Length)) + + let getProjectOptions (rootDir: string) = + if isNull rootDir then [||] + else + fileWatcher.Path <- rootDir + fileWatcher.EnableRaisingEvents <- true + + /// This function is meant to be temporary. Until we figure out what a language server for a project + /// system looks like, we have to guess based on the files we find in the root. + let getProjectOptions (projectPath: string) = + let projectDir = Path.GetDirectoryName(projectPath) + let normalizePath (path: string) = + if Path.IsPathRooted(path) then path + else Path.Combine(projectDir, path) + + // To avoid essentially re-creating a copy of MSBuild alongside this tool, we instead fake a design- + // time build with this project. The output of building this helper project is text that's easily + // parsable. See the helper project for more information. + let reporterProject = Path.Combine(Path.GetDirectoryName(typeof.Assembly.Location), "FSharp.Compiler.LanguageServer.DesignTime.proj") + let detectedTfmSentinel = "DetectedTargetFramework=" + let detectedCommandLineArgSentinel = "DetectedCommandLineArg=" + + let execTfmReporter = + sprintf "build \"%s\" \"/p:ProjectFile=%s\"" reporterProject projectPath + |> execProcess "dotnet" + + let execArgReporter (tfm: string) = + sprintf "build \"%s\" \"/p:ProjectFile=%s\" \"/p:TargetFramework=%s\"" reporterProject projectPath tfm + |> execProcess "dotnet" + + // find the target frameworks + let targetFrameworks = + execTfmReporter + |> linesWithPrefixClean detectedTfmSentinel + + let getArgs (tfm: string) = + execArgReporter tfm + |> linesWithPrefixClean detectedCommandLineArgSentinel + + let tfmAndArgs = + targetFrameworks + |> Array.map (fun tfm -> tfm, getArgs tfm) + + let separateArgs (args: string[]) = + args + |> Array.partition (fun a -> a.StartsWith("-")) + |> (fun (options, files) -> + let normalizedFiles = files |> Array.map normalizePath + options, normalizedFiles) + + // TODO: for now we're only concerned with the first TFM + let _tfm, args = Array.head tfmAndArgs + + let otherOptions, sourceFiles = separateArgs args + + let projectOptions: FSharpProjectOptions = + { ProjectFileName = projectPath + ProjectId = None + SourceFiles = sourceFiles + OtherOptions = otherOptions + ReferencedProjects = [||] // TODO: populate from @(ProjectReference) + IsIncompleteTypeCheckEnvironment = false + UseScriptResolutionRules = false + LoadTime = DateTime.Now + UnresolvedReferences = None + OriginalLoadReferences = [] + ExtraProjectInfo = None + Stamp = None } + projectOptions + let topLevelProjects = Directory.GetFiles(rootDir, "*.fsproj") + let watchableProjectPaths = + match topLevelProjects with + | [||] -> + match Directory.GetFiles(rootDir, "*.sln") with + // TODO: what to do with multiple .sln or a combo of .sln/.fsproj? + | [| singleSolution |] -> + let content = File.ReadAllText(singleSolution) + let solutionDir = Path.GetDirectoryName(singleSolution) + Solution.getProjectPaths content solutionDir + | _ -> [||] + | _ -> topLevelProjects + let watchableProjectOptions = + watchableProjectPaths + |> Array.map getProjectOptions + + // associate source files with project options + let watchFile file projectOptions = + sourceFileToProjectMap.AddOrUpdate(file, projectOptions, fun _ _ -> projectOptions) + + for projectOptions in watchableProjectOptions do + // watch .fsproj + watchFile projectOptions.ProjectFileName projectOptions |> ignore + // TODO: watch .deps.json + for sourceFile in projectOptions.SourceFiles do + let sourceFileFullPath = + if Path.IsPathRooted(sourceFile) then sourceFile + else + let projectDir = Path.GetDirectoryName(projectOptions.ProjectFileName) + Path.Combine(projectDir, sourceFile) + watchFile sourceFileFullPath projectOptions |> ignore + + watchableProjectOptions + + member __.Checker = checker + + /// Initialize the LSP at the specified location. According to the spec, `rootUri` is to be preferred over `rootPath`. + member __.Initialize (rootPath: string) (rootUri: DocumentUri) (computeDiagnostics: FSharpProjectOptions -> unit) = + let rootDir = + if not (isNull rootUri) then Uri(rootUri).LocalPath + else rootPath + let projectOptions = getProjectOptions rootDir + projectInvalidatedEvent.Publish.Add computeDiagnostics // compute diagnostics on project invalidation + for projectOption in projectOptions do + computeDiagnostics projectOption // compute initial set of diagnostics [] member __.Shutdown = shutdownEvent.Publish @@ -17,10 +215,19 @@ type State() = [] member __.Cancel = cancelEvent.Publish + [] + member __.ProjectInvalidated = projectInvalidatedEvent.Publish + member __.DoShutdown() = shutdownEvent.Trigger() member __.DoExit() = exitEvent.Trigger() member __.DoCancel() = cancelEvent.Trigger() + member __.InvalidateAllProjects() = + for projectOptions in sourceFileToProjectMap.Values do + projectInvalidatedEvent.Trigger(projectOptions) + member val Options = Options.Default() with get, set + + member val JsonRpc: JsonRpc option = None with get, set diff --git a/src/fsharp/FSharp.Compiler.LanguageServer/TextDocument.fs b/src/fsharp/FSharp.Compiler.LanguageServer/TextDocument.fs index 0c73796505..489b55ebce 100644 --- a/src/fsharp/FSharp.Compiler.LanguageServer/TextDocument.fs +++ b/src/fsharp/FSharp.Compiler.LanguageServer/TextDocument.fs @@ -2,13 +2,15 @@ namespace FSharp.Compiler.LanguageServer -open System +open System.Threading module TextDocument = + let mutable publishDiagnosticsCancellationTokenSource = new CancellationTokenSource() + let Hover (state: State) (textDocument: TextDocumentIdentifier) (position: Position) = async { - Console.Error.WriteLine("hover at " + position.line.ToString() + "," + position.character.ToString()) + eprintfn "hover at %d, %d" position.line position.character if not state.Options.usePreviewTextHover then return None else let startCol, endCol = @@ -21,10 +23,53 @@ module TextDocument = } } - let PublishDiagnostics(state: State) = + let PublishDiagnostics(state: State, projectOptions: FSharp.Compiler.SourceCodeServices.FSharpProjectOptions) = + // TODO: honor TextDocumentClientCapabilities.publishDiagnostics.relatedInformation + // cancel any existing request to publish diagnostics + publishDiagnosticsCancellationTokenSource.Cancel() + publishDiagnosticsCancellationTokenSource <- new CancellationTokenSource() async { - return { - PublishDiagnosticsParams.uri = "" - diagnostics = [||] - } + if not state.Options.usePreviewDiagnostics then return () + else + eprintfn "starting diagnostics computation" + match state.JsonRpc with + | None -> eprintfn "state.JsonRpc was null; should not be?" + | Some jsonRpc -> + let! results = state.Checker.ParseAndCheckProject projectOptions + let diagnostics = results.Errors + let diagnosticsPerFile = + diagnostics + |> Array.fold (fun state t -> + let existing = Map.tryFind t.FileName state |> Option.defaultValue [] + Map.add t.FileName (t :: existing) state) Map.empty + for sourceFile in projectOptions.SourceFiles do + let diagnostics = + Map.tryFind sourceFile diagnosticsPerFile + |> Option.defaultValue [] + |> List.map (fun d -> + // F# errors count lines starting at 1, but LSP starts at 0 + let range: Range = + { start = { line = d.StartLineAlternate - 1; character = d.StartColumn } + ``end`` = { line = d.EndLineAlternate - 1; character = d.EndColumn } } + let severity = + match d.Severity with + | FSharp.Compiler.SourceCodeServices.FSharpErrorSeverity.Warning -> Diagnostic.Warning + | FSharp.Compiler.SourceCodeServices.FSharpErrorSeverity.Error -> Diagnostic.Error + let res: Diagnostic = + { range = range + severity = Some severity + code = "FS" + d.ErrorNumber.ToString("0000") + source = Some d.FileName + message = d.Message + relatedInformation = None } + res) + |> List.toArray + let args: PublishDiagnosticsParams = + { uri = System.Uri(sourceFile).AbsoluteUri + diagnostics = diagnostics } + + // fire each notification separately + jsonRpc.NotifyAsync(TextDocumentPublishDiagnostics, args) |> Async.AwaitTask |> Async.Start } + |> (fun computation -> Async.StartAsTask(computation, cancellationToken=publishDiagnosticsCancellationTokenSource.Token)) + |> Async.AwaitTask From 9adbbe86a20c72cc62565999e57e0aca40d11c85 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Fri, 27 Sep 2019 21:40:37 +0300 Subject: [PATCH 279/286] Less subsequent filtering in completion (#7650) --- src/fsharp/service/FSharpCheckerResults.fs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fsharp/service/FSharpCheckerResults.fs b/src/fsharp/service/FSharpCheckerResults.fs index 6b493ca332..d17b56c085 100644 --- a/src/fsharp/service/FSharpCheckerResults.fs +++ b/src/fsharp/service/FSharpCheckerResults.fs @@ -717,8 +717,9 @@ type internal TypeCheckInfo | None | Some [] -> let globalItems = allSymbols() - |> List.filter (fun x -> not x.Symbol.IsExplicitlySuppressed) - |> List.filter (fun x -> + |> List.filter (fun x -> + not x.Symbol.IsExplicitlySuppressed && + match x.Symbol with | :? FSharpMemberOrFunctionOrValue as m when m.IsConstructor && filterCtors = ResolveTypeNamesToTypeRefs -> false | _ -> true) From c1d6fc8aca7ed522645cb934d134fc76e0bf7a72 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Fri, 27 Sep 2019 21:51:29 +0300 Subject: [PATCH 280/286] Make ILPreTypeDef interface (#7649) --- src/absil/il.fs | 45 +++++++++++++++++++++++++------------------- src/absil/il.fsi | 14 +++++++++----- src/fsharp/import.fs | 6 +++--- 3 files changed, 38 insertions(+), 27 deletions(-) diff --git a/src/absil/il.fs b/src/absil/il.fs index 4da728ac0b..75d30e6b79 100644 --- a/src/absil/il.fs +++ b/src/absil/il.fs @@ -2133,26 +2133,33 @@ and [] ILTypeDefs(f : unit -> ILPreTypeDef[]) = let ns, n = splitILTypeName nm dict.Value.[(ns, n)].GetTypeDef() + +and [] ILPreTypeDef = + abstract Namespace: string list + abstract Name: string + abstract GetTypeDef: unit -> ILTypeDef + + /// This is a memory-critical class. Very many of these objects get allocated and held to represent the contents of .NET assemblies. -and [] ILPreTypeDef(nameSpace: string list, name: string, metadataIndex: int32, storage: ILTypeDefStored) = +and [] ILPreTypeDefImpl(nameSpace: string list, name: string, metadataIndex: int32, storage: ILTypeDefStored) = let mutable store : ILTypeDef = Unchecked.defaultof<_> - member __.Namespace = nameSpace - member __.Name = name - member __.MetadataIndex = metadataIndex + interface ILPreTypeDef with + member __.Namespace = nameSpace + member __.Name = name - member x.GetTypeDef() = - match box store with - | null -> - match storage with - | ILTypeDefStored.Given td -> - store <- td - td - | ILTypeDefStored.Computed f -> - LazyInitializer.EnsureInitialized(&store, Func<_>(fun () -> f())) - | ILTypeDefStored.Reader f -> - LazyInitializer.EnsureInitialized(&store, Func<_>(fun () -> f x.MetadataIndex)) - | _ -> store + member x.GetTypeDef() = + match box store with + | null -> + match storage with + | ILTypeDefStored.Given td -> + store <- td + td + | ILTypeDefStored.Computed f -> + LazyInitializer.EnsureInitialized(&store, Func<_>(fun () -> f())) + | ILTypeDefStored.Reader f -> + LazyInitializer.EnsureInitialized(&store, Func<_>(fun () -> f metadataIndex)) + | _ -> store and ILTypeDefStored = | Given of ILTypeDef @@ -2491,11 +2498,11 @@ let mkRefForNestedILTypeDef scope (enc: ILTypeDef list, td: ILTypeDef) = let mkILPreTypeDef (td: ILTypeDef) = let ns, n = splitILTypeName td.Name - ILPreTypeDef (ns, n, NoMetadataIdx, ILTypeDefStored.Given td) + ILPreTypeDefImpl (ns, n, NoMetadataIdx, ILTypeDefStored.Given td) :> ILPreTypeDef let mkILPreTypeDefComputed (ns, n, f) = - ILPreTypeDef (ns, n, NoMetadataIdx, ILTypeDefStored.Computed f) + ILPreTypeDefImpl (ns, n, NoMetadataIdx, ILTypeDefStored.Computed f) :> ILPreTypeDef let mkILPreTypeDefRead (ns, n, idx, f) = - ILPreTypeDef (ns, n, idx, f) + ILPreTypeDefImpl (ns, n, idx, f) :> ILPreTypeDef let addILTypeDef td (tdefs: ILTypeDefs) = ILTypeDefs (fun () -> [| yield mkILPreTypeDef td; yield! tdefs.AsArrayOfPreTypeDefs |]) diff --git a/src/absil/il.fsi b/src/absil/il.fsi index 87fd66932a..e981e8e8b5 100755 --- a/src/absil/il.fsi +++ b/src/absil/il.fsi @@ -1322,12 +1322,16 @@ and [] /// The information is enough to perform name resolution for the F# compiler, probe attributes /// for ExtensionAttribute etc. This is key to the on-demand exploration of .NET metadata. /// This information has to be "Goldilocks" - not too much, not too little, just right. -and [] ILPreTypeDef = - member Namespace: string list - member Name: string - member MetadataIndex: int32 +and [] ILPreTypeDef = + abstract Namespace: string list + abstract Name: string /// Realise the actual full typedef - member GetTypeDef : unit -> ILTypeDef + abstract GetTypeDef : unit -> ILTypeDef + + +and [] ILPreTypeDefImpl = + interface ILPreTypeDef + and [] ILTypeDefStored diff --git a/src/fsharp/import.fs b/src/fsharp/import.fs index dbe4296e0f..8fdd28f3b5 100755 --- a/src/fsharp/import.fs +++ b/src/fsharp/import.fs @@ -478,7 +478,7 @@ and ImportILTypeDefList amap m (cpath: CompilationPath) enc items = let modty = lazy (ImportILTypeDefList amap m (cpath.NestedCompPath n Namespace) enc tgs) NewModuleOrNamespace (Some cpath) taccessPublic (mkSynId m n) XmlDoc.Empty [] (MaybeLazy.Lazy modty)) (fun (n, info: Lazy<_>) -> - let (scoref2, _, lazyTypeDef: ILPreTypeDef) = info.Force() + let (scoref2, lazyTypeDef: ILPreTypeDef) = info.Force() ImportILTypeDef amap m scoref2 cpath enc n (lazyTypeDef.GetTypeDef())) let kind = match enc with [] -> Namespace | _ -> ModuleOrType @@ -489,7 +489,7 @@ and ImportILTypeDefList amap m (cpath: CompilationPath) enc items = and ImportILTypeDefs amap m scoref cpath enc (tdefs: ILTypeDefs) = // We be very careful not to force a read of the type defs here tdefs.AsArrayOfPreTypeDefs - |> Array.map (fun pre -> (pre.Namespace, (pre.Name, notlazy(scoref, pre.MetadataIndex, pre)))) + |> Array.map (fun pre -> (pre.Namespace, (pre.Name, notlazy(scoref, pre)))) |> Array.toList |> ImportILTypeDefList amap m cpath enc @@ -519,7 +519,7 @@ let ImportILAssemblyExportedType amap m auxModLoader (scoref: ILScopeRef) (expor | None -> error(Error(FSComp.SR.impReferenceToDllRequiredByAssembly(exportedType.ScopeRef.QualifiedName, scoref.QualifiedName, exportedType.Name), m)) | Some preTypeDef -> - scoref, -1, preTypeDef) + scoref, preTypeDef) [ ImportILTypeDefList amap m (CompPath(scoref, [])) [] [(ns, (n, info))] ] From 2328612a4803b70c8a18f43d5106d94027be09f8 Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Fri, 27 Sep 2019 21:51:48 +0300 Subject: [PATCH 281/286] Add FSharpDisplayContext.WithShortTypeNames(bool) (#7651) --- src/fsharp/symbols/Symbols.fs | 4 ++++ src/fsharp/symbols/Symbols.fsi | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/fsharp/symbols/Symbols.fs b/src/fsharp/symbols/Symbols.fs index f6b93d4e32..fcfe2c085f 100755 --- a/src/fsharp/symbols/Symbols.fs +++ b/src/fsharp/symbols/Symbols.fs @@ -188,8 +188,12 @@ module Impl = type FSharpDisplayContext(denv: TcGlobals -> DisplayEnv) = member x.Contents g = denv g + static member Empty = FSharpDisplayContext(fun g -> DisplayEnv.Empty g) + member x.WithShortTypeNames shortNames = + FSharpDisplayContext(fun g -> { denv g with shortTypeNames = shortNames }) + // delay the realization of 'item' in case it is unresolved type FSharpSymbol(cenv: SymbolEnv, item: (unit -> Item), access: (FSharpSymbol -> CcuThunk -> AccessorDomain -> bool)) = diff --git a/src/fsharp/symbols/Symbols.fsi b/src/fsharp/symbols/Symbols.fsi index c8580fedf3..60c3cecedd 100644 --- a/src/fsharp/symbols/Symbols.fsi +++ b/src/fsharp/symbols/Symbols.fsi @@ -50,6 +50,8 @@ type [] public FSharpDisplayContext = internal new : denv: (TcGlobals -> Tastops.DisplayEnv) -> FSharpDisplayContext static member Empty: FSharpDisplayContext + member WithShortTypeNames: bool -> FSharpDisplayContext + /// Represents a symbol in checked F# source code or a compiled .NET component. /// /// The subtype of the symbol may reveal further information and can be one of FSharpEntity, FSharpUnionCase From 93df95aead8ad785f27323cc41e4bea7b1f5909c Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Fri, 27 Sep 2019 13:47:50 -0700 Subject: [PATCH 282/286] replace deprecated nuspec `iconUrl` element with `icon` --- .gitattributes | 2 ++ .../FSharp.Compiler.Service.MSBuild.v12.fsproj | 3 ++- ...FSharp.Compiler.Service.ProjectCracker.fsproj | 3 ++- .../FSharp.Compiler.Service.fsproj | 3 ++- .../FSharp.Core.nuget/FSharp.Core.nuget.csproj | 4 ++++ src/fsharp/FSharp.Core.nuget/icon.png | Bin 0 -> 1581 bytes 6 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 src/fsharp/FSharp.Core.nuget/icon.png diff --git a/.gitattributes b/.gitattributes index a0a6f27928..db017a84e9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -25,3 +25,5 @@ targets.make text eol=lf *.bsl linguist-vendored=true + +*.png binary diff --git a/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj b/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj index 56ba4a9f09..fbc1e3f281 100644 --- a/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj +++ b/fcs/FSharp.Compiler.Service.MSBuild.v12/FSharp.Compiler.Service.MSBuild.v12.fsproj @@ -13,10 +13,11 @@ F# community contributors https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE https://github.com/fsharp/FSharp.Compiler.Service - https://raw.github.com/fsharp/FSharp.Compiler.Service/master/misc/logo.png + logo.png F#, compiler, msbuild + Service/MSBuildReferenceResolver.fs diff --git a/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj b/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj index c330227567..5f5d169797 100644 --- a/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj +++ b/fcs/FSharp.Compiler.Service.ProjectCracker/FSharp.Compiler.Service.ProjectCracker.fsproj @@ -11,10 +11,11 @@ F# community contributors https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE https://github.com/fsharp/FSharp.Compiler.Service - https://raw.github.com/fsharp/FSharp.Compiler.Service/master/misc/logo.png + logo.png F#, compiler, msbuild + ProjectCrackerOptions.fs diff --git a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj index a02a346b02..f519ba3462 100644 --- a/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj +++ b/fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj @@ -28,7 +28,7 @@ F# community contributors https://github.com/fsharp/FSharp.Compiler.Service/blob/master/LICENSE https://github.com/fsharp/FSharp.Compiler.Service - https://raw.github.com/fsharp/FSharp.Compiler.Service/master/misc/logo.png + logo.png F#, fsharp, interactive, compiler, editor @@ -41,6 +41,7 @@ $(DefineConstants);FX_RESHAPED_REFEMIT + AssemblyInfo/AssemblyInfo.fs diff --git a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuget.csproj b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuget.csproj index 4bc3e61c16..b55bc2feba 100644 --- a/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuget.csproj +++ b/src/fsharp/FSharp.Core.nuget/FSharp.Core.nuget.csproj @@ -9,6 +9,10 @@ FSharp.Core redistributables from Visual F# Tools version $(FSPackageMajorVersion) For F# $(FSCoreMajorVersion). Contains code from the F# Software Foundation. + + + + false diff --git a/src/fsharp/FSharp.Core.nuget/icon.png b/src/fsharp/FSharp.Core.nuget/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..8a2b81b9eb60b9bd48e50daed8ab02a46ee4992f GIT binary patch literal 1581 zcmXw3dr%W+5Wl3S(FfL4WtA!Y%7hEfB!WB|b8zRyCiVIVTx zNzPm!kts^~A#+bmdOVOCle8;y)vowVJNH%WRc?h-Y9RnDXcF+bn z*li~;306aP%Y%y_0u+mAh&qS~58j$LH~q#G z(!AI7P7v@a;K4anPh1DRbFD{?CC`k4tH9`WpLUy8FJIZ&Ii50G%=g!EI`_@yHw=Ec z=jKi23khOhIw@uVsAYKr)=cunp1k<@G3BZAvlAk{wfW3t?TVfRh!}mVDil!J0WWlD z3%}LeE(WSh7j%QSNvLtZ*W;c&roXfii2sXub+u%OU|XU6CK6!I2&}+Z!O@)L}$~ZX;#W(qagHT z71H?4SU^yr9j8p=&f*U4Zmu~(<4}3Q;KhMCgk57OH1o0=vDbDeJlhOG@UYRlcj+!l zR&kXeG(uh~Dg6&&i4w;(*$!rzE7IKcSk_Fcs{m23@{D*jhIsVppUhHARrKQ8LG?u4 zBN}BZGVz8uIDpY5SyqBT1w7x8>wYC08jB2q```#kF{@YG6v&H^H%LlYy`>Lm6d!~= zwvWFNr!zcrtVJc)x(<`~S%g(V^^`H3H-vys4vLDLzqg6~&tQRa|$R z*ku3G;X1JCE!AJi>b+b~bDZw6)-bzsN%$Mo<7GMX4DNP3ZJGzWN+Ev!2aC;4_T+%$ zO5<9xc7at4lw5qc=hm2AI>c`C+NDdVQ31~@o&`(4jfL2awpVp;-xQ5cP|s2$A$C3V zMAwipYc*(j1|)}^U}J6}h-^9xa^P53gAXH*EXSG*^dYYk z3FpKeKWJt&mSHllRRb)R9CL6@hh~O%{5`-~ce$*}_97@*b9fu}#3XxVg~|?omiifh+Hsmj>=l_z6AzHj%P zh9}7VaJVZ*w+<*dGr}Yk37JWCJiXKDFk<0meCm1n1*b!Zh2hMsABR7*2lEj%fRFdH zVWE_cr~s-Bsw)*rRP*%zFHtiJ&C|ofM4a4m VXWV0Pq6A; Date: Thu, 26 Sep 2019 12:13:06 +0000 Subject: [PATCH 283/286] Update dependencies from https://github.com/dotnet/arcade build 20190923.5 - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19473.5 --- eng/Version.Details.xml | 4 +- eng/common/enable-cross-org-publishing.ps1 | 6 + eng/common/sdl/extract-artifact-packages.ps1 | 7 + eng/common/templates/job/job.yml | 142 +++++++++--------- .../templates/job/publish-build-assets.yml | 1 - eng/common/templates/jobs/jobs.yml | 74 ++++----- .../post-build/channels/netcore-dev-30.yml | 126 ---------------- .../post-build/channels/netcore-dev-31.yml | 14 +- .../post-build/channels/netcore-dev-5.yml | 14 +- .../channels/netcore-internal-30.yml | 26 +++- .../channels/netcore-release-30.yml | 14 +- .../channels/netcore-release-31.yml | 14 +- .../channels/netcore-tools-latest.yml | 14 +- .../channels/public-validation-release.yml | 12 +- .../templates/post-build/common-variables.yml | 4 - .../templates/post-build/post-build.yml | 48 ++++-- eng/common/tools.ps1 | 14 +- eng/common/tools.sh | 16 +- global.json | 4 +- 19 files changed, 243 insertions(+), 311 deletions(-) create mode 100644 eng/common/enable-cross-org-publishing.ps1 delete mode 100644 eng/common/templates/post-build/channels/netcore-dev-30.yml diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 32461002c4..ce40df6327 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - 7b731032220c21a3ed0021c72757b1f3122579b2 + ef4b288de587f0b86e65b3950e9095f714808ade diff --git a/eng/common/enable-cross-org-publishing.ps1 b/eng/common/enable-cross-org-publishing.ps1 new file mode 100644 index 0000000000..eccbf9f1b1 --- /dev/null +++ b/eng/common/enable-cross-org-publishing.ps1 @@ -0,0 +1,6 @@ +param( + [string] $token +) + +Write-Host "##vso[task.setvariable variable=VSS_NUGET_ACCESSTOKEN]$token" +Write-Host "##vso[task.setvariable variable=VSS_NUGET_URI_PREFIXES]https://dnceng.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/dnceng/;https://devdiv.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/devdiv/" diff --git a/eng/common/sdl/extract-artifact-packages.ps1 b/eng/common/sdl/extract-artifact-packages.ps1 index 1fdbb14329..6e6825013b 100644 --- a/eng/common/sdl/extract-artifact-packages.ps1 +++ b/eng/common/sdl/extract-artifact-packages.ps1 @@ -5,6 +5,13 @@ param( $ErrorActionPreference = "Stop" Set-StrictMode -Version 2.0 + +# `tools.ps1` checks $ci to perform some actions. Since the post-build +# scripts don't necessarily execute in the same agent that run the +# build.ps1/sh script this variable isn't automatically set. +$ci = $true +. $PSScriptRoot\..\tools.ps1 + $ExtractPackage = { param( [string] $PackagePath # Full path to a NuGet package diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index ffda80a197..13dd40e26c 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -1,67 +1,33 @@ +# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, +# and some (Microbuild) should only be applied to non-PR cases for internal builds. + parameters: # Job schema parameters - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job cancelTimeoutInMinutes: '' - condition: '' - - continueOnError: false - container: '' - + continueOnError: false dependsOn: '' - displayName: '' - - steps: [] - pool: '' - + steps: [] strategy: '' - timeoutInMinutes: '' - variables: [] - workspace: '' - # Job base template specific parameters - # Optional: Enable installing Microbuild plugin - # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix - # _TeamName - the name of your team - # _SignType - 'test' or 'real' +# Job base template specific parameters + # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md + artifacts: '' enableMicrobuild: false - - # Optional: Include PublishBuildArtifacts task enablePublishBuildArtifacts: false - - # Optional: Enable publishing to the build asset registry enablePublishBuildAssets: false - - # Optional: Prevent gather/push manifest from executing when using publishing pipelines - enablePublishUsingPipelines: false - - # Optional: Include PublishTestResults task enablePublishTestResults: false - - # Optional: enable sending telemetry - enableTelemetry: false - - # Optional: define the helix repo for telemetry (example: 'dotnet/arcade') - helixRepo: '' - - # Optional: define the helix type for telemetry (example: 'build/product/') - helixType: '' - - # Required: name of the job + enablePublishUsingPipelines: false name: '' - - # Optional: should run as a public build even in the internal project - # if 'true', the build won't run any of the internal only steps, even if it is running in non-public projects. + preSteps: [] runAsPublic: false -# Internal resources (telemetry, microbuild) can only be accessed from non-public projects, -# and some (Microbuild) should only be applied to non-PR cases for internal builds. - jobs: - job: ${{ parameters.name }} @@ -93,7 +59,7 @@ jobs: timeoutInMinutes: ${{ parameters.timeoutInMinutes }} variables: - - ${{ if eq(parameters.enableTelemetry, 'true') }}: + - ${{ if ne(parameters.enableTelemetry, 'false') }}: - name: DOTNET_CLI_TELEMETRY_PROFILE value: '$(Build.Repository.Uri)' - ${{ each variable in parameters.variables }}: @@ -125,21 +91,12 @@ jobs: workspace: ${{ parameters.workspace }} steps: - - ${{ if eq(parameters.enableTelemetry, 'true') }}: - # Telemetry tasks are built from https://github.com/dotnet/arcade-extensions - - task: sendStartTelemetry@0 - displayName: 'Send Helix Start Telemetry' - inputs: - helixRepo: ${{ parameters.helixRepo }} - ${{ if ne(parameters.helixType, '') }}: - helixType: ${{ parameters.helixType }} - buildConfig: $(_BuildConfig) - runAsPublic: ${{ parameters.runAsPublic }} - continueOnError: ${{ parameters.continueOnError }} - condition: always() + - ${{ if ne(parameters.preSteps, '') }}: + - ${{ each preStep in parameters.preSteps }}: + - ${{ preStep }} - - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - task: MicroBuildSigningPlugin@2 displayName: Install MicroBuild plugin inputs: @@ -151,9 +108,16 @@ jobs: continueOnError: ${{ parameters.continueOnError }} condition: and(succeeded(), in(variables['_SignType'], 'real', 'test'), eq(variables['Agent.Os'], 'Windows_NT')) - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - task: NuGetAuthenticate@0 + - ${{ if or(eq(parameters.artifacts.download, 'true'), ne(parameters.artifacts.download, '')) }}: + - task: DownloadPipelineArtifact@2 + inputs: + buildType: current + artifactName: ${{ coalesce(parameters.artifacts.download.name, 'Artifacts_$(Agent.OS)_$(_BuildConfig)') }} + targetPath: ${{ coalesce(parameters.artifacts.download.path, 'artifacts') }} + itemPattern: ${{ coalesce(parameters.artifacts.download.pattern, '**') }} + - ${{ each step in parameters.steps }}: - ${{ step }} @@ -166,20 +130,60 @@ jobs: env: TeamName: $(_TeamName) - - ${{ if eq(parameters.enableTelemetry, 'true') }}: - # Telemetry tasks are built from https://github.com/dotnet/arcade-extensions - - task: sendEndTelemetry@0 - displayName: 'Send Helix End Telemetry' - continueOnError: ${{ parameters.continueOnError }} - condition: always() - - - ${{ if eq(parameters.enablePublishBuildArtifacts, 'true') }}: + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if or(eq(parameters.artifacts.publish.artifacts, 'true'), ne(parameters.artifacts.publish.artifacts, '')) }}: + - task: CopyFiles@2 + displayName: Gather binaries for publish to artifacts + inputs: + SourceFolder: 'artifacts/bin' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/bin' + - task: CopyFiles@2 + displayName: Gather packages for publish to artifacts + inputs: + SourceFolder: 'artifacts/packages' + Contents: '**' + TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/packages' + - task: PublishBuildArtifacts@1 + displayName: Publish pipeline artifacts + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)/artifacts' + PublishLocation: Container + ArtifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} + continueOnError: true + condition: always() + - ${{ if or(eq(parameters.artifacts.publish.logs, 'true'), ne(parameters.artifacts.publish.logs, '')) }}: + - publish: artifacts/log + artifact: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} + displayName: Publish logs + continueOnError: true + condition: always() + - ${{ if or(eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: + - ${{ if and(ne(parameters.enablePublishUsingPipelines, 'true'), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: CopyFiles@2 + displayName: Gather Asset Manifests + inputs: + SourceFolder: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/AssetManifest' + TargetFolder: '$(Build.ArtifactStagingDirectory)/AssetManifests' + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + + - task: PublishBuildArtifacts@1 + displayName: Push Asset Manifests + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)/AssetManifests' + PublishLocation: Container + ArtifactName: AssetManifests + continueOnError: ${{ parameters.continueOnError }} + condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true')) + + - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: - task: PublishBuildArtifacts@1 displayName: Publish Logs inputs: PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' PublishLocation: Container - ArtifactName: $(Agent.Os)_$(Agent.JobName) + ArtifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} continueOnError: true condition: always() diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 5dca87c5db..b722975f9c 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -61,7 +61,6 @@ jobs: /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:Configuration=$(_BuildConfig) - /v:detailed condition: ${{ parameters.condition }} continueOnError: ${{ parameters.continueOnError }} diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml index 6a2f98c036..c08225a9a9 100644 --- a/eng/common/templates/jobs/jobs.yml +++ b/eng/common/templates/jobs/jobs.yml @@ -1,19 +1,10 @@ parameters: - # Optional: 'true' if failures in job.yml job should not fail the job + # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md continueOnError: false - # Optional: Enable installing Microbuild plugin - # if 'true', these "variables" must be specified in the variables object or as part of the queue matrix - # _TeamName - the name of your team - # _SignType - 'test' or 'real' - enableMicrobuild: false - # Optional: Include PublishBuildArtifacts task enablePublishBuildArtifacts: false - # Optional: Enable publishing to the build asset registry - enablePublishBuildAssets: false - # Optional: Enable publishing using release pipelines enablePublishUsingPipelines: false @@ -23,19 +14,9 @@ parameters: # Optional: Include toolset dependencies in the generated graph files includeToolset: false - # Optional: Include PublishTestResults task - enablePublishTestResults: false - - # Optional: enable sending telemetry - # if enabled then the 'helixRepo' parameter should also be specified - enableTelemetry: false - # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job jobs: [] - # Optional: define the helix repo for telemetry (example: 'dotnet/arcade') - helixRepo: '' - # Optional: Override automatically derived dependsOn value for "publish build assets" job publishBuildAssetsDependsOn: '' @@ -62,29 +43,30 @@ jobs: name: ${{ job.job }} -- ${{ if and(eq(parameters.enablePublishBuildAssets, true), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - template: ../job/publish-build-assets.yml - parameters: - continueOnError: ${{ parameters.continueOnError }} - dependsOn: - - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: - - ${{ each job in parameters.publishBuildAssetsDependsOn }}: - - ${{ job.job }} - - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: - - ${{ each job in parameters.jobs }}: - - ${{ job.job }} - pool: - vmImage: vs2017-win2016 - runAsPublic: ${{ parameters.runAsPublic }} - publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} - enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} - -- ${{ if and(eq(parameters.graphFileGeneration.enabled, true), eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - template: ../job/generate-graph-files.yml - parameters: - continueOnError: ${{ parameters.continueOnError }} - includeToolset: ${{ parameters.graphFileGeneration.includeToolset }} - dependsOn: - - Asset_Registry_Publish - pool: - vmImage: vs2017-win2016 +- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - ${{ if or(eq(parameters.enablePublishBuildAssets, true), eq(parameters.artifacts.publish.manifests, 'true'), ne(parameters.artifacts.publish.manifests, '')) }}: + - template: ../job/publish-build-assets.yml + parameters: + continueOnError: ${{ parameters.continueOnError }} + dependsOn: + - ${{ if ne(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.publishBuildAssetsDependsOn }}: + - ${{ job.job }} + - ${{ if eq(parameters.publishBuildAssetsDependsOn, '') }}: + - ${{ each job in parameters.jobs }}: + - ${{ job.job }} + pool: + vmImage: vs2017-win2016 + runAsPublic: ${{ parameters.runAsPublic }} + publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }} + enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }} + + - ${{ if eq(parameters.graphFileGeneration.enabled, true) }}: + - template: ../job/generate-graph-files.yml + parameters: + continueOnError: ${{ parameters.continueOnError }} + includeToolset: ${{ parameters.graphFileGeneration.includeToolset }} + dependsOn: + - Asset_Registry_Publish + pool: + vmImage: vs2017-win2016 diff --git a/eng/common/templates/post-build/channels/netcore-dev-30.yml b/eng/common/templates/post-build/channels/netcore-dev-30.yml deleted file mode 100644 index 69f1a9013e..0000000000 --- a/eng/common/templates/post-build/channels/netcore-dev-30.yml +++ /dev/null @@ -1,126 +0,0 @@ -parameters: - symbolPublishingAdditionalParameters: '' - artifactsPublishingAdditionalParameters: '' - publishInstallersAndChecksums: false - -stages: -- stage: NetCore_Dev30_Publish - dependsOn: validate - variables: - - template: ../common-variables.yml - displayName: .NET Core 3.0 Dev Publishing - jobs: - - template: ../setup-maestro-vars.yml - - - job: - displayName: Symbol Publishing - dependsOn: setupMaestroVars - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicDevRelease_30_Channel_Id)) - variables: - - group: DotNet-Symbol-Server-Pats - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - artifactName: 'BlobArtifacts' - continueOnError: true - - - task: DownloadBuildArtifacts@0 - displayName: Download PDB Artifacts - inputs: - artifactName: 'PDBArtifacts' - continueOnError: true - - - task: PowerShell@2 - displayName: Publish - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet - /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) - /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) - /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' - /p:Configuration=Release - ${{ parameters.symbolPublishingAdditionalParameters }} - - - job: publish_assets - displayName: Publish Assets - dependsOn: setupMaestroVars - variables: - - group: DotNet-Blob-Feed - - group: AzureDevOps-Artifact-Feeds-Pats - - name: BARBuildId - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ] - - name: IsStableBuild - value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ] - condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicDevRelease_30_Channel_Id)) - pool: - vmImage: 'windows-2019' - steps: - - task: DownloadBuildArtifacts@0 - displayName: Download Package Artifacts - inputs: - buildType: current - artifactName: PackageArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Blob Artifacts - inputs: - buildType: current - artifactName: BlobArtifacts - - - task: DownloadBuildArtifacts@0 - displayName: Download Asset Manifests - inputs: - buildType: current - artifactName: AssetManifests - - - task: NuGetToolInstaller@1 - displayName: 'Install NuGet.exe' - - # This is necessary whenever we want to publish/restore to an AzDO private feed - - task: NuGetAuthenticate@0 - displayName: 'Authenticate to AzDO Feeds' - - - task: PowerShell@2 - displayName: Publish Assets - env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) - inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet - /p:ArtifactsCategory=$(_DotNetArtifactsCategory) - /p:IsStableBuild=$(IsStableBuild) - /p:IsInternalBuild=$(IsInternalBuild) - /p:RepositoryName=$(Build.Repository.Name) - /p:CommitSha=$(Build.SourceVersion) - /p:NugetPath=$(NuGetExeToolPath) - /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)' - /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)' - /p:BARBuildId=$(BARBuildId) - /p:MaestroApiEndpoint='$(MaestroApiEndPoint)' - /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)' - /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/' - /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/' - /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/' - /p:Configuration=Release - /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }} - /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl) - /p:InstallersAzureAccountKey=$(dotnetcli-storage-key) - /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl) - /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key) - /p:PublishToAzureDevOpsNuGetFeeds=true - /p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3/nuget/v3/index.json' - /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3-transport/nuget/v3/index.json' - /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - /p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3-symbols/nuget/v3/index.json' - /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)' - ${{ parameters.artifactsPublishingAdditionalParameters }} - - - template: ../../steps/promote-build.yml - parameters: - ChannelId: ${{ variables.PublicDevRelease_30_Channel_Id }} diff --git a/eng/common/templates/post-build/channels/netcore-dev-31.yml b/eng/common/templates/post-build/channels/netcore-dev-31.yml index 720a0ab08a..af64724f79 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-31.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-31.yml @@ -1,11 +1,13 @@ parameters: - symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate publishInstallersAndChecksums: false + symbolPublishingAdditionalParameters: '' stages: - stage: NetCore_Dev31_Publish - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Core 3.1 Dev Publishing @@ -85,10 +87,14 @@ stages: - task: NuGetAuthenticate@0 displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 + displayName: Enable cross-org publishing + inputs: + filePath: eng\common\enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) + - task: PowerShell@2 displayName: Publish Assets - env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet diff --git a/eng/common/templates/post-build/channels/netcore-dev-5.yml b/eng/common/templates/post-build/channels/netcore-dev-5.yml index 9c81e39e9c..6c8dff5424 100644 --- a/eng/common/templates/post-build/channels/netcore-dev-5.yml +++ b/eng/common/templates/post-build/channels/netcore-dev-5.yml @@ -1,11 +1,13 @@ parameters: - symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate publishInstallersAndChecksums: false + symbolPublishingAdditionalParameters: '' stages: - stage: NetCore_Dev5_Publish - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Core 5 Dev Publishing @@ -85,10 +87,14 @@ stages: - task: NuGetAuthenticate@0 displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 + displayName: Enable cross-org publishing + inputs: + filePath: eng\common\enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) + - task: PowerShell@2 displayName: Publish Assets - env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet diff --git a/eng/common/templates/post-build/channels/netcore-internal-30.yml b/eng/common/templates/post-build/channels/netcore-internal-30.yml index 053163cf6a..201ed570ae 100644 --- a/eng/common/templates/post-build/channels/netcore-internal-30.yml +++ b/eng/common/templates/post-build/channels/netcore-internal-30.yml @@ -1,10 +1,12 @@ parameters: - symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate + symbolPublishingAdditionalParameters: '' stages: - stage: NetCore_30_Internal_Servicing_Publishing - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Core 3.0 Internal Servicing Publishing @@ -32,6 +34,18 @@ stages: artifactName: 'PDBArtifacts' continueOnError: true + # This is necessary whenever we want to publish/restore to an AzDO private feed + # Since sdk-task.ps1 tries to restore packages we need to do this authentication here + # otherwise it'll complain about accessing a private feed. + - task: NuGetAuthenticate@0 + displayName: 'Authenticate to AzDO Feeds' + + - task: PowerShell@2 + displayName: Enable cross-org publishing + inputs: + filePath: eng\common\enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) + - task: PowerShell@2 displayName: Publish inputs: @@ -84,10 +98,14 @@ stages: - task: NuGetAuthenticate@0 displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 + displayName: Enable cross-org publishing + inputs: + filePath: eng\common\enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) + - task: PowerShell@2 displayName: Publish Assets - env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet diff --git a/eng/common/templates/post-build/channels/netcore-release-30.yml b/eng/common/templates/post-build/channels/netcore-release-30.yml index 8ba9237ffc..206dd43e3a 100644 --- a/eng/common/templates/post-build/channels/netcore-release-30.yml +++ b/eng/common/templates/post-build/channels/netcore-release-30.yml @@ -1,11 +1,13 @@ parameters: - symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate publishInstallersAndChecksums: false + symbolPublishingAdditionalParameters: '' stages: - stage: NetCore_Release30_Publish - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Core 3.0 Release Publishing @@ -85,10 +87,14 @@ stages: - task: NuGetAuthenticate@0 displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 + displayName: Enable cross-org publishing + inputs: + filePath: eng\common\enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) + - task: PowerShell@2 displayName: Publish Assets - env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet diff --git a/eng/common/templates/post-build/channels/netcore-release-31.yml b/eng/common/templates/post-build/channels/netcore-release-31.yml index d8270eadae..6270c82835 100644 --- a/eng/common/templates/post-build/channels/netcore-release-31.yml +++ b/eng/common/templates/post-build/channels/netcore-release-31.yml @@ -1,11 +1,13 @@ parameters: - symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate publishInstallersAndChecksums: false + symbolPublishingAdditionalParameters: '' stages: - stage: NetCore_Release31_Publish - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Core 3.1 Release Publishing @@ -85,10 +87,14 @@ stages: - task: NuGetAuthenticate@0 displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 + displayName: Enable cross-org publishing + inputs: + filePath: eng\common\enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) + - task: PowerShell@2 displayName: Publish Assets - env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet diff --git a/eng/common/templates/post-build/channels/netcore-tools-latest.yml b/eng/common/templates/post-build/channels/netcore-tools-latest.yml index c75d186733..9bf9626ca3 100644 --- a/eng/common/templates/post-build/channels/netcore-tools-latest.yml +++ b/eng/common/templates/post-build/channels/netcore-tools-latest.yml @@ -1,11 +1,13 @@ parameters: - symbolPublishingAdditionalParameters: '' artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate publishInstallersAndChecksums: false + symbolPublishingAdditionalParameters: '' stages: - stage: NetCore_Tools_Latest_Publish - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Tools - Latest Publishing @@ -85,10 +87,14 @@ stages: - task: NuGetAuthenticate@0 displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 + displayName: Enable cross-org publishing + inputs: + filePath: eng\common\enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) + - task: PowerShell@2 displayName: Publish Assets - env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet diff --git a/eng/common/templates/post-build/channels/public-validation-release.yml b/eng/common/templates/post-build/channels/public-validation-release.yml index fb2c23d0f4..5c8e91cce1 100644 --- a/eng/common/templates/post-build/channels/public-validation-release.yml +++ b/eng/common/templates/post-build/channels/public-validation-release.yml @@ -1,10 +1,12 @@ parameters: artifactsPublishingAdditionalParameters: '' + dependsOn: + - Validate publishInstallersAndChecksums: false stages: - stage: PVR_Publish - dependsOn: validate + dependsOn: ${{ parameters.dependsOn }} variables: - template: ../common-variables.yml displayName: .NET Tools - Validation Publishing @@ -50,10 +52,14 @@ stages: - task: NuGetAuthenticate@0 displayName: 'Authenticate to AzDO Feeds' + - task: PowerShell@2 + displayName: Enable cross-org publishing + inputs: + filePath: eng\common\enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) + - task: PowerShell@2 displayName: Publish Assets - env: - AZURE_DEVOPS_EXT_PAT: $(dn-bot-dnceng-universal-packages-rw) inputs: filePath: eng\common\sdk-task.ps1 arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet diff --git a/eng/common/templates/post-build/common-variables.yml b/eng/common/templates/post-build/common-variables.yml index adb2a854f2..9ccc08b2c8 100644 --- a/eng/common/templates/post-build/common-variables.yml +++ b/eng/common/templates/post-build/common-variables.yml @@ -3,10 +3,6 @@ variables: - group: DotNet-DotNetCli-Storage - group: DotNet-MSRC-Storage - # .NET Core 3 Dev - - name: PublicDevRelease_30_Channel_Id - value: 3 - # .NET Core 3.1 Dev - name: PublicDevRelease_31_Channel_Id value: 128 diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 5b9d0a5d99..3f06b5d146 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -16,11 +16,14 @@ parameters: signingValidationAdditionalParameters: '' # Which stages should finish execution before post-build stages start - dependsOn: [build] + validateDependsOn: + - build + publishDependsOn: + - Validate stages: -- stage: validate - dependsOn: ${{ parameters.dependsOn }} +- stage: Validate + dependsOn: ${{ parameters.validateDependsOn }} displayName: Validate jobs: - ${{ if eq(parameters.enableNugetValidation, 'true') }}: @@ -45,6 +48,9 @@ stages: - ${{ if eq(parameters.enableSigningValidation, 'true') }}: - job: displayName: Signing Validation + variables: + - template: common-variables.yml + - group: AzureDevOps-Artifact-Feeds-Pats pool: vmImage: 'windows-2019' steps: @@ -54,6 +60,19 @@ stages: buildType: current artifactName: PackageArtifacts + # This is necessary whenever we want to publish/restore to an AzDO private feed + # Since sdk-task.ps1 tries to restore packages we need to do this authentication here + # otherwise it'll complain about accessing a private feed. + - task: NuGetAuthenticate@0 + condition: eq(variables['IsInternalBuild'], 'true') + displayName: 'Authenticate to AzDO Feeds' + + - task: PowerShell@2 + displayName: Enable cross-org publishing + inputs: + filePath: eng\common\enable-cross-org-publishing.ps1 + arguments: -token $(dn-bot-dnceng-artifact-feeds-rw) + - task: PowerShell@2 displayName: Validate inputs: @@ -97,46 +116,47 @@ stages: - template: \eng\common\templates\post-build\channels\netcore-dev-5.yml parameters: - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - -- template: \eng\common\templates\post-build\channels\netcore-dev-30.yml - parameters: symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} - publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - template: \eng\common\templates\post-build\channels\netcore-dev-31.yml parameters: - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\netcore-tools-latest.yml parameters: - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\public-validation-release.yml parameters: artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} - template: \eng\common\templates\post-build\channels\netcore-release-30.yml parameters: - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\netcore-release-31.yml parameters: - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} - template: \eng\common\templates\post-build\channels\netcore-internal-30.yml parameters: - symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }} + dependsOn: ${{ parameters.publishDependsOn }} + symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }} diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index 91efea9405..5c94bd78d6 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -154,15 +154,6 @@ function InitializeDotNetCli([bool]$install) { # Make Sure that our bootstrapped dotnet cli is available in future steps of the Azure Pipelines build Write-PipelinePrependPath -Path $dotnetRoot - # Work around issues with Azure Artifacts credential provider - # https://github.com/dotnet/arcade/issues/3932 - if ($ci) { - $env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS = 20 - $env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS = 20 - Write-PipelineSetVariable -Name 'NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS' -Value '20' - Write-PipelineSetVariable -Name 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS' -Value '20' - } - Write-PipelineSetVariable -Name 'DOTNET_MULTILEVEL_LOOKUP' -Value '0' Write-PipelineSetVariable -Name 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE' -Value '1' @@ -504,6 +495,11 @@ function MSBuild() { # https://github.com/dotnet/arcade/issues/3932 if ($ci -and $buildTool.Tool -eq "dotnet") { dotnet nuget locals http-cache -c + + $env:NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS = 20 + $env:NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS = 20 + Write-PipelineSetVariable -Name 'NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS' -Value '20' + Write-PipelineSetVariable -Name 'NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS' -Value '20' } $toolsetBuildProject = InitializeToolset diff --git a/eng/common/tools.sh b/eng/common/tools.sh index cdba97ac8b..93ee4d67e3 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -152,15 +152,6 @@ function InitializeDotNetCli { # build steps from using anything other than what we've downloaded. Write-PipelinePrependPath -path "$dotnet_root" - # Work around issues with Azure Artifacts credential provider - # https://github.com/dotnet/arcade/issues/3932 - if [[ "$ci" == true ]]; then - export NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20 - export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 - Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20" - Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20" - fi - Write-PipelineSetVariable -name "DOTNET_MULTILEVEL_LOOKUP" -value "0" Write-PipelineSetVariable -name "DOTNET_SKIP_FIRST_TIME_EXPERIENCE" -value "1" @@ -342,6 +333,11 @@ function MSBuild { # https://github.com/dotnet/arcade/issues/3932 if [[ "$ci" == true ]]; then dotnet nuget locals http-cache -c + + export NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20 + export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 + Write-PipelineSetVariable -name "NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS" -value "20" + Write-PipelineSetVariable -name "NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS" -value "20" fi local toolset_dir="${_InitializeToolset%/*}" @@ -379,8 +375,6 @@ function MSBuild-Core { } } -. "$scriptroot/pipeline-logging-functions.sh" - ResolvePath "${BASH_SOURCE[0]}" _script_dir=`dirname "$_ResolvePath"` diff --git a/global.json b/global.json index 1e7325d768..8687218e1b 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "3.0.100-preview6-012264", + "dotnet": "3.0.100", "vs": { "version": "16.1", "components": [ @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19463.3", + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19473.5", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 168bcfb02390f853da2d1ac6955919719524a31c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 27 Sep 2019 12:19:01 +0000 Subject: [PATCH 284/286] Update dependencies from https://github.com/dotnet/arcade build 20190926.6 - Microsoft.DotNet.Arcade.Sdk - 5.0.0-beta.19476.6 --- eng/Version.Details.xml | 4 +- eng/common/init-tools-native.ps1 | 1 + eng/common/sdl/execute-all-sdl-tools.ps1 | 52 ++++++++++++------------ eng/common/templates/job/execute-sdl.yml | 10 ++--- global.json | 2 +- 5 files changed, 35 insertions(+), 34 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ce40df6327..aef250643d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - ef4b288de587f0b86e65b3950e9095f714808ade + b449f372df1a3374ebdc85f42ff137dcda08776b diff --git a/eng/common/init-tools-native.ps1 b/eng/common/init-tools-native.ps1 index 8cf18bcfeb..0fc0503ab9 100644 --- a/eng/common/init-tools-native.ps1 +++ b/eng/common/init-tools-native.ps1 @@ -133,6 +133,7 @@ try { if (Test-Path $InstallBin) { Write-Host "Native tools are available from" (Convert-Path -Path $InstallBin) Write-Host "##vso[task.prependpath]$(Convert-Path -Path $InstallBin)" + return $InstallBin } else { Write-Error "Native tools install directory does not exist, installation failed" diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 index 01799d63ff..eb21321ba2 100644 --- a/eng/common/sdl/execute-all-sdl-tools.ps1 +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -1,30 +1,30 @@ Param( - [string] $GuardianPackageName, # Required: the name of guardian CLI package (not needed if GuardianCliLocation is specified) - [string] $NugetPackageDirectory, # Required: directory where NuGet packages are installed (not needed if GuardianCliLocation is specified) - [string] $GuardianCliLocation, # Optional: Direct location of Guardian CLI executable if GuardianPackageName & NugetPackageDirectory are not specified - [string] $Repository=$env:BUILD_REPOSITORY_NAME, # Required: the name of the repository (e.g. dotnet/arcade) - [string] $BranchName=$env:BUILD_SOURCEBRANCH, # Optional: name of branch or version of gdn settings; defaults to master - [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, # Required: the directory where source files are located - [string] $ArtifactsDirectory = (Join-Path $env:BUILD_SOURCESDIRECTORY ("artifacts")), # Required: the directory where build artifacts are located - [string] $AzureDevOpsAccessToken, # Required: access token for dnceng; should be provided via KeyVault - [string[]] $SourceToolsList, # Optional: list of SDL tools to run on source code - [string[]] $ArtifactToolsList, # Optional: list of SDL tools to run on built artifacts - [bool] $TsaPublish=$False, # Optional: true will publish results to TSA; only set to true after onboarding to TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaBranchName=$env:BUILD_SOURCEBRANCH, # Optional: required for TSA publish; defaults to $(Build.SourceBranchName); TSA is the automated framework used to upload test results as bugs. - [string] $TsaRepositoryName=$env:BUILD_REPOSITORY_NAME, # Optional: TSA repository name; will be generated automatically if not submitted; TSA is the automated framework used to upload test results as bugs. - [string] $BuildNumber=$env:BUILD_BUILDNUMBER, # Optional: required for TSA publish; defaults to $(Build.BuildNumber) - [bool] $UpdateBaseline=$False, # Optional: if true, will update the baseline in the repository; should only be run after fixing any issues which need to be fixed - [bool] $TsaOnboard=$False, # Optional: if true, will onboard the repository to TSA; should only be run once; TSA is the automated framework used to upload test results as bugs. - [string] $TsaInstanceUrl, # Optional: only needed if TsaOnboard or TsaPublish is true; the instance-url registered with TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaCodebaseName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the codebase registered with TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaProjectName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the project registered with TSA; TSA is the automated framework used to upload test results as bugs. - [string] $TsaNotificationEmail, # Optional: only needed if TsaOnboard is true; the email(s) which will receive notifications of TSA bug filings (e.g. alias@microsoft.com); TSA is the automated framework used to upload test results as bugs. - [string] $TsaCodebaseAdmin, # Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs. - [string] $TsaBugAreaPath, # Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. - [string] $TsaIterationPath, # Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. - [string] $GuardianLoggerLevel="Standard", # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error - [string[]] $CrScanAdditionalRunConfigParams, # Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1") - [string[]] $PoliCheckAdditionalRunConfigParams # Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1") + [string] $GuardianPackageName, # Required: the name of guardian CLI package (not needed if GuardianCliLocation is specified) + [string] $NugetPackageDirectory, # Required: directory where NuGet packages are installed (not needed if GuardianCliLocation is specified) + [string] $GuardianCliLocation, # Optional: Direct location of Guardian CLI executable if GuardianPackageName & NugetPackageDirectory are not specified + [string] $Repository=$env:BUILD_REPOSITORY_NAME, # Required: the name of the repository (e.g. dotnet/arcade) + [string] $BranchName=$env:BUILD_SOURCEBRANCH, # Optional: name of branch or version of gdn settings; defaults to master + [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, # Required: the directory where source files are located + [string] $ArtifactsDirectory = (Join-Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY ("artifacts")), # Required: the directory where build artifacts are located + [string] $AzureDevOpsAccessToken, # Required: access token for dnceng; should be provided via KeyVault + [string[]] $SourceToolsList, # Optional: list of SDL tools to run on source code + [string[]] $ArtifactToolsList, # Optional: list of SDL tools to run on built artifacts + [bool] $TsaPublish=$False, # Optional: true will publish results to TSA; only set to true after onboarding to TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaBranchName=$env:BUILD_SOURCEBRANCH, # Optional: required for TSA publish; defaults to $(Build.SourceBranchName); TSA is the automated framework used to upload test results as bugs. + [string] $TsaRepositoryName=$env:BUILD_REPOSITORY_NAME, # Optional: TSA repository name; will be generated automatically if not submitted; TSA is the automated framework used to upload test results as bugs. + [string] $BuildNumber=$env:BUILD_BUILDNUMBER, # Optional: required for TSA publish; defaults to $(Build.BuildNumber) + [bool] $UpdateBaseline=$False, # Optional: if true, will update the baseline in the repository; should only be run after fixing any issues which need to be fixed + [bool] $TsaOnboard=$False, # Optional: if true, will onboard the repository to TSA; should only be run once; TSA is the automated framework used to upload test results as bugs. + [string] $TsaInstanceUrl, # Optional: only needed if TsaOnboard or TsaPublish is true; the instance-url registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaCodebaseName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the codebase registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaProjectName, # Optional: only needed if TsaOnboard or TsaPublish is true; the name of the project registered with TSA; TSA is the automated framework used to upload test results as bugs. + [string] $TsaNotificationEmail, # Optional: only needed if TsaOnboard is true; the email(s) which will receive notifications of TSA bug filings (e.g. alias@microsoft.com); TSA is the automated framework used to upload test results as bugs. + [string] $TsaCodebaseAdmin, # Optional: only needed if TsaOnboard is true; the aliases which are admins of the TSA codebase (e.g. DOMAIN\alias); TSA is the automated framework used to upload test results as bugs. + [string] $TsaBugAreaPath, # Optional: only needed if TsaOnboard is true; the area path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. + [string] $TsaIterationPath, # Optional: only needed if TsaOnboard is true; the iteration path where TSA will file bugs in AzDO; TSA is the automated framework used to upload test results as bugs. + [string] $GuardianLoggerLevel="Standard", # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error + [string[]] $CrScanAdditionalRunConfigParams, # Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1") + [string[]] $PoliCheckAdditionalRunConfigParams # Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1") ) $ErrorActionPreference = "Stop" diff --git a/eng/common/templates/job/execute-sdl.yml b/eng/common/templates/job/execute-sdl.yml index a7f9964195..9a00430d65 100644 --- a/eng/common/templates/job/execute-sdl.yml +++ b/eng/common/templates/job/execute-sdl.yml @@ -24,15 +24,15 @@ jobs: buildType: current downloadType: specific files matchingPattern: "**" - downloadPath: $(Build.SourcesDirectory)\artifacts + downloadPath: $(Build.ArtifactStagingDirectory)\artifacts - powershell: eng/common/sdl/extract-artifact-packages.ps1 - -InputPath $(Build.SourcesDirectory)\artifacts\BlobArtifacts - -ExtractPath $(Build.SourcesDirectory)\artifacts\BlobArtifacts + -InputPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts + -ExtractPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts displayName: Extract Blob Artifacts continueOnError: ${{ parameters.sdlContinueOnError }} - powershell: eng/common/sdl/extract-artifact-packages.ps1 - -InputPath $(Build.SourcesDirectory)\artifacts\PackageArtifacts - -ExtractPath $(Build.SourcesDirectory)\artifacts\PackageArtifacts + -InputPath $(Build.ArtifactStagingDirectory)\artifacts\PackageArtifacts + -ExtractPath $(Build.ArtifactStagingDirectory)\artifacts\PackageArtifacts displayName: Extract Package Artifacts continueOnError: ${{ parameters.sdlContinueOnError }} - task: NuGetToolInstaller@1 diff --git a/global.json b/global.json index 8687218e1b..e8c93c341d 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19473.5", + "Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19476.6", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } From 699cb0db39b65ae97beedc71194907b962014888 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 30 Sep 2019 17:29:55 -0500 Subject: [PATCH 285/286] update RELEASE_NOTES and README with versions fix some calls to generate docs to match new FSharp.Formatting APIs --- fcs/README.md | 6 +++--- fcs/RELEASE_NOTES.md | 12 ++++++++++++ fcs/docsrc/tools/generate.fsx | 5 +++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/fcs/README.md b/fcs/README.md index 92ab8b3236..33f5989094 100644 --- a/fcs/README.md +++ b/fcs/README.md @@ -62,9 +62,9 @@ which does things like: You can push the packages if you have permissions, either automatically using ``build Release`` or manually set APIKEY=... - ..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.31.0.0.nupkg %APIKEY% -Source https://nuget.org - ..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.MSBuild.v12.31.0.0.nupkg %APIKEY% -Source https://nuget.org - ..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.ProjectCracker.31.0.0.nupkg %APIKEY% -Source https://nuget.org + ..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.32.0.0.nupkg %APIKEY% -Source https://nuget.org + ..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.MSBuild.v12.32.0.0.nupkg %APIKEY% -Source https://nuget.org + ..\fsharp\.nuget\nuget.exe push %HOMEDRIVE%%HOMEPATH%\Downloads\FSharp.Compiler.Service.ProjectCracker.32.0.0.nupkg %APIKEY% -Source https://nuget.org ### Use of Paket and FAKE diff --git a/fcs/RELEASE_NOTES.md b/fcs/RELEASE_NOTES.md index 73164bb892..c83a64330d 100644 --- a/fcs/RELEASE_NOTES.md +++ b/fcs/RELEASE_NOTES.md @@ -1,3 +1,15 @@ +#### 32.0.0 + +* integrate dotnet/fsharp from e1b8537ee (2019-08-13) to 48f932cf8 (2019-09-27) +* notable changes include: + * (preview) nameof + * (preview) open static classes + * Fixed 64-bit integer literal parsing + * Better exhaustiveness checking for byte and sbyte pattern matches + * Better native resource handling + * Script-host assembly load events + * Tons of other ones, check the F# 4.7 release notes for them + #### 31.0.0 * Integrate dotnet/fsharp from 5a8f454a1 to 05c558a61 * Notable changes include: diff --git a/fcs/docsrc/tools/generate.fsx b/fcs/docsrc/tools/generate.fsx index 617a154efb..c5f7589b23 100644 --- a/fcs/docsrc/tools/generate.fsx +++ b/fcs/docsrc/tools/generate.fsx @@ -28,6 +28,7 @@ open System.IO open Fake.FileHelper open FSharp.Literate open FSharp.MetadataFormat +open FSharp.Formatting.Razor let root = "." @@ -60,7 +61,7 @@ let fsfmt = __SOURCE_DIRECTORY__ @@ ".." @@ ".." @@ @"packages" @@ "FSharp.Form let buildReference () = CleanDir (output @@ "reference") for lib in referenceBinaries do - MetadataFormat.Generate + RazorMetadataFormat.Generate ( bin @@ lib, output @@ "reference", layoutRoots, parameters = ("root", root)::info, sourceRepo = "https://github.com/fsharp/FSharp.Compiler.Service/tree/master/src", @@ -87,7 +88,7 @@ let buildReference () = let buildDocumentation () = for dir in [content] do let sub = if dir.Length > content.Length then dir.Substring(content.Length + 1) else "." - Literate.ProcessDirectory + RazorLiterate.ProcessDirectory ( dir, docTemplate, output @@ sub, replacements = ("root", root)::info, layoutRoots = layoutRoots, generateAnchors = true, processRecursive=false ) From d348d6ad18f2ecd5ab8ad8c1eec03c42f7540401 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 30 Sep 2019 17:48:45 -0500 Subject: [PATCH 286/286] Fix release notes so they are happier --- fcs/RELEASE_NOTES.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fcs/RELEASE_NOTES.md b/fcs/RELEASE_NOTES.md index c83a64330d..f299ca9902 100644 --- a/fcs/RELEASE_NOTES.md +++ b/fcs/RELEASE_NOTES.md @@ -1,6 +1,6 @@ #### 32.0.0 -* integrate dotnet/fsharp from e1b8537ee (2019-08-13) to 48f932cf8 (2019-09-27) +* integrate dotnet/fsharp from e1b8537ee to 48f932cf8 * notable changes include: * (preview) nameof * (preview) open static classes @@ -8,7 +8,6 @@ * Better exhaustiveness checking for byte and sbyte pattern matches * Better native resource handling * Script-host assembly load events - * Tons of other ones, check the F# 4.7 release notes for them #### 31.0.0 * Integrate dotnet/fsharp from 5a8f454a1 to 05c558a61