diff --git a/benchmarks/CompilerServiceBenchmarks/Program.fs b/benchmarks/CompilerServiceBenchmarks/Program.fs index 201856e3f98..f13602445d7 100644 --- a/benchmarks/CompilerServiceBenchmarks/Program.fs +++ b/benchmarks/CompilerServiceBenchmarks/Program.fs @@ -146,7 +146,6 @@ type CompilerService() = let readerOptions = { pdbDirPath = None - ilGlobals = mkILGlobals ILScopeRef.Local reduceMemoryUsage = ReduceMemoryFlag.No metadataOnly = MetadataOnlyFlag.Yes tryGetMetadataSnapshot = fun _ -> None diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a7bfa5b42b5..7aee4d6ef91 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -3,9 +3,9 @@ - + https://github.com/dotnet/arcade - ccfddb60fbd3de13463298334f00610edb5f63c6 + 77bfd5a60e0691b0cebd180a0fd85eb65fa7f362 diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index b94c2f4e411..435e7641341 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -1,13 +1,14 @@ param ( $darcVersion = $null, - $versionEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16", - $verbosity = "m" + $versionEndpoint = 'https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16', + $verbosity = 'minimal', + $toolpath = $null ) . $PSScriptRoot\tools.ps1 -function InstallDarcCli ($darcVersion) { - $darcCliPackageName = "microsoft.dotnet.darc" +function InstallDarcCli ($darcVersion, $toolpath) { + $darcCliPackageName = 'microsoft.dotnet.darc' $dotnetRoot = InitializeDotNetCli -install:$true $dotnet = "$dotnetRoot\dotnet.exe" @@ -23,11 +24,24 @@ function InstallDarcCli ($darcVersion) { $darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content } - $arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json' + $arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/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 --framework netcoreapp2.1 + Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' + if (-not $toolpath) { + Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g" + & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g + }else { + Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity --tool-path '$toolpath'" + & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath" + } } -InstallDarcCli $darcVersion +try { + InstallDarcCli $darcVersion $toolpath +} +catch { + Write-Host $_.ScriptStackTrace + Write-PipelineTelemetryError -Category 'Darc' -Message $_ + ExitWithExitCode 1 +} \ No newline at end of file diff --git a/eng/common/dotnet-install.sh b/eng/common/dotnet-install.sh index 2744be29f01..d259a274c78 100755 --- a/eng/common/dotnet-install.sh +++ b/eng/common/dotnet-install.sh @@ -14,6 +14,8 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" version='Latest' architecture='' runtime='dotnet' +runtimeSourceFeed='' +runtimeSourceFeedKey='' while [[ $# > 0 ]]; do opt="$(echo "$1" | awk '{print tolower($0)}')" case "$opt" in @@ -29,6 +31,14 @@ while [[ $# > 0 ]]; do shift runtime="$1" ;; + -runtimesourcefeed) + shift + runtimeSourceFeed="$1" + ;; + -runtimesourcefeedkey) + shift + runtimeSourceFeedKey="$1" + ;; *) echo "Invalid argument: $1" exit 1 diff --git a/global.json b/global.json index c996ae5cb1f..c1871f593c0 100644 --- a/global.json +++ b/global.json @@ -10,7 +10,7 @@ } }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20269.3", + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20278.5", "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2" } } diff --git a/src/absil/illib.fs b/src/absil/illib.fs index 98a8636991f..47f169935cb 100644 --- a/src/absil/illib.fs +++ b/src/absil/illib.fs @@ -264,10 +264,6 @@ module List = let rec loop i xs = match xs with [] -> false | h :: t -> f i h || loop (i+1) t loop 0 xs - let existsTrue (xs: bool list) = - let rec loop i xs = match xs with [] -> false | h :: t -> h || loop (i+1) t - loop 0 xs - let lengthsEqAndForall2 p l1 l2 = List.length l1 = List.length l2 && List.forall2 p l1 l2 @@ -334,13 +330,6 @@ module List = | [] -> None | h :: t -> if f h then Some (h, List.rev acc @ t) else loop (h :: acc) t loop [] inp - - let headAndTail l = - match l with - | [] -> - Debug.Assert(false, "empty list") - failwith "List.headAndTail" - | h :: t -> h, t let zip4 l1 l2 l3 l4 = List.zip l1 (List.zip3 l2 l3 l4) |> List.map (fun (x1, (x2, x3, x4)) -> (x1, x2, x3, x4)) diff --git a/src/fsharp/IlxGen.fs b/src/fsharp/IlxGen.fs index 16a6094d1fb..c07dc03b8f3 100644 --- a/src/fsharp/IlxGen.fs +++ b/src/fsharp/IlxGen.fs @@ -7645,7 +7645,7 @@ let CodegenAssembly cenv eenv mgbuf fileImpls = // top-level initialization code. let extraBindings = mgbuf.GrabExtraBindingsToGenerate() //printfn "#extraBindings = %d" extraBindings.Length - if extraBindings.Length > 0 then + if not (isNil extraBindings) then let mexpr = TMDefs [ for b in extraBindings -> TMDefLet(b, range0) ] let _emptyTopInstrs, _emptyTopCode = CodeGenMethod cenv mgbuf ([], "unused", eenv, 0, (fun cgbuf eenv -> diff --git a/src/fsharp/MethodCalls.fs b/src/fsharp/MethodCalls.fs index 518fc640916..4ffe1797123 100644 --- a/src/fsharp/MethodCalls.fs +++ b/src/fsharp/MethodCalls.fs @@ -1867,12 +1867,15 @@ let GenWitnessExpr amap g m (traitInfo: TraitConstraintInfo) argExprs = // Fix bug 1281: If we resolve to an instance method on a struct and we haven't yet taken // the address of the object then go do that - if minfo.IsStruct && minfo.IsInstance && (match argExprs with [] -> false | h :: _ -> not (isByrefTy g (tyOfExpr g h))) then - let h, t = List.headAndTail argExprs - let wrap, h', _readonly, _writeonly = mkExprAddrOfExpr g true false PossiblyMutates h None m - Some (wrap (Expr.Op (TOp.TraitCall traitInfo, [], (h' :: t), m))) + if minfo.IsStruct && minfo.IsInstance then + match argExprs with + | h :: t when not (isByrefTy g (tyOfExpr g h)) -> + let wrap, h', _readonly, _writeonly = mkExprAddrOfExpr g true false PossiblyMutates h None m + Some (wrap (Expr.Op (TOp.TraitCall traitInfo, [], (h' :: t), m))) + | _ -> + Some (MakeMethInfoCall amap m minfo methArgTys argExprs) else - Some (MakeMethInfoCall amap m minfo methArgTys argExprs ) + Some (MakeMethInfoCall amap m minfo methArgTys argExprs) | Choice2Of5 (tinst, rfref, isSet) -> match isSet, rfref.RecdField.IsStatic, argExprs.Length with diff --git a/src/fsharp/NicePrint.fs b/src/fsharp/NicePrint.fs index 84b2904ad52..9a966e8e433 100755 --- a/src/fsharp/NicePrint.fs +++ b/src/fsharp/NicePrint.fs @@ -1472,12 +1472,14 @@ module InfoMemberPrinting = let prettifyILMethInfo (amap: Import.ImportMap) m (minfo: MethInfo) typarInst ilMethInfo = let (ILMethInfo(_, apparentTy, dty, mdef, _)) = ilMethInfo let (prettyTyparInst, prettyTys), _ = PrettyTypes.PrettifyInstAndTypes amap.g (typarInst, (apparentTy :: minfo.FormalMethodInst)) - let prettyApparentTy, prettyFormalMethInst = List.headAndTail prettyTys - let prettyMethInfo = - match dty with - | None -> MethInfo.CreateILMeth (amap, m, prettyApparentTy, mdef) - | Some declaringTyconRef -> MethInfo.CreateILExtensionMeth(amap, m, prettyApparentTy, declaringTyconRef, minfo.ExtensionMemberPriorityOption, mdef) - prettyTyparInst, prettyMethInfo, prettyFormalMethInst + match prettyTys with + | prettyApparentTy :: prettyFormalMethInst -> + let prettyMethInfo = + match dty with + | None -> MethInfo.CreateILMeth (amap, m, prettyApparentTy, mdef) + | Some declaringTyconRef -> MethInfo.CreateILExtensionMeth(amap, m, prettyApparentTy, declaringTyconRef, minfo.ExtensionMemberPriorityOption, mdef) + prettyTyparInst, prettyMethInfo, prettyFormalMethInst + | _ -> failwith "prettifyILMethInfo - prettyTys empty" /// Format a method to a buffer using "standalone" display style. /// For example, these are the formats used when printing signatures of methods that have not been overridden, diff --git a/src/fsharp/TypeChecker.fs b/src/fsharp/TypeChecker.fs index 9abd05cfd58..2df03cef263 100755 --- a/src/fsharp/TypeChecker.fs +++ b/src/fsharp/TypeChecker.fs @@ -9265,9 +9265,8 @@ and TcNameOfExpr cenv env tpenv (synArg: SynExpr) = 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 -> + | LongOrSingleIdent (false, (LongIdentWithDots((id::rest) as longId, _) as lidd), _, _) -> let ad = env.eAccessRights - let id, rest = List.headAndTail longId 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 diff --git a/src/fsharp/TypedTreeOps.fs b/src/fsharp/TypedTreeOps.fs index ea0d42a959f..01158a11f9b 100644 --- a/src/fsharp/TypedTreeOps.fs +++ b/src/fsharp/TypedTreeOps.fs @@ -3887,8 +3887,8 @@ module DebugPrint = and appL g flayout tys args = let z = flayout - let z = if tys.Length > 0 then z ^^ instL typeL tys else z - let z = if args.Length > 0 then z --- spaceListL (List.map (atomL g) args) else z + let z = if isNil tys then z else z ^^ instL typeL tys + let z = if isNil args then z else z --- spaceListL (List.map (atomL g) args) z and implFileL g (TImplFile (_, _, mexpr, _, _, _)) = diff --git a/src/fsharp/fsi/fsi.fs b/src/fsharp/fsi/fsi.fs index 84040569579..e263e8371c0 100644 --- a/src/fsharp/fsi/fsi.fs +++ b/src/fsharp/fsi/fsi.fs @@ -1479,7 +1479,7 @@ type internal FsiDynamicCompiler for folder in result.Roots do tcConfigB.AddIncludePath(m, folder, "") let scripts = result.SourceFiles |> Seq.toList - if scripts |> Seq.length > 0 then + if not (isNil scripts) then fsiDynamicCompiler.EvalSourceFiles(ctok, istate, m, scripts, lexResourceManager, errorLogger) else istate with _ -> @@ -2266,10 +2266,15 @@ type internal FsiInteractionProcessor // When the last declaration has a shape of DoExp (i.e., non-binding), // transform it to a shape of "let it = ", so we can refer it. - let defsA = if defsA.Length <= 1 || not (List.isEmpty defsB) then defsA else - match List.headAndTail (List.rev defsA) with - | SynModuleDecl.DoExpr(_,exp,_), rest -> (rest |> List.rev) @ (fsiDynamicCompiler.BuildItBinding exp) - | _ -> defsA + let defsA = + if not (isNil defsB) then defsA else + match defsA with + | [] -> defsA + | [_] -> defsA + | _ -> + match List.rev defsA with + | SynModuleDecl.DoExpr(_,exp,_) :: rest -> (rest |> List.rev) @ (fsiDynamicCompiler.BuildItBinding exp) + | _ -> defsA Some (IDefns(defsA,m)),Some (IDefns(defsB,m)),istate diff --git a/src/fsharp/service/ServiceAnalysis.fs b/src/fsharp/service/ServiceAnalysis.fs index d71ee6a0b83..69d2d774669 100644 --- a/src/fsharp/service/ServiceAnalysis.fs +++ b/src/fsharp/service/ServiceAnalysis.fs @@ -181,7 +181,7 @@ module UnusedOpens = | true, scopes -> openStatement.AppliedScope :: scopes | _ -> [openStatement.AppliedScope] usedModules.[openedModule.Entity] <- scopes - newlyOpenedModules.Length > 0 + not (isNil newlyOpenedModules) /// Incrementally filter out the open statements one by one. Filter those whose contents are referred to somewhere in the symbol uses. /// Async to allow cancellation.