Skip to content

Commit

Permalink
Merge pull request #11039 from dotnet/merges/main-to-feature/tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
cartermp authored Feb 7, 2021
2 parents 51d4c36 + fa86927 commit adee316
Show file tree
Hide file tree
Showing 32 changed files with 528 additions and 76 deletions.
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ stages:
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: eng/release/insert-into-vs.yml
parameters:
componentBranchName: release/dev16.8
insertTargetBranch: master
componentBranchName: refs/heads/release/dev16.9
insertTargetBranch: rel/d16.9
insertTeamEmail: fsharpteam@microsoft.com
insertTeamName: 'F#'
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="6.0.0-beta.21101.7">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.21105.5">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>2b430e5bbfaec37a6cead2f0cf79157f01f1a623</Sha>
<Sha>fc83e59329203724d4a63c4f6c843be62983a35e</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
4 changes: 2 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<!-- FSharp.Compiler.Service version -->
<FCSMajorVersion>39</FCSMajorVersion>
<FCSMinorVersion>0</FCSMinorVersion>
<FCSBuildVersion>3</FCSBuildVersion>
<FCSBuildVersion>0</FCSBuildVersion>
<FCSRevisionVersion>$(FSRevisionVersion)</FCSRevisionVersion>
<FSharpCompilerServicePackageVersion>$(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion)</FSharpCompilerServicePackageVersion>
<FSharpCompilerServiceVersion>$(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion).$(FCSRevisionVersion)</FSharpCompilerServiceVersion>
Expand All @@ -48,7 +48,7 @@
</PropertyGroup>
<PropertyGroup>
<VSMajorVersion>16</VSMajorVersion>
<VSMinorVersion>8</VSMinorVersion>
<VSMinorVersion>9</VSMinorVersion>
<VSGeneralVersion>$(VSMajorVersion).0</VSGeneralVersion>
<VSAssemblyVersionPrefix>$(VSMajorVersion).$(VSMinorVersion).0</VSAssemblyVersionPrefix>
<VSAssemblyVersion>$(VSAssemblyVersionPrefix).0</VSAssemblyVersion>
Expand Down
9 changes: 2 additions & 7 deletions eng/common/dotnet-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,8 @@ while [[ $# > 0 ]]; do
shift
done

# Use uname to determine what the CPU is.
cpuname=$(uname -p)
# Some Linux platforms report unknown for platform, but the arch for machine.
if [[ "$cpuname" == "unknown" ]]; then
cpuname=$(uname -m)
fi

# Use uname to determine what the CPU is, see https://en.wikipedia.org/wiki/Uname#Examples
cpuname=$(uname -m)
case $cpuname in
aarch64)
buildarch=arm64
Expand Down
5 changes: 2 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"sdk": {
"version": "5.0.100",
"rollForward": "minor"
"version": "5.0.100"
},
"tools": {
"dotnet": "5.0.100",
Expand All @@ -13,7 +12,7 @@
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21101.7",
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21105.5",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
15 changes: 10 additions & 5 deletions src/fsharp/CompilerOptions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -688,11 +688,6 @@ let outputFileFlagsFsc (tcConfigB: TcConfigBuilder) =
OptionString (fun s -> tcConfigB.signer <- Some s), None,
Some (FSComp.SR.optsStrongKeyFile()))

CompilerOption
("keycontainer", tagString,
OptionString(fun s -> tcConfigB.container <- Some s), None,
Some(FSComp.SR.optsStrongKeyContainer()))

CompilerOption
("platform", tagString,
OptionString (fun s ->
Expand Down Expand Up @@ -1402,6 +1397,16 @@ let deprecatedFlagsFsc tcConfigB =
OptionUnit (fun () -> SetOptimizeOff tcConfigB),
Some(DeprecatedCommandLineOptionSuggestAlternative("-Ooff", "--optimize-", rangeCmdArgs)), None)


CompilerOption
("keycontainer", tagString,
OptionString(fun s ->
if FSharpEnvironment.isRunningOnCoreClr then error(Error(FSComp.SR.containerSigningUnsupportedOnThisPlatform(), rangeCmdArgs))
else tcConfigB.container <- Some s),
if FSharpEnvironment.isRunningOnCoreClr then None
else Some(DeprecatedCommandLineOptionSuggestAlternative("--keycontainer", "--keyfile", rangeCmdArgs))
,None)

mlKeywordsFlag
gnuStyleErrorsFlag tcConfigB ]

Expand Down
16 changes: 9 additions & 7 deletions src/fsharp/CreateILModule.fs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ let ValidateKeySigningAttributes (tcConfig : TcConfig, tcGlobals, topAttrs) =
let delaySignAttrib = AttributeHelpers.TryFindBoolAttribute tcGlobals "System.Reflection.AssemblyDelaySignAttribute" topAttrs.assemblyAttrs
let signerAttrib = AttributeHelpers.TryFindStringAttribute tcGlobals "System.Reflection.AssemblyKeyFileAttribute" topAttrs.assemblyAttrs
let containerAttrib = AttributeHelpers.TryFindStringAttribute tcGlobals "System.Reflection.AssemblyKeyNameAttribute" topAttrs.assemblyAttrs

// if delaySign is set via an attribute, validate that it wasn't set via an option
let delaysign =
match delaySignAttrib with
Expand All @@ -82,7 +82,7 @@ let ValidateKeySigningAttributes (tcConfig : TcConfig, tcGlobals, topAttrs) =
else
delaysign
| _ -> tcConfig.delaysign

// if signer is set via an attribute, validate that it wasn't set via an option
let signer =
match signerAttrib with
Expand All @@ -93,20 +93,22 @@ let ValidateKeySigningAttributes (tcConfig : TcConfig, tcGlobals, topAttrs) =
else
Some signer
| None -> tcConfig.signer

// if container is set via an attribute, validate that it wasn't set via an option, and that they keyfile wasn't set
// if keyfile was set, use that instead (silently)
// REVIEW: This is C# behavior, but it seems kind of sketchy that we fail silently
let container =
match containerAttrib with
| Some container ->
match containerAttrib with
| Some container ->
if not (FSharpEnvironment.isRunningOnCoreClr) then
warning(Error(FSComp.SR.containerDeprecated(), rangeCmdArgs))
if tcConfig.container.IsSome && tcConfig.container <> Some container then
warning(Error(FSComp.SR.fscKeyNameWarning(), rangeCmdArgs))
warning(Error(FSComp.SR.fscKeyNameWarning(), rangeCmdArgs))
tcConfig.container
else
Some container
| None -> tcConfig.container

StrongNameSigningInfo (delaysign, tcConfig.publicsign, signer, container)

/// Get the object used to perform strong-name signing
Expand Down
2 changes: 2 additions & 0 deletions src/fsharp/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,8 @@ forFormatInvalidForInterpolated4,"Interpolated strings used as type IFormattable
3390,xmlDocUnresolvedCrossReference,"This XML comment is invalid: unresolved cross-reference '%s'"
3390,xmlDocMissingParameter,"This XML comment is incomplete: no documentation for parameter '%s'"
3391,tcLiteralAttributeCannotUseActivePattern,"A [<Literal>] declaration cannot use an active pattern for its identifier"
3392,containerDeprecated,"The 'AssemblyKeyNameAttribute' has been deprecated. Use 'AssemblyKeyFileAttribute' instead."
3393,containerSigningUnsupportedOnThisPlatform,"Key container signing is not supported on this platform."
3401,ilxgenInvalidConstructInStateMachineDuringCodegen,"The resumable code construct '%s' may only be used in inlined code protected by 'if __useResumableStateMachines then ...' and the overall composition must form valid resumable code."
3501,structTemplateMustImplementOneInterface,"Invalid resumable code - a template struct type used with __resumableStateMachineStruct must implement exactly one interface. Usually this interface is the type 'System.Runtime.CompilerServices.IAsyncStateMachine'. If necessary mark the struct type with [<NoEquality; NoComparison>]."
3502,stateMachineMacroTypars,"Invalid resumable code - a macro in a state machine has type parameters"
Expand Down
12 changes: 7 additions & 5 deletions src/fsharp/absil/ilsign.fs
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ module internal FSharp.Compiler.AbstractIL.StrongNameSign
iclrSN.StrongNameSignatureVerificationEx(fileName, true, &ok) |> ignore
#endif

let failWithContainerSigningUnsupportedOnThisPlatform() = failwith (FSComp.SR.containerSigningUnsupportedOnThisPlatform() |> snd)

//---------------------------------------------------------------------
// Strong name signing
//---------------------------------------------------------------------
Expand All @@ -516,7 +518,7 @@ module internal FSharp.Compiler.AbstractIL.StrongNameSign
legacySignerCloseKeyContainer containerName
#else
ignore containerName
failwith ("Key container signing is not supported on this platform")
failWithContainerSigningUnsupportedOnThisPlatform()
#endif
member s.IsFullySigned =
match s with
Expand All @@ -528,7 +530,7 @@ module internal FSharp.Compiler.AbstractIL.StrongNameSign
#if !FX_NO_CORHOST_SIGNER
true
#else
failwith ("Key container signing is not supported on this platform")
failWithContainerSigningUnsupportedOnThisPlatform()
#endif

member s.PublicKey =
Expand All @@ -542,7 +544,7 @@ module internal FSharp.Compiler.AbstractIL.StrongNameSign
legacySignerGetPublicKeyForKeyContainer containerName
#else
ignore containerName
failwith ("Key container signing is not supported on this platform")
failWithContainerSigningUnsupportedOnThisPlatform()
#endif

member s.SignatureSize =
Expand All @@ -562,7 +564,7 @@ module internal FSharp.Compiler.AbstractIL.StrongNameSign
pkSignatureSize (legacySignerGetPublicKeyForKeyContainer containerName)
#else
ignore containerName
failwith ("Key container signing is not supported on this platform")
failWithContainerSigningUnsupportedOnThisPlatform()
#endif

member s.SignFile file =
Expand All @@ -575,5 +577,5 @@ module internal FSharp.Compiler.AbstractIL.StrongNameSign
legacySignerSignFileWithKeyContainer file containerName
#else
ignore containerName
failwith ("Key container signing is not supported on this platform")
failWithContainerSigningUnsupportedOnThisPlatform()
#endif
77 changes: 65 additions & 12 deletions src/fsharp/service/FSharpParseFileResults.fs
Original file line number Diff line number Diff line change
Expand Up @@ -179,23 +179,23 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput
let rec getIdentRangeForFuncExprInApp traverseSynExpr expr pos =
match expr with
| SynExpr.Ident ident -> Some ident.idRange

| SynExpr.LongIdent(_, _, _, range) -> Some range

| SynExpr.Paren(expr, _, _, range) when rangeContainsPos range pos ->
getIdentRangeForFuncExprInApp traverseSynExpr expr pos

| SynExpr.LongIdent (_, _, _, range) -> Some range

// This matches computation expressions like 'async { ... }'
| SynExpr.App(_, _, _, SynExpr.CompExpr (_, _, expr, range), _) when rangeContainsPos range pos ->
| SynExpr.Paren (expr, _, _, range) when rangeContainsPos range pos ->
getIdentRangeForFuncExprInApp traverseSynExpr expr pos

| SynExpr.App(_, _, funcExpr, argExpr, _) ->
| SynExpr.App (_, _, funcExpr, argExpr, _) ->
match argExpr with
| SynExpr.App (_, _, _, _, range) when rangeContainsPos range pos ->
getIdentRangeForFuncExprInApp traverseSynExpr argExpr pos

| SynExpr.Paren(SynExpr.Lambda(_, _, _args, body, _, _), _, _, _) when rangeContainsPos body.Range pos ->
getIdentRangeForFuncExprInApp traverseSynExpr body pos
// Special case: `async { ... }` is actually a CompExpr inside of the argExpr of a SynExpr.App
| SynExpr.CompExpr (_, _, expr, range) when rangeContainsPos range pos ->
getIdentRangeForFuncExprInApp traverseSynExpr expr pos

| SynExpr.Paren (expr, _, _, range) when rangeContainsPos range pos ->
getIdentRangeForFuncExprInApp traverseSynExpr expr pos

| _ ->
match funcExpr with
Expand All @@ -209,16 +209,68 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput
// of the identifier of the function we're after
getIdentRangeForFuncExprInApp traverseSynExpr funcExpr pos

| SynExpr.LetOrUse(_, _, bindings, body, range) when rangeContainsPos range pos ->
| SynExpr.LetOrUse (_, _, bindings, body, range) when rangeContainsPos range pos ->
let binding =
bindings
|> List.tryFind (fun x -> rangeContainsPos x.RangeOfBindingWithRhs pos)
match binding with
| Some(SynBinding(_, _, _, _, _, _, _, _, _, expr, _, _)) ->
| Some(SynBinding.SynBinding(_, _, _, _, _, _, _, _, _, expr, _, _)) ->
getIdentRangeForFuncExprInApp traverseSynExpr expr pos
| None ->
getIdentRangeForFuncExprInApp traverseSynExpr body pos

| SynExpr.IfThenElse (ifExpr, thenExpr, elseExpr, _, _, _, range) when rangeContainsPos range pos ->
if rangeContainsPos ifExpr.Range pos then
getIdentRangeForFuncExprInApp traverseSynExpr ifExpr pos
elif rangeContainsPos thenExpr.Range pos then
getIdentRangeForFuncExprInApp traverseSynExpr thenExpr pos
else
match elseExpr with
| None -> None
| Some expr ->
getIdentRangeForFuncExprInApp traverseSynExpr expr pos

| SynExpr.Match (_, expr, clauses, range) when rangeContainsPos range pos ->
if rangeContainsPos expr.Range pos then
getIdentRangeForFuncExprInApp traverseSynExpr expr pos
else
let clause = clauses |> List.tryFind (fun clause -> rangeContainsPos clause.Range pos)
match clause with
| None -> None
| Some clause ->
match clause with
| SynMatchClause.SynMatchClause (_, whenExpr, resultExpr, _, _) ->
match whenExpr with
| None ->
getIdentRangeForFuncExprInApp traverseSynExpr resultExpr pos
| Some whenExpr ->
if rangeContainsPos whenExpr.Range pos then
getIdentRangeForFuncExprInApp traverseSynExpr whenExpr pos
else
getIdentRangeForFuncExprInApp traverseSynExpr resultExpr pos


// Ex: C.M(x, y, ...) <--- We want to find where in the tupled application the call is being made
| SynExpr.Tuple(_, exprs, _, tupRange) when rangeContainsPos tupRange pos ->
let expr = exprs |> List.tryFind (fun expr -> rangeContainsPos expr.Range pos)
match expr with
| None -> None
| Some expr ->
getIdentRangeForFuncExprInApp traverseSynExpr expr pos

// Capture the body of a lambda, often nested in a call to a collection function
| SynExpr.Lambda(_, _, _args, body, _, _) when rangeContainsPos body.Range pos ->
getIdentRangeForFuncExprInApp traverseSynExpr body pos

| SynExpr.Do(expr, range) when rangeContainsPos range pos ->
getIdentRangeForFuncExprInApp traverseSynExpr expr pos

| SynExpr.Assert(expr, range) when rangeContainsPos range pos ->
getIdentRangeForFuncExprInApp traverseSynExpr expr pos

| SynExpr.ArbitraryAfterError (_debugStr, range) when rangeContainsPos range pos ->
Some range

| expr ->
traverseSynExpr expr
|> Option.map (fun expr -> expr)
Expand All @@ -234,6 +286,7 @@ type FSharpParseFileResults(diagnostics: FSharpDiagnostic[], input: ParsedInput
})
| None -> None


member scope.GetAllArgumentsForFunctionApplicationAtPostion pos =
match input with
| Some input -> SynExprAppLocationsImpl.getAllCurriedArgsAtPosition pos input
Expand Down
Loading

0 comments on commit adee316

Please sign in to comment.