Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion benchmarks/CompilerServiceBenchmarks/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ type CompilerService() =
let readerOptions =
{
pdbDirPath = None
ilGlobals = mkILGlobals ILScopeRef.Local
reduceMemoryUsage = ReduceMemoryFlag.No
metadataOnly = MetadataOnlyFlag.Yes
tryGetMetadataSnapshot = fun _ -> None
Expand Down
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.20269.3">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.20278.5">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>ccfddb60fbd3de13463298334f00610edb5f63c6</Sha>
<Sha>77bfd5a60e0691b0cebd180a0fd85eb65fa7f362</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
30 changes: 22 additions & 8 deletions eng/common/darc-init.ps1
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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
}
10 changes: 10 additions & 0 deletions eng/common/dotnet-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,6 +31,14 @@ while [[ $# > 0 ]]; do
shift
runtime="$1"
;;
-runtimesourcefeed)
shift
runtimeSourceFeed="$1"
;;
-runtimesourcefeedkey)
shift
runtimeSourceFeedKey="$1"
;;
*)
echo "Invalid argument: $1"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
11 changes: 0 additions & 11 deletions src/absil/illib.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/IlxGen.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
13 changes: 8 additions & 5 deletions src/fsharp/MethodCalls.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions src/fsharp/NicePrint.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions src/fsharp/TypeChecker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/fsharp/TypedTreeOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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, _, _, _)) =
Expand Down
15 changes: 10 additions & 5 deletions src/fsharp/fsi/fsi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 _ ->
Expand Down Expand Up @@ -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 = <exp>", 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

Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/service/ServiceAnalysis.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down