Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into otel
Browse files Browse the repository at this point in the history
  • Loading branch information
safesparrow committed Oct 24, 2022
2 parents ad91f8b + ddbaafd commit 26ab7f5
Show file tree
Hide file tree
Showing 108 changed files with 2,360 additions and 730 deletions.
37 changes: 34 additions & 3 deletions .github/workflows/add_to_project.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: Add all issues to F# project
name: Add all issues to F# project, assign milestone and labels

on:
issues:
types:
- opened
- transferred

permissions:
issues: write
repository-projects: write

jobs:
cleanup_old_runs:
runs-on: ubuntu-20.04
Expand All @@ -21,11 +25,38 @@ jobs:
gh api -X GET "$_UrlPath/$_CurrentWorkflowID/runs" --paginate \
| jq '.workflow_runs[] | select(.status == "completed") | .id' \
| xargs -I{} gh api -X DELETE "/repos/$GITHUB_REPOSITORY/actions/runs"/{}
add-to-project:
add_to_project:
name: Add issue to project
runs-on: ubuntu-latest
permissions:
issues: write
repository-projects: write
steps:
- uses: actions/add-to-project@v0.3.0
with:
project-url: https://github.com/orgs/dotnet/projects/126/
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.REPO_PROJECT_PAT }}
apply-label:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Needs-Triage']
})
apply-milestone:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.update({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
milestone: 29
})
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,4 @@ nCrunchTemp_*
/test.fsx

tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.actual
*.vsp
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"configurations": [
{
"name": "Launch FSI (Debug, .NET 6.0)",
"name": "Launch FSI (Debug, .NET 7.0)",
"type": "coreclr",
"request": "launch",
// TODO: Shall we assume that it's already been built, or build it every time we debug?
Expand All @@ -36,7 +36,7 @@
},
},
{
"name": "Launch FSC (Debug, .NET 6.0)",
"name": "Launch FSC (Debug, .NET 7.0)",
"type": "coreclr",
"request": "launch",
// TODO: Shall we assume that it's already been built, or build it every time we debug?
Expand Down Expand Up @@ -77,4 +77,4 @@
"enableStepFiltering": false,
}
]
}
}
21 changes: 18 additions & 3 deletions VisualFSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiAnyCpu", "src\fsi\fsiAny
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiArm64", "src\fsi\fsiArm64Project\fsiArm64.fsproj", "{EB015235-1E07-4CDA-9CC6-3FBCC27910D1}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HistoricalBenchmark", "tests\benchmarks\FCSBenchmarks\BenchmarkComparison\HistoricalBenchmark.fsproj", "{583182E1-3484-4A8F-AC06-7C0D232C0CA4}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "HistoricalBenchmark", "tests\benchmarks\FCSBenchmarks\BenchmarkComparison\HistoricalBenchmark.fsproj", "{583182E1-3484-4A8F-AC06-7C0D232C0CA4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FCSBenchmarks", "FCSBenchmarks", "{39CDF34B-FB23-49AE-AB27-0975DA379BB5}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -193,6 +193,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FCSBenchmarks", "FCSBenchma
tests\benchmarks\FCSBenchmarks\SmokeTestAllBenchmarks.ps1 = tests\benchmarks\FCSBenchmarks\SmokeTestAllBenchmarks.ps1
EndProjectSection
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fsharp.ProfilingStartpointProject", "tests\benchmarks\Fsharp.ProfilingStartpointProject\Fsharp.ProfilingStartpointProject.fsproj", "{FE23BB65-276A-4E41-8CC7-F7752241DEBA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1019,6 +1021,18 @@ Global
{583182E1-3484-4A8F-AC06-7C0D232C0CA4}.Release|Any CPU.Build.0 = Release|Any CPU
{583182E1-3484-4A8F-AC06-7C0D232C0CA4}.Release|x86.ActiveCfg = Release|Any CPU
{583182E1-3484-4A8F-AC06-7C0D232C0CA4}.Release|x86.Build.0 = Release|Any CPU
{FE23BB65-276A-4E41-8CC7-F7752241DEBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE23BB65-276A-4E41-8CC7-F7752241DEBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE23BB65-276A-4E41-8CC7-F7752241DEBA}.Debug|x86.ActiveCfg = Debug|Any CPU
{FE23BB65-276A-4E41-8CC7-F7752241DEBA}.Debug|x86.Build.0 = Debug|Any CPU
{FE23BB65-276A-4E41-8CC7-F7752241DEBA}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
{FE23BB65-276A-4E41-8CC7-F7752241DEBA}.Proto|Any CPU.Build.0 = Debug|Any CPU
{FE23BB65-276A-4E41-8CC7-F7752241DEBA}.Proto|x86.ActiveCfg = Debug|Any CPU
{FE23BB65-276A-4E41-8CC7-F7752241DEBA}.Proto|x86.Build.0 = Debug|Any CPU
{FE23BB65-276A-4E41-8CC7-F7752241DEBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE23BB65-276A-4E41-8CC7-F7752241DEBA}.Release|Any CPU.Build.0 = Release|Any CPU
{FE23BB65-276A-4E41-8CC7-F7752241DEBA}.Release|x86.ActiveCfg = Release|Any CPU
{FE23BB65-276A-4E41-8CC7-F7752241DEBA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1089,16 +1103,17 @@ Global
{B5A9BBD9-2F45-4722-A6CA-BAE3C64CD4E2} = {3881429D-A97A-49EB-B7AE-A82BA5FE9C77}
{14F3D3D6-5C8E-43C2-98A2-17EA704D4DEA} = {CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}
{A422D673-8E3B-4924-821B-DD3174173426} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
{564E7DC5-11CB-4FCF-ABDD-23AD93AF3A61} = {39CDF34B-FB23-49AE-AB27-0975DA379BB5}
{B1E30F2C-894F-47A9-9C8A-3324831E7D26} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
{597D9896-4B90-4E9E-9C99-445C2CB9FF60} = {B8DDA694-7939-42E3-95E5-265C2217C142}
{0973C362-585C-4838-9459-D7E45C6B784B} = {B8DDA694-7939-42E3-95E5-265C2217C142}
{E54456F4-D51A-4334-B225-92EBBED92B40} = {B8DDA694-7939-42E3-95E5-265C2217C142}
{511C95D9-3BA6-451F-B6F8-F033F40878A5} = {B8DDA694-7939-42E3-95E5-265C2217C142}
{37EB3E54-ABC6-4CF5-8273-7CE4B61A42C1} = {B8DDA694-7939-42E3-95E5-265C2217C142}
{EB015235-1E07-4CDA-9CC6-3FBCC27910D1} = {B8DDA694-7939-42E3-95E5-265C2217C142}
{39CDF34B-FB23-49AE-AB27-0975DA379BB5} = {DFB6ADD7-3149-43D9-AFA0-FC4A818B472B}
{564E7DC5-11CB-4FCF-ABDD-23AD93AF3A61} = {39CDF34B-FB23-49AE-AB27-0975DA379BB5}
{583182E1-3484-4A8F-AC06-7C0D232C0CA4} = {39CDF34B-FB23-49AE-AB27-0975DA379BB5}
{39CDF34B-FB23-49AE-AB27-0975DA379BB5} = {DFB6ADD7-3149-43D9-AFA0-FC4A818B472B}
{FE23BB65-276A-4E41-8CC7-F7752241DEBA} = {39CDF34B-FB23-49AE-AB27-0975DA379BB5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {48EDBBBE-C8EE-4E3C-8B19-97184A487B37}
Expand Down
1 change: 1 addition & 0 deletions buildtools/AssemblyCheck/SkipVerifyEmbeddedPdb.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FSharp.Build.UnitTests.dll
FSharp.Compiler.Benchmarks.dll
Fsharp.ProfilingStartpointProject.dll
FSharp.Compiler.ComponentTests.dll
FSharp.Test.Utilities.dll
FSharp.Compiler.Private.Scripting.UnitTests.dll
Expand Down
3 changes: 3 additions & 0 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,10 @@ try {
}

if ($pack) {
$properties_storage = $properties
$properties += "/p:GenerateSbom=false"
BuildSolution "Microsoft.FSharp.Compiler.sln"
$properties = $properties_storage
}
if ($build) {
VerifyAssemblyVersionsAndSymbols
Expand Down
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.22512.1">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.22513.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>508fe921a748de6efc8b5d979e17beb88ccf5bcf</Sha>
<Sha>32f13f8a8af8085ca09fbf93513ac848582c4a41</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="8.0.0-beta.22512.1">
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="8.0.0-beta.22513.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>508fe921a748de6efc8b5d979e17beb88ccf5bcf</Sha>
<Sha>32f13f8a8af8085ca09fbf93513ac848582c4a41</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
20 changes: 20 additions & 0 deletions eng/actions/backport/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'PR Backporter'
description: 'Backports a pull request to a branch using the "/backport to <branch>" comment'
inputs:
target_branch:
description: 'Backport target branch.'
auth_token:
description: 'The token used to authenticate to GitHub.'
pr_title_template:
description: 'The template used for the PR title. Special placeholder tokens that will be replaced with a value: %target_branch%, %source_pr_title%, %source_pr_number%, %cc_users%.'
default: '[%target_branch%] %source_pr_title%'
pr_description_template:
description: 'The template used for the PR description. Special placeholder tokens that will be replaced with a value: %target_branch%, %source_pr_title%, %source_pr_number%, %cc_users%.'
default: |
Backport of #%source_pr_number% to %target_branch%
/cc %cc_users%
runs:
using: 'node12'
main: 'index.js'
156 changes: 156 additions & 0 deletions eng/actions/backport/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

function BackportException(message, postToGitHub = true) {
this.message = message;
this.postToGitHub = postToGitHub;
}

async function run() {
const util = require("util");
const jsExec = util.promisify(require("child_process").exec);

console.log("Installing npm dependencies");
const { stdout, stderr } = await jsExec("npm install @actions/core @actions/github @actions/exec");
console.log("npm-install stderr:\n\n" + stderr);
console.log("npm-install stdout:\n\n" + stdout);
console.log("Finished installing npm dependencies");

const core = require("@actions/core");
const github = require("@actions/github");
const exec = require("@actions/exec");

const repo_owner = github.context.payload.repository.owner.login;
const repo_name = github.context.payload.repository.name;
const pr_number = github.context.payload.issue.number;
const comment_user = github.context.payload.comment.user.login;

let octokit = github.getOctokit(core.getInput("auth_token", { required: true }));
let target_branch = core.getInput("target_branch", { required: true });

try {
// verify the comment user is a repo collaborator
try {
await octokit.rest.repos.checkCollaborator({
owner: repo_owner,
repo: repo_name,
username: comment_user
});
console.log(`Verified ${comment_user} is a repo collaborator.`);
} catch (error) {
console.log(error);
throw new BackportException(`Error: @${comment_user} is not a repo collaborator, backporting is not allowed. If you're a collaborator please make sure your ${repo_owner} team membership visibility is set to Public on https://github.com/orgs/${repo_owner}/people?query=${comment_user}`);
}

try { await exec.exec(`git ls-remote --exit-code --heads origin ${target_branch}`) } catch { throw new BackportException(`Error: The specified backport target branch ${target_branch} wasn't found in the repo.`); }
console.log(`Backport target branch: ${target_branch}`);

console.log("Applying backport patch");

await exec.exec(`git checkout ${target_branch}`);
await exec.exec(`git clean -xdff`);

// configure git
await exec.exec(`git config user.name "github-actions"`);
await exec.exec(`git config user.email "github-actions@github.com"`);

// create temporary backport branch
const temp_branch = `backport/pr-${pr_number}-to-${target_branch}`;
await exec.exec(`git checkout -b ${temp_branch}`);

// skip opening PR if the branch already exists on the origin remote since that means it was opened
// by an earlier backport and force pushing to the branch updates the existing PR
let should_open_pull_request = true;
try {
await exec.exec(`git ls-remote --exit-code --heads origin ${temp_branch}`);
should_open_pull_request = false;
} catch { }

// download and apply patch
await exec.exec(`curl -sSL "${github.context.payload.issue.pull_request.patch_url}" --output changes.patch`);

const git_am_command = "git am --3way --ignore-whitespace --keep-non-patch changes.patch";
let git_am_output = `$ ${git_am_command}\n\n`;
let git_am_failed = false;
try {
await exec.exec(git_am_command, [], {
listeners: {
stdout: function stdout(data) { git_am_output += data; },
stderr: function stderr(data) { git_am_output += data; }
}
});
} catch (error) {
git_am_output += error;
git_am_failed = true;
}

if (git_am_failed) {
const git_am_failed_body = `@${github.context.payload.comment.user.login} backporting to ${target_branch} failed, the patch most likely resulted in conflicts:\n\n\`\`\`shell\n${git_am_output}\n\`\`\`\n\nPlease backport manually!`;
await octokit.rest.issues.createComment({
owner: repo_owner,
repo: repo_name,
issue_number: pr_number,
body: git_am_failed_body
});
throw new BackportException("Error: git am failed, most likely due to a merge conflict.", false);
}
else {
// push the temp branch to the repository
await exec.exec(`git push --force --set-upstream origin HEAD:${temp_branch}`);
}

if (!should_open_pull_request) {
console.log("Backport temp branch already exists, skipping opening a PR.");
return;
}

// prepate the GitHub PR details
let backport_pr_title = core.getInput("pr_title_template");
let backport_pr_description = core.getInput("pr_description_template");

// get users to cc (append PR author if different from user who issued the backport command)
let cc_users = `@${comment_user}`;
if (comment_user != github.context.payload.issue.user.login) cc_users += ` @${github.context.payload.issue.user.login}`;

// replace the special placeholder tokens with values
backport_pr_title = backport_pr_title
.replace(/%target_branch%/g, target_branch)
.replace(/%source_pr_title%/g, github.context.payload.issue.title)
.replace(/%source_pr_number%/g, github.context.payload.issue.number)
.replace(/%cc_users%/g, cc_users);

backport_pr_description = backport_pr_description
.replace(/%target_branch%/g, target_branch)
.replace(/%source_pr_title%/g, github.context.payload.issue.title)
.replace(/%source_pr_number%/g, github.context.payload.issue.number)
.replace(/%cc_users%/g, cc_users);

// open the GitHub PR
await octokit.rest.pulls.create({
owner: repo_owner,
repo: repo_name,
title: backport_pr_title,
body: backport_pr_description,
head: temp_branch,
base: target_branch
});

console.log("Successfully opened the GitHub PR.");
} catch (error) {

core.setFailed(error);

if (error.postToGitHub === undefined || error.postToGitHub == true) {
// post failure to GitHub comment
const unknown_error_body = `@${comment_user} an error occurred while backporting to ${target_branch}, please check the run log for details!\n\n${error.message}`;
await octokit.rest.issues.createComment({
owner: repo_owner,
repo: repo_name,
issue_number: pr_number,
body: unknown_error_body
});
}
}
}

run();
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"perl": "5.32.1.1"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22512.1",
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.22512.1"
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22513.2",
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.22513.2"
}
}
7 changes: 4 additions & 3 deletions src/Compiler/Checking/CheckComputationExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ let (|JoinRelation|_|) cenv env (expr: SynExpr) =

| _ -> None

let elimFastIntegerForLoop (spFor, spTo, id, start, dir, finish, innerExpr, m) =
let elimFastIntegerForLoop (spFor, spTo, id, start: SynExpr, dir, finish: SynExpr, innerExpr, m: range) =
let mOp = (unionRanges start.Range finish.Range).MakeSynthetic()
let pseudoEnumExpr =
if dir then mkSynInfix m start ".." finish
else mkSynTrifix m ".. .." start (SynExpr.Const (SynConst.Int32 -1, start.Range)) finish
if dir then mkSynInfix mOp start ".." finish
else mkSynTrifix mOp ".. .." start (SynExpr.Const (SynConst.Int32 -1, mOp)) finish
SynExpr.ForEach (spFor, spTo, SeqExprOnly false, true, mkSynPatVar None id, pseudoEnumExpr, innerExpr, m)

/// Check if a computation or sequence expression is syntactically free of 'yield' (though not yield!)
Expand Down

0 comments on commit 26ab7f5

Please sign in to comment.