зеркало из https://github.com/dotnet/fsharp.git
Merge branch 'release/dev17.5' into merges/release/dev17.4-to-release/dev17.5
This commit is contained in:
Коммит
1c147cf6b5
|
@ -3,7 +3,7 @@
|
|||
"isRoot": true,
|
||||
"tools": {
|
||||
"fantomas": {
|
||||
"version": "5.0.0-beta-005",
|
||||
"version": "5.0.3",
|
||||
"commands": [
|
||||
"fantomas"
|
||||
]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
|
||||
#-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
ARG VARIANT=7.0-bullseye-slim
|
||||
ARG VARIANT=7.0.100-bullseye-slim-amd64
|
||||
FROM mcr.microsoft.com/dotnet/sdk:${VARIANT}
|
||||
|
||||
# Avoid warnings by switching to noninteractive
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"args": {
|
||||
// Update 'VARIANT' to pick a .NET Core version: 3.1, 5.0, 6.0, 7.0
|
||||
// Append -bullseye(-slim), -focal, or -jammy to pin to an OS version.
|
||||
"VARIANT": "7.0-bullseye-slim"
|
||||
"VARIANT": "7.0.100-bullseye-slim-amd64"
|
||||
}
|
||||
},
|
||||
"hostRequirements": {
|
||||
|
|
|
@ -7,19 +7,85 @@ fcs-samples/
|
|||
scripts/
|
||||
setup/
|
||||
tests/
|
||||
vsintegration/
|
||||
vsintegration/*
|
||||
!vsintegration/tests/FSharp.Editor.Tests
|
||||
artifacts/
|
||||
|
||||
# Explicitly unformatted implementation files
|
||||
|
||||
src/Compiler/Checking/**/*.fs
|
||||
src/Compiler/DependencyManager/**/*.fs
|
||||
src/Compiler/Facilities/**/*.fs
|
||||
src/Compiler/Interactive/**/*.fs
|
||||
src/Compiler/Legacy/**/*.fs
|
||||
src/Compiler/Optimize/**/*.fs
|
||||
src/Compiler/Symbols/**/*.fs
|
||||
src/Compiler/TypedTree/**/*.fs
|
||||
src/Compiler/Checking/AccessibilityLogic.fs
|
||||
src/Compiler/Checking/AttributeChecking.fs
|
||||
src/Compiler/Checking/AugmentWithHashCompare.fs
|
||||
src/Compiler/Checking/CheckBasics.fs
|
||||
src/Compiler/Checking/CheckComputationExpressions.fs
|
||||
src/Compiler/Checking/CheckDeclarations.fs
|
||||
src/Compiler/Checking/CheckExpressions.fs
|
||||
src/Compiler/Checking/CheckFormatStrings.fs
|
||||
src/Compiler/Checking/CheckIncrementalClasses.fs
|
||||
src/Compiler/Checking/CheckPatterns.fs
|
||||
src/Compiler/Checking/ConstraintSolver.fs
|
||||
src/Compiler/Checking/FindUnsolved.fs
|
||||
src/Compiler/Checking/import.fs
|
||||
src/Compiler/Checking/InfoReader.fs
|
||||
src/Compiler/Checking/infos.fs
|
||||
src/Compiler/Checking/MethodCalls.fs
|
||||
src/Compiler/Checking/MethodOverrides.fs
|
||||
src/Compiler/Checking/NameResolution.fs
|
||||
src/Compiler/Checking/NicePrint.fs
|
||||
src/Compiler/Checking/PatternMatchCompilation.fs
|
||||
src/Compiler/Checking/PostInferenceChecks.fs
|
||||
src/Compiler/Checking/QuotationTranslator.fs
|
||||
src/Compiler/Checking/SignatureConformance.fs
|
||||
src/Compiler/Checking/TypeHierarchy.fs
|
||||
src/Compiler/Checking/TypeRelations.fs
|
||||
|
||||
src/Compiler/DependencyManager/AssemblyResolveHandler.fs
|
||||
src/Compiler/DependencyManager/DependencyProvider.fs
|
||||
src/Compiler/DependencyManager/NativeDllResolveHandler.fs
|
||||
|
||||
src/Compiler/Facilities/BuildGraph.fs
|
||||
src/Compiler/Facilities/CompilerLocation.fs
|
||||
src/Compiler/Facilities/DiagnosticOptions.fs
|
||||
src/Compiler/Facilities/DiagnosticResolutionHints.fs
|
||||
src/Compiler/Facilities/DiagnosticsLogger.fs
|
||||
src/Compiler/Facilities/LanguageFeatures.fs
|
||||
src/Compiler/Facilities/Logger.fs
|
||||
src/Compiler/Facilities/prim-lexing.fs
|
||||
src/Compiler/Facilities/prim-parsing.fs
|
||||
src/Compiler/Facilities/ReferenceResolver.fs
|
||||
src/Compiler/Facilities/SimulatedMSBuildReferenceResolver.fs
|
||||
src/Compiler/Facilities/TextLayoutRender.fs
|
||||
|
||||
src/Compiler/Interactive/ControlledExecution.fs
|
||||
src/Compiler/Interactive/fsi.fs
|
||||
|
||||
src/Compiler/Legacy/LegacyHostedCompilerForTesting.fs
|
||||
src/Compiler/Legacy/LegacyMSBuildReferenceResolver.fs
|
||||
|
||||
src/Compiler/Optimize/DetupleArgs.fs
|
||||
src/Compiler/Optimize/InnerLambdasToTopLevelFuncs.fs
|
||||
src/Compiler/Optimize/LowerCalls.fs
|
||||
src/Compiler/Optimize/LowerComputedCollections.fs
|
||||
src/Compiler/Optimize/LowerLocalMutables.fs
|
||||
src/Compiler/Optimize/LowerSequences.fs
|
||||
src/Compiler/Optimize/LowerStateMachines.fs
|
||||
src/Compiler/Optimize/Optimizer.fs
|
||||
|
||||
src/Compiler/Symbols/Exprs.fs
|
||||
src/Compiler/Symbols/FSharpDiagnostic.fs
|
||||
src/Compiler/Symbols/SymbolHelpers.fs
|
||||
src/Compiler/Symbols/SymbolPatterns.fs
|
||||
src/Compiler/Symbols/Symbols.fs
|
||||
|
||||
src/Compiler/TypedTree/CompilerGlobalState.fs
|
||||
src/Compiler/TypedTree/QuotationPickler.fs
|
||||
src/Compiler/TypedTree/tainted.fs
|
||||
src/Compiler/TypedTree/TcGlobals.fs
|
||||
src/Compiler/TypedTree/TypedTree.fs
|
||||
src/Compiler/TypedTree/TypedTreeBasics.fs
|
||||
src/Compiler/TypedTree/TypedTreeOps.fs
|
||||
src/Compiler/TypedTree/TypedTreePickle.fs
|
||||
src/Compiler/TypedTree/TypeProviders.fs
|
||||
|
||||
# Explicitly unformatted file that needs more care to get it to format well
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
* @dotnet/fsharp-team-msft
|
|
@ -2,7 +2,7 @@
|
|||
name: Bug report
|
||||
about: Create a report to help us improve F#
|
||||
title: ''
|
||||
labels: Bug
|
||||
labels: [Bug, Needs-Triage]
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
name: Bug report
|
||||
description: Create a report to help us improve F#
|
||||
title: "`Bug`: "
|
||||
labels: [Needs Triage]
|
||||
body:
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Is there an existing issue for this?
|
||||
description: Please search to see if an issue already exists for the bug you encountered.
|
||||
options:
|
||||
- label: I have searched the existing issues
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Issue description
|
||||
description: Please provide a succinct description of the issue you're experiencing.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Steps To Reproduce
|
||||
description: Provide the steps required to reproduce the problem.
|
||||
placeholder: |
|
||||
1. Step A
|
||||
2. Step B...
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected Behavior
|
||||
description: Provide a description of the expected behavior.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Actual Behavior
|
||||
description: Provide a description of the actual behaviour observed.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Known workarounds
|
||||
description: Provide a description of the actual behaviour observed.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Related information
|
||||
description: |
|
||||
Provide any related information (optional), examples:
|
||||
- **OS**: Windows 11
|
||||
- **.NET Runtime Kind and version**: .NET Framework 4.8 and .NET 7
|
||||
- **Tooling**: Visual Studio 2022
|
||||
value: |
|
||||
- OS:
|
||||
- .NET Runtime Kind and version:
|
||||
- Tooling:
|
||||
render: markdown
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Anything else?
|
||||
description: |
|
||||
Links? References? Anything that will give us more context about the issue you are encountering!
|
||||
|
||||
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
|
||||
validations:
|
||||
required: false
|
|
@ -2,7 +2,7 @@
|
|||
name: Feature request
|
||||
about: Suggest an idea for the F# tools or compiler
|
||||
title: ''
|
||||
labels: Feature Request
|
||||
labels: [Feature Request, Needs-Triage]
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
name: Other issue
|
||||
about: Open an issue which does not belong to any categories above
|
||||
title: ''
|
||||
labels: [Needs-Triage]
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
<!-- Please, provide a clear and concise description of what the problem is below: -->
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
name: Add all issues and PRs to F# project, assign milestone and labels
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- opened
|
||||
- transferred
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
branches: ['main']
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
repository-projects: write
|
||||
|
||||
jobs:
|
||||
cleanup_old_runs:
|
||||
runs-on: ubuntu-20.04
|
||||
if: github.event_name != 'pull_request_target'
|
||||
permissions:
|
||||
actions: write
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Delete old workflow runs
|
||||
run: |
|
||||
_UrlPath="/repos/$GITHUB_REPOSITORY/actions/workflows"
|
||||
_CurrentWorkflowID="$(gh api -X GET "$_UrlPath" | jq '.workflows[] | select(.name == '\""$GITHUB_WORKFLOW"\"') | .id')"
|
||||
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:
|
||||
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.REPO_PROJECT_PAT }}
|
||||
apply-label:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name != 'pull_request_target'
|
||||
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
|
||||
if: github.event_name != 'pull_request_target'
|
||||
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
|
||||
})
|
|
@ -0,0 +1,83 @@
|
|||
name: Backport PR to branch
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
schedule:
|
||||
# once a day at 13:00 UTC
|
||||
- cron: '0 13 * * *'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
cleanup_old_runs:
|
||||
if: github.event.schedule == '0 13 * * *'
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
actions: write
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Delete old workflow runs
|
||||
run: |
|
||||
_UrlPath="/repos/$GITHUB_REPOSITORY/actions/workflows"
|
||||
_CurrentWorkflowID="$(gh api -X GET "$_UrlPath" | jq '.workflows[] | select(.name == '\""$GITHUB_WORKFLOW"\"') | .id')"
|
||||
|
||||
# delete workitems which are 'completed'. (other candidate values of status field are: 'queued' and 'in_progress')
|
||||
|
||||
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"/{}
|
||||
|
||||
backport:
|
||||
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/backport to')
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Extract backport target branch
|
||||
uses: actions/github-script@v3
|
||||
id: target-branch-extractor
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
if (context.eventName !== "issue_comment") throw "Error: This action only works on issue_comment events.";
|
||||
|
||||
// extract the target branch name from the trigger phrase containing these characters: a-z, A-Z, digits, forward slash, dot, hyphen, underscore
|
||||
const regex = /^\/backport to ([a-zA-Z\d\/\.\-\_]+)/;
|
||||
target_branch = regex.exec(context.payload.comment.body);
|
||||
if (target_branch == null) throw "Error: No backport branch found in the trigger phrase.";
|
||||
|
||||
return target_branch[1];
|
||||
- name: Post backport started comment to pull request
|
||||
uses: actions/github-script@v3
|
||||
with:
|
||||
script: |
|
||||
const backport_start_body = `Started backporting to ${{ steps.target-branch-extractor.outputs.result }}: https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${process.env.GITHUB_RUN_ID}`;
|
||||
await github.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: backport_start_body
|
||||
});
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Run backport
|
||||
uses: ./eng/actions/backport
|
||||
with:
|
||||
target_branch: ${{ steps.target-branch-extractor.outputs.result }}
|
||||
auth_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
pr_description_template: |
|
||||
Backport of #%source_pr_number% to %target_branch%
|
||||
|
||||
/cc %cc_users%
|
||||
|
||||
## Customer Impact
|
||||
|
||||
## Testing
|
||||
|
||||
## Risk
|
||||
|
||||
IMPORTANT: Is this backport for a servicing release? If so and this change touches code that ships in a NuGet package, please make certain that you have added any necessary [package authoring](https://github.com/dotnet/runtime/blob/main/docs/project/library-servicing.md) and gotten it explicitly reviewed.
|
|
@ -0,0 +1,122 @@
|
|||
name: Commands on PR
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
schedule:
|
||||
# once a day at 13:00 UTC
|
||||
- cron: '0 13 * * *'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
cleanup_old_runs:
|
||||
if: github.event.schedule == '0 13 * * *'
|
||||
runs-on: ubuntu-20.04
|
||||
permissions:
|
||||
actions: write
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Delete old workflow runs
|
||||
run: |
|
||||
_UrlPath="/repos/$GITHUB_REPOSITORY/actions/workflows"
|
||||
_CurrentWorkflowID="$(gh api -X GET "$_UrlPath" | jq '.workflows[] | select(.name == '\""$GITHUB_WORKFLOW"\"') | .id')"
|
||||
|
||||
# delete workitems which are 'completed'. (other candidate values of status field are: 'queued' and 'in_progress')
|
||||
|
||||
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"/{}
|
||||
|
||||
run_command:
|
||||
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/run')
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Extract command to run
|
||||
uses: actions/github-script@v3
|
||||
id: command-extractor
|
||||
with:
|
||||
result-encoding: string
|
||||
script: |
|
||||
if (context.eventName !== "issue_comment") throw "Error: This action only works on issue_comment events.";
|
||||
|
||||
// extract the command to run, allowed characters: a-z, A-Z, digits, hyphen, underscore
|
||||
const regex = /^\/run ([a-zA-Z\d\-\_]+)/;
|
||||
command = regex.exec(context.payload.comment.body);
|
||||
if (command == null) throw "Error: No command found in the trigger phrase.";
|
||||
|
||||
return command[1];
|
||||
- name: Get github ref
|
||||
uses: actions/github-script@v3
|
||||
id: get-pr
|
||||
with:
|
||||
script: |
|
||||
const result = await github.pulls.get({
|
||||
pull_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
});
|
||||
return { "ref": result.data.head.ref, "repository": result.data.head.repo.full_name};
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ fromJson(steps.get-pr.outputs.result).repository }}
|
||||
ref: ${{ fromJson(steps.get-pr.outputs.result).ref }}
|
||||
fetch-depth: 0
|
||||
- name: Install dotnet
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
global-json-file: global.json
|
||||
- name: Install dotnet tools
|
||||
run: dotnet tool restore
|
||||
- name: Process fantomas command
|
||||
if: steps.command-extractor.outputs.result == 'fantomas'
|
||||
id: fantomas
|
||||
run: dotnet fantomas src -r
|
||||
- name: Process fantomas command
|
||||
if: steps.command-extractor.outputs.result == 'xlf'
|
||||
id: xlf
|
||||
run: dotnet build src\Compiler /t:UpdateXlf
|
||||
- name: Commit and push changes
|
||||
if: steps.fantomas.outcome == 'success' || steps.xlf.outcome == 'success'
|
||||
run: |
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git commit -a -m 'Automated command ran: ${{ steps.command-extractor.outputs.result }}
|
||||
|
||||
Co-authored-by: ${{ github.event.comment.user.login }} <${{ github.event.comment.user.id }}+${{ github.event.comment.user.login }}@users.noreply.github.com>'
|
||||
git push
|
||||
- name: Post command comment
|
||||
if: steps.fantomas.outcome == 'success' || steps.xlf.outcome == 'success'
|
||||
uses: actions/github-script@v3
|
||||
with:
|
||||
script: |
|
||||
// Probably, there's more universal way of getting outputs, but my gh-actions-fu is not that good.
|
||||
var output = ""
|
||||
if ("${{steps.command-extractor.outputs.result}}" == 'fantomas') {
|
||||
output = "${{steps.fantomas.outputs.result}}"
|
||||
} else if("${{steps.command-extractor.outputs.result}}" == 'xlf') {
|
||||
output = "${{steps.xlf.outputs.result}}"
|
||||
}
|
||||
const body = `Ran ${{ steps.command-extractor.outputs.result }}: https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${process.env.GITHUB_RUN_ID}\n${output}`;
|
||||
await github.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: body
|
||||
});
|
||||
- name: Post command failed comment
|
||||
if: failure()
|
||||
uses: actions/github-script@v3
|
||||
with:
|
||||
script: |
|
||||
const body = `Failed to run ${{ steps.command-extractor.outputs.result }}: https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${process.env.GITHUB_RUN_ID}`;
|
||||
await github.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: body
|
||||
});
|
|
@ -15,7 +15,6 @@ scripts/*.patch
|
|||
/src/FSharp.Build/*.resx
|
||||
/src/fsi/*.resx
|
||||
/src/FSharp.Compiler.Interactive.Settings/*.resx
|
||||
/src/FSharp.Compiler.Server.Shared/*.resx
|
||||
/src/fsi/Fsi.sln
|
||||
/src/FSharp.Build/*.resources
|
||||
/src/Compiler/*.resx
|
||||
|
@ -125,3 +124,4 @@ nCrunchTemp_*
|
|||
/test.fsx
|
||||
|
||||
tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstandard.actual
|
||||
*.vsp
|
||||
|
|
|
@ -3,21 +3,30 @@
|
|||
"version": "0.2.0",
|
||||
"inputs": [
|
||||
{
|
||||
"id": "argsPrompt",
|
||||
"id": "fscArgsPrompt",
|
||||
"description": "Enter arguments for fsc",
|
||||
"default": "",
|
||||
"type": "promptString",
|
||||
},
|
||||
{
|
||||
"id": "fsiArgsPrompt",
|
||||
"description": "Enter arguments for fsi (optional)",
|
||||
"default": "",
|
||||
"type": "promptString",
|
||||
}
|
||||
],
|
||||
"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?
|
||||
// "preLaunchTask": "Build (Debug)",
|
||||
// If you have changed target frameworks, make sure to update the program p
|
||||
"program": "${workspaceFolder}/artifacts/bin/fsi/Debug/net7.0/fsi.dll",
|
||||
"args": [
|
||||
"${input:fsiArgsPrompt}"
|
||||
],
|
||||
"cwd": "${workspaceFolder}/src",
|
||||
"console": "integratedTerminal", // This is the default to be able to run in Codespaces.
|
||||
"internalConsoleOptions": "neverOpen",
|
||||
|
@ -36,7 +45,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?
|
||||
|
@ -44,7 +53,7 @@
|
|||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/artifacts/bin/fsc/Debug/net7.0/fsc.dll",
|
||||
"args": [
|
||||
"${input:argsPrompt}"
|
||||
"${input:fscArgsPrompt}"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"console": "integratedTerminal", // This is the default to be able to run in Codespaces.
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
},
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Build (Debug)",
|
||||
"label": "Full Build (Debug)",
|
||||
"command": "./build.sh",
|
||||
"type": "shell",
|
||||
"args": [
|
||||
|
@ -23,12 +23,16 @@
|
|||
],
|
||||
"windows": {
|
||||
"command": "${workspaceFolder}/Build.cmd",
|
||||
"args": [
|
||||
"-c Debug",
|
||||
"-noVisualStudio"
|
||||
],
|
||||
},
|
||||
"problemMatcher": "$msCompile",
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "Build (Release)",
|
||||
"label": "Full Build (Release)",
|
||||
"command": "./build.sh",
|
||||
"type": "shell",
|
||||
"args": [
|
||||
|
@ -36,10 +40,27 @@
|
|||
],
|
||||
"windows": {
|
||||
"command": "${workspaceFolder}/Build.cmd",
|
||||
"args": [
|
||||
"-c Release",
|
||||
"-noVisualStudio"
|
||||
],
|
||||
},
|
||||
"problemMatcher": "$msCompile",
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "Rebuild (Debug)",
|
||||
"command": "dotnet",
|
||||
"type": "shell",
|
||||
"args": [
|
||||
"build",
|
||||
"-c",
|
||||
"Debug",
|
||||
"${workspaceFolder}/FSharp.sln"
|
||||
],
|
||||
"problemMatcher": "$msCompile",
|
||||
"group": "build",
|
||||
},
|
||||
{
|
||||
"label": "Update xlf files",
|
||||
"command": "./build.sh",
|
||||
|
|
|
@ -44,12 +44,12 @@ This will update your fork with the latest from `dotnet/fsharp` on your machine
|
|||
|
||||
## Developing on Windows
|
||||
|
||||
Install the latest released [Visual Studio](https://www.visualstudio.com/downloads/), as that is what the `main` branch's tools are synced with. Select the following workloads:
|
||||
Install the latest released [Visual Studio](https://visualstudio.microsoft.com/vs/preview/) preview, as that is what the `main` branch's tools are synced with. Select the following workloads:
|
||||
|
||||
* .NET desktop development (also check F# desktop support, as this will install some legacy templates)
|
||||
* Visual Studio extension development
|
||||
|
||||
You will also need the latest .NET 6 SDK installed from [here](https://dotnet.microsoft.com/download/dotnet/6.0).
|
||||
You will also need the latest .NET 7 SDK installed from [here](https://dotnet.microsoft.com/download/dotnet/7.0).
|
||||
|
||||
Building is simple:
|
||||
|
||||
|
@ -73,10 +73,10 @@ If you don't have everything installed yet, you'll get prompted by Visual Studio
|
|||
|
||||
If you are just developing the core compiler and library then building ``FSharp.sln`` will be enough.
|
||||
|
||||
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:
|
||||
We recommend installing the latest Visual Studio preview and using that if you are on Windows. However, if you prefer not to do that, you will need to install the following:
|
||||
|
||||
* [.NET Framework 4.7.2](https://dotnet.microsoft.com/download/dotnet-framework/net472)
|
||||
* [.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0)
|
||||
* [.NET 7](https://dotnet.microsoft.com/download/dotnet/7.0)
|
||||
|
||||
You'll need to pass an additional flag to the build script:
|
||||
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.1.32113.165
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Editor.Tests", "vsintegration\tests\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj", "{321F47BC-8148-4C8D-B340-08B7BF07D31D}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Service", "src\Compiler\FSharp.Compiler.Service.fsproj", "{AD603EF2-FAC6-48D1-AAEB-A6CF898062A9}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Core", "src\FSharp.Core\FSharp.Core.fsproj", "{67DA0BF3-AAD3-47F4-9EC6-AD8EC532B5A9}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.DependencyManager.Nuget", "src\FSharp.DependencyManager.Nuget\FSharp.DependencyManager.Nuget.fsproj", "{24399E68-9000-4556-BDDD-8D74A9660D28}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Editor", "vsintegration\src\FSharp.Editor\FSharp.Editor.fsproj", "{86E148BE-92C8-47CC-A070-11D769C6D898}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FSharp.PatternMatcher", "vsintegration\src\FSharp.PatternMatcher\FSharp.PatternMatcher.csproj", "{4FFA5E03-4128-48C9-8FCD-D7C60729ED74}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FSharp.UIResources", "vsintegration\src\FSharp.UIResources\FSharp.UIResources.csproj", "{DA9495E6-BEAA-42A4-AD3B-170D2005AF4B}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.VS.FSI", "vsintegration\src\FSharp.VS.FSI\FSharp.VS.FSI.fsproj", "{EAC029EB-4A8F-4966-9B38-60D73D8E20D1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Proto|Any CPU = Proto|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{321F47BC-8148-4C8D-B340-08B7BF07D31D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{321F47BC-8148-4C8D-B340-08B7BF07D31D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{321F47BC-8148-4C8D-B340-08B7BF07D31D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{321F47BC-8148-4C8D-B340-08B7BF07D31D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{321F47BC-8148-4C8D-B340-08B7BF07D31D}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AD603EF2-FAC6-48D1-AAEB-A6CF898062A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AD603EF2-FAC6-48D1-AAEB-A6CF898062A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AD603EF2-FAC6-48D1-AAEB-A6CF898062A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AD603EF2-FAC6-48D1-AAEB-A6CF898062A9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AD603EF2-FAC6-48D1-AAEB-A6CF898062A9}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{67DA0BF3-AAD3-47F4-9EC6-AD8EC532B5A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{67DA0BF3-AAD3-47F4-9EC6-AD8EC532B5A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{67DA0BF3-AAD3-47F4-9EC6-AD8EC532B5A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{67DA0BF3-AAD3-47F4-9EC6-AD8EC532B5A9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{67DA0BF3-AAD3-47F4-9EC6-AD8EC532B5A9}.Proto|Any CPU.ActiveCfg = Proto|Any CPU
|
||||
{67DA0BF3-AAD3-47F4-9EC6-AD8EC532B5A9}.Proto|Any CPU.Build.0 = Proto|Any CPU
|
||||
{24399E68-9000-4556-BDDD-8D74A9660D28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{24399E68-9000-4556-BDDD-8D74A9660D28}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{24399E68-9000-4556-BDDD-8D74A9660D28}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{24399E68-9000-4556-BDDD-8D74A9660D28}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{24399E68-9000-4556-BDDD-8D74A9660D28}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{86E148BE-92C8-47CC-A070-11D769C6D898}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{86E148BE-92C8-47CC-A070-11D769C6D898}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{86E148BE-92C8-47CC-A070-11D769C6D898}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{86E148BE-92C8-47CC-A070-11D769C6D898}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{86E148BE-92C8-47CC-A070-11D769C6D898}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4FFA5E03-4128-48C9-8FCD-D7C60729ED74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4FFA5E03-4128-48C9-8FCD-D7C60729ED74}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4FFA5E03-4128-48C9-8FCD-D7C60729ED74}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4FFA5E03-4128-48C9-8FCD-D7C60729ED74}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4FFA5E03-4128-48C9-8FCD-D7C60729ED74}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DA9495E6-BEAA-42A4-AD3B-170D2005AF4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DA9495E6-BEAA-42A4-AD3B-170D2005AF4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DA9495E6-BEAA-42A4-AD3B-170D2005AF4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DA9495E6-BEAA-42A4-AD3B-170D2005AF4B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DA9495E6-BEAA-42A4-AD3B-170D2005AF4B}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EAC029EB-4A8F-4966-9B38-60D73D8E20D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EAC029EB-4A8F-4966-9B38-60D73D8E20D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EAC029EB-4A8F-4966-9B38-60D73D8E20D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EAC029EB-4A8F-4966-9B38-60D73D8E20D1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EAC029EB-4A8F-4966-9B38-60D73D8E20D1}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {68ED1BEB-EB1D-4334-A708-988D54C83B66}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -14,4 +14,8 @@
|
|||
</Otherwise>
|
||||
</Choose>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Override the setting for the Arcade UserRuntimeConfig for fsc on .NET Core -->
|
||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
20
FSharp.sln
20
FSharp.sln
|
@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.1.32113.165
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Server.Shared", "src\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj", "{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}"
|
||||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Core", "src\FSharp.Core\FSharp.Core.fsproj", "{DED3BBD7-53F4-428A-8C9F-27968E768605}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}"
|
||||
|
@ -98,9 +96,10 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiAnyCpu", "src\fsi\fsiAny
|
|||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiArm64", "src\fsi\fsiArm64Project\fsiArm64.fsproj", "{209C7D37-8C01-413C-8698-EC25F4C86976}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HistoricalBenchmark", "tests\benchmarks\FCSBenchmarks\BenchmarkComparison\HistoricalBenchmark.fsproj", "{BEC6E796-7E53-4888-AAFC-B8FD55C425DF}"
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "HistoricalBenchmark", "tests\benchmarks\FCSBenchmarks\BenchmarkComparison\HistoricalBenchmark.fsproj", "{BEC6E796-7E53-4888-AAFC-B8FD55C425DF}"
|
||||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Benchmarks", "tests\benchmarks\FCSBenchmarks\CompilerServiceBenchmarks\FSharp.Compiler.Benchmarks.fsproj", "{9C7523BA-7AB2-4604-A5FD-653E82C2BAD1}"
|
||||
EndProject
|
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Benchmarks", "tests\benchmarks\FCSBenchmarks\CompilerServiceBenchmarks\FSharp.Compiler.Benchmarks.fsproj", "{9C7523BA-7AB2-4604-A5FD-653E82C2BAD1}"
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D58BFE8B-7C85-4D3B-B5F3-9A7BB90FF1EE}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
src\Compiler\FSComp.txt = src\Compiler\FSComp.txt
|
||||
|
@ -116,18 +115,6 @@ Global
|
|||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.Build.0 = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|x86.ActiveCfg = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|x86.Build.0 = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|x86.Build.0 = Release|Any CPU
|
||||
{DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
|
@ -433,7 +420,6 @@ Global
|
|||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06} = {B8DDA694-7939-42E3-95E5-265C2217C142}
|
||||
{DED3BBD7-53F4-428A-8C9F-27968E768605} = {3058BC79-8E79-4645-B05D-48CC182FA8A6}
|
||||
{702A7979-BCF9-4C41-853E-3ADFC9897890} = {B8DDA694-7939-42E3-95E5-265C2217C142}
|
||||
{649FA588-F02E-457C-9FCF-87E46407481E} = {B8DDA694-7939-42E3-95E5-265C2217C142}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
<OtherFlags>$(OtherFlags) --nowarn:3384</OtherFlags>
|
||||
<OtherFlags>$(OtherFlags) --times --nowarn:75</OtherFlags>
|
||||
<OtherFlags Condition="$(ParallelCheckingWithSignatureFilesOn) == 'true'">$(OtherFlags) --test:ParallelCheckingWithSignatureFilesOn</OtherFlags>
|
||||
<OtherFlags Condition="$(AdditionalFscCmdFlags) != ''">$(OtherFlags) $(AdditionalFscCmdFlags)</OtherFlags>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- nuget -->
|
||||
|
|
|
@ -66,8 +66,13 @@ Update the `insertTargetBranch` value at the bottom of `azure-pipelines.yml` in
|
|||
### When VS `main` is open for insertions for preview releases of VS:
|
||||
|
||||
1. Create a new `release/dev*` branch (e.g., `release/dev17.4`) and initially set its HEAD commit to that of the previous release (e.g., `release/dev17.3` in this case).
|
||||
2. Set the new branch to receive auto-merges from `main`, and also set the old release branch to flow into the new one. [This PR](https://github.com/dotnet/roslyn-tools/pull/1245/files) is a good example of what to do when a new `release/dev17.4` branch is created that should receive merges from both `main` and the previous release branch, `release/dev17.3`.
|
||||
3. Set the packages from the new branch to flow into the correct package feeds via the `darc` tool. To do this:
|
||||
```console
|
||||
git checkout -b release/dev17.4
|
||||
git reset --hard upstream/release/dev17.3
|
||||
git push --set-upstream upstream release/dev17.4
|
||||
```
|
||||
3. Set the new branch to receive auto-merges from `main`, and also set the old release branch to flow into the new one. [This PR](https://github.com/dotnet/roslyn-tools/pull/1245/files) is a good example of what to do when a new `release/dev17.4` branch is created that should receive merges from both `main` and the previous release branch, `release/dev17.3`.
|
||||
4. Set the packages from the new branch to flow into the correct package feeds via the `darc` tool. To do this:
|
||||
1. Ensure the latest `darc` tool is installed by running `eng/common/darc-init.ps1`.
|
||||
2. (only needed once) Run the command `darc authenticate`. A text file will be opened with instructions on how to populate access tokens.
|
||||
3. Check the current package/channel subscriptions by running `darc get-default-channels --source-repo fsharp`. For this example, notice that the latest subscription shows the F# branch `release/dev17.3` is getting added to the `VS 17.3` channel.
|
||||
|
|
11
README.md
11
README.md
|
@ -1,8 +1,11 @@
|
|||
# The F# compiler, F# core library, and F# editor tools
|
||||
[![Build Status](https://dev.azure.com/dnceng-public/public/_apis/build/status/dotnet/fsharp/fsharp-ci?branchName=main)](https://dev.azure.com/dnceng-public/public/_build/latest?definitionId=90&branchName=main)
|
||||
[![Help Wanted](https://img.shields.io/github/issues/dotnet/fsharp/help%20wanted?style=flat-square&color=%232EA043&label=help%20wanted)](https://github.com/dotnet/fsharp/labels/help%20wanted)
|
||||
|
||||
|
||||
You're invited to contribute to future releases of the F# compiler, core library, and tools. Development of this repository can be done on any OS supported by [.NET](https://dotnet.microsoft.com/).
|
||||
|
||||
You will also need the latest .NET 6 SDK installed from [here](https://dotnet.microsoft.com/download/dotnet/6.0).
|
||||
You will also need the latest .NET 7 SDK installed from [here](https://dotnet.microsoft.com/download/dotnet/7.0).
|
||||
|
||||
## Contributing
|
||||
|
||||
|
@ -54,12 +57,6 @@ After it's finished, open `FSharp.sln` in your editor of choice.
|
|||
|
||||
Even if you find a single-character typo, we're happy to take the change! Although the codebase can feel daunting for beginners, we and other contributors are happy to help you along.
|
||||
|
||||
## Build Status
|
||||
|
||||
| Branch | Status |
|
||||
|:------:|:------:|
|
||||
|main|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/fsharp/fsharp-ci?branchName=main)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=496&branchName=main)|
|
||||
|
||||
## Per-build NuGet packages
|
||||
|
||||
Per-build [versions](https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-tools&view=versions&package=FSharp.Compiler.Service&protocolType=NuGet) of our NuGet packages are available via this URL: `https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json`
|
||||
|
|
|
@ -106,8 +106,9 @@ The F# tests are split as follows:
|
|||
|
||||
* [FSharp.Compiler.ComponentTests](tests/FSharp.Compiler.ComponentTests) - Validation of compiler APIs.
|
||||
|
||||
* [VisualFSharp.UnitTests](vsintegration/tests/unittests) - Visual F# Tools IDE Unit Test Suite
|
||||
This suite exercises a wide range of behaviors in the F# Visual Studio project system and language service.
|
||||
* [VisualFSharp.UnitTests](vsintegration/tests/unittests) - Validation of a wide range of behaviors in the F# Visual Studio project system and language service (including the legacy one).
|
||||
|
||||
* [FSharp.Editor.Tests](vsintegration/tests/FSharp.Editor.Tests) - Visual F# Tools IDE Test Suite.
|
||||
|
||||
### FSharp Suite
|
||||
|
||||
|
@ -148,9 +149,9 @@ Tags are in the left column, paths to to corresponding test folders are in the r
|
|||
|
||||
If you want to re-run a particular test area, the easiest way to do so is to set a temporary tag for that area in test.lst (e.g. "RERUN") and adjust `ttags` [run.fsharpqa.test.fsx script](tests/fsharpqa/run.fsharpqa.test.fsx) and run it.
|
||||
|
||||
### FSharp.Compiler.UnitTests, FSharp.Core.UnitTests, VisualFSharp.UnitTests
|
||||
### FSharp.Compiler.UnitTests, FSharp.Core.UnitTests, VisualFSharp.UnitTests, FSharp.Editor.Tests
|
||||
|
||||
These are all NUnit tests. You can execute these tests individually via the Visual Studio NUnit3 runner
|
||||
These are all currently NUnit tests (we hope to migrate them to xUnit). You can execute these tests individually via the Visual Studio NUnit3 runner
|
||||
extension or the command line via `nunit3-console.exe`.
|
||||
|
||||
Note that for compatibility reasons, the IDE unit tests should be run in a 32-bit process,
|
||||
|
|
|
@ -33,8 +33,6 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.VS.FSI", "vsintegrat
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualFSharpFull", "vsintegration\Vsix\VisualFSharpFull\VisualFSharpFull.csproj", "{59ADCE46-9740-4079-834D-9A03A3494EBC}"
|
||||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Server.Shared", "src\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj", "{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}"
|
||||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Core", "src\FSharp.Core\FSharp.Core.fsproj", "{DED3BBD7-53F4-428A-8C9F-27968E768605}"
|
||||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.LanguageService", "vsintegration\src\FSharp.LanguageService\FSharp.LanguageService.fsproj", "{EE85AAB7-CDA0-4C4E-BDA0-A64CCC413E3F}"
|
||||
|
@ -184,7 +182,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
|
||||
|
@ -193,6 +191,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FCSBenchmarks", "FCSBenchma
|
|||
tests\benchmarks\FCSBenchmarks\SmokeTestAllBenchmarks.ps1 = tests\benchmarks\FCSBenchmarks\SmokeTestAllBenchmarks.ps1
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Fsharp.ProfilingStartpointProject", "tests\benchmarks\Fsharp.ProfilingStartpointProject\Fsharp.ProfilingStartpointProject.fsproj", "{FE23BB65-276A-4E41-8CC7-F7752241DEBA}"
|
||||
EndProject
|
||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Editor.Tests", "vsintegration\tests\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj", "{CBC96CC7-65AB-46EA-A82E-F6A788DABF80}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -227,18 +229,6 @@ Global
|
|||
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|x86.Build.0 = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.Build.0 = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|x86.ActiveCfg = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|x86.Build.0 = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|x86.Build.0 = Release|Any CPU
|
||||
{DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
|
@ -1019,6 +1009,30 @@ 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
|
||||
{CBC96CC7-65AB-46EA-A82E-F6A788DABF80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CBC96CC7-65AB-46EA-A82E-F6A788DABF80}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CBC96CC7-65AB-46EA-A82E-F6A788DABF80}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{CBC96CC7-65AB-46EA-A82E-F6A788DABF80}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{CBC96CC7-65AB-46EA-A82E-F6A788DABF80}.Proto|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CBC96CC7-65AB-46EA-A82E-F6A788DABF80}.Proto|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CBC96CC7-65AB-46EA-A82E-F6A788DABF80}.Proto|x86.ActiveCfg = Debug|Any CPU
|
||||
{CBC96CC7-65AB-46EA-A82E-F6A788DABF80}.Proto|x86.Build.0 = Debug|Any CPU
|
||||
{CBC96CC7-65AB-46EA-A82E-F6A788DABF80}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CBC96CC7-65AB-46EA-A82E-F6A788DABF80}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CBC96CC7-65AB-46EA-A82E-F6A788DABF80}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{CBC96CC7-65AB-46EA-A82E-F6A788DABF80}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -1031,7 +1045,6 @@ Global
|
|||
{CCAB6E50-34C6-42AF-A6B0-567C29FCD91B} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
|
||||
{991DCF75-C2EB-42B6-9A0D-AA1D2409D519} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
|
||||
{59ADCE46-9740-4079-834D-9A03A3494EBC} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
|
||||
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06} = {B8DDA694-7939-42E3-95E5-265C2217C142}
|
||||
{DED3BBD7-53F4-428A-8C9F-27968E768605} = {3058BC79-8E79-4645-B05D-48CC182FA8A6}
|
||||
{EE85AAB7-CDA0-4C4E-BDA0-A64CCC413E3F} = {CCAB6E50-34C6-42AF-A6B0-567C29FCD91B}
|
||||
{1C5C163C-37EA-4A3C-8CCC-0D34B74BF8EF} = {CCAB6E50-34C6-42AF-A6B0-567C29FCD91B}
|
||||
|
@ -1089,6 +1102,7 @@ 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}
|
||||
|
@ -1096,9 +1110,10 @@ Global
|
|||
{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}
|
||||
{CBC96CC7-65AB-46EA-A82E-F6A788DABF80} = {F7876C9B-FB6A-4EFB-B058-D6967DB75FB2}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {48EDBBBE-C8EE-4E3C-8B19-97184A487B37}
|
||||
|
|
|
@ -86,11 +86,11 @@ stages:
|
|||
# Signed build #
|
||||
#-------------------------------------------------------------------------------------------------------------------#
|
||||
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
|
||||
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/dev17.4') }}:
|
||||
- ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/release/dev17.5') }}:
|
||||
- template: /eng/common/templates/job/onelocbuild.yml
|
||||
parameters:
|
||||
MirrorRepo: fsharp
|
||||
MirrorBranch: release/dev17.4
|
||||
MirrorBranch: release/dev17.5
|
||||
LclSource: lclFilesfromPackage
|
||||
LclPackageId: 'LCL-JUNO-PROD-FSHARP'
|
||||
- template: /eng/common/templates/jobs/jobs.yml
|
||||
|
@ -120,6 +120,7 @@ stages:
|
|||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
- template: /eng/restore-internal-tools.yml
|
||||
- script: eng\CIBuild.cmd
|
||||
-configuration $(_BuildConfig)
|
||||
-prepareMachine
|
||||
|
@ -140,6 +141,7 @@ stages:
|
|||
/p:OfficialBuildId=$(BUILD.BUILDNUMBER)
|
||||
/p:PublishToSymbolServer=true
|
||||
/p:VisualStudioDropName=$(VisualStudioDropName)
|
||||
/p:GenerateSbom=true
|
||||
- script: .\tests\EndToEndBuildTests\EndToEndBuildTests.cmd -c $(_BuildConfig)
|
||||
displayName: End to end build tests
|
||||
- task: PublishTestResults@2
|
||||
|
@ -262,6 +264,38 @@ stages:
|
|||
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
|
||||
displayName: Check code formatting (run 'dotnet fantomas src -r' to fix)
|
||||
|
||||
# Check whether package with current version has been published to nuget.org
|
||||
# We will try to restore both FSharp.Core and FCS and if restore is _successful_, package version needs to be bumped.
|
||||
# NOTE: This CI check should only run on the release branches.
|
||||
- job: Check_Published_Package_Versions
|
||||
condition: or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), or(startsWith(variables['System.PullRequest.SourceBranch'], 'release/dev'), startsWith(variables['System.PullRequest.TargetBranch'], 'release/dev')))
|
||||
pool:
|
||||
vmImage: $(UbuntuMachineQueueName)
|
||||
strategy:
|
||||
maxParallel: 2
|
||||
matrix:
|
||||
FCS:
|
||||
_project: "FSharp.Compiler.Service_notshipped.fsproj"
|
||||
FSCore:
|
||||
_project: "FSharp.Core_notshipped.fsproj"
|
||||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
- task: UseDotNet@2
|
||||
displayName: install SDK
|
||||
inputs:
|
||||
packageType: sdk
|
||||
useGlobalJson: true
|
||||
includePreviewVersions: true
|
||||
workingDirectory: $(Build.SourcesDirectory)
|
||||
installationPath: $(Agent.ToolsDirectory)/dotnet
|
||||
- pwsh: ./check.ps1 -project $(_project)
|
||||
workingDirectory: $(Build.SourcesDirectory)/buildtools/checkpackages
|
||||
env:
|
||||
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
|
||||
displayName: Check published package version
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------------------------------------------#
|
||||
# PR builds #
|
||||
#-------------------------------------------------------------------------------------------------------------------#
|
||||
|
@ -729,9 +763,8 @@ stages:
|
|||
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
|
||||
- template: eng/release/insert-into-vs.yml
|
||||
parameters:
|
||||
componentBranchName: refs/heads/release/dev17.4
|
||||
insertTargetBranch: rel/d17.4
|
||||
|
||||
componentBranchName: refs/heads/release/dev17.5
|
||||
insertTargetBranch: rel/d17.5
|
||||
insertTeamEmail: fsharpteam@microsoft.com
|
||||
insertTeamName: 'F#'
|
||||
completeInsertion: 'auto'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
<Project>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -20,4 +20,12 @@
|
|||
<PackageReference Include="FSharp.Compiler.Service" Version="[$(FSharpCompilerServicePackageVersion)]" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="WritePackageVersion" BeforeTargets="Restore">
|
||||
<WriteLinesToFile
|
||||
File="Version.txt"
|
||||
Lines="FSharp.Compiler.Service=$(FSharpCompilerServicePackageVersion)"
|
||||
Overwrite="true"
|
||||
Encoding="Unicode"/>
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -14,4 +14,12 @@
|
|||
<PackageReference Include="FSharp.Core" Version="[$(FSCorePackageVersionValue)]" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="WritePackageVersion" BeforeTargets="Restore">
|
||||
<WriteLinesToFile
|
||||
File="Version.txt"
|
||||
Lines="FSharp.Core=$(FSCorePackageVersionValue)"
|
||||
Overwrite="true"
|
||||
Encoding="Unicode"/>
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# ENTRY POINT MAIN()
|
||||
Param(
|
||||
[Parameter(Mandatory=$True)]
|
||||
[String] $project
|
||||
)
|
||||
& dotnet restore $project 2>$null
|
||||
|
||||
if ($LASTEXITCODE -eq 0)
|
||||
{
|
||||
$package = Get-Content -Path .\Version.txt
|
||||
Write-Error "
|
||||
Package restore succeded for '${package}', expected to fail.
|
||||
This usually means that the package has been already published.
|
||||
Please, bump the version to fix this failure." -ErrorAction Stop
|
||||
} else {
|
||||
exit 0
|
||||
}
|
|
@ -42,7 +42,6 @@ Most of the syntax operations require an entire document's source text or parse
|
|||
|---------|---------------|---------------|-----------------|
|
||||
| Most code fixes | Current document's typecheck data | Set (1 or more) of suggested text replacements | S-M |
|
||||
| Semantic classification | Current document's typecheck data | Spans of text with semantic classification type for all constructs in a document | S-L |
|
||||
| Code lenses | Current document's typecheck data and top-level declarations (for showing signatures); graph of all projects that reference the current one (for showing references) | Signature data for each top-level construct; spans of text for each reference to a top-level construct with navigation information | S-XL |
|
||||
| Code generation / refactorings | Current document's typecheck data and/or current resolved symbol/symbols | Text replacement(s) | S-L |
|
||||
| Code completion | Current document's typecheck data and currently-resolved symbol user is typing at | List of all symbols in scope that are "completable" based on where completion is invoked | S-L |
|
||||
| Editor tooltips | Current document's typecheck data and resolved symbol where user invoked a tooltip | F# tooltip data based on inspecting a type and its declarations, then pretty-printing them | S-XL |
|
||||
|
|
|
@ -45,6 +45,7 @@ param (
|
|||
[switch]$deployExtensions,
|
||||
[switch]$prepareMachine,
|
||||
[switch]$useGlobalNuGetCache = $true,
|
||||
[switch]$dontUseGlobalNuGetCache = $false,
|
||||
[switch]$warnAsError = $true,
|
||||
[switch][Alias('test')]$testDesktop,
|
||||
[switch]$testCoreClr,
|
||||
|
@ -113,7 +114,7 @@ function Print-Usage() {
|
|||
Write-Host " -msbuildEngine <value> Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)."
|
||||
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 " -dontUseGlobalNuGetCache Do not use the 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 " -sourceBuild Simulate building for source-build."
|
||||
Write-Host " -skipbuild Skip building product"
|
||||
|
@ -131,6 +132,10 @@ function Process-Arguments() {
|
|||
exit 0
|
||||
}
|
||||
|
||||
if ($dontUseGlobalNugetCache -or $ci) {
|
||||
$script:useGlobalNugetCache = $False
|
||||
}
|
||||
|
||||
$script:nodeReuse = $False;
|
||||
|
||||
if ($testAll) {
|
||||
|
@ -497,7 +502,10 @@ try {
|
|||
}
|
||||
|
||||
if ($pack) {
|
||||
$properties_storage = $properties
|
||||
$properties += "/p:GenerateSbom=false"
|
||||
BuildSolution "Microsoft.FSharp.Compiler.sln"
|
||||
$properties = $properties_storage
|
||||
}
|
||||
if ($build) {
|
||||
VerifyAssemblyVersionsAndSymbols
|
||||
|
@ -584,6 +592,7 @@ try {
|
|||
|
||||
if ($testVs -and -not $noVisualStudio) {
|
||||
TestUsingNUnit -testProject "$RepoRoot\vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\VisualFSharp.UnitTests\"
|
||||
TestUsingNUnit -testProject "$RepoRoot\vsintegration\tests\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj" -targetFramework $desktopTargetFramework -testadapterpath "$ArtifactsDir\bin\FSharp.Editor.Tests\FSharp.Editor.Tests.fsproj"
|
||||
}
|
||||
|
||||
# verify nupkgs have access to the source code
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
@echo off
|
||||
powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0\common\build.ps1""" -build -restore %*"
|
|
@ -8,14 +8,14 @@
|
|||
</Dependency>
|
||||
</ProductDependencies>
|
||||
<ToolsetDependencies>
|
||||
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.22524.5">
|
||||
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.22554.2">
|
||||
<Uri>https://github.com/dotnet/arcade</Uri>
|
||||
<Sha>c5dd6a1da2e6d9b3423ab809fcda8af2927a408b</Sha>
|
||||
<Sha>80b6be47e1425ea90c5febffac119250043a0c92</Sha>
|
||||
<SourceBuild RepoName="arcade" ManagedOnly="true" />
|
||||
</Dependency>
|
||||
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="8.0.0-beta.22524.5">
|
||||
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="8.0.0-beta.22554.2">
|
||||
<Uri>https://github.com/dotnet/arcade</Uri>
|
||||
<Sha>c5dd6a1da2e6d9b3423ab809fcda8af2927a408b</Sha>
|
||||
<Sha>80b6be47e1425ea90c5febffac119250043a0c92</Sha>
|
||||
</Dependency>
|
||||
</ToolsetDependencies>
|
||||
</Dependencies>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<!-- F# Version components -->
|
||||
<FSMajorVersion>7</FSMajorVersion>
|
||||
<FSMinorVersion>0</FSMinorVersion>
|
||||
<FSBuildVersion>0</FSBuildVersion>
|
||||
<FSBuildVersion>201</FSBuildVersion>
|
||||
<FSRevisionVersion>0</FSRevisionVersion>
|
||||
<!-- -->
|
||||
<!-- F# Language version -->
|
||||
|
@ -31,9 +31,9 @@
|
|||
<FSCoreShippedVersion>6.0.0.0</FSCoreShippedVersion>
|
||||
<!-- -->
|
||||
<!-- FSharp.Compiler.Service version -->
|
||||
<FCSMajorVersion>42</FCSMajorVersion>
|
||||
<FCSMajorVersion>43</FCSMajorVersion>
|
||||
<FCSMinorVersion>7</FCSMinorVersion>
|
||||
<FCSBuildVersion>101</FCSBuildVersion>
|
||||
<FCSBuildVersion>$(FSBuildVersion)</FCSBuildVersion>
|
||||
<FCSRevisionVersion>$(FSRevisionVersion)</FCSRevisionVersion>
|
||||
<FSharpCompilerServicePackageVersion>$(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion)</FSharpCompilerServicePackageVersion>
|
||||
<FSharpCompilerServiceVersion>$(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion).$(FCSRevisionVersion)</FSharpCompilerServiceVersion>
|
||||
|
@ -47,7 +47,8 @@
|
|||
<!-- -->
|
||||
<!-- FSharp tools for Visual Studio version number -->
|
||||
<FSToolsMajorVersion>12</FSToolsMajorVersion>
|
||||
<FSToolsMinorVersion>4</FSToolsMinorVersion>
|
||||
|
||||
<FSToolsMinorVersion>5</FSToolsMinorVersion>
|
||||
<FSToolsBuildVersion>0</FSToolsBuildVersion>
|
||||
<FSToolsRevisionVersion>$(FSRevisionVersion)</FSToolsRevisionVersion>
|
||||
<FSProductVersionPrefix>$(FSToolsMajorVersion).$(FSToolsMinorVersion).$(FSToolsBuildVersion)</FSProductVersionPrefix>
|
||||
|
@ -56,7 +57,7 @@
|
|||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VSMajorVersion>17</VSMajorVersion>
|
||||
<VSMinorVersion>4</VSMinorVersion>
|
||||
<VSMinorVersion>5</VSMinorVersion>
|
||||
<VSGeneralVersion>$(VSMajorVersion).0</VSGeneralVersion>
|
||||
<VSAssemblyVersionPrefix>$(VSMajorVersion).$(VSMinorVersion).0</VSAssemblyVersionPrefix>
|
||||
<VSAssemblyVersion>$(VSAssemblyVersionPrefix).0</VSAssemblyVersion>
|
||||
|
@ -88,6 +89,7 @@
|
|||
<SystemBuffersVersion>4.5.1</SystemBuffersVersion>
|
||||
<SystemCollectionsImmutableVersion>6.0.0</SystemCollectionsImmutableVersion>
|
||||
<MicrosoftDiaSymReaderPortablePdbVersion>1.6.0</MicrosoftDiaSymReaderPortablePdbVersion>
|
||||
<SystemDiagnosticsDiagnosticSourceVersion>6.0.0</SystemDiagnosticsDiagnosticSourceVersion>
|
||||
<SystemMemoryVersion>4.5.5</SystemMemoryVersion>
|
||||
<SystemReflectionEmitVersion>4.7.0</SystemReflectionEmitVersion>
|
||||
<SystemReflectionMetadataVersion>6.0.0</SystemReflectionMetadataVersion>
|
||||
|
@ -95,12 +97,12 @@
|
|||
<SystemRuntimeCompilerServicesUnsafeVersion>6.0.0</SystemRuntimeCompilerServicesUnsafeVersion>
|
||||
<SystemValueTupleVersion>4.5.0</SystemValueTupleVersion>
|
||||
<!-- Versions for package groups -->
|
||||
<RoslynVersion>4.4.0-3.22470.1</RoslynVersion>
|
||||
<VisualStudioEditorPackagesVersion>17.4.196-preview</VisualStudioEditorPackagesVersion>
|
||||
<MicrosoftVisualStudioShellPackagesVersion>17.4.0-preview-3-32916-145</MicrosoftVisualStudioShellPackagesVersion>
|
||||
<VisualStudioProjectSystemPackagesVersion>17.4.342-pre</VisualStudioProjectSystemPackagesVersion>
|
||||
<MicrosoftVisualStudioThreadingPackagesVersion>17.4.23-alpha</MicrosoftVisualStudioThreadingPackagesVersion>
|
||||
<MicrosoftBuildOverallPackagesVersion>17.4.0</MicrosoftBuildOverallPackagesVersion>
|
||||
<RoslynVersion>4.5.0-1.22520.13</RoslynVersion>
|
||||
<VisualStudioEditorPackagesVersion>17.5.49-preview</VisualStudioEditorPackagesVersion>
|
||||
<MicrosoftVisualStudioShellPackagesVersion>17.5.0-preview-1-33020-520</MicrosoftVisualStudioShellPackagesVersion>
|
||||
<VisualStudioProjectSystemPackagesVersion>17.5.202-pre-g89e17c9f72</VisualStudioProjectSystemPackagesVersion>
|
||||
<MicrosoftVisualStudioThreadingPackagesVersion>17.4.27</MicrosoftVisualStudioThreadingPackagesVersion>
|
||||
<MicrosoftBuildOverallPackagesVersion>17.4.0-preview-22469-04</MicrosoftBuildOverallPackagesVersion>
|
||||
<!-- Roslyn packages -->
|
||||
<MicrosoftCodeAnalysisEditorFeaturesVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesVersion>
|
||||
<MicrosoftCodeAnalysisEditorFeaturesTextVersion>$(RoslynVersion)</MicrosoftCodeAnalysisEditorFeaturesTextVersion>
|
||||
|
@ -114,7 +116,7 @@
|
|||
<!-- Visual Studio Shell packages -->
|
||||
<MicrosoftVisualStudioInteropVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioInteropVersion>
|
||||
<MicrosoftInternalVisualStudioInteropVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftInternalVisualStudioInteropVersion>
|
||||
<MicrosoftVisualStudioImagingInterop140DesignTimeVersion>17.4.0-preview-3-32916-053</MicrosoftVisualStudioImagingInterop140DesignTimeVersion>
|
||||
<MicrosoftVisualStudioImagingInterop140DesignTimeVersion>17.5.0-preview-1-33019-447</MicrosoftVisualStudioImagingInterop140DesignTimeVersion>
|
||||
<MicrosoftVisualStudioShellInterop80Version>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShellInterop80Version>
|
||||
<MicrosoftVisualStudioShellInterop90Version>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShellInterop90Version>
|
||||
<MicrosoftVisualStudioShellInterop100Version>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShellInterop100Version>
|
||||
|
@ -131,8 +133,8 @@
|
|||
<MicrosoftVisualStudioShellDesignVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShellDesignVersion>
|
||||
<MicrosoftVisualStudioShellFrameworkVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShellFrameworkVersion>
|
||||
<MicrosoftVisualStudioPackageLanguageService150Version>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioPackageLanguageService150Version>
|
||||
<MicrosoftVisualStudioManagedInterfacesVersion>17.4.0-preview-3-32916-053</MicrosoftVisualStudioManagedInterfacesVersion>
|
||||
<MicrosoftVisualStudioProjectAggregatorVersion>17.4.0-preview-3-32916-053</MicrosoftVisualStudioProjectAggregatorVersion>
|
||||
<MicrosoftVisualStudioManagedInterfacesVersion>17.5.0-preview-1-33019-447</MicrosoftVisualStudioManagedInterfacesVersion>
|
||||
<MicrosoftVisualStudioProjectAggregatorVersion>17.5.0-preview-1-33019-447</MicrosoftVisualStudioProjectAggregatorVersion>
|
||||
<MicrosoftVisualStudioGraphModelVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioGraphModelVersion>
|
||||
<MicrosoftVisualStudioImagingVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioImagingVersion>
|
||||
<MicrosoftVisualStudioDesignerInterfacesVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioDesignerInterfacesVersion>
|
||||
|
@ -169,7 +171,7 @@
|
|||
<MicrosoftVisualStudioProjectSystemManagedVersion>2.3.6152103</MicrosoftVisualStudioProjectSystemManagedVersion>
|
||||
<!-- Misc. Visual Studio packages -->
|
||||
<MicrosoftVSSDKBuildToolsVersion>17.1.4054</MicrosoftVSSDKBuildToolsVersion>
|
||||
<MicrosoftVisualStudioRpcContractsVersion>17.4.7-alpha</MicrosoftVisualStudioRpcContractsVersion>
|
||||
<MicrosoftVisualStudioRpcContractsVersion>17.5.9-alpha-g84529e7115</MicrosoftVisualStudioRpcContractsVersion>
|
||||
<MicrosoftVisualFSharpMicrosoftVisualStudioShellUIInternalVersion>17.0.0</MicrosoftVisualFSharpMicrosoftVisualStudioShellUIInternalVersion>
|
||||
<MicrosoftVisualStudioValidationVersion>17.0.64</MicrosoftVisualStudioValidationVersion>
|
||||
<MicrosoftVisualStudioWCFReferenceInteropVersion>9.0.30729</MicrosoftVisualStudioWCFReferenceInteropVersion>
|
||||
|
@ -196,14 +198,14 @@
|
|||
<MicrosoftNETCoreILAsmVersion>5.0.0-preview.7.20364.11</MicrosoftNETCoreILAsmVersion>
|
||||
<MicrosoftNETTestSdkVersion>16.11.0</MicrosoftNETTestSdkVersion>
|
||||
<MicrosoftWin32RegistryVersion>5.0.0</MicrosoftWin32RegistryVersion>
|
||||
<NewtonsoftJsonVersion>13.0.1</NewtonsoftJsonVersion>
|
||||
<NewtonsoftJsonVersion>13.0.2</NewtonsoftJsonVersion>
|
||||
<NUnitVersion>3.13.2</NUnitVersion>
|
||||
<NUnit3TestAdapterVersion>4.1.0</NUnit3TestAdapterVersion>
|
||||
<NUnitLiteVersion>3.11.0</NUnitLiteVersion>
|
||||
<NunitXmlTestLoggerVersion>2.1.80</NunitXmlTestLoggerVersion>
|
||||
<RoslynToolsSignToolVersion>1.0.0-beta2-dev3</RoslynToolsSignToolVersion>
|
||||
<StreamJsonRpcVersion>2.13.23-alpha</StreamJsonRpcVersion>
|
||||
<NerdbankStreamsVersion>2.9.87-alpha</NerdbankStreamsVersion>
|
||||
<StreamJsonRpcVersion>2.14.6-alpha</StreamJsonRpcVersion>
|
||||
<NerdbankStreamsVersion>2.9.112</NerdbankStreamsVersion>
|
||||
<XUnitVersion>2.4.1</XUnitVersion>
|
||||
<XUnitRunnerVersion>2.4.2</XUnitRunnerVersion>
|
||||
<FluentAssertionsVersion>5.10.3</FluentAssertionsVersion>
|
||||
|
|
|
@ -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'
|
|
@ -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();
|
|
@ -64,7 +64,7 @@ try {
|
|||
$GlobalJson.tools | Add-Member -Name "vs" -Value (ConvertFrom-Json "{ `"version`": `"16.5`" }") -MemberType NoteProperty
|
||||
}
|
||||
if( -not ($GlobalJson.tools.PSObject.Properties.Name -match "xcopy-msbuild" )) {
|
||||
$GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.2.1" -MemberType NoteProperty
|
||||
$GlobalJson.tools | Add-Member -Name "xcopy-msbuild" -Value "17.3.1" -MemberType NoteProperty
|
||||
}
|
||||
if ($GlobalJson.tools."xcopy-msbuild".Trim() -ine "none") {
|
||||
$xcopyMSBuildToolsFolder = InitializeXCopyMSBuild $GlobalJson.tools."xcopy-msbuild" -install $true
|
||||
|
|
|
@ -365,8 +365,8 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
|
|||
|
||||
# If the version of msbuild is going to be xcopied,
|
||||
# use this version. Version matches a package here:
|
||||
# https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-eng&package=RoslynTools.MSBuild&protocolType=NuGet&version=17.2.1&view=overview
|
||||
$defaultXCopyMSBuildVersion = '17.2.1'
|
||||
# https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-eng&package=RoslynTools.MSBuild&protocolType=NuGet&version=17.3.1view=overview
|
||||
$defaultXCopyMSBuildVersion = '17.3.1'
|
||||
|
||||
if (!$vsRequirements) {
|
||||
if (Get-Member -InputObject $GlobalJson.tools -Name 'vs') {
|
||||
|
|
|
@ -521,7 +521,7 @@ global_json_file="${repo_root}global.json"
|
|||
# determine if global.json contains a "runtimes" entry
|
||||
global_json_has_runtimes=false
|
||||
if command -v jq &> /dev/null; then
|
||||
if jq -er '. | select(has("runtimes"))' "$global_json_file" &> /dev/null; then
|
||||
if jq -e '.tools | has("runtimes")' "$global_json_file" &> /dev/null; then
|
||||
global_json_has_runtimes=true
|
||||
fi
|
||||
elif [[ "$(cat "$global_json_file")" =~ \"runtimes\"[[:space:]\:]*\{ ]]; then
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
steps:
|
||||
- task: NuGetAuthenticate@0
|
||||
inputs:
|
||||
nuGetServiceConnections: 'devdiv/dotnet-core-internal-tooling'
|
||||
forceReinstallCredentialProvider: true
|
||||
|
||||
- script: $(Build.SourcesDirectory)\eng\RestoreInternal.cmd
|
||||
-ci
|
||||
-projects $(Build.SourcesDirectory)/eng/common/internal/Tools.csproj
|
||||
/bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/RestoreInternal.binlog
|
||||
/v:normal
|
||||
displayName: Restore internal tools
|
||||
condition: and(succeeded(), ne(variables['_skipRestoreInternalTools'], 'true'))
|
10
global.json
10
global.json
|
@ -1,24 +1,24 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "7.0.100-rc.1.22431.12",
|
||||
"version": "7.0.100-rc.2.22477.23",
|
||||
"allowPrerelease": true,
|
||||
"rollForward": "latestPatch"
|
||||
},
|
||||
"tools": {
|
||||
"dotnet": "7.0.100-rc.1.22431.12",
|
||||
"dotnet": "7.0.100-rc.2.22477.23",
|
||||
"vs": {
|
||||
"version": "17.2",
|
||||
"components": [
|
||||
"Microsoft.VisualStudio.Component.FSharp"
|
||||
]
|
||||
},
|
||||
"xcopy-msbuild": "17.2.1"
|
||||
"xcopy-msbuild": "17.3.1"
|
||||
},
|
||||
"native-tools": {
|
||||
"perl": "5.32.1.1"
|
||||
},
|
||||
"msbuild-sdks": {
|
||||
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22524.5",
|
||||
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.22524.5"
|
||||
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.22554.2",
|
||||
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.22554.2"
|
||||
}
|
||||
}
|
|
@ -13,7 +13,6 @@
|
|||
<ProjectReference Include="$(FSharpSourcesRoot)\fsi\fsiArm64Project\fsiArm64.fsproj" />
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Build\FSharp.Build.fsproj" />
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Compiler.Interactive.Settings\FSharp.Compiler.Interactive.Settings.fsproj" />
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj" />
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\Compiler\FSharp.Compiler.Service.fsproj" />
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Core\FSharp.Core.fsproj" />
|
||||
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.DependencyManager.Nuget\FSharp.DependencyManager.Nuget.fsproj" />
|
||||
|
@ -99,6 +98,7 @@ folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools"
|
|||
file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\FSharp.Compiler.Service.xml"
|
||||
file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\System.Buffers.dll"
|
||||
file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\System.Collections.Immutable.dll"
|
||||
file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\System.Diagnostics.DiagnosticSource.dll"
|
||||
file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\System.Memory.dll"
|
||||
file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\System.Numerics.Vectors.dll"
|
||||
file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\System.Reflection.Metadata.dll"
|
||||
|
@ -108,7 +108,6 @@ folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools"
|
|||
file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\Microsoft.Build.Framework.dll"
|
||||
file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\Microsoft.Build.Tasks.Core.dll"
|
||||
file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\Microsoft.Build.Utilities.Core.dll"
|
||||
file source="$(BinariesFolder)FSharp.Compiler.Server.Shared\$(Configuration)\$(TargetFramework)\FSharp.Compiler.Server.Shared.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
|
||||
file source="$(BinariesFolder)FSharp.Core\$(Configuration)\netstandard2.0\FSharp.Core.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
|
||||
file source="$(BinariesFolder)FSharp.Core\$(Configuration)\netstandard2.0\FSharp.Core.xml"
|
||||
file source="$(BinariesFolder)FSharp.Build\$(Configuration)\netstandard2.0\FSharp.Build.dll" vs.file.ngen=no vs.file.ngenArchitecture=All vs.file.ngenPriority=2
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
<_Dependency Include="FSharp.Compiler.Interactive.Settings" Version="$(FSProductVersion)" />
|
||||
<_Dependency Include="FSharp.Compiler.Service" Version="$(FSharpCompilerServiceVersion)" />
|
||||
<_Dependency Include="FSharp.DependencyManager.Nuget" Version="$(FSProductVersion)" />
|
||||
<_Dependency Include="FSharp.Compiler.Server.Shared" Version="$(FSProductVersion)" />
|
||||
<_Dependency Include="FSharp.Core" Version="$(FSCoreVersion)" />
|
||||
<_Dependency Include="FSharp.Editor" Version="$(VSAssemblyVersion)" />
|
||||
<_Dependency Include="FSharp.LanguageService.Base" Version="$(VSAssemblyVersion)" />
|
||||
|
|
|
@ -2073,6 +2073,9 @@ type ILMethodDef
|
|||
member x.WithAbstract(condition) =
|
||||
x.With(attributes = (x.Attributes |> conditionalAdd condition MethodAttributes.Abstract))
|
||||
|
||||
member x.WithVirtual(condition) =
|
||||
x.With(attributes = (x.Attributes |> conditionalAdd condition MethodAttributes.Virtual))
|
||||
|
||||
member x.WithAccess(access) =
|
||||
x.With(
|
||||
attributes =
|
||||
|
@ -4629,7 +4632,7 @@ let rec encodeCustomAttrElemTypeForObject x =
|
|||
| ILAttribElem.UInt64 _ -> [| et_U8 |]
|
||||
| ILAttribElem.Type _ -> [| 0x50uy |]
|
||||
| ILAttribElem.TypeRef _ -> [| 0x50uy |]
|
||||
| ILAttribElem.Null _ -> [| et_STRING |] // yes, the 0xe prefix is used when passing a "null" to a property or argument of type "object" here
|
||||
| ILAttribElem.Null -> [| et_STRING |] // yes, the 0xe prefix is used when passing a "null" to a property or argument of type "object" here
|
||||
| ILAttribElem.Single _ -> [| et_R4 |]
|
||||
| ILAttribElem.Double _ -> [| et_R8 |]
|
||||
| ILAttribElem.Array (elemTy, _) -> [| yield et_SZARRAY; yield! encodeCustomAttrElemType elemTy |]
|
||||
|
|
|
@ -1134,6 +1134,7 @@ type ILMethodDef =
|
|||
member internal WithHideBySig: bool -> ILMethodDef
|
||||
member internal WithFinal: bool -> ILMethodDef
|
||||
member internal WithAbstract: bool -> ILMethodDef
|
||||
member internal WithVirtual: bool -> ILMethodDef
|
||||
member internal WithAccess: ILMemberAccess -> ILMethodDef
|
||||
member internal WithNewSlot: ILMethodDef
|
||||
member internal WithSecurity: bool -> ILMethodDef
|
||||
|
|
|
@ -1220,12 +1220,9 @@ type ISeekReadIndexedRowReader<'RowT, 'KeyT, 'T when 'RowT: struct> =
|
|||
abstract CompareKey: 'KeyT -> int
|
||||
abstract ConvertRow: byref<'RowT> -> 'T
|
||||
|
||||
let seekReadIndexedRowsRange numRows binaryChop (reader: ISeekReadIndexedRowReader<'RowT, _, _>) =
|
||||
let seekReadIndexedRowsByInterface numRows binaryChop (reader: ISeekReadIndexedRowReader<'RowT, _, _>) =
|
||||
let mutable row = Unchecked.defaultof<'RowT>
|
||||
|
||||
let mutable startRid = -1
|
||||
let mutable endRid = -1
|
||||
|
||||
if binaryChop then
|
||||
let mutable low = 0
|
||||
let mutable high = numRows + 1
|
||||
|
@ -1244,12 +1241,12 @@ let seekReadIndexedRowsRange numRows binaryChop (reader: ISeekReadIndexedRowRead
|
|||
elif c < 0 then high <- mid
|
||||
else fin <- true
|
||||
|
||||
let res = ImmutableArray.CreateBuilder()
|
||||
|
||||
if high - low > 1 then
|
||||
// now read off rows, forward and backwards
|
||||
let mid = (low + high) / 2
|
||||
|
||||
startRid <- mid
|
||||
|
||||
// read backwards
|
||||
let mutable fin = false
|
||||
let mutable curr = mid - 1
|
||||
|
@ -1261,12 +1258,14 @@ let seekReadIndexedRowsRange numRows binaryChop (reader: ISeekReadIndexedRowRead
|
|||
reader.GetRow(curr, &row)
|
||||
|
||||
if reader.CompareKey(reader.GetKey(&row)) = 0 then
|
||||
startRid <- curr
|
||||
res.Add(reader.ConvertRow(&row))
|
||||
else
|
||||
fin <- true
|
||||
|
||||
curr <- curr - 1
|
||||
|
||||
res.Reverse()
|
||||
|
||||
// read forward
|
||||
let mutable fin = false
|
||||
let mutable curr = mid
|
||||
|
@ -1278,47 +1277,23 @@ let seekReadIndexedRowsRange numRows binaryChop (reader: ISeekReadIndexedRowRead
|
|||
reader.GetRow(curr, &row)
|
||||
|
||||
if reader.CompareKey(reader.GetKey(&row)) = 0 then
|
||||
endRid <- curr
|
||||
res.Add(reader.ConvertRow(&row))
|
||||
else
|
||||
fin <- true
|
||||
|
||||
curr <- curr + 1
|
||||
|
||||
res.ToArray()
|
||||
else
|
||||
let mutable rid = 1
|
||||
let res = ImmutableArray.CreateBuilder()
|
||||
|
||||
while rid <= numRows && startRid = -1 do
|
||||
reader.GetRow(rid, &row)
|
||||
for i = 1 to numRows do
|
||||
reader.GetRow(i, &row)
|
||||
|
||||
if reader.CompareKey(reader.GetKey(&row)) = 0 then
|
||||
startRid <- rid
|
||||
endRid <- rid
|
||||
res.Add(reader.ConvertRow(&row))
|
||||
|
||||
rid <- rid + 1
|
||||
|
||||
let mutable fin = false
|
||||
|
||||
while rid <= numRows && not fin do
|
||||
reader.GetRow(rid, &row)
|
||||
|
||||
if reader.CompareKey(reader.GetKey(&row)) = 0 then
|
||||
endRid <- rid
|
||||
else
|
||||
fin <- true
|
||||
|
||||
startRid, endRid
|
||||
|
||||
let seekReadIndexedRowsByInterface numRows binaryChop (reader: ISeekReadIndexedRowReader<'RowT, _, _>) =
|
||||
let startRid, endRid = seekReadIndexedRowsRange numRows binaryChop reader
|
||||
|
||||
if startRid <= 0 || endRid < startRid then
|
||||
[||]
|
||||
else
|
||||
|
||||
Array.init (endRid - startRid + 1) (fun i ->
|
||||
let mutable row = Unchecked.defaultof<'RowT>
|
||||
reader.GetRow(startRid + i, &row)
|
||||
reader.ConvertRow(&row))
|
||||
res.ToArray()
|
||||
|
||||
[<Struct>]
|
||||
type CustomAttributeRow =
|
||||
|
|
|
@ -412,7 +412,7 @@ module Zmap =
|
|||
| Some y -> y
|
||||
| None -> failwithf "Zmap.force: %s: x = %+A" str x
|
||||
|
||||
let equalTypes (s: Type) (t: Type) = s.Equals t
|
||||
let equalTypes (s: Type) (t: Type) = Type.op_Equality (s, t)
|
||||
|
||||
let equalTypeLists (tys1: Type list) (tys2: Type list) =
|
||||
List.lengthsEqAndForall2 equalTypes tys1 tys2
|
||||
|
@ -505,7 +505,7 @@ let convTypeRefAux (cenv: cenv) (tref: ILTypeRef) =
|
|||
match tref.Scope with
|
||||
| ILScopeRef.Assembly asmref -> convResolveAssemblyRef cenv asmref qualifiedName
|
||||
| ILScopeRef.Module _
|
||||
| ILScopeRef.Local _ ->
|
||||
| ILScopeRef.Local ->
|
||||
let typT = Type.GetType qualifiedName
|
||||
|
||||
match typT with
|
||||
|
@ -820,7 +820,8 @@ let TypeBuilderInstantiationT =
|
|||
ty
|
||||
|
||||
let typeIsNotQueryable (ty: Type) =
|
||||
(ty :? TypeBuilder) || ((ty.GetType()).Equals(TypeBuilderInstantiationT))
|
||||
(ty :? TypeBuilder)
|
||||
|| Type.op_Equality (ty.GetType(), TypeBuilderInstantiationT)
|
||||
|
||||
let queryableTypeGetField _emEnv (parentT: Type) (fref: ILFieldRef) =
|
||||
let res =
|
||||
|
|
|
@ -297,12 +297,6 @@ let signStream stream keyBlob =
|
|||
let signature = createSignature hash keyBlob KeyType.KeyPair
|
||||
patchSignature stream peReader signature
|
||||
|
||||
let signFile fileName keyBlob =
|
||||
use fs =
|
||||
FileSystem.OpenFileForWriteShim(fileName, FileMode.Open, FileAccess.ReadWrite)
|
||||
|
||||
signStream fs keyBlob
|
||||
|
||||
let signatureSize (pk: byte[]) =
|
||||
if pk.Length < 25 then
|
||||
raise (CryptographicException(getResourceString (FSComp.SR.ilSignInvalidPKBlob ())))
|
||||
|
@ -339,18 +333,9 @@ let signerOpenKeyPairFile filePath =
|
|||
|
||||
let signerGetPublicKeyForKeyPair (kp: keyPair) : pubkey = getPublicKeyForKeyPair kp
|
||||
|
||||
let signerGetPublicKeyForKeyContainer (_kcName: keyContainerName) : pubkey =
|
||||
raise (NotImplementedException("signerGetPublicKeyForKeyContainer is not yet implemented"))
|
||||
|
||||
let signerCloseKeyContainer (_kc: keyContainerName) : unit =
|
||||
raise (NotImplementedException("signerCloseKeyContainer is not yet implemented"))
|
||||
|
||||
let signerSignatureSize (pk: pubkey) : int = signatureSize pk
|
||||
|
||||
let signerSignFileWithKeyPair (fileName: string) (kp: keyPair) : unit = signFile fileName kp
|
||||
|
||||
let signerSignFileWithKeyContainer (_fileName: string) (_kcName: keyContainerName) : unit =
|
||||
raise (NotImplementedException("signerSignFileWithKeyContainer is not yet implemented"))
|
||||
let signerSignStreamWithKeyPair stream keyBlob = signStream stream keyBlob
|
||||
|
||||
let failWithContainerSigningUnsupportedOnThisPlatform () =
|
||||
failwith (FSComp.SR.containerSigningUnsupportedOnThisPlatform () |> snd)
|
||||
|
@ -364,20 +349,12 @@ type ILStrongNameSigner =
|
|||
| KeyPair of keyPair
|
||||
| KeyContainer of keyContainerName
|
||||
|
||||
static member OpenPublicKeyOptions s p =
|
||||
PublicKeyOptionsSigner((signerOpenPublicKeyFile s), p)
|
||||
static member OpenPublicKeyOptions kp p = PublicKeyOptionsSigner(kp, p)
|
||||
|
||||
static member OpenPublicKey pubkey = PublicKeySigner pubkey
|
||||
static member OpenKeyPairFile s = KeyPair(signerOpenKeyPairFile s)
|
||||
static member OpenPublicKey bytes = PublicKeySigner bytes
|
||||
static member OpenKeyPairFile bytes = KeyPair(bytes)
|
||||
static member OpenKeyContainer s = KeyContainer s
|
||||
|
||||
member s.Close() =
|
||||
match s with
|
||||
| PublicKeySigner _
|
||||
| PublicKeyOptionsSigner _
|
||||
| KeyPair _ -> ()
|
||||
| KeyContainer _ -> failWithContainerSigningUnsupportedOnThisPlatform ()
|
||||
|
||||
member s.IsFullySigned =
|
||||
match s with
|
||||
| PublicKeySigner _ -> false
|
||||
|
@ -412,9 +389,9 @@ type ILStrongNameSigner =
|
|||
| KeyPair kp -> pkSignatureSize (signerGetPublicKeyForKeyPair kp)
|
||||
| KeyContainer _ -> failWithContainerSigningUnsupportedOnThisPlatform ()
|
||||
|
||||
member s.SignFile file =
|
||||
member s.SignStream stream =
|
||||
match s with
|
||||
| PublicKeySigner _ -> ()
|
||||
| PublicKeyOptionsSigner _ -> ()
|
||||
| KeyPair kp -> signerSignFileWithKeyPair file kp
|
||||
| KeyPair kp -> signerSignStreamWithKeyPair stream kp
|
||||
| KeyContainer _ -> failWithContainerSigningUnsupportedOnThisPlatform ()
|
||||
|
|
|
@ -7,18 +7,20 @@
|
|||
|
||||
module internal FSharp.Compiler.AbstractIL.StrongNameSign
|
||||
|
||||
open System
|
||||
open System.IO
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Strong name signing
|
||||
//---------------------------------------------------------------------
|
||||
[<Sealed>]
|
||||
type ILStrongNameSigner =
|
||||
member PublicKey: byte[]
|
||||
static member OpenPublicKeyOptions: string -> bool -> ILStrongNameSigner
|
||||
static member OpenPublicKeyOptions: byte array -> bool -> ILStrongNameSigner
|
||||
static member OpenPublicKey: byte[] -> ILStrongNameSigner
|
||||
static member OpenKeyPairFile: string -> ILStrongNameSigner
|
||||
static member OpenKeyPairFile: byte[] -> ILStrongNameSigner
|
||||
static member OpenKeyContainer: string -> ILStrongNameSigner
|
||||
member Close: unit -> unit
|
||||
member IsFullySigned: bool
|
||||
member PublicKey: byte[]
|
||||
member SignatureSize: int
|
||||
member SignFile: string -> unit
|
||||
member SignStream: Stream -> unit
|
||||
|
|
|
@ -504,8 +504,6 @@ type cenv =
|
|||
|
||||
deterministic: bool
|
||||
|
||||
showTimes: bool
|
||||
|
||||
desiredMetadataVersion: ILVersionInfo
|
||||
|
||||
requiredDataFixups: (int32 * (int * bool)) list ref
|
||||
|
@ -3023,14 +3021,14 @@ let GenModule (cenv : cenv) (modul: ILModuleDef) =
|
|||
let midx = AddUnsharedRow cenv TableNames.Module (GetModuleAsRow cenv modul)
|
||||
List.iter (GenResourcePass3 cenv) (modul.Resources.AsList())
|
||||
let tdefs = destTypeDefsWithGlobalFunctionsFirst cenv.ilg modul.TypeDefs
|
||||
reportTime cenv.showTimes "Module Generation Preparation"
|
||||
reportTime "Module Generation Preparation"
|
||||
GenTypeDefsPass1 [] cenv tdefs
|
||||
reportTime cenv.showTimes "Module Generation Pass 1"
|
||||
reportTime "Module Generation Pass 1"
|
||||
GenTypeDefsPass2 0 [] cenv tdefs
|
||||
reportTime cenv.showTimes "Module Generation Pass 2"
|
||||
reportTime "Module Generation Pass 2"
|
||||
(match modul.Manifest with None -> () | Some m -> GenManifestPass3 cenv m)
|
||||
GenTypeDefsPass3 [] cenv tdefs
|
||||
reportTime cenv.showTimes "Module Generation Pass 3"
|
||||
reportTime "Module Generation Pass 3"
|
||||
GenCustomAttrsPass3Or4 cenv (hca_Module, midx) modul.CustomAttrs
|
||||
// GenericParam is the only sorted table indexed by Columns in other tables (GenericParamConstraint\CustomAttributes).
|
||||
// Hence we need to sort it before we emit any entries in GenericParamConstraint\CustomAttributes that are attached to generic params.
|
||||
|
@ -3038,7 +3036,7 @@ let GenModule (cenv : cenv) (modul: ILModuleDef) =
|
|||
// the key --> index map since it is no longer valid
|
||||
cenv.GetTable(TableNames.GenericParam).SetRowsOfSharedTable (SortTableRows TableNames.GenericParam (cenv.GetTable(TableNames.GenericParam).GenericRowsOfTable))
|
||||
GenTypeDefsPass4 [] cenv tdefs
|
||||
reportTime cenv.showTimes "Module Generation Pass 4"
|
||||
reportTime "Module Generation Pass 4"
|
||||
|
||||
/// Arbitrary value
|
||||
[<Literal>]
|
||||
|
@ -3057,7 +3055,6 @@ let generateIL (
|
|||
ilg: ILGlobals,
|
||||
emitTailcalls,
|
||||
deterministic,
|
||||
showTimes,
|
||||
referenceAssemblyOnly,
|
||||
referenceAssemblyAttribOpt: ILAttribute option,
|
||||
allGivenSources,
|
||||
|
@ -3099,7 +3096,6 @@ let generateIL (
|
|||
use cenv =
|
||||
{ emitTailcalls=emitTailcalls
|
||||
deterministic = deterministic
|
||||
showTimes=showTimes
|
||||
ilg = ilg
|
||||
desiredMetadataVersion=desiredMetadataVersion
|
||||
requiredDataFixups= requiredDataFixups
|
||||
|
@ -3183,7 +3179,7 @@ let generateIL (
|
|||
EventTokenMap = (fun t edef ->
|
||||
let tidx = idxForNextedTypeDef t
|
||||
getUncodedToken TableNames.Event (cenv.eventDefs.GetTableEntry (EventKey (tidx, edef.Name)))) }
|
||||
reportTime cenv.showTimes "Finalize Module Generation Results"
|
||||
reportTime "Finalize Module Generation Results"
|
||||
// New return the results
|
||||
let data = cenv.data.AsMemory().ToArray()
|
||||
let resources = cenv.resources.AsMemory().ToArray()
|
||||
|
@ -3218,7 +3214,6 @@ let writeILMetadataAndCode (
|
|||
ilg,
|
||||
emitTailcalls,
|
||||
deterministic,
|
||||
showTimes,
|
||||
referenceAssemblyOnly,
|
||||
referenceAssemblyAttribOpt,
|
||||
allGivenSources,
|
||||
|
@ -3241,7 +3236,6 @@ let writeILMetadataAndCode (
|
|||
ilg,
|
||||
emitTailcalls,
|
||||
deterministic,
|
||||
showTimes,
|
||||
referenceAssemblyOnly,
|
||||
referenceAssemblyAttribOpt,
|
||||
allGivenSources,
|
||||
|
@ -3249,7 +3243,7 @@ let writeILMetadataAndCode (
|
|||
cilStartAddress,
|
||||
normalizeAssemblyRefs)
|
||||
|
||||
reportTime showTimes "Generated Tables and Code"
|
||||
reportTime "Generated Tables and Code"
|
||||
let tableSize (tab: TableName) = tables[tab.Index].Count
|
||||
|
||||
// Now place the code
|
||||
|
@ -3321,7 +3315,7 @@ let writeILMetadataAndCode (
|
|||
(if tableSize TableNames.GenericParamConstraint > 0 then 0x00001000 else 0x00000000) |||
|
||||
0x00000200
|
||||
|
||||
reportTime showTimes "Layout Header of Tables"
|
||||
reportTime "Layout Header of Tables"
|
||||
|
||||
let guidAddress n = (if n = 0 then 0 else (n - 1) * 0x10 + 0x01)
|
||||
|
||||
|
@ -3365,7 +3359,7 @@ let writeILMetadataAndCode (
|
|||
if n >= blobAddressTable.Length then failwith "blob index out of range"
|
||||
blobAddressTable[n]
|
||||
|
||||
reportTime showTimes "Build String/Blob Address Tables"
|
||||
reportTime "Build String/Blob Address Tables"
|
||||
|
||||
let sortedTables =
|
||||
Array.init 64 (fun i ->
|
||||
|
@ -3374,7 +3368,7 @@ let writeILMetadataAndCode (
|
|||
let rows = tab.GenericRowsOfTable
|
||||
if TableRequiresSorting tabName then SortTableRows tabName rows else rows)
|
||||
|
||||
reportTime showTimes "Sort Tables"
|
||||
reportTime "Sort Tables"
|
||||
|
||||
let codedTables =
|
||||
|
||||
|
@ -3489,7 +3483,7 @@ let writeILMetadataAndCode (
|
|||
tablesBuf.EmitInt32 rows.Length
|
||||
|
||||
|
||||
reportTime showTimes "Write Header of tablebuf"
|
||||
reportTime "Write Header of tablebuf"
|
||||
|
||||
// The tables themselves
|
||||
for rows in sortedTables do
|
||||
|
@ -3524,7 +3518,7 @@ let writeILMetadataAndCode (
|
|||
|
||||
tablesBuf.AsMemory().ToArray()
|
||||
|
||||
reportTime showTimes "Write Tables to tablebuf"
|
||||
reportTime "Write Tables to tablebuf"
|
||||
|
||||
let tablesStreamUnpaddedSize = codedTables.Length
|
||||
// QUERY: extra 4 empty bytes in array.exe - why? Include some extra padding after
|
||||
|
@ -3541,7 +3535,7 @@ let writeILMetadataAndCode (
|
|||
let blobsChunk, _next = chunk blobsStreamPaddedSize next
|
||||
let blobsStreamPadding = blobsChunk.size - blobsStreamUnpaddedSize
|
||||
|
||||
reportTime showTimes "Layout Metadata"
|
||||
reportTime "Layout Metadata"
|
||||
|
||||
let metadata, guidStart =
|
||||
use mdbuf = ByteBuffer.Create(MetadataCapacity, useArrayPool = true)
|
||||
|
@ -3576,12 +3570,12 @@ let writeILMetadataAndCode (
|
|||
mdbuf.EmitInt32 blobsChunk.size
|
||||
mdbuf.EmitIntsAsBytes [| 0x23; 0x42; 0x6c; 0x6f; 0x62; 0x00; 0x00; 0x00; (* #Blob000 *)|]
|
||||
|
||||
reportTime showTimes "Write Metadata Header"
|
||||
reportTime "Write Metadata Header"
|
||||
// Now the coded tables themselves
|
||||
mdbuf.EmitBytes codedTables
|
||||
for i = 1 to tablesStreamPadding do
|
||||
mdbuf.EmitIntAsByte 0x00
|
||||
reportTime showTimes "Write Metadata Tables"
|
||||
reportTime "Write Metadata Tables"
|
||||
|
||||
// The string stream
|
||||
mdbuf.EmitByte 0x00uy
|
||||
|
@ -3589,7 +3583,7 @@ let writeILMetadataAndCode (
|
|||
mdbuf.EmitBytes s
|
||||
for i = 1 to stringsStreamPadding do
|
||||
mdbuf.EmitIntAsByte 0x00
|
||||
reportTime showTimes "Write Metadata Strings"
|
||||
reportTime "Write Metadata Strings"
|
||||
// The user string stream
|
||||
mdbuf.EmitByte 0x00uy
|
||||
for s in userStrings do
|
||||
|
@ -3599,7 +3593,7 @@ let writeILMetadataAndCode (
|
|||
for i = 1 to userStringsStreamPadding do
|
||||
mdbuf.EmitIntAsByte 0x00
|
||||
|
||||
reportTime showTimes "Write Metadata User Strings"
|
||||
reportTime "Write Metadata User Strings"
|
||||
// The GUID stream
|
||||
let guidStart = mdbuf.Position
|
||||
Array.iter mdbuf.EmitBytes guids
|
||||
|
@ -3611,7 +3605,7 @@ let writeILMetadataAndCode (
|
|||
mdbuf.EmitBytes s
|
||||
for i = 1 to blobsStreamPadding do
|
||||
mdbuf.EmitIntAsByte 0x00
|
||||
reportTime showTimes "Write Blob Stream"
|
||||
reportTime "Write Blob Stream"
|
||||
// Done - close the buffer and return the result.
|
||||
mdbuf.AsMemory().ToArray(), guidStart
|
||||
|
||||
|
@ -3627,7 +3621,7 @@ let writeILMetadataAndCode (
|
|||
let token = getUncodedToken TableNames.UserStrings (userStringAddress userStringIndex)
|
||||
if (Bytes.get code (locInCode-1) <> i_ldstr) then failwith "strings-in-code fixup: not at ldstr instruction!"
|
||||
applyFixup32 code locInCode token
|
||||
reportTime showTimes "Fixup Metadata"
|
||||
reportTime "Fixup Metadata"
|
||||
|
||||
entryPointToken, code, codePadding, metadata, data, resources, requiredDataFixups.Value, pdbData, mappings, guidStart
|
||||
|
||||
|
@ -3691,7 +3685,6 @@ let writeBytes (os: BinaryWriter) (chunk: byte[]) = os.Write(chunk, 0, chunk.Len
|
|||
|
||||
let writePdb (
|
||||
dumpDebugInfo,
|
||||
showTimes,
|
||||
embeddedPDB,
|
||||
pdbfile,
|
||||
outfile,
|
||||
|
@ -3714,9 +3707,22 @@ let writePdb (
|
|||
// Used to capture the pdb file bytes in the case we're generating in-memory
|
||||
let mutable pdbBytes = None
|
||||
|
||||
let signImage () =
|
||||
// Sign the binary. No further changes to binary allowed past this point!
|
||||
match signer with
|
||||
| None -> ()
|
||||
| Some s ->
|
||||
use fs = reopenOutput()
|
||||
try
|
||||
s.SignStream fs
|
||||
with exn ->
|
||||
failwith ($"Warning: A call to SignFile failed ({exn.Message})")
|
||||
reportTime "Signing Image"
|
||||
|
||||
// Now we've done the bulk of the binary, do the PDB file and fixup the binary.
|
||||
match pdbfile with
|
||||
| None -> ()
|
||||
| None -> signImage ()
|
||||
|
||||
| Some pdbfile ->
|
||||
let idd =
|
||||
match pdbInfoOpt with
|
||||
|
@ -3741,7 +3747,7 @@ let writePdb (
|
|||
stream.WriteTo fs
|
||||
getInfoForPortablePdb contentId pdbfile pathMap debugDataChunk debugDeterministicPdbChunk debugChecksumPdbChunk algorithmName checkSum embeddedPDB deterministic
|
||||
| None -> [| |]
|
||||
reportTime showTimes "Generate PDB Info"
|
||||
reportTime "Generate PDB Info"
|
||||
|
||||
// Now we have the debug data we can go back and fill in the debug directory in the image
|
||||
use fs2 = reopenOutput()
|
||||
|
@ -3766,28 +3772,15 @@ let writePdb (
|
|||
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
|
||||
reportTime "Finalize PDB"
|
||||
signImage ()
|
||||
os2.Dispose()
|
||||
with exn ->
|
||||
failwith ("Error while writing debug directory entry: " + exn.Message)
|
||||
(try os2.Dispose(); FileSystem.FileDeleteShim outfile with _ -> ())
|
||||
reraise()
|
||||
|
||||
reportTime showTimes "Finalize PDB"
|
||||
|
||||
// Sign the binary. No further changes to binary allowed past this point!
|
||||
match signer with
|
||||
| None -> ()
|
||||
| Some s ->
|
||||
try
|
||||
s.SignFile outfile
|
||||
s.Close()
|
||||
with exn ->
|
||||
failwith ("Warning: A call to SignFile failed ("+exn.Message+")")
|
||||
(try s.Close() with _ -> ())
|
||||
(try FileSystem.FileDeleteShim outfile with _ -> ())
|
||||
()
|
||||
|
||||
reportTime showTimes "Signing Image"
|
||||
reportTime "Finish"
|
||||
pdbBytes
|
||||
|
||||
type options =
|
||||
|
@ -3804,7 +3797,6 @@ type options =
|
|||
signer: ILStrongNameSigner option
|
||||
emitTailcalls: bool
|
||||
deterministic: bool
|
||||
showTimes: bool
|
||||
dumpDebugInfo: bool
|
||||
referenceAssemblyOnly: bool
|
||||
referenceAssemblyAttribOpt: ILAttribute option
|
||||
|
@ -3815,7 +3807,7 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe
|
|||
// 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
|
||||
|
||||
reportTime options.showTimes "Write Started"
|
||||
reportTime "Write Started"
|
||||
let isDll = modul.IsDLL
|
||||
let ilg = options.ilg
|
||||
|
||||
|
@ -3930,7 +3922,6 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe
|
|||
ilg,
|
||||
options.emitTailcalls,
|
||||
options.deterministic,
|
||||
options.showTimes,
|
||||
options.referenceAssemblyOnly,
|
||||
options.referenceAssemblyAttribOpt,
|
||||
options.allGivenSources,
|
||||
|
@ -3939,7 +3930,7 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe
|
|||
normalizeAssemblyRefs
|
||||
)
|
||||
|
||||
reportTime options.showTimes "Generated IL and metadata"
|
||||
reportTime "Generated IL and metadata"
|
||||
let _codeChunk, next = chunk code.Length next
|
||||
let _codePaddingChunk, next = chunk codePadding.Length next
|
||||
|
||||
|
@ -3972,7 +3963,7 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe
|
|||
match options.pdbfile, options.portablePDB with
|
||||
| Some _, true ->
|
||||
let pdbInfo =
|
||||
generatePortablePdb options.embedAllSource options.embedSourceList options.sourceLink options.checksumAlgorithm options.showTimes pdbData options.pathMap
|
||||
generatePortablePdb options.embedAllSource options.embedSourceList options.sourceLink options.checksumAlgorithm pdbData options.pathMap
|
||||
|
||||
if options.embeddedPDB then
|
||||
let (uncompressedLength, contentId, stream, algorithmName, checkSum) = pdbInfo
|
||||
|
@ -4098,7 +4089,7 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe
|
|||
let imageEndSectionPhysLoc = nextPhys
|
||||
let imageEndAddr = next
|
||||
|
||||
reportTime options.showTimes "Layout image"
|
||||
reportTime "Layout image"
|
||||
|
||||
let write p (os: BinaryWriter) chunkName chunk =
|
||||
match p with
|
||||
|
@ -4505,7 +4496,7 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe
|
|||
|
||||
pdbData, pdbInfoOpt, debugDirectoryChunk, debugDataChunk, debugChecksumPdbChunk, debugEmbeddedPdbChunk, debugDeterministicPdbChunk, textV2P, mappings
|
||||
|
||||
reportTime options.showTimes "Writing Image"
|
||||
reportTime "Writing Image"
|
||||
pdbData, pdbInfoOpt, debugDirectoryChunk, debugDataChunk, debugChecksumPdbChunk, debugEmbeddedPdbChunk, debugDeterministicPdbChunk, textV2P, mappings
|
||||
|
||||
let writeBinaryFiles (options: options, modul, normalizeAssemblyRefs) =
|
||||
|
@ -4531,10 +4522,9 @@ let writeBinaryFiles (options: options, modul, normalizeAssemblyRefs) =
|
|||
reraise()
|
||||
|
||||
let reopenOutput () =
|
||||
FileSystem.OpenFileForWriteShim(options.outfile, FileMode.Open, FileAccess.Write, FileShare.Read)
|
||||
FileSystem.OpenFileForWriteShim(options.outfile, FileMode.Open, FileAccess.ReadWrite, FileShare.Read)
|
||||
|
||||
writePdb (options.dumpDebugInfo,
|
||||
options.showTimes,
|
||||
options.embeddedPDB,
|
||||
options.pdbfile,
|
||||
options.outfile,
|
||||
|
@ -4561,11 +4551,12 @@ let writeBinaryInMemory (options: options, modul, normalizeAssemblyRefs) =
|
|||
let pdbData, pdbInfoOpt, debugDirectoryChunk, debugDataChunk, debugChecksumPdbChunk, debugEmbeddedPdbChunk, debugDeterministicPdbChunk, textV2P, _mappings =
|
||||
writeBinaryAux(stream, options, modul, normalizeAssemblyRefs)
|
||||
|
||||
let reopenOutput () = stream
|
||||
let reopenOutput () =
|
||||
stream.Seek(0, SeekOrigin.Begin) |> ignore
|
||||
stream
|
||||
|
||||
let pdbBytes =
|
||||
writePdb (options.dumpDebugInfo,
|
||||
options.showTimes,
|
||||
options.embeddedPDB,
|
||||
options.pdbfile,
|
||||
options.outfile,
|
||||
|
|
|
@ -22,7 +22,6 @@ type options =
|
|||
signer: ILStrongNameSigner option
|
||||
emitTailcalls: bool
|
||||
deterministic: bool
|
||||
showTimes: bool
|
||||
dumpDebugInfo: bool
|
||||
referenceAssemblyOnly: bool
|
||||
referenceAssemblyAttribOpt: ILAttribute option
|
||||
|
|
|
@ -316,10 +316,10 @@ let pdbGetDebugInfo
|
|||
let getDebugFileName outfile =
|
||||
(FileSystemUtils.chopExtension outfile) + ".pdb"
|
||||
|
||||
let sortMethods showTimes info =
|
||||
reportTime showTimes (sprintf "PDB: Defined %d documents" info.Documents.Length)
|
||||
let sortMethods info =
|
||||
reportTime (sprintf "PDB: Defined %d documents" info.Documents.Length)
|
||||
Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods
|
||||
reportTime showTimes (sprintf "PDB: Sorted %d methods" info.Methods.Length)
|
||||
reportTime (sprintf "PDB: Sorted %d methods" info.Methods.Length)
|
||||
()
|
||||
|
||||
let getRowCounts tableRowCounts =
|
||||
|
@ -345,7 +345,6 @@ type PortablePdbGenerator
|
|||
embedSourceList: string list,
|
||||
sourceLink: string,
|
||||
checksumAlgorithm,
|
||||
showTimes,
|
||||
info: PdbData,
|
||||
pathMap: PathMap
|
||||
) =
|
||||
|
@ -784,7 +783,7 @@ type PortablePdbGenerator
|
|||
| Some scope -> writeMethodScopes minfo.MethToken scope
|
||||
|
||||
member _.Emit() =
|
||||
sortMethods showTimes info
|
||||
sortMethods info
|
||||
metadata.SetCapacity(TableIndex.MethodDebugInformation, info.Methods.Length)
|
||||
|
||||
defineModuleImportScope ()
|
||||
|
@ -823,7 +822,7 @@ type PortablePdbGenerator
|
|||
let contentId = serializer.Serialize blobBuilder
|
||||
let portablePdbStream = new MemoryStream()
|
||||
blobBuilder.WriteContentTo portablePdbStream
|
||||
reportTime showTimes "PDB: Created"
|
||||
reportTime "PDB: Created"
|
||||
(portablePdbStream.Length, contentId, portablePdbStream, algorithmName, contentHash)
|
||||
|
||||
let generatePortablePdb
|
||||
|
@ -831,12 +830,11 @@ let generatePortablePdb
|
|||
(embedSourceList: string list)
|
||||
(sourceLink: string)
|
||||
checksumAlgorithm
|
||||
showTimes
|
||||
(info: PdbData)
|
||||
(pathMap: PathMap)
|
||||
=
|
||||
let generator =
|
||||
PortablePdbGenerator(embedAllSource, embedSourceList, sourceLink, checksumAlgorithm, showTimes, info, pathMap)
|
||||
PortablePdbGenerator(embedAllSource, embedSourceList, sourceLink, checksumAlgorithm, info, pathMap)
|
||||
|
||||
generator.Emit()
|
||||
|
||||
|
|
|
@ -107,7 +107,6 @@ val generatePortablePdb:
|
|||
embedSourceList: string list ->
|
||||
sourceLink: string ->
|
||||
checksumAlgorithm: HashAlgorithm ->
|
||||
showTimes: bool ->
|
||||
info: PdbData ->
|
||||
pathMap: PathMap ->
|
||||
int64 * BlobContentId * MemoryStream * string * byte[]
|
||||
|
|
|
@ -413,6 +413,9 @@ let CheckEntityAttributes g (tcref: TyconRef) m =
|
|||
else
|
||||
CheckFSharpAttributes g tcref.Attribs m
|
||||
|
||||
let CheckILEventAttributes g (tcref: TyconRef) cattrs m =
|
||||
CheckILAttributes g (isByrefLikeTyconRef g m tcref) cattrs m
|
||||
|
||||
/// Check the attributes associated with a method, returning warnings and errors as data.
|
||||
let CheckMethInfoAttributes g m tyargsOpt (minfo: MethInfo) =
|
||||
match stripTyEqns g minfo.ApparentEnclosingAppType with
|
||||
|
@ -507,7 +510,8 @@ let CheckUnionCaseAttributes g (x:UnionCaseRef) m =
|
|||
/// Check the attributes on a record field, returning errors and warnings as data.
|
||||
let CheckRecdFieldAttributes g (x:RecdFieldRef) m =
|
||||
CheckEntityAttributes g x.TyconRef m ++ (fun () ->
|
||||
CheckFSharpAttributes g x.PropertyAttribs m)
|
||||
CheckFSharpAttributes g x.PropertyAttribs m) ++ (fun () ->
|
||||
CheckFSharpAttributes g x.RecdField.FieldAttribs m)
|
||||
|
||||
/// Check the attributes on an F# value, returning errors and warnings as data.
|
||||
let CheckValAttributes g (x:ValRef) m =
|
||||
|
|
|
@ -101,3 +101,5 @@ val IsSecurityAttribute:
|
|||
val IsSecurityCriticalAttribute: g: TcGlobals -> Attrib -> bool
|
||||
|
||||
val IsAssemblyVersionAttribute: g: TcGlobals -> Attrib -> bool
|
||||
|
||||
val CheckILEventAttributes: g: TcGlobals -> tcref: TyconRef -> cattrs: ILAttributes -> m: range -> OperationResult<unit>
|
||||
|
|
|
@ -7,7 +7,6 @@ open Internal.Utilities.Library
|
|||
open FSharp.Compiler.AbstractIL.IL
|
||||
open FSharp.Compiler.DiagnosticsLogger
|
||||
open FSharp.Compiler.Syntax
|
||||
open FSharp.Compiler.SyntaxTrivia
|
||||
open FSharp.Compiler.Xml
|
||||
open FSharp.Compiler.TcGlobals
|
||||
open FSharp.Compiler.TypedTree
|
||||
|
@ -856,8 +855,7 @@ let slotImplMethod (final, c, slotsig) : ValMemberInfo =
|
|||
IsFinal=final
|
||||
IsOverrideOrExplicitImpl=true
|
||||
GetterOrSetterIsCompilerGenerated=false
|
||||
MemberKind=SynMemberKind.Member
|
||||
Trivia=SynMemberFlagsTrivia.Zero}
|
||||
MemberKind=SynMemberKind.Member }
|
||||
IsImplemented=false
|
||||
ApparentEnclosingEntity=c}
|
||||
|
||||
|
@ -868,8 +866,7 @@ let nonVirtualMethod c : ValMemberInfo =
|
|||
IsFinal=false
|
||||
IsOverrideOrExplicitImpl=false
|
||||
GetterOrSetterIsCompilerGenerated=false
|
||||
MemberKind=SynMemberKind.Member
|
||||
Trivia=SynMemberFlagsTrivia.Zero}
|
||||
MemberKind=SynMemberKind.Member }
|
||||
IsImplemented=false
|
||||
ApparentEnclosingEntity=c}
|
||||
|
||||
|
@ -999,7 +996,16 @@ let MakeBindingsForEqualityWithComparerAugmentation (g: TcGlobals) (tycon: Tycon
|
|||
// build the hash rhs
|
||||
let withcGetHashCodeExpr =
|
||||
let compv, compe = mkCompGenLocal m "comp" g.IEqualityComparer_ty
|
||||
let thisv, hashe = hashf g tcref tycon compe
|
||||
|
||||
// Special case List<T> type to avoid StackOverflow exception , call custom hash code instead
|
||||
let thisv,hashe =
|
||||
if tyconRefEq g tcref g.list_tcr_canon && tycon.HasMember g "CustomHashCode" [g.IEqualityComparer_ty] then
|
||||
let customCodeVal = (tycon.TryGetMember g "CustomHashCode" [g.IEqualityComparer_ty]).Value
|
||||
let tinst, ty = mkMinimalTy g tcref
|
||||
let thisv, thise = mkThisVar g m ty
|
||||
thisv,mkApps g ((exprForValRef m customCodeVal, customCodeVal.Type), (if isNil tinst then [] else [tinst]), [thise; compe], m)
|
||||
else
|
||||
hashf g tcref tycon compe
|
||||
mkLambdas g m tps [thisv; compv] (hashe, g.int_ty)
|
||||
|
||||
// build the equals rhs
|
||||
|
|
|
@ -4,6 +4,7 @@ module internal FSharp.Compiler.CheckBasics
|
|||
|
||||
open System.Collections.Generic
|
||||
|
||||
open FSharp.Compiler.Diagnostics
|
||||
open Internal.Utilities.Library
|
||||
open Internal.Utilities.Library.Extras
|
||||
open FSharp.Compiler
|
||||
|
@ -310,6 +311,8 @@ type TcFileState =
|
|||
|
||||
isInternalTestSpanStackReferring: bool
|
||||
|
||||
diagnosticOptions: FSharpDiagnosticOptions
|
||||
|
||||
// forward call
|
||||
TcPat: WarnOnUpperFlag -> TcFileState -> TcEnv -> PrelimValReprInfo option -> TcPatValFlags -> TcPatLinearEnv -> TType -> SynPat -> (TcPatPhase2Input -> Pattern) * TcPatLinearEnv
|
||||
|
||||
|
@ -328,7 +331,7 @@ type TcFileState =
|
|||
|
||||
/// Create a new compilation environment
|
||||
static member Create
|
||||
(g, isScript, amap, thisCcu, isSig, haveSig, conditionalDefines, tcSink, tcVal, isInternalTestSpanStackReferring,
|
||||
(g, isScript, amap, thisCcu, isSig, haveSig, conditionalDefines, tcSink, tcVal, isInternalTestSpanStackReferring, diagnosticOptions,
|
||||
tcPat,
|
||||
tcSimplePats,
|
||||
tcSequenceExpressionEntry,
|
||||
|
@ -358,6 +361,7 @@ type TcFileState =
|
|||
compilingCanonicalFslibModuleType = (isSig || not haveSig) && g.compilingFSharpCore
|
||||
conditionalDefines = conditionalDefines
|
||||
isInternalTestSpanStackReferring = isInternalTestSpanStackReferring
|
||||
diagnosticOptions = diagnosticOptions
|
||||
TcPat = tcPat
|
||||
TcSimplePats = tcSimplePats
|
||||
TcSequenceExpressionEntry = tcSequenceExpressionEntry
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
module internal FSharp.Compiler.CheckBasics
|
||||
|
||||
open System.Collections.Generic
|
||||
open FSharp.Compiler.Diagnostics
|
||||
open Internal.Utilities.Library
|
||||
open FSharp.Compiler.AccessibilityLogic
|
||||
open FSharp.Compiler.CompilerGlobalState
|
||||
|
@ -260,6 +261,8 @@ type TcFileState =
|
|||
|
||||
isInternalTestSpanStackReferring: bool
|
||||
|
||||
diagnosticOptions: FSharpDiagnosticOptions
|
||||
|
||||
// forward call
|
||||
TcPat: WarnOnUpperFlag
|
||||
-> TcFileState
|
||||
|
@ -319,6 +322,7 @@ type TcFileState =
|
|||
tcSink: TcResultsSink *
|
||||
tcVal: TcValF *
|
||||
isInternalTestSpanStackReferring: bool *
|
||||
diagnosticOptions: FSharpDiagnosticOptions *
|
||||
tcPat: (WarnOnUpperFlag -> TcFileState -> TcEnv -> PrelimValReprInfo option -> TcPatValFlags -> TcPatLinearEnv -> TType -> SynPat -> (TcPatPhase2Input -> Pattern) * TcPatLinearEnv) *
|
||||
tcSimplePats: (TcFileState -> bool -> CheckConstraints -> TType -> TcEnv -> TcPatLinearEnv -> SynSimplePats -> string list * TcPatLinearEnv) *
|
||||
tcSequenceExpressionEntry: (TcFileState -> TcEnv -> OverallTy -> UnscopedTyparEnv -> bool * SynExpr -> range -> Expr * UnscopedTyparEnv) *
|
||||
|
|
|
@ -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!)
|
||||
|
@ -1671,6 +1672,9 @@ let TcComputationExpression (cenv: cenv) env (overallTy: OverallTy) tpenv (mWhol
|
|||
let bindCall = mkSynCall bindName bindRange (bindArgs @ [consumeExpr])
|
||||
translatedCtxt (bindCall |> addBindDebugPoint))
|
||||
|
||||
/// This function is for desugaring into .Bind{N}Return calls if possible
|
||||
/// The outer option indicates if .BindReturn is possible. When it returns None, .BindReturn cannot be used
|
||||
/// The inner option indicates if a custom operation is involved inside
|
||||
and convertSimpleReturnToExpr varSpace innerComp =
|
||||
match innerComp with
|
||||
| SynExpr.YieldOrReturn ((false, _), returnExpr, m) ->
|
||||
|
@ -1696,7 +1700,8 @@ let TcComputationExpression (cenv: cenv) env (overallTy: OverallTy) tpenv (mWhol
|
|||
| Some (thenExpr, None) ->
|
||||
let elseExprOptOpt =
|
||||
match elseCompOpt with
|
||||
| None -> Some None
|
||||
// When we are missing an 'else' part alltogether in case of 'if cond then return exp', we fallback from BindReturn into regular Bind+Return
|
||||
| None -> None
|
||||
| Some elseComp ->
|
||||
match convertSimpleReturnToExpr varSpace elseComp with
|
||||
| None -> None // failure
|
||||
|
|
|
@ -5,6 +5,7 @@ module internal FSharp.Compiler.CheckDeclarations
|
|||
open System
|
||||
open System.Collections.Generic
|
||||
|
||||
open FSharp.Compiler.Diagnostics
|
||||
open Internal.Utilities.Collections
|
||||
open Internal.Utilities.Library
|
||||
open Internal.Utilities.Library.Extras
|
||||
|
@ -395,6 +396,21 @@ let CheckDuplicates (idf: _ -> Ident) k elems =
|
|||
errorR (Duplicate(k, id1.idText, id1.idRange))))
|
||||
elems
|
||||
|
||||
let private CheckDuplicatesArgNames (synVal: SynValSig) m =
|
||||
let argNames = synVal.SynInfo.ArgNames |> List.duplicates
|
||||
for name in argNames do
|
||||
errorR(Error((FSComp.SR.chkDuplicatedMethodParameter(name), m)))
|
||||
|
||||
let private CheckDuplicatesAbstractMethodParmsSig (typeSpecs: SynTypeDefnSig list) =
|
||||
for SynTypeDefnSig(typeRepr= trepr) in typeSpecs do
|
||||
match trepr with
|
||||
| SynTypeDefnSigRepr.ObjectModel(_, synMemberSigs, _) ->
|
||||
for sms in synMemberSigs do
|
||||
match sms with
|
||||
| SynMemberSig.Member(memberSig = synValSig; range = m) ->
|
||||
CheckDuplicatesArgNames synValSig m
|
||||
| _ -> ()
|
||||
| _ -> ()
|
||||
|
||||
module TcRecdUnionAndEnumDeclarations =
|
||||
|
||||
|
@ -437,17 +453,20 @@ module TcRecdUnionAndEnumDeclarations =
|
|||
| _ -> ()
|
||||
rfspec
|
||||
|
||||
let TcAnonFieldDecl cenv env parent tpenv nm (SynField(Attributes attribs, isStatic, idOpt, ty, isMutable, xmldoc, vis, m)) =
|
||||
let TcAnonFieldDecl cenv env parent tpenv nm (SynField(Attributes attribs, isStatic, idOpt, ty, isMutable, xmldoc, vis, m, _)) =
|
||||
let mName = m.MakeSynthetic()
|
||||
let id = match idOpt with None -> mkSynId mName nm | Some id -> id
|
||||
let xmlDoc = xmldoc.ToXmlDoc(true, Some [])
|
||||
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xmldoc.ToXmlDoc(checkXmlDocs, Some [])
|
||||
TcFieldDecl cenv env parent false tpenv (isStatic, attribs, id, idOpt.IsNone, ty, isMutable, xmlDoc, vis, m)
|
||||
|
||||
let TcNamedFieldDecl cenv env parent isIncrClass tpenv (SynField(Attributes attribs, isStatic, id, ty, isMutable, xmldoc, vis, m)) =
|
||||
let TcNamedFieldDecl cenv env parent isIncrClass tpenv (SynField(Attributes attribs, isStatic, id, ty, isMutable, xmldoc, vis, m, _)) =
|
||||
match id with
|
||||
| None -> error (Error(FSComp.SR.tcFieldRequiresName(), m))
|
||||
| Some id ->
|
||||
let xmlDoc = xmldoc.ToXmlDoc(true, Some [])
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xmldoc.ToXmlDoc(checkXmlDocs, Some [])
|
||||
TcFieldDecl cenv env parent isIncrClass tpenv (isStatic, attribs, id, false, ty, isMutable, xmlDoc, vis, m)
|
||||
|
||||
let TcNamedFieldDecls cenv env parent isIncrClass tpenv fields =
|
||||
|
@ -479,10 +498,10 @@ module TcRecdUnionAndEnumDeclarations =
|
|||
match seen.TryGetValue f.LogicalName with
|
||||
| true, synField ->
|
||||
match sf, synField with
|
||||
| SynField(_, _, Some id, _, _, _, _, _), SynField(_, _, Some _, _, _, _, _, _) ->
|
||||
| SynField(idOpt = Some id), SynField(idOpt = Some _) ->
|
||||
error(Error(FSComp.SR.tcFieldNameIsUsedModeThanOnce(id.idText), id.idRange))
|
||||
| SynField(_, _, Some id, _, _, _, _, _), SynField(_, _, None, _, _, _, _, _)
|
||||
| SynField(_, _, None, _, _, _, _, _), SynField(_, _, Some id, _, _, _, _, _) ->
|
||||
| SynField(idOpt = Some id), SynField(idOpt = None)
|
||||
| SynField(idOpt = None), SynField(idOpt = Some id) ->
|
||||
error(Error(FSComp.SR.tcFieldNameConflictsWithGeneratedNameForAnonymousField(id.idText), id.idRange))
|
||||
| _ -> assert false
|
||||
| _ ->
|
||||
|
@ -536,7 +555,8 @@ module TcRecdUnionAndEnumDeclarations =
|
|||
|> Seq.map (fun f -> f.DisplayNameCore)
|
||||
|> Seq.toList
|
||||
|
||||
let xmlDoc = xmldoc.ToXmlDoc(true, Some names)
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xmldoc.ToXmlDoc(checkXmlDocs, Some names)
|
||||
Construct.NewUnionCase id rfields recordTy attrs xmlDoc vis
|
||||
|
||||
let TcUnionCaseDecls (cenv: cenv) env (parent: ParentRef) (thisTy: TType) (thisTyInst: TypeInst) hasRQAAttribute tpenv unionCases =
|
||||
|
@ -545,6 +565,7 @@ module TcRecdUnionAndEnumDeclarations =
|
|||
|
||||
let TcEnumDecl cenv env parent thisTy fieldTy (SynEnumCase(attributes=Attributes synAttrs; ident= SynIdent(id,_); value=v; xmlDoc=xmldoc; range=m)) =
|
||||
let attrs = TcAttributes cenv env AttributeTargets.Field synAttrs
|
||||
|
||||
match v with
|
||||
| SynConst.Bytes _
|
||||
| SynConst.UInt16s _
|
||||
|
@ -554,7 +575,8 @@ module TcRecdUnionAndEnumDeclarations =
|
|||
let vis, _ = ComputeAccessAndCompPath env None m None None parent
|
||||
let vis = CombineReprAccess parent vis
|
||||
if id.idText = "value__" then errorR(Error(FSComp.SR.tcNotValidEnumCaseName(), id.idRange))
|
||||
let xmlDoc = xmldoc.ToXmlDoc(true, Some [])
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xmldoc.ToXmlDoc(checkXmlDocs, Some [])
|
||||
Construct.NewRecdField true (Some v) id false thisTy false false [] attrs xmlDoc vis false
|
||||
|
||||
let TcEnumDecls (cenv: cenv) env parent thisTy enumCases =
|
||||
|
@ -585,7 +607,7 @@ let TcAndPublishMemberSpec cenv env containerInfo declKind tpenv memb =
|
|||
| SynMemberSig.ValField(_, m) -> error(Error(FSComp.SR.tcFieldValIllegalHere(), m))
|
||||
| SynMemberSig.Inherit(_, m) -> error(Error(FSComp.SR.tcInheritIllegalHere(), m))
|
||||
| SynMemberSig.NestedType(_, m) -> error(Error(FSComp.SR.tcTypesCannotContainNestedTypes(), m))
|
||||
| SynMemberSig.Member(synValSig, memberFlags, _) ->
|
||||
| SynMemberSig.Member(memberSig = synValSig; flags = memberFlags) ->
|
||||
TcAndPublishValSpec (cenv, env, containerInfo, declKind, Some memberFlags, tpenv, synValSig)
|
||||
| SynMemberSig.Interface _ ->
|
||||
// These are done in TcMutRecDefns_Phase1
|
||||
|
@ -953,6 +975,20 @@ module MutRecBindingChecking =
|
|||
| rest -> rest
|
||||
|
||||
let prelimRecValues = [ for x in defnAs do match x with Phase2AMember bind -> yield bind.RecBindingInfo.Val | _ -> () ]
|
||||
|
||||
let tyconOpt =
|
||||
if cenv.g.langVersion.SupportsFeature(LanguageFeature.CSharpExtensionAttributeNotRequired) then
|
||||
tyconOpt
|
||||
|> Option.map (fun tycon ->
|
||||
tryAddExtensionAttributeIfNotAlreadyPresent
|
||||
(fun tryFindExtensionAttribute ->
|
||||
tycon.MembersOfFSharpTyconSorted
|
||||
|> Seq.tryPick (fun m -> tryFindExtensionAttribute m.Attribs)
|
||||
)
|
||||
tycon
|
||||
)
|
||||
else
|
||||
tyconOpt
|
||||
let defnAs = MutRecShape.Tycon(TyconBindingsPhase2A(tyconOpt, declKind, prelimRecValues, tcref, copyOfTyconTypars, thisTy, defnAs))
|
||||
defnAs, (tpenv, recBindIdx, uncheckedBindsRev))
|
||||
|
||||
|
@ -1619,8 +1655,21 @@ module MutRecBindingChecking =
|
|||
|
||||
defnsEs, envMutRec
|
||||
|
||||
let private ReportErrorOnStaticClass (synMembers: SynMemberDefn list) =
|
||||
for mem in synMembers do
|
||||
match mem with
|
||||
| SynMemberDefn.ImplicitCtor(ctorArgs = SynSimplePats.SimplePats(pats = pats)) when (not pats.IsEmpty) ->
|
||||
for pat in pats do
|
||||
errorR(Error(FSComp.SR.chkConstructorWithArgumentsOnStaticClasses(), pat.Range))
|
||||
|
||||
| SynMemberDefn.Member(SynBinding(valData = SynValData(memberFlags = Some memberFlags)), m) when memberFlags.MemberKind = SynMemberKind.Constructor ->
|
||||
errorR(Error(FSComp.SR.chkAdditionalConstructorOnStaticClasses(), m))
|
||||
| SynMemberDefn.Member(SynBinding(valData = SynValData(memberFlags = Some memberFlags)), m) when memberFlags.MemberKind = SynMemberKind.Member && memberFlags.IsInstance ->
|
||||
errorR(Error(FSComp.SR.chkInstanceMemberOnStaticClasses(), m));
|
||||
| _ -> ()
|
||||
|
||||
/// Check and generalize the interface implementations, members, 'let' definitions in a mutually recursive group of definitions.
|
||||
let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (envMutRec: TcEnv) (mutRecDefns: MutRecDefnsPhase2Data) =
|
||||
let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (envMutRec: TcEnv) (mutRecDefns: MutRecDefnsPhase2Data) isMutRec =
|
||||
let g = cenv.g
|
||||
let interfacesFromTypeDefn envForTycon tyconMembersData =
|
||||
let (MutRecDefnsPhase2DataForTycon(_, _, declKind, tcref, _, _, declaredTyconTypars, members, _, _, _)) = tyconMembersData
|
||||
|
@ -1650,10 +1699,12 @@ let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (env
|
|||
(generatedHashAndEqualsWithComparerValues && typeEquiv g intfTyR g.mk_IStructuralEquatable_ty) then
|
||||
errorR(Error(FSComp.SR.tcDefaultImplementationForInterfaceHasAlreadyBeenAdded(), intfTy.Range))
|
||||
|
||||
if overridesOK = WarnOnOverrides then
|
||||
warning(IntfImplInIntrinsicAugmentation(intfTy.Range))
|
||||
if overridesOK = ErrorOnOverrides then
|
||||
errorR(IntfImplInExtrinsicAugmentation(intfTy.Range))
|
||||
match isMutRec, overridesOK with
|
||||
| _, OverridesOK -> () // No warning/error if overrides are allowed
|
||||
| true, WarnOnOverrides -> () // If we are in a recursive module/namespace, overrides of interface implementations are allowed and not considered a warning
|
||||
| false, WarnOnOverrides -> warning(IntfImplInIntrinsicAugmentation(intfTy.Range))
|
||||
| _, ErrorOnOverrides -> errorR(IntfImplInExtrinsicAugmentation(intfTy.Range))
|
||||
|
||||
match defnOpt with
|
||||
| Some defn -> [ (intfTyR, defn, m) ]
|
||||
| _-> []
|
||||
|
@ -1717,7 +1768,13 @@ let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (env
|
|||
|
||||
let binds: MutRecDefnsPhase2Info =
|
||||
(envMutRec, mutRecDefns) ||> MutRecShapes.mapTyconsWithEnv (fun envForDecls tyconData ->
|
||||
let (MutRecDefnsPhase2DataForTycon(tyconOpt, _, declKind, tcref, _, _, declaredTyconTypars, _, _, _, fixupFinalAttrs)) = tyconData
|
||||
let (MutRecDefnsPhase2DataForTycon(tyconOpt, _x, declKind, tcref, _, _, declaredTyconTypars, synMembers, _, _, fixupFinalAttrs)) = tyconData
|
||||
|
||||
// If a tye uses both [<Sealed>] and [<AbstractClass>] attributes it means it is a static class.
|
||||
let isStaticClass = HasFSharpAttribute cenv.g cenv.g.attrib_SealedAttribute tcref.Attribs && HasFSharpAttribute cenv.g cenv.g.attrib_AbstractClassAttribute tcref.Attribs
|
||||
if isStaticClass && cenv.g.langVersion.SupportsFeature(LanguageFeature.ErrorReportingOnStaticClasses) then
|
||||
ReportErrorOnStaticClass synMembers
|
||||
|
||||
let envForDecls =
|
||||
// This allows to implement protected interface methods if it's a DIM.
|
||||
// Does not need to be hidden behind a lang version as it needs to be possible to
|
||||
|
@ -2164,7 +2221,9 @@ module TcExceptionDeclarations =
|
|||
CheckForDuplicateConcreteType env (id.idText + "Exception") id.idRange
|
||||
CheckForDuplicateConcreteType env id.idText id.idRange
|
||||
let repr = TExnFresh (Construct.MakeRecdFieldsTable [])
|
||||
let xmlDoc = xmlDoc.ToXmlDoc(true, Some [])
|
||||
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xmlDoc.ToXmlDoc(checkXmlDocs, Some [])
|
||||
Construct.NewExn cpath id vis repr attrs xmlDoc
|
||||
|
||||
let TcExnDefnCore_Phase1G_EstablishRepresentation (cenv: cenv) (env: TcEnv) parent (exnc: Entity) (SynExceptionDefnRepr(_, SynUnionCase(caseType=args), reprIdOpt, _, _, m)) =
|
||||
|
@ -2254,7 +2313,7 @@ module TcExceptionDeclarations =
|
|||
let envMutRec = AddLocalExnDefnAndReport cenv.tcSink scopem (AddLocalTycons g cenv.amap scopem [exnc] envInitial) exnc
|
||||
|
||||
let defns = [MutRecShape.Tycon(MutRecDefnsPhase2DataForTycon(Some exnc, parent, ModuleOrMemberBinding, mkLocalEntityRef exnc, None, NoSafeInitInfo, [], aug, m, NoNewSlots, (fun () -> ())))]
|
||||
let binds2, envFinal = TcMutRecDefns_Phase2 cenv envInitial m scopem None envMutRec defns
|
||||
let binds2, envFinal = TcMutRecDefns_Phase2 cenv envInitial m scopem None envMutRec defns true
|
||||
let binds2flat = binds2 |> MutRecShapes.collectTycons |> List.collect snd
|
||||
// Augment types with references to values that implement the pre-baked semantics of the type
|
||||
let binds3 = AddAugmentationDeclarations.AddGenericEqualityBindings cenv envFinal exnc
|
||||
|
@ -2361,7 +2420,7 @@ module EstablishTypeDefinitionCores =
|
|||
for SynUnionCase (caseType=args; range=m) in unionCases do
|
||||
match args with
|
||||
| SynUnionCaseKind.Fields flds ->
|
||||
for SynField(_, _, _, ty, _, _, _, m) in flds do
|
||||
for SynField(fieldType = ty; range = m) in flds do
|
||||
let tyR, _ = TcTypeAndRecover cenv NoNewTypars NoCheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv ty
|
||||
yield (tyR, m)
|
||||
|
||||
|
@ -2378,7 +2437,7 @@ module EstablishTypeDefinitionCores =
|
|||
|
||||
| SynTypeDefnSimpleRepr.General (_, _, _, fields, _, _, implicitCtorSynPats, _) when tycon.IsFSharpStructOrEnumTycon -> // for structs
|
||||
for field in fields do
|
||||
let (SynField(_, isStatic, _, ty, _, _, _, m)) = field
|
||||
let (SynField(isStatic = isStatic; fieldType = ty; range = m)) = field
|
||||
if not isStatic then
|
||||
let tyR, _ = TcTypeAndRecover cenv NoNewTypars NoCheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv ty
|
||||
yield (tyR, m)
|
||||
|
@ -2398,7 +2457,7 @@ module EstablishTypeDefinitionCores =
|
|||
yield (ty, m)
|
||||
|
||||
| SynTypeDefnSimpleRepr.Record (_, fields, _) ->
|
||||
for SynField(_, _, _, ty, _, _, _, m) in fields do
|
||||
for SynField(fieldType = ty; range = m) in fields do
|
||||
let tyR, _ = TcTypeAndRecover cenv NoNewTypars NoCheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv ty
|
||||
yield (tyR, m)
|
||||
|
||||
|
@ -2498,7 +2557,9 @@ module EstablishTypeDefinitionCores =
|
|||
|
||||
let envForDecls, moduleTyAcc = MakeInnerEnv true envInitial id moduleKind
|
||||
let moduleTy = Construct.NewEmptyModuleOrNamespaceType moduleKind
|
||||
let xmlDoc = xml.ToXmlDoc(true, Some [])
|
||||
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xml.ToXmlDoc(checkXmlDocs, Some [])
|
||||
let moduleEntity = Construct.NewModuleOrNamespace (Some envInitial.eCompPath) vis id xmlDoc modAttrs (MaybeLazy.Strict moduleTy)
|
||||
let innerParent = Parent (mkLocalModuleRef moduleEntity)
|
||||
let innerTypeNames = TypeNamesInMutRecDecls cenv envForDecls decls
|
||||
|
@ -2566,7 +2627,9 @@ module EstablishTypeDefinitionCores =
|
|||
|
||||
patNames
|
||||
| _ -> []
|
||||
let xmlDoc = xmlDoc.ToXmlDoc(true, Some paramNames )
|
||||
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xmlDoc.ToXmlDoc(checkXmlDocs, Some paramNames )
|
||||
Construct.NewTycon
|
||||
(cpath, id.idText, id.idRange, vis, visOfRepr, TyparKind.Type, LazyWithContext.NotLazy checkedTypars,
|
||||
xmlDoc, preferPostfix, preEstablishedHasDefaultCtor, hasSelfReferentialCtor, lmodTy)
|
||||
|
@ -3143,11 +3206,22 @@ module EstablishTypeDefinitionCores =
|
|||
| None -> ()
|
||||
| Some spats ->
|
||||
let ctorArgNames, _ = TcSimplePatsOfUnknownType cenv true CheckCxs envinner tpenv spats
|
||||
if not ctorArgNames.IsEmpty then errorR (Error(FSComp.SR.parsOnlyClassCanTakeValueArguments(), m))
|
||||
if not ctorArgNames.IsEmpty then
|
||||
match spats with
|
||||
| SynSimplePats.SimplePats(_, m) -> errorR (Error(FSComp.SR.parsOnlyClassCanTakeValueArguments(), m))
|
||||
| SynSimplePats.Typed(_, _, m) -> errorR (Error(FSComp.SR.parsOnlyClassCanTakeValueArguments(), m))
|
||||
|
||||
let envinner = AddDeclaredTypars CheckForDuplicateTypars (tycon.Typars m) envinner
|
||||
let envinner = MakeInnerEnvForTyconRef envinner thisTyconRef false
|
||||
|
||||
let multiCaseUnionStructCheck (unionCases: UnionCase list) =
|
||||
if tycon.IsStructRecordOrUnionTycon && unionCases.Length > 1 then
|
||||
let fieldNames = [ for uc in unionCases do for ft in uc.FieldTable.TrueInstanceFieldsAsList do yield (ft.LogicalName, ft.Range) ]
|
||||
let distFieldNames = fieldNames |> List.distinctBy fst
|
||||
if distFieldNames.Length <> fieldNames.Length then
|
||||
let fieldRanges = distFieldNames |> List.map snd
|
||||
for m in fieldRanges do
|
||||
errorR(Error(FSComp.SR.tcStructUnionMultiCaseDistinctFields(), m))
|
||||
|
||||
// Notify the Language Service about field names in record/class declaration
|
||||
let ad = envinner.AccessRights
|
||||
|
@ -3239,10 +3313,7 @@ module EstablishTypeDefinitionCores =
|
|||
|
||||
let hasRQAAttribute = HasFSharpAttribute cenv.g cenv.g.attrib_RequireQualifiedAccessAttribute tycon.Attribs
|
||||
let unionCases = TcRecdUnionAndEnumDeclarations.TcUnionCaseDecls cenv envinner innerParent thisTy thisTyInst hasRQAAttribute tpenv unionCases
|
||||
if tycon.IsStructRecordOrUnionTycon && unionCases.Length > 1 then
|
||||
let fieldNames = [ for uc in unionCases do for ft in uc.FieldTable.TrueInstanceFieldsAsList do yield ft.LogicalName ]
|
||||
if fieldNames |> List.distinct |> List.length <> fieldNames.Length then
|
||||
errorR(Error(FSComp.SR.tcStructUnionMultiCaseDistinctFields(), m))
|
||||
multiCaseUnionStructCheck unionCases
|
||||
|
||||
writeFakeUnionCtorsToSink unionCases
|
||||
let repr = Construct.MakeUnionRepr unionCases
|
||||
|
@ -3945,6 +4016,14 @@ module TcDeclarations =
|
|||
| SynMemberDefn.NestedType (range=m) :: _ -> errorR(Error(FSComp.SR.tcTypesCannotContainNestedTypes(), m))
|
||||
| _ -> ()
|
||||
| ds ->
|
||||
// Check for duplicated parameters in abstract methods
|
||||
for slot in ds do
|
||||
if isAbstractSlot slot then
|
||||
match slot with
|
||||
| SynMemberDefn.AbstractSlot (slotSig = synVal; range = m) ->
|
||||
CheckDuplicatesArgNames synVal m
|
||||
| _ -> ()
|
||||
|
||||
// Classic class construction
|
||||
let _, ds = List.takeUntil (allFalse [isMember;isAbstractSlot;isInterface;isInherit;isField;isTycon]) ds
|
||||
match ds with
|
||||
|
@ -3970,11 +4049,12 @@ module TcDeclarations =
|
|||
let rec private SplitTyconDefn (SynTypeDefn(typeInfo=synTyconInfo;typeRepr=trepr; members=extraMembers)) =
|
||||
let extraMembers = desugarGetSetMembers extraMembers
|
||||
let implements1 = List.choose (function SynMemberDefn.Interface (interfaceType=ty) -> Some(ty, ty.Range) | _ -> None) extraMembers
|
||||
|
||||
match trepr with
|
||||
| SynTypeDefnRepr.ObjectModel(kind, cspec, m) ->
|
||||
let cspec = desugarGetSetMembers cspec
|
||||
CheckMembersForm cspec
|
||||
let fields = cspec |> List.choose (function SynMemberDefn.ValField (f, _) -> Some f | _ -> None)
|
||||
let fields = cspec |> List.choose (function SynMemberDefn.ValField (fieldInfo = f) -> Some f | _ -> None)
|
||||
let implements2 = cspec |> List.choose (function SynMemberDefn.Interface (interfaceType=ty) -> Some(ty, ty.Range) | _ -> None)
|
||||
let inherits =
|
||||
cspec |> List.choose (function
|
||||
|
@ -3982,7 +4062,7 @@ module TcDeclarations =
|
|||
| SynMemberDefn.ImplicitInherit (ty, _, idOpt, m) -> Some(ty, m, idOpt)
|
||||
| _ -> None)
|
||||
//let nestedTycons = cspec |> List.choose (function SynMemberDefn.NestedType (x, _, _) -> Some x | _ -> None)
|
||||
let slotsigs = cspec |> List.choose (function SynMemberDefn.AbstractSlot (x, y, _) -> Some(x, y) | _ -> None)
|
||||
let slotsigs = cspec |> List.choose (function SynMemberDefn.AbstractSlot (slotSig = x; flags = y) -> Some(x, y) | _ -> None)
|
||||
|
||||
let members =
|
||||
let membersIncludingAutoProps =
|
||||
|
@ -4011,7 +4091,7 @@ module TcDeclarations =
|
|||
let mLetPortion = synExpr.Range
|
||||
let fldId = ident (CompilerGeneratedName id.idText, mLetPortion)
|
||||
let headPat = SynPat.LongIdent (SynLongIdent([fldId], [], [None]), None, Some noInferredTypars, SynArgPats.Pats [], None, mLetPortion)
|
||||
let retInfo = match tyOpt with None -> None | Some ty -> Some (SynReturnInfo((ty, SynInfo.unnamedRetVal), ty.Range))
|
||||
let retInfo = match tyOpt with None -> None | Some ty -> Some (None, SynReturnInfo((ty, SynInfo.unnamedRetVal), ty.Range))
|
||||
let isMutable =
|
||||
match propKind with
|
||||
| SynMemberKind.PropertySet
|
||||
|
@ -4032,7 +4112,7 @@ module TcDeclarations =
|
|||
// Convert auto properties to member bindings in the post-list
|
||||
let rec postAutoProps memb =
|
||||
match memb with
|
||||
| SynMemberDefn.AutoProperty(attributes=Attributes attribs; isStatic=isStatic; ident=id; typeOpt=tyOpt; propKind=propKind; memberFlags=memberFlags; memberFlagsForSet=memberFlagsForSet; xmlDoc=xmlDoc; accessibility=access; getSetRange=mGetSetOpt) ->
|
||||
| SynMemberDefn.AutoProperty(attributes=Attributes attribs; isStatic=isStatic; ident=id; typeOpt=tyOpt; propKind=propKind; memberFlags=memberFlags; memberFlagsForSet=memberFlagsForSet; xmlDoc=xmlDoc; accessibility=access; trivia = { GetSetKeywords = mGetSetOpt }) ->
|
||||
let mMemberPortion = id.idRange
|
||||
// Only the keep the non-field-targeted attributes
|
||||
let attribs = attribs |> List.filter (fun a -> match a.Target with Some t when t.idText = "field" -> false | _ -> true)
|
||||
|
@ -4043,7 +4123,7 @@ module TcDeclarations =
|
|||
let memberFlagsForSet = { memberFlagsForSet with GetterOrSetterIsCompilerGenerated = true }
|
||||
|
||||
match propKind, mGetSetOpt with
|
||||
| SynMemberKind.PropertySet, Some m -> errorR(Error(FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSetNotJustSet(), m))
|
||||
| SynMemberKind.PropertySet, Some gs -> errorR(Error(FSComp.SR.parsMutableOnAutoPropertyShouldBeGetSetNotJustSet(), gs.Range))
|
||||
| _ -> ()
|
||||
|
||||
[
|
||||
|
@ -4053,7 +4133,7 @@ module TcDeclarations =
|
|||
| SynMemberKind.PropertyGetSet ->
|
||||
let getter =
|
||||
let rhsExpr = SynExpr.Ident fldId
|
||||
let retInfo = match tyOpt with None -> None | Some ty -> Some (SynReturnInfo((ty, SynInfo.unnamedRetVal), ty.Range))
|
||||
let retInfo = match tyOpt with None -> None | Some ty -> Some (None, SynReturnInfo((ty, SynInfo.unnamedRetVal), ty.Range))
|
||||
let attribs = mkAttributeList attribs mMemberPortion
|
||||
let binding = mkSynBinding (xmlDoc, headPat) (access, false, false, mMemberPortion, DebugPointAtBinding.NoneAtInvisible, retInfo, rhsExpr, rhsExpr.Range, [], attribs, Some memberFlags, SynBindingTrivia.Zero)
|
||||
SynMemberDefn.Member (binding, mMemberPortion)
|
||||
|
@ -4138,7 +4218,7 @@ module TcDeclarations =
|
|||
//-------------------------------------------------------------------------
|
||||
|
||||
/// Bind a collection of mutually recursive definitions in an implementation file
|
||||
let TcMutRecDefinitions (cenv: cenv) envInitial parent typeNames tpenv m scopem mutRecNSInfo (mutRecDefns: MutRecDefnsInitialData) =
|
||||
let TcMutRecDefinitions (cenv: cenv) envInitial parent typeNames tpenv m scopem mutRecNSInfo (mutRecDefns: MutRecDefnsInitialData) isMutRec =
|
||||
|
||||
let g = cenv.g
|
||||
|
||||
|
@ -4192,7 +4272,51 @@ module TcDeclarations =
|
|||
cenv true scopem m
|
||||
|
||||
// Check the members and decide on representations for types with implicit constructors.
|
||||
let withBindings, envFinal = TcMutRecDefns_Phase2 cenv envInitial m scopem mutRecNSInfo envMutRecPrelimWithReprs withEnvs
|
||||
let withBindings, envFinal = TcMutRecDefns_Phase2 cenv envInitial m scopem mutRecNSInfo envMutRecPrelimWithReprs withEnvs isMutRec
|
||||
|
||||
let withBindings =
|
||||
if cenv.g.langVersion.SupportsFeature(LanguageFeature.CSharpExtensionAttributeNotRequired) then
|
||||
// If any of the types has a member with the System.Runtime.CompilerServices.ExtensionAttribute,
|
||||
// or a recursive module has a binding with the System.Runtime.CompilerServices.ExtensionAttribute,
|
||||
// that type/recursive module should also received the ExtensionAttribute if it is not yet present.
|
||||
// Example:
|
||||
// open System.Runtime.CompilerServices
|
||||
//
|
||||
// type Int32Extensions =
|
||||
// [<Extension>]
|
||||
// static member PlusOne (a:int) : int = a + 1
|
||||
//
|
||||
// or
|
||||
//
|
||||
// module rec Foo
|
||||
//
|
||||
// [<System.Runtime.CompilerServices.Extension>]
|
||||
// let PlusOne (a:int) = a + 1
|
||||
withBindings
|
||||
|> List.map (function
|
||||
| MutRecShape.Tycon (Some tycon, bindings) ->
|
||||
let tycon =
|
||||
tryAddExtensionAttributeIfNotAlreadyPresent
|
||||
(fun tryFindExtensionAttribute ->
|
||||
tycon.MembersOfFSharpTyconSorted
|
||||
|> Seq.tryPick (fun m -> tryFindExtensionAttribute m.Attribs)
|
||||
)
|
||||
tycon
|
||||
MutRecShape.Tycon (Some tycon, bindings)
|
||||
| MutRecShape.Module ((MutRecDefnsPhase2DataForModule(moduleOrNamespaceType, entity), env), shapes) ->
|
||||
let entity =
|
||||
tryAddExtensionAttributeIfNotAlreadyPresent
|
||||
(fun tryFindExtensionAttribute ->
|
||||
moduleOrNamespaceType.Value.AllValsAndMembers
|
||||
|> Seq.filter(fun v -> v.IsModuleBinding)
|
||||
|> Seq.tryPick (fun v -> tryFindExtensionAttribute v.Attribs)
|
||||
)
|
||||
entity
|
||||
|
||||
MutRecShape.Module ((MutRecDefnsPhase2DataForModule(moduleOrNamespaceType, entity), env), shapes)
|
||||
| shape -> shape)
|
||||
else
|
||||
withBindings
|
||||
|
||||
// Generate the hash/compare/equality bindings for all tycons.
|
||||
//
|
||||
|
@ -4230,22 +4354,22 @@ module TcDeclarations =
|
|||
let implements2 = cspec |> List.choose (function SynMemberSig.Interface (ty, m) -> Some(ty, m) | _ -> None)
|
||||
let inherits = cspec |> List.choose (function SynMemberSig.Inherit (ty, _) -> Some(ty, m, None) | _ -> None)
|
||||
//let nestedTycons = cspec |> List.choose (function SynMemberSig.NestedType (x, _) -> Some x | _ -> None)
|
||||
let slotsigs = cspec |> List.choose (function SynMemberSig.Member (v, fl, _) when fl.IsDispatchSlot -> Some(v, fl) | _ -> None)
|
||||
let slotsigs = cspec |> List.choose (function SynMemberSig.Member (memberSig = v; flags = fl) when fl.IsDispatchSlot -> Some(v, fl) | _ -> None)
|
||||
let members = cspec |> List.filter (function
|
||||
| SynMemberSig.Interface _ -> true
|
||||
| SynMemberSig.Member (_, memberFlags, _) when not memberFlags.IsDispatchSlot -> true
|
||||
| SynMemberSig.Member (flags = memberFlags) when not memberFlags.IsDispatchSlot -> true
|
||||
| SynMemberSig.NestedType (_, m) -> error(Error(FSComp.SR.tcTypesCannotContainNestedTypes(), m)); false
|
||||
| _ -> false)
|
||||
let isConcrete =
|
||||
members |> List.exists (function
|
||||
| SynMemberSig.Member (_, memberFlags, _) -> memberFlags.MemberKind=SynMemberKind.Constructor
|
||||
| SynMemberSig.Member (flags = memberFlags) -> memberFlags.MemberKind=SynMemberKind.Constructor
|
||||
| _ -> false)
|
||||
|
||||
// An ugly bit of code to pre-determine if a type has a nullary constructor, prior to establishing the
|
||||
// members of the type
|
||||
let preEstablishedHasDefaultCtor =
|
||||
members |> List.exists (function
|
||||
| SynMemberSig.Member (synValSig, memberFlags, _) ->
|
||||
| SynMemberSig.Member (memberSig = synValSig; flags = memberFlags) ->
|
||||
memberFlags.MemberKind=SynMemberKind.Constructor &&
|
||||
// REVIEW: This is a syntactic approximation
|
||||
(match synValSig.SynType, synValSig.SynInfo.CurriedArgInfos with
|
||||
|
@ -4351,6 +4475,7 @@ let rec TcSignatureElementNonMutRec (cenv: cenv) parent typeNames endm (env: TcE
|
|||
return env
|
||||
|
||||
| SynModuleSigDecl.Types (typeSpecs, m) ->
|
||||
CheckDuplicatesAbstractMethodParmsSig typeSpecs
|
||||
let scopem = unionRanges m endm
|
||||
let mutRecDefns = typeSpecs |> List.map MutRecShape.Tycon
|
||||
let env = TcDeclarations.TcMutRecSignatureDecls cenv env parent typeNames emptyUnscopedTyparEnv m scopem None mutRecDefns
|
||||
|
@ -4391,7 +4516,9 @@ let rec TcSignatureElementNonMutRec (cenv: cenv) parent typeNames endm (env: TcE
|
|||
let id = ident (modName, id.idRange)
|
||||
|
||||
let moduleTy = Construct.NewEmptyModuleOrNamespaceType moduleKind
|
||||
let xmlDoc = xml.ToXmlDoc(true, Some [])
|
||||
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xml.ToXmlDoc(checkXmlDocs, Some [])
|
||||
let moduleEntity = Construct.NewModuleOrNamespace (Some env.eCompPath) vis id xmlDoc attribs (MaybeLazy.Strict moduleTy)
|
||||
|
||||
let! moduleTy, _ = TcModuleOrNamespaceSignatureElementsNonMutRec cenv (Parent (mkLocalModuleRef moduleEntity)) env (id, moduleKind, moduleDefs, m, xml)
|
||||
|
@ -4497,7 +4624,8 @@ and TcSignatureElements cenv parent endm env xml mutRecNSInfo defs =
|
|||
cancellable {
|
||||
// Ensure the .Deref call in UpdateAccModuleOrNamespaceType succeeds
|
||||
if cenv.compilingCanonicalFslibModuleType then
|
||||
let xmlDoc = xml.ToXmlDoc(true, Some [])
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xml.ToXmlDoc(checkXmlDocs, Some [])
|
||||
ensureCcuHasModuleOrNamespaceAtPath cenv.thisCcu env.ePath env.eCompPath xmlDoc
|
||||
|
||||
let typeNames = EstablishTypeDefinitionCores.TypeNamesInNonMutRecSigDecls defs
|
||||
|
@ -4521,6 +4649,7 @@ and TcSignatureElementsMutRec cenv parent typeNames m mutRecNSInfo envInitial (d
|
|||
((true, true), defs) ||> List.collectFold (fun (openOk, moduleAbbrevOk) def ->
|
||||
match def with
|
||||
| SynModuleSigDecl.Types (typeSpecs, _) ->
|
||||
CheckDuplicatesAbstractMethodParmsSig typeSpecs
|
||||
let decls = typeSpecs |> List.map MutRecShape.Tycon
|
||||
decls, (false, false)
|
||||
|
||||
|
@ -4532,7 +4661,7 @@ and TcSignatureElementsMutRec cenv parent typeNames m mutRecNSInfo envInitial (d
|
|||
| SynModuleSigDecl.Exception (exnSig=SynExceptionSig(exnRepr=exnRepr; withKeyword=withKeyword; members=members)) ->
|
||||
let ( SynExceptionDefnRepr(synAttrs, SynUnionCase(ident=SynIdent(id,_)), _, xmlDoc, vis, m)) = exnRepr
|
||||
let compInfo = SynComponentInfo(synAttrs, None, [], [id], xmlDoc, false, vis, id.idRange)
|
||||
let decls = [ MutRecShape.Tycon(SynTypeDefnSig.SynTypeDefnSig(compInfo, SynTypeDefnSigRepr.Exception exnRepr, members, m, { TypeKeyword = None; WithKeyword = withKeyword; EqualsRange = None })) ]
|
||||
let decls = [ MutRecShape.Tycon(SynTypeDefnSig.SynTypeDefnSig(compInfo, SynTypeDefnSigRepr.Exception exnRepr, members, m, { LeadingKeyword = SynTypeDefnLeadingKeyword.Synthetic; WithKeyword = withKeyword; EqualsRange = None })) ]
|
||||
decls, (false, false)
|
||||
|
||||
| SynModuleSigDecl.Val (vspec, _) ->
|
||||
|
@ -4648,7 +4777,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem
|
|||
| SynModuleDecl.Types (typeDefs, m) ->
|
||||
let scopem = unionRanges m scopem
|
||||
let mutRecDefns = typeDefs |> List.map MutRecShape.Tycon
|
||||
let mutRecDefnsChecked, envAfter = TcDeclarations.TcMutRecDefinitions cenv env parent typeNames tpenv m scopem None mutRecDefns
|
||||
let mutRecDefnsChecked, envAfter = TcDeclarations.TcMutRecDefinitions cenv env parent typeNames tpenv m scopem None mutRecDefns false
|
||||
// Check the non-escaping condition as we build the expression on the way back up
|
||||
let defn = TcMutRecDefsFinish cenv mutRecDefnsChecked m
|
||||
let escapeCheck () =
|
||||
|
@ -4722,7 +4851,9 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem
|
|||
// Create the new module specification to hold the accumulated results of the type of the module
|
||||
// Also record this in the environment as the accumulator
|
||||
let moduleTy = Construct.NewEmptyModuleOrNamespaceType moduleKind
|
||||
let xmlDoc = xml.ToXmlDoc(true, Some [])
|
||||
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xml.ToXmlDoc(checkXmlDocs, Some [])
|
||||
let moduleEntity = Construct.NewModuleOrNamespace (Some env.eCompPath) vis id xmlDoc modAttrs (MaybeLazy.Strict moduleTy)
|
||||
|
||||
// Now typecheck.
|
||||
|
@ -4730,6 +4861,31 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem
|
|||
|
||||
// Get the inferred type of the decls and record it in the modul.
|
||||
moduleEntity.entity_modul_type <- MaybeLazy.Strict moduleTyAcc.Value
|
||||
|
||||
let moduleEntity =
|
||||
if cenv.g.langVersion.SupportsFeature(LanguageFeature.CSharpExtensionAttributeNotRequired) then
|
||||
// If any of the let bindings inside the module has the System.Runtime.CompilerServices.ExtensionAttribute,
|
||||
// that module should also received the ExtensionAttribute if it is not yet present.
|
||||
// Example:
|
||||
// module Foo
|
||||
//
|
||||
//[<System.Runtime.CompilerServices.Extension>]
|
||||
//let PlusOne (a:int) = a + 1
|
||||
tryAddExtensionAttributeIfNotAlreadyPresent
|
||||
(fun tryFindExtensionAttribute ->
|
||||
match moduleContents with
|
||||
| ModuleOrNamespaceContents.TMDefs(defs) ->
|
||||
defs
|
||||
|> Seq.tryPick (function
|
||||
| ModuleOrNamespaceContents.TMDefLet (Binding.TBind(var = v),_) ->
|
||||
tryFindExtensionAttribute v.Attribs
|
||||
| _ -> None)
|
||||
| _ -> None
|
||||
)
|
||||
moduleEntity
|
||||
else
|
||||
moduleEntity
|
||||
|
||||
let moduleDef = TMDefRec(false, [], [], [ModuleOrNamespaceBinding.Module(moduleEntity, moduleContents)], m)
|
||||
|
||||
PublishModuleDefn cenv env moduleEntity
|
||||
|
@ -4789,7 +4945,6 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem
|
|||
let! moduleContents, topAttrs, envAtEnd = TcModuleOrNamespaceElements cenv parent endm envNS xml mutRecNSInfo [] defs
|
||||
|
||||
MutRecBindingChecking.TcMutRecDefns_UpdateNSContents nsInfo
|
||||
|
||||
let env, openDecls =
|
||||
if isNil enclosingNamespacePath then
|
||||
envAtEnd, []
|
||||
|
@ -4901,7 +5056,7 @@ and TcModuleOrNamespaceElementsMutRec (cenv: cenv) parent typeNames m envInitial
|
|||
loop (match parent with ParentNone -> true | Parent _ -> false) m [] defs
|
||||
|
||||
let tpenv = emptyUnscopedTyparEnv
|
||||
let mutRecDefnsChecked, envAfter = TcDeclarations.TcMutRecDefinitions cenv envInitial parent typeNames tpenv m scopem mutRecNSInfo mutRecDefns
|
||||
let mutRecDefnsChecked, envAfter = TcDeclarations.TcMutRecDefinitions cenv envInitial parent typeNames tpenv m scopem mutRecNSInfo mutRecDefns true
|
||||
|
||||
// Check the assembly attributes
|
||||
let attrs, _ = TcAttributesWithPossibleTargets false cenv envAfter AttributeTargets.Top synAttrs
|
||||
|
@ -4943,7 +5098,8 @@ and TcModuleOrNamespaceElements cenv parent endm env xml mutRecNSInfo openDecls0
|
|||
cancellable {
|
||||
// Ensure the deref_nlpath call in UpdateAccModuleOrNamespaceType succeeds
|
||||
if cenv.compilingCanonicalFslibModuleType then
|
||||
let xmlDoc = xml.ToXmlDoc(true, Some [])
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xml.ToXmlDoc(checkXmlDocs, Some [])
|
||||
ensureCcuHasModuleOrNamespaceAtPath cenv.thisCcu env.ePath env.eCompPath xmlDoc
|
||||
|
||||
// Collect the type names so we can implicitly add the compilation suffix to module names
|
||||
|
@ -5169,15 +5325,23 @@ let CheckOneImplFile
|
|||
isInternalTestSpanStackReferring,
|
||||
env,
|
||||
rootSigOpt: ModuleOrNamespaceType option,
|
||||
synImplFile) =
|
||||
synImplFile,
|
||||
diagnosticOptions) =
|
||||
|
||||
let (ParsedImplFileInput (_, isScript, qualNameOfFile, scopedPragmas, _, implFileFrags, isLastCompiland, _)) = synImplFile
|
||||
let (ParsedImplFileInput (fileName, isScript, qualNameOfFile, scopedPragmas, _, implFileFrags, isLastCompiland, _, _)) = synImplFile
|
||||
let infoReader = InfoReader(g, amap)
|
||||
|
||||
cancellable {
|
||||
use _ =
|
||||
Activity.start "CheckDeclarations.CheckOneImplFile"
|
||||
[|
|
||||
Activity.Tags.fileName, fileName
|
||||
Activity.Tags.qualifiedNameOfFile, qualNameOfFile.Text
|
||||
|]
|
||||
let cenv =
|
||||
cenv.Create (g, isScript, amap, thisCcu, false, Option.isSome rootSigOpt,
|
||||
conditionalDefines, tcSink, (LightweightTcValForUsingInBuildMethodCall g), isInternalTestSpanStackReferring,
|
||||
diagnosticOptions,
|
||||
tcPat=TcPat,
|
||||
tcSimplePats=TcSimplePats,
|
||||
tcSequenceExpressionEntry=TcSequenceExpressionEntry,
|
||||
|
@ -5300,12 +5464,19 @@ let CheckOneImplFile
|
|||
|
||||
|
||||
/// Check an entire signature file
|
||||
let CheckOneSigFile (g, amap, thisCcu, checkForErrors, conditionalDefines, tcSink, isInternalTestSpanStackReferring) tcEnv (sigFile: ParsedSigFileInput) =
|
||||
let CheckOneSigFile (g, amap, thisCcu, checkForErrors, conditionalDefines, tcSink, isInternalTestSpanStackReferring, diagnosticOptions) tcEnv (sigFile: ParsedSigFileInput) =
|
||||
cancellable {
|
||||
use _ =
|
||||
Activity.start "CheckDeclarations.CheckOneSigFile"
|
||||
[|
|
||||
Activity.Tags.fileName, sigFile.FileName
|
||||
Activity.Tags.qualifiedNameOfFile, sigFile.QualifiedName.Text
|
||||
|]
|
||||
let cenv =
|
||||
cenv.Create
|
||||
(g, false, amap, thisCcu, true, false, conditionalDefines, tcSink,
|
||||
(LightweightTcValForUsingInBuildMethodCall g), isInternalTestSpanStackReferring,
|
||||
diagnosticOptions,
|
||||
tcPat=TcPat,
|
||||
tcSimplePats=TcSimplePats,
|
||||
tcSequenceExpressionEntry=TcSequenceExpressionEntry,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
module internal FSharp.Compiler.CheckDeclarations
|
||||
|
||||
open FSharp.Compiler.Diagnostics
|
||||
open Internal.Utilities.Library
|
||||
open FSharp.Compiler.CheckBasics
|
||||
open FSharp.Compiler.CompilerGlobalState
|
||||
|
@ -58,11 +59,19 @@ val CheckOneImplFile:
|
|||
bool *
|
||||
TcEnv *
|
||||
ModuleOrNamespaceType option *
|
||||
ParsedImplFileInput ->
|
||||
ParsedImplFileInput *
|
||||
FSharpDiagnosticOptions ->
|
||||
Cancellable<TopAttribs * CheckedImplFile * TcEnv * bool>
|
||||
|
||||
val CheckOneSigFile:
|
||||
TcGlobals * ImportMap * CcuThunk * (unit -> bool) * ConditionalDefines option * TcResultsSink * bool ->
|
||||
TcGlobals *
|
||||
ImportMap *
|
||||
CcuThunk *
|
||||
(unit -> bool) *
|
||||
ConditionalDefines option *
|
||||
TcResultsSink *
|
||||
bool *
|
||||
FSharpDiagnosticOptions ->
|
||||
TcEnv ->
|
||||
ParsedSigFileInput ->
|
||||
Cancellable<TcEnv * ModuleOrNamespaceType * bool>
|
||||
|
|
|
@ -1015,15 +1015,16 @@ let MakeMemberDataAndMangledNameForMemberVal(g, tcref, isExtrinsic, attrs, implS
|
|||
|
||||
if not isCompGen && IsLogicalInfixOpName id.idText then
|
||||
let m = id.idRange
|
||||
let name = ConvertValLogicalNameToDisplayNameCore id.idText
|
||||
let logicalName = id.idText
|
||||
let displayName = ConvertValLogicalNameToDisplayNameCore logicalName
|
||||
// Check symbolic members. Expect valSynData implied arity to be [[2]].
|
||||
match SynInfo.AritiesOfArgs valSynData with
|
||||
| [] | [0] -> warning(Error(FSComp.SR.memberOperatorDefinitionWithNoArguments name, m))
|
||||
| [] | [0] -> warning(Error(FSComp.SR.memberOperatorDefinitionWithNoArguments displayName, m))
|
||||
| n :: otherArgs ->
|
||||
let opTakesThreeArgs = IsLogicalTernaryOperator name
|
||||
if n<>2 && not opTakesThreeArgs then warning(Error(FSComp.SR.memberOperatorDefinitionWithNonPairArgument(name, n), m))
|
||||
if n<>3 && opTakesThreeArgs then warning(Error(FSComp.SR.memberOperatorDefinitionWithNonTripleArgument(name, n), m))
|
||||
if not (isNil otherArgs) then warning(Error(FSComp.SR.memberOperatorDefinitionWithCurriedArguments name, m))
|
||||
let opTakesThreeArgs = IsLogicalTernaryOperator logicalName
|
||||
if n<>2 && not opTakesThreeArgs then warning(Error(FSComp.SR.memberOperatorDefinitionWithNonPairArgument(displayName, n), m))
|
||||
if n<>3 && opTakesThreeArgs then warning(Error(FSComp.SR.memberOperatorDefinitionWithNonTripleArgument(displayName, n), m))
|
||||
if not (isNil otherArgs) then warning(Error(FSComp.SR.memberOperatorDefinitionWithCurriedArguments displayName, m))
|
||||
|
||||
if isExtrinsic && IsLogicalOpName id.idText then
|
||||
warning(Error(FSComp.SR.tcMemberOperatorDefinitionInExtrinsic(), id.idRange))
|
||||
|
@ -1209,6 +1210,12 @@ let CheckRequiredProperties (g:TcGlobals) (env: TcEnv) (cenv: TcFileState) (minf
|
|||
let details = NicePrint.multiLineStringOfPropInfos g cenv.amap mMethExpr env.DisplayEnv missingProps
|
||||
errorR(Error(FSComp.SR.tcMissingRequiredMembers details, mMethExpr))
|
||||
|
||||
let private HasMethodImplNoInliningAttribute g attrs =
|
||||
match TryFindFSharpAttribute g g.attrib_MethodImplAttribute attrs with
|
||||
// NO_INLINING = 8
|
||||
| Some (Attrib(_, _, [ AttribInt32Arg flags ], _, _, _, _)) -> (flags &&& 0x8) <> 0x0
|
||||
| _ -> false
|
||||
|
||||
let MakeAndPublishVal (cenv: cenv) env (altActualParent, inSig, declKind, valRecInfo, vscheme, attrs, xmlDoc, konst, isGeneratedEventVal) =
|
||||
|
||||
let g = cenv.g
|
||||
|
@ -1257,16 +1264,10 @@ let MakeAndPublishVal (cenv: cenv) env (altActualParent, inSig, declKind, valRec
|
|||
errorR(Error(FSComp.SR.tcDllImportStubsCannotBeInlined(), m))
|
||||
ValInline.Never
|
||||
else
|
||||
let implflags =
|
||||
match TryFindFSharpAttribute g g.attrib_MethodImplAttribute attrs with
|
||||
| Some (Attrib(_, _, [ AttribInt32Arg flags ], _, _, _, _)) -> flags
|
||||
| _ -> 0x0
|
||||
// MethodImplOptions.NoInlining = 0x8
|
||||
let NO_INLINING = 0x8
|
||||
if (implflags &&& NO_INLINING) <> 0x0 then
|
||||
ValInline.Never
|
||||
else
|
||||
inlineFlag
|
||||
if HasMethodImplNoInliningAttribute g attrs
|
||||
then ValInline.Never
|
||||
else inlineFlag
|
||||
|
||||
|
||||
// CompiledName not allowed on virtual/abstract/override members
|
||||
let compiledNameAttrib = TryFindFSharpStringAttribute g g.attrib_CompiledNameAttribute attrs
|
||||
|
@ -1780,7 +1781,7 @@ let FreshenAbstractSlot g amap m synTyparDecls absMethInfo =
|
|||
//-------------------------------------------------------------------------
|
||||
|
||||
/// Helper used to check record expressions and record patterns
|
||||
let BuildFieldMap (cenv: cenv) env isPartial ty flds m =
|
||||
let BuildFieldMap (cenv: cenv) env isPartial ty (flds: ((Ident list * Ident) * 'T) list) m =
|
||||
let g = cenv.g
|
||||
let ad = env.eAccessRights
|
||||
|
||||
|
@ -1792,7 +1793,8 @@ let BuildFieldMap (cenv: cenv) env isPartial ty flds m =
|
|||
let allFields = flds |> List.map (fun ((_, ident), _) -> ident)
|
||||
flds
|
||||
|> List.map (fun (fld, fldExpr) ->
|
||||
let frefSet = ResolveField cenv.tcSink cenv.nameResolver env.eNameResEnv ad ty fld allFields
|
||||
let (fldPath, fldId) = fld
|
||||
let frefSet = ResolveField cenv.tcSink cenv.nameResolver env.eNameResEnv ad ty fldPath fldId allFields
|
||||
fld, frefSet, fldExpr)
|
||||
|
||||
let relevantTypeSets =
|
||||
|
@ -1821,19 +1823,19 @@ let BuildFieldMap (cenv: cenv) env isPartial ty flds m =
|
|||
rfinfo1.TypeInst, rfinfo1.TyconRef
|
||||
|
||||
let fldsmap, rfldsList =
|
||||
((Map.empty, []), fldResolutions) ||> List.fold (fun (fs, rfldsList) (fld, frefs, fldExpr) ->
|
||||
((Map.empty, []), fldResolutions) ||> List.fold (fun (fs, rfldsList) ((_, ident), frefs, fldExpr) ->
|
||||
match frefs |> List.filter (fun (FieldResolution(rfinfo2, _)) -> tyconRefEq g tcref rfinfo2.TyconRef) with
|
||||
| [FieldResolution(rfinfo2, showDeprecated)] ->
|
||||
|
||||
// Record the precise resolution of the field for intellisense
|
||||
let item = Item.RecdField(rfinfo2)
|
||||
CallNameResolutionSink cenv.tcSink ((snd fld).idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, ad)
|
||||
CallNameResolutionSink cenv.tcSink (ident.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurence.Use, ad)
|
||||
|
||||
let fref2 = rfinfo2.RecdFieldRef
|
||||
|
||||
CheckRecdFieldAccessible cenv.amap m env.eAccessRights fref2 |> ignore
|
||||
|
||||
CheckFSharpAttributes g fref2.PropertyAttribs m |> CommitOperationResult
|
||||
CheckFSharpAttributes g fref2.PropertyAttribs ident.idRange |> CommitOperationResult
|
||||
|
||||
if Map.containsKey fref2.FieldName fs then
|
||||
errorR (Error(FSComp.SR.tcFieldAppearsTwiceInRecord(fref2.FieldName), m))
|
||||
|
@ -2168,7 +2170,8 @@ module GeneralizationHelpers =
|
|||
match memberFlags.MemberKind with
|
||||
// can't infer extra polymorphism for properties
|
||||
| SynMemberKind.PropertyGet
|
||||
| SynMemberKind.PropertySet ->
|
||||
| SynMemberKind.PropertySet
|
||||
| SynMemberKind.PropertyGetSet ->
|
||||
if not (isNil declaredTypars) then
|
||||
errorR(Error(FSComp.SR.tcPropertyRequiresExplicitTypeParameters(), m))
|
||||
| SynMemberKind.Constructor ->
|
||||
|
@ -2202,21 +2205,32 @@ module GeneralizationHelpers =
|
|||
// ComputeInlineFlag
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable m =
|
||||
let inlineFlag =
|
||||
let ComputeInlineFlag (memFlagsOption: SynMemberFlags option) isInline isMutable g attrs m =
|
||||
let hasNoCompilerInliningAttribute() = HasFSharpAttribute g g.attrib_NoCompilerInliningAttribute attrs
|
||||
let isCtorOrAbstractSlot() =
|
||||
match memFlagsOption with
|
||||
| None -> false
|
||||
| Some x -> (x.MemberKind = SynMemberKind.Constructor) || x.IsDispatchSlot || x.IsOverrideOrExplicitImpl
|
||||
|
||||
let inlineFlag, reportIncorrectInlineKeywordUsage =
|
||||
// Mutable values may never be inlined
|
||||
// Constructors may never be inlined
|
||||
// Calls to virtual/abstract slots may never be inlined
|
||||
if isMutable ||
|
||||
(match memFlagsOption with
|
||||
| None -> false
|
||||
| Some x -> (x.MemberKind = SynMemberKind.Constructor) || x.IsDispatchSlot || x.IsOverrideOrExplicitImpl)
|
||||
then ValInline.Never
|
||||
elif isInline then ValInline.Always
|
||||
else ValInline.Optional
|
||||
// Values marked with NoCompilerInliningAttribute or [<MethodImpl(MethodImplOptions.NoInlining)>] may never be inlined
|
||||
if isMutable || isCtorOrAbstractSlot() || hasNoCompilerInliningAttribute() then
|
||||
ValInline.Never, errorR
|
||||
elif HasMethodImplNoInliningAttribute g attrs then
|
||||
ValInline.Never,
|
||||
if g.langVersion.SupportsFeature LanguageFeature.WarningWhenInliningMethodImplNoInlineMarkedFunction
|
||||
then warning
|
||||
else ignore
|
||||
elif isInline then
|
||||
ValInline.Always, ignore
|
||||
else
|
||||
ValInline.Optional, ignore
|
||||
|
||||
if isInline && (inlineFlag <> ValInline.Always) then
|
||||
errorR(Error(FSComp.SR.tcThisValueMayNotBeInlined(), m))
|
||||
reportIncorrectInlineKeywordUsage (Error(FSComp.SR.tcThisValueMayNotBeInlined(), m))
|
||||
|
||||
inlineFlag
|
||||
|
||||
|
@ -2429,7 +2443,8 @@ module BindingNormalization =
|
|||
let (NormalizedBindingPat(pat, rhsExpr, valSynData, typars)) =
|
||||
NormalizeBindingPattern cenv cenv.nameResolver isObjExprBinding env valSynData headPat (NormalizedBindingRhs ([], retInfo, rhsExpr))
|
||||
let paramNames = Some valSynData.SynValInfo.ArgNames
|
||||
let xmlDoc = xmlDoc.ToXmlDoc(true, paramNames)
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xmlDoc.ToXmlDoc(checkXmlDocs, paramNames)
|
||||
NormalizedBinding(vis, kind, isInline, isMutable, attrs, xmlDoc, typars, valSynData, pat, rhsExpr, mBinding, debugPoint)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -3953,7 +3968,7 @@ let rec TcTyparConstraint ridx (cenv: cenv) newOk checkConstraints occ (env: TcE
|
|||
| SynTypeConstraint.WhereTyparIsDelegate(tp, synTys, m) ->
|
||||
TcConstraintWhereTyparIsDelegate cenv env newOk checkConstraints occ tpenv tp synTys m
|
||||
|
||||
| SynTypeConstraint.WhereTyparSupportsMember(synSupportTys, synMemberSig, m) ->
|
||||
| SynTypeConstraint.WhereTyparSupportsMember(TypesForTypar synSupportTys, synMemberSig, m) ->
|
||||
TcConstraintWhereTyparSupportsMember cenv env newOk tpenv synSupportTys synMemberSig m
|
||||
|
||||
| SynTypeConstraint.WhereSelfConstrained(ty, m) ->
|
||||
|
@ -4028,7 +4043,7 @@ and TcPseudoMemberSpec cenv newOk env synTypes tpenv synMemberSig m =
|
|||
let tys, tpenv = List.mapFold (TcTypeAndRecover cenv newOk CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env) tpenv synTypes
|
||||
|
||||
match synMemberSig with
|
||||
| SynMemberSig.Member (synValSig, memberFlags, m) ->
|
||||
| SynMemberSig.Member (synValSig, memberFlags, m, _) ->
|
||||
// REVIEW: Test pseudo constraints cannot refer to polymorphic methods.
|
||||
// REVIEW: Test pseudo constraints cannot be curried.
|
||||
let members, tpenv = TcValSpec cenv env ModuleOrMemberBinding newOk ExprContainerInfo (Some memberFlags) (Some (List.head tys)) tpenv synValSig []
|
||||
|
@ -4352,9 +4367,6 @@ and TcTypeOrMeasure kindOpt (cenv: cenv) newOk checkConstraints occ (iwsam: Warn
|
|||
| SynType.MeasurePower(ty, exponent, m) ->
|
||||
TcTypeMeasurePower kindOpt cenv newOk checkConstraints occ env tpenv ty exponent m
|
||||
|
||||
| SynType.MeasureDivide(typ1, typ2, m) ->
|
||||
TcTypeMeasureDivide kindOpt cenv newOk checkConstraints occ env tpenv typ1 typ2 m
|
||||
|
||||
| SynType.App(arg1, _, args, _, _, postfix, m) ->
|
||||
TcTypeMeasureApp kindOpt cenv newOk checkConstraints occ env tpenv arg1 args postfix m
|
||||
|
||||
|
@ -4362,6 +4374,10 @@ and TcTypeOrMeasure kindOpt (cenv: cenv) newOk checkConstraints occ (iwsam: Warn
|
|||
| SynType.SignatureParameter(usedType = innerType) ->
|
||||
TcTypeOrMeasure kindOpt cenv newOk checkConstraints occ iwsam env tpenv innerType
|
||||
|
||||
| SynType.Or(range = m) ->
|
||||
// The inner types are expected to be collected by (|TypesForTypar|) at this point.
|
||||
error(Error((FSComp.SR.tcSynTypeOrInvalidInDeclaration()), m))
|
||||
|
||||
and CheckIWSAM (cenv: cenv) (env: TcEnv) checkConstraints iwsam m tcref =
|
||||
let g = cenv.g
|
||||
let ad = env.eAccessRights
|
||||
|
@ -4369,7 +4385,7 @@ and CheckIWSAM (cenv: cenv) (env: TcEnv) checkConstraints iwsam m tcref =
|
|||
if iwsam = WarnOnIWSAM.Yes && isInterfaceTy g ty && checkConstraints = CheckCxs then
|
||||
let tcref = tcrefOfAppTy g ty
|
||||
let meths = AllMethInfosOfTypeInScope ResultCollectionSettings.AllResults cenv.infoReader env.NameEnv None ad IgnoreOverrides m ty
|
||||
if meths |> List.exists (fun meth -> not meth.IsInstance && meth.IsDispatchSlot) then
|
||||
if meths |> List.exists (fun meth -> not meth.IsInstance && meth.IsDispatchSlot && not meth.IsExtensionMember) then
|
||||
warning(Error(FSComp.SR.tcUsingInterfaceWithStaticAbstractMethodAsType(tcref.DisplayNameWithStaticParametersAndUnderscoreTypars), m))
|
||||
|
||||
and TcLongIdentType kindOpt (cenv: cenv) newOk checkConstraints occ iwsam env tpenv synLongId =
|
||||
|
@ -4541,16 +4557,6 @@ and TcTypeMeasurePower kindOpt (cenv: cenv) newOk checkConstraints occ env tpenv
|
|||
let ms, tpenv = TcMeasure cenv newOk checkConstraints occ env tpenv ty m
|
||||
TType_measure (Measure.RationalPower (ms, TcSynRationalConst exponent)), tpenv
|
||||
|
||||
and TcTypeMeasureDivide kindOpt (cenv: cenv) newOk checkConstraints occ env tpenv typ1 typ2 m =
|
||||
match kindOpt with
|
||||
| Some TyparKind.Type ->
|
||||
errorR(Error(FSComp.SR.tcUnexpectedSymbolInTypeExpression("/"), m))
|
||||
NewErrorType (), tpenv
|
||||
| _ ->
|
||||
let ms1, tpenv = TcMeasure cenv newOk checkConstraints occ env tpenv typ1 m
|
||||
let ms2, tpenv = TcMeasure cenv newOk checkConstraints occ env tpenv typ2 m
|
||||
TType_measure (Measure.Prod(ms1, Measure.Inv ms2)), tpenv
|
||||
|
||||
and TcTypeMeasureApp kindOpt (cenv: cenv) newOk checkConstraints occ env tpenv arg1 args postfix m =
|
||||
match arg1 with
|
||||
| StripParenTypes (SynType.Var(_, m1) | SynType.MeasurePower(_, _, m1)) ->
|
||||
|
@ -5283,11 +5289,16 @@ and TcExprThenDynamic (cenv: cenv) overallTy env tpenv isArg e1 mQmark e2 delaye
|
|||
|
||||
TcExprThen cenv overallTy env tpenv isArg appExpr delayed
|
||||
|
||||
and TcExprsWithFlexes (cenv: cenv) env m tpenv flexes argTys args =
|
||||
if List.length args <> List.length argTys then error(Error(FSComp.SR.tcExpressionCountMisMatch((List.length argTys), (List.length args)), m))
|
||||
and TcExprsWithFlexes (cenv: cenv) env m tpenv flexes (argTys: TType list) (args: SynExpr list) =
|
||||
if args.Length <> argTys.Length then error(Error(FSComp.SR.tcExpressionCountMisMatch((argTys.Length), (args.Length)), m))
|
||||
(tpenv, List.zip3 flexes argTys args) ||> List.mapFold (fun tpenv (flex, ty, e) ->
|
||||
TcExprFlex cenv flex false ty env tpenv e)
|
||||
|
||||
and TcExprsNoFlexes (cenv: cenv) env m tpenv (argTys: TType list) (args: SynExpr list) =
|
||||
if args.Length <> argTys.Length then error(Error(FSComp.SR.tcExpressionCountMisMatch((argTys.Length), (args.Length)), m))
|
||||
(tpenv, List.zip argTys args) ||> List.mapFold (fun tpenv (ty, e) ->
|
||||
TcExprFlex2 cenv ty env false tpenv e)
|
||||
|
||||
and CheckSuperInit (cenv: cenv) objTy m =
|
||||
let g = cenv.g
|
||||
|
||||
|
@ -5343,7 +5354,7 @@ and TcPropagatingExprLeafThenConvert (cenv: cenv) overallTy actualTy (env: TcEnv
|
|||
UnifyTypes cenv env m overallTy.Commit actualTy
|
||||
f ()
|
||||
|
||||
/// Process a leaf construct, for cases where we propogate the overall type eagerly in
|
||||
/// Process a leaf construct, for cases where we propagate the overall type eagerly in
|
||||
/// some cases. Then apply additional type-directed conversions.
|
||||
///
|
||||
/// However in some cases favour propagating characteristics of the overall type.
|
||||
|
@ -5355,7 +5366,7 @@ and TcPropagatingExprLeafThenConvert (cenv: cenv) overallTy actualTy (env: TcEnv
|
|||
/// - tuple (except if overallTy is a tuple type or a variable type that can become one)
|
||||
/// - anon record (except if overallTy is an anon record type or a variable type that can become one)
|
||||
/// - record (except if overallTy is requiresCtor || haveCtor or a record type or a variable type that can become one))
|
||||
and TcPossiblyPropogatingExprLeafThenConvert isPropagating (cenv: cenv) (overallTy: OverallTy) (env: TcEnv) m processExpr =
|
||||
and TcPossiblyPropagatingExprLeafThenConvert isPropagating (cenv: cenv) (overallTy: OverallTy) (env: TcEnv) m processExpr =
|
||||
|
||||
let g = cenv.g
|
||||
|
||||
|
@ -5533,7 +5544,7 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE
|
|||
|
||||
| SynExpr.AnonRecd (isStruct, withExprOpt, unsortedFieldExprs, mWholeExpr) ->
|
||||
TcNonControlFlowExpr env <| fun env ->
|
||||
TcPossiblyPropogatingExprLeafThenConvert (fun ty -> isAnonRecdTy g ty || isTyparTy g ty) cenv overallTy env mWholeExpr (fun overallTy ->
|
||||
TcPossiblyPropagatingExprLeafThenConvert (fun ty -> isAnonRecdTy g ty || isTyparTy g ty) cenv overallTy env mWholeExpr (fun overallTy ->
|
||||
TcAnonRecdExpr cenv overallTy env tpenv (isStruct, withExprOpt, unsortedFieldExprs, mWholeExpr)
|
||||
)
|
||||
|
||||
|
@ -5651,7 +5662,7 @@ and TcExprUndelayed (cenv: cenv) (overallTy: OverallTy) env tpenv (synExpr: SynE
|
|||
TcNonControlFlowExpr env <| fun env ->
|
||||
TcExprNamedIndexPropertySet cenv overallTy env tpenv (synLongId, synExpr1, synExpr2, mStmt)
|
||||
|
||||
| SynExpr.TraitCall (tps, synMemberSig, arg, m) ->
|
||||
| SynExpr.TraitCall (TypesForTypar tps, synMemberSig, arg, m) ->
|
||||
TcNonControlFlowExpr env <| fun env ->
|
||||
TcExprTraitCall cenv overallTy env tpenv (tps, synMemberSig, arg, m)
|
||||
|
||||
|
@ -5794,13 +5805,27 @@ and TcExprLazy (cenv: cenv) overallTy env tpenv (synInnerExpr, m) =
|
|||
let expr = mkLazyDelayed g m innerTy (mkUnitDelayLambda g m innerExpr)
|
||||
expr, tpenv
|
||||
|
||||
and CheckTupleIsCorrectLength g (env: TcEnv) m tupleTy (args: 'a list) tcArgs =
|
||||
if isAnyTupleTy g tupleTy then
|
||||
let tupInfo, ptys = destAnyTupleTy g tupleTy
|
||||
|
||||
if args.Length <> ptys.Length then
|
||||
let argTys = NewInferenceTypes g args
|
||||
suppressErrorReporting (fun () -> tcArgs argTys)
|
||||
let expectedTy = TType_tuple (tupInfo, argTys)
|
||||
|
||||
// We let error recovery handle this exception
|
||||
error (ErrorFromAddingTypeEquation(g, env.DisplayEnv, tupleTy, expectedTy,
|
||||
(ConstraintSolverTupleDiffLengths(env.DisplayEnv, env.eContextInfo, ptys, argTys, m, m)), m))
|
||||
|
||||
and TcExprTuple (cenv: cenv) overallTy env tpenv (isExplicitStruct, args, m) =
|
||||
let g = cenv.g
|
||||
TcPossiblyPropogatingExprLeafThenConvert (fun ty -> isAnyTupleTy g ty || isTyparTy g ty) cenv overallTy env m (fun overallTy ->
|
||||
let tupInfo, argTys = UnifyTupleTypeAndInferCharacteristics env.eContextInfo cenv env.DisplayEnv m overallTy isExplicitStruct args
|
||||
TcPossiblyPropagatingExprLeafThenConvert (fun ty -> isAnyTupleTy g ty || isTyparTy g ty) cenv overallTy env m (fun overallTy ->
|
||||
|
||||
let flexes = argTys |> List.map (fun _ -> false)
|
||||
let argsR, tpenv = TcExprsWithFlexes cenv env m tpenv flexes argTys args
|
||||
CheckTupleIsCorrectLength g env m overallTy args (fun argTys -> TcExprsNoFlexes cenv env m tpenv argTys args |> ignore)
|
||||
|
||||
let tupInfo, argTys = UnifyTupleTypeAndInferCharacteristics env.eContextInfo cenv env.DisplayEnv m overallTy isExplicitStruct args
|
||||
let argsR, tpenv = TcExprsNoFlexes cenv env m tpenv argTys args
|
||||
let expr = mkAnyTupled g m tupInfo argsR argTys
|
||||
expr, tpenv
|
||||
)
|
||||
|
@ -5877,7 +5902,7 @@ and TcExprRecord (cenv: cenv) overallTy env tpenv (inherits, withExprOpt, synRec
|
|||
CallExprHasTypeSink cenv.tcSink (mWholeExpr, env.NameEnv, overallTy.Commit, env.AccessRights)
|
||||
let requiresCtor = (GetCtorShapeCounter env = 1) // Get special expression forms for constructors
|
||||
let haveCtor = Option.isSome inherits
|
||||
TcPossiblyPropogatingExprLeafThenConvert (fun ty -> requiresCtor || haveCtor || isRecdTy g ty || isTyparTy g ty) cenv overallTy env mWholeExpr (fun overallTy ->
|
||||
TcPossiblyPropagatingExprLeafThenConvert (fun ty -> requiresCtor || haveCtor || isRecdTy g ty || isTyparTy g ty) cenv overallTy env mWholeExpr (fun overallTy ->
|
||||
TcRecdExpr cenv overallTy env tpenv (inherits, withExprOpt, synRecdFields, mWholeExpr)
|
||||
)
|
||||
|
||||
|
@ -6080,8 +6105,7 @@ and TcExprILAssembly (cenv: cenv) overallTy env tpenv (ilInstrs, synTyArgs, synA
|
|||
let argTys = NewInferenceTypes g synArgs
|
||||
let tyargs, tpenv = TcTypes cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv synTyArgs
|
||||
// No subsumption at uses of IL assembly code
|
||||
let flexes = argTys |> List.map (fun _ -> false)
|
||||
let args, tpenv = TcExprsWithFlexes cenv env m tpenv flexes argTys synArgs
|
||||
let args, tpenv = TcExprsNoFlexes cenv env m tpenv argTys synArgs
|
||||
let retTys, tpenv = TcTypes cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv synRetTys
|
||||
let returnTy =
|
||||
match retTys with
|
||||
|
@ -6102,10 +6126,12 @@ and RewriteRangeExpr synExpr =
|
|||
match synExpr with
|
||||
// a..b..c (parsed as (a..b)..c )
|
||||
| SynExpr.IndexRange(Some (SynExpr.IndexRange(Some synExpr1, _, Some synStepExpr, _, _, _)), _, Some synExpr2, _m1, _m2, mWhole) ->
|
||||
let mWhole = mWhole.MakeSynthetic()
|
||||
Some (mkSynTrifix mWhole ".. .." synExpr1 synStepExpr synExpr2)
|
||||
// a..b
|
||||
| SynExpr.IndexRange (Some synExpr1, mOperator, Some synExpr2, _m1, _m2, mWhole) ->
|
||||
let otherExpr =
|
||||
let mWhole = mWhole.MakeSynthetic()
|
||||
match mkSynInfix mOperator synExpr1 ".." synExpr2 with
|
||||
| SynExpr.App (a, b, c, d, _) -> SynExpr.App (a, b, c, d, mWhole)
|
||||
| _ -> failwith "impossible"
|
||||
|
@ -6163,7 +6189,8 @@ and TcTyparExprThen (cenv: cenv) overallTy env tpenv synTypar m delayed =
|
|||
let tp, tpenv = TcTypar cenv env NoNewTypars tpenv synTypar
|
||||
let mExprAndLongId = unionRanges synTypar.Range ident.idRange
|
||||
let ty = mkTyparTy tp
|
||||
let item, _rest = ResolveLongIdentInType cenv.tcSink cenv.nameResolver env.NameEnv LookupKind.Expr ident.idRange ad ident IgnoreOverrides TypeNameResolutionInfo.Default ty
|
||||
let lookupKind = LookupKind.Expr LookupIsInstance.Ambivalent
|
||||
let item, _rest = ResolveLongIdentInType cenv.tcSink cenv.nameResolver env.NameEnv lookupKind ident.idRange ad ident IgnoreOverrides TypeNameResolutionInfo.Default ty
|
||||
let delayed3 =
|
||||
match rest with
|
||||
| [] -> delayed2
|
||||
|
@ -6701,7 +6728,7 @@ and TcObjectExprBinding (cenv: cenv) (env: TcEnv) implTy tpenv (absSlotInfo, bin
|
|||
| SynPat.Named (SynIdent(id,_), _, _, _), None ->
|
||||
let bindingRhs = PushOnePatternToRhs cenv true (mkSynThisPatVar (ident (CompilerGeneratedName "this", id.idRange))) bindingRhs
|
||||
let logicalMethId = id
|
||||
let memberFlags = OverrideMemberFlags SynMemberFlagsTrivia.Zero SynMemberKind.Member
|
||||
let memberFlags = OverrideMemberFlags SynMemberKind.Member
|
||||
bindingRhs, logicalMethId, memberFlags
|
||||
|
||||
| SynPat.InstanceMember(thisId, memberId, _, _, _), Some memberFlags ->
|
||||
|
@ -7135,18 +7162,18 @@ and TcInterpolatedStringExpr cenv (overallTy: OverallTy) env m tpenv (parts: Syn
|
|||
// Type check the expressions filling the holes
|
||||
|
||||
if List.isEmpty synFillExprs then
|
||||
let str = mkString g m printfFormatString
|
||||
|
||||
if isString then
|
||||
let sb = System.Text.StringBuilder(printfFormatString).Replace("%%", "%")
|
||||
let str = mkString g m (sb.ToString())
|
||||
TcPropagatingExprLeafThenConvert cenv overallTy g.string_ty env (* true *) m (fun () ->
|
||||
str, tpenv
|
||||
)
|
||||
else
|
||||
let str = mkString g m printfFormatString
|
||||
mkCallNewFormat g m printerTy printerArgTy printerResidueTy printerResultTy printerTupleTy str, tpenv
|
||||
else
|
||||
// Type check the expressions filling the holes
|
||||
let flexes = argTys |> List.map (fun _ -> false)
|
||||
let fillExprs, tpenv = TcExprsWithFlexes cenv env m tpenv flexes argTys synFillExprs
|
||||
let fillExprs, tpenv = TcExprsNoFlexes cenv env m tpenv argTys synFillExprs
|
||||
|
||||
let fillExprsBoxed = (argTys, fillExprs) ||> List.map2 (mkCallBox g m)
|
||||
|
||||
|
@ -7172,8 +7199,7 @@ and TcInterpolatedStringExpr cenv (overallTy: OverallTy) env m tpenv (parts: Syn
|
|||
| Choice2Of2 createFormattableStringMethod ->
|
||||
|
||||
// Type check the expressions filling the holes
|
||||
let flexes = argTys |> List.map (fun _ -> false)
|
||||
let fillExprs, tpenv = TcExprsWithFlexes cenv env m tpenv flexes argTys synFillExprs
|
||||
let fillExprs, tpenv = TcExprsNoFlexes cenv env m tpenv argTys synFillExprs
|
||||
|
||||
let fillExprsBoxed = (argTys, fillExprs) ||> List.map2 (mkCallBox g m)
|
||||
|
||||
|
@ -8580,7 +8606,7 @@ and TcImplicitOpItemThen (cenv: cenv) overallTy env id sln tpenv mItem delayed =
|
|||
|
||||
let vs, ves = argTys |> List.mapi (fun i ty -> mkCompGenLocal mItem ("arg" + string i) ty) |> List.unzip
|
||||
|
||||
let memberFlags = StaticMemberFlags SynMemberFlagsTrivia.Zero SynMemberKind.Member
|
||||
let memberFlags = StaticMemberFlags SynMemberKind.Member
|
||||
let logicalCompiledName = ComputeLogicalName id memberFlags
|
||||
let traitInfo = TTrait(argTys, logicalCompiledName, memberFlags, argTys, Some retTy, sln)
|
||||
|
||||
|
@ -9101,6 +9127,8 @@ and TcEventItemThen (cenv: cenv) overallTy env tpenv mItem mExprAndItem objDetai
|
|||
let objArgs = Option.toList (Option.map fst objDetails)
|
||||
MethInfoChecks g cenv.amap true None objArgs env.eAccessRights mItem delInvokeMeth
|
||||
|
||||
CheckILEventAttributes g einfo.DeclaringTyconRef (einfo.GetCustomAttrs()) mItem |> CommitOperationResult
|
||||
|
||||
// This checks for and drops the 'object' sender
|
||||
let argsTy = ArgsTypeOfEventInfo cenv.infoReader mItem ad einfo
|
||||
if not (slotSigHasVoidReturnTy (delInvokeMeth.GetSlotSig(cenv.amap, mItem))) then errorR (nonStandardEventError einfo.EventName mItem)
|
||||
|
@ -9908,7 +9936,7 @@ and TcMethodArg cenv env (lambdaPropagationInfo, tpenv) (lambdaPropagationInfoFo
|
|||
let lambdaPropagationInfo =
|
||||
[| for info, argInfo in Array.zip lambdaPropagationInfo lambdaPropagationInfoForArg do
|
||||
match argInfo with
|
||||
| ArgDoesNotMatch _ -> ()
|
||||
| ArgDoesNotMatch -> ()
|
||||
| NoInfo | CallerLambdaHasArgTypes _ ->
|
||||
yield info
|
||||
| CalledArgMatchesType (adjustedCalledArgTy, noEagerConstraintApplication) ->
|
||||
|
@ -10245,7 +10273,7 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt
|
|||
|> fun (r, v) -> (List.map fst r, List.map snd r, List.map snd v)
|
||||
let retAttribs =
|
||||
match rtyOpt with
|
||||
| Some (SynBindingReturnInfo(_, _, Attributes retAttrs)) ->
|
||||
| Some (SynBindingReturnInfo(attributes = Attributes retAttrs)) ->
|
||||
rotRetAttribs @ TcAttrs AttributeTargets.ReturnValue true retAttrs
|
||||
| None -> rotRetAttribs
|
||||
let valSynData =
|
||||
|
@ -10257,8 +10285,7 @@ and TcNormalizedBinding declKind (cenv: cenv) env tpenv overallTy safeThisValOpt
|
|||
retAttribs, valAttribs, valSynData
|
||||
|
||||
let isVolatile = HasFSharpAttribute g g.attrib_VolatileFieldAttribute valAttribs
|
||||
|
||||
let inlineFlag = ComputeInlineFlag memberFlagsOpt isInline isMutable mBinding
|
||||
let inlineFlag = ComputeInlineFlag memberFlagsOpt isInline isMutable g valAttribs mBinding
|
||||
|
||||
let argAttribs =
|
||||
spatsL |> List.map (SynInfo.InferSynArgInfoFromSimplePats >> List.map (SynInfo.AttribsOfArgData >> TcAttrs AttributeTargets.Parameter false))
|
||||
|
@ -10617,7 +10644,8 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn
|
|||
attributeAssignedNamedItems |> List.map (fun (CallerNamedArg(id, CallerArg(callerArgTy, m, isOpt, callerArgExpr))) ->
|
||||
if isOpt then error(Error(FSComp.SR.tcOptionalArgumentsCannotBeUsedInCustomAttribute(), m))
|
||||
let m = callerArgExpr.Range
|
||||
let setterItem, _ = ResolveLongIdentInType cenv.tcSink cenv.nameResolver env.NameEnv LookupKind.Expr m ad id IgnoreOverrides TypeNameResolutionInfo.Default ty
|
||||
let lookupKind = LookupKind.Expr LookupIsInstance.Ambivalent
|
||||
let setterItem, _ = ResolveLongIdentInType cenv.tcSink cenv.nameResolver env.NameEnv lookupKind m ad id IgnoreOverrides TypeNameResolutionInfo.Default ty
|
||||
let nm, isProp, argTy =
|
||||
match setterItem with
|
||||
| Item.Property (_, [pinfo]) ->
|
||||
|
@ -10893,7 +10921,7 @@ and ApplyTypesFromArgumentPatterns (cenv: cenv, env, optionalArgsOK, ty, m, tpen
|
|||
| [] ->
|
||||
match retInfoOpt with
|
||||
| None -> ()
|
||||
| Some (SynBindingReturnInfo (retInfoTy, m, _)) ->
|
||||
| Some (SynBindingReturnInfo (typeName = retInfoTy; range = m)) ->
|
||||
let retInfoTy, _ = TcTypeAndRecover cenv NewTyparsOK CheckCxs ItemOccurence.UseInType WarnOnIWSAM.Yes env tpenv retInfoTy
|
||||
UnifyTypes cenv env m ty retInfoTy
|
||||
// Property setters always have "unit" return type
|
||||
|
@ -10919,7 +10947,7 @@ and ComputeIsComplete enclosingDeclaredTypars declaredTypars ty =
|
|||
/// Determine if a uniquely-identified-abstract-slot exists for an override member (or interface member implementation) based on the information available
|
||||
/// at the syntactic definition of the member (i.e. prior to type inference). If so, we know the expected signature of the override, and the full slotsig
|
||||
/// it implements. Apply the inferred slotsig.
|
||||
and ApplyAbstractSlotInference (cenv: cenv) (envinner: TcEnv) (argsAndRetTy, m, synTyparDecls, declaredTypars, memberId, tcrefObjTy, renaming, _objTy, intfSlotTyOpt, valSynData, memberFlags: SynMemberFlags, attribs) =
|
||||
and ApplyAbstractSlotInference (cenv: cenv) (envinner: TcEnv) (baseValOpt: Val option) (argsAndRetTy, m, synTyparDecls, declaredTypars, memberId, tcrefObjTy, renaming, intfSlotTyOpt, valSynData, memberFlags: SynMemberFlags, attribs) =
|
||||
|
||||
let g = cenv.g
|
||||
let ad = envinner.eAccessRights
|
||||
|
@ -10966,7 +10994,21 @@ and ApplyAbstractSlotInference (cenv: cenv) (envinner: TcEnv) (argsAndRetTy, m,
|
|||
| _ -> [] // check that method to override is sealed is located at CheckOverridesAreAllUsedOnce (typrelns.fs)
|
||||
// We hit this case when it is ambiguous which abstract method is being implemented.
|
||||
|
||||
|
||||
if g.langVersion.SupportsFeature(LanguageFeature.ErrorForNonVirtualMembersOverrides) then
|
||||
// Checks if the declaring type inherits from a base class and is not FSharpObjModelTy
|
||||
// Raises an error if we try to override an non virtual member with the same name in both
|
||||
match baseValOpt with
|
||||
| Some ttype when not(isFSharpObjModelTy g ttype.Type) ->
|
||||
match stripTyEqns g ttype.Type with
|
||||
| TType_app(tyconRef, _, _) ->
|
||||
let ilMethods = tyconRef.ILTyconRawMetadata.Methods.AsList()
|
||||
let nameOpt = ilMethods |> List.tryFind(fun id -> id.Name = memberId.idText)
|
||||
match nameOpt with
|
||||
| Some name when not name.IsVirtual ->
|
||||
errorR(Error(FSComp.SR.tcNoMemberFoundForOverride(), memberId.idRange))
|
||||
| _ -> ()
|
||||
| _ -> ()
|
||||
| _ -> ()
|
||||
|
||||
// If we determined a unique member then utilize the type information from the slotsig
|
||||
let declaredTypars =
|
||||
|
@ -11128,14 +11170,14 @@ and AnalyzeRecursiveStaticMemberOrValDecl
|
|||
CheckForNonAbstractInterface declKind tcref memberFlags id.idRange
|
||||
|
||||
let isExtrinsic = (declKind = ExtrinsicExtensionBinding)
|
||||
let tcrefObjTy, enclosingDeclaredTypars, renaming, objTy, _ = FreshenObjectArgType cenv mBinding TyparRigidity.WillBeRigid tcref isExtrinsic declaredTyconTypars
|
||||
let tcrefObjTy, enclosingDeclaredTypars, renaming, _, _ = FreshenObjectArgType cenv mBinding TyparRigidity.WillBeRigid tcref isExtrinsic declaredTyconTypars
|
||||
let envinner = AddDeclaredTypars CheckForDuplicateTypars enclosingDeclaredTypars envinner
|
||||
let envinner = MakeInnerEnvForTyconRef envinner tcref isExtrinsic
|
||||
|
||||
let (ExplicitTyparInfo(_, declaredTypars, infer)) = explicitTyparInfo
|
||||
|
||||
let optInferredImplSlotTys, declaredTypars =
|
||||
ApplyAbstractSlotInference cenv envinner (ty, mBinding, synTyparDecls, declaredTypars, id, tcrefObjTy, renaming, objTy, intfSlotTyOpt, valSynInfo, memberFlags, bindingAttribs)
|
||||
ApplyAbstractSlotInference cenv envinner None (ty, mBinding, synTyparDecls, declaredTypars, id, tcrefObjTy, renaming, intfSlotTyOpt, valSynInfo, memberFlags, bindingAttribs)
|
||||
|
||||
let explicitTyparInfo = ExplicitTyparInfo(declaredTypars, declaredTypars, infer)
|
||||
|
||||
|
@ -11200,7 +11242,6 @@ and AnalyzeRecursiveStaticMemberOrValDecl
|
|||
| _ ->
|
||||
envinner, tpenv, id, None, None, vis, vis2, None, [], None, explicitTyparInfo, bindingRhs, declaredTypars
|
||||
|
||||
|
||||
and AnalyzeRecursiveInstanceMemberDecl
|
||||
(cenv: cenv,
|
||||
envinner: TcEnv,
|
||||
|
@ -11259,7 +11300,7 @@ and AnalyzeRecursiveInstanceMemberDecl
|
|||
// at the member signature. If so, we know the type of this member, and the full slotsig
|
||||
// it implements. Apply the inferred slotsig.
|
||||
let optInferredImplSlotTys, declaredTypars =
|
||||
ApplyAbstractSlotInference cenv envinner (argsAndRetTy, mBinding, synTyparDecls, declaredTypars, memberId, tcrefObjTy, renaming, objTy, intfSlotTyOpt, valSynInfo, memberFlags, bindingAttribs)
|
||||
ApplyAbstractSlotInference cenv envinner baseValOpt (argsAndRetTy, mBinding, synTyparDecls, declaredTypars, memberId, tcrefObjTy, renaming, intfSlotTyOpt, valSynInfo, memberFlags, bindingAttribs)
|
||||
|
||||
// Update the ExplicitTyparInfo to reflect the declaredTypars inferred from the abstract slot
|
||||
let explicitTyparInfo = ExplicitTyparInfo(declaredTypars, declaredTypars, infer)
|
||||
|
@ -11379,7 +11420,7 @@ and AnalyzeAndMakeAndPublishRecursiveValue
|
|||
// Allocate the type inference variable for the inferred type
|
||||
let ty = NewInferenceType g
|
||||
|
||||
let inlineFlag = ComputeInlineFlag memberFlagsOpt isInline isMutable mBinding
|
||||
let inlineFlag = ComputeInlineFlag memberFlagsOpt isInline isMutable g bindingAttribs mBinding
|
||||
|
||||
if isMutable then errorR(Error(FSComp.SR.tcOnlyRecordFieldsAndSimpleLetCanBeMutable(), mBinding))
|
||||
|
||||
|
@ -12003,7 +12044,7 @@ let TcAndPublishValSpec (cenv: cenv, env, containerInfo: ContainerInfo, declKind
|
|||
|
||||
let (ValSpecResult (altActualParent, memberInfoOpt, id, enclosingDeclaredTypars, declaredTypars, ty, prelimValReprInfo, declKind)) = valSpecResult
|
||||
|
||||
let inlineFlag = ComputeInlineFlag (memberInfoOpt |> Option.map (fun (PrelimMemberInfo(memberInfo, _, _)) -> memberInfo.MemberFlags)) isInline mutableFlag m
|
||||
let inlineFlag = ComputeInlineFlag (memberInfoOpt |> Option.map (fun (PrelimMemberInfo(memberInfo, _, _)) -> memberInfo.MemberFlags)) isInline mutableFlag g attrs m
|
||||
|
||||
let freeInType = freeInTypeLeftToRight g false ty
|
||||
|
||||
|
@ -12043,7 +12084,8 @@ let TcAndPublishValSpec (cenv: cenv, env, containerInfo: ContainerInfo, declKind
|
|||
| None -> None
|
||||
| Some valReprInfo -> Some valReprInfo.ArgNames
|
||||
|
||||
let xmlDoc = xmlDoc.ToXmlDoc(true, paramNames)
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xmlDoc.ToXmlDoc(checkXmlDocs, paramNames)
|
||||
let vspec = MakeAndPublishVal cenv env (altActualParent, true, declKind, ValNotInRecScope, valscheme, attrs, xmlDoc, literalValue, false)
|
||||
|
||||
assert(vspec.InlineInfo = inlineFlag)
|
||||
|
|
|
@ -623,6 +623,12 @@ val TcExpr:
|
|||
synExpr: SynExpr ->
|
||||
Expr * UnscopedTyparEnv
|
||||
|
||||
/// Check that 'args' have the correct number of elements for a tuple expression.
|
||||
/// If not, use 'tcArgs' to type check the given elements to show
|
||||
/// their correct types (if known) in the error message and raise the error
|
||||
val CheckTupleIsCorrectLength:
|
||||
g: TcGlobals -> env: TcEnv -> m: range -> tupleTy: TType -> args: 'a list -> tcArgs: (TType list -> unit) -> unit
|
||||
|
||||
/// Converts 'a..b' to a call to the '(..)' operator in FSharp.Core
|
||||
/// Converts 'a..b..c' to a call to the '(.. ..)' operator in FSharp.Core
|
||||
val RewriteRangeExpr: synExpr: SynExpr -> SynExpr option
|
||||
|
|
|
@ -48,6 +48,13 @@ let newInfo () =
|
|||
addZeros = false
|
||||
precision = false}
|
||||
|
||||
let escapeDotnetFormatString str =
|
||||
str
|
||||
// We need to double '{' and '}', because even if they were escaped in the
|
||||
// original string, extra curly braces were stripped away by the F# lexer.
|
||||
|> Seq.collect (fun x -> if x = '{' || x = '}' then [x;x] else [x])
|
||||
|> System.String.Concat
|
||||
|
||||
let parseFormatStringInternal
|
||||
(m: range)
|
||||
(fragRanges: range list)
|
||||
|
@ -55,7 +62,7 @@ let parseFormatStringInternal
|
|||
isInterpolated
|
||||
isFormattableString
|
||||
(context: FormatStringCheckContext option)
|
||||
fmt
|
||||
(fmt: string)
|
||||
printerArgTy
|
||||
printerResidueTy =
|
||||
|
||||
|
@ -86,6 +93,8 @@ let parseFormatStringInternal
|
|||
// there are no accurate intra-string ranges available for exact error message locations within the string.
|
||||
// The 'm' range passed as an input is however accurate and covers the whole string.
|
||||
//
|
||||
let escapeFormatStringEnabled = g.langVersion.SupportsFeature Features.LanguageFeature.EscapeDotnetFormattableStrings
|
||||
|
||||
let fmt, fragments =
|
||||
|
||||
//printfn "--------------------"
|
||||
|
@ -175,7 +184,7 @@ let parseFormatStringInternal
|
|||
| _ ->
|
||||
// Don't muck with the fmt when there is no source code context to go get the original
|
||||
// source code (i.e. when compiling or background checking)
|
||||
fmt, [ (0, 1, m) ]
|
||||
(if escapeFormatStringEnabled then escapeDotnetFormatString fmt else fmt), [ (0, 1, m) ]
|
||||
|
||||
let len = fmt.Length
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ module internal FSharp.Compiler.CheckIncrementalClasses
|
|||
|
||||
open System
|
||||
|
||||
open FSharp.Compiler.Diagnostics
|
||||
open Internal.Utilities.Collections
|
||||
open Internal.Utilities.Library
|
||||
open Internal.Utilities.Library.Extras
|
||||
|
@ -14,7 +15,6 @@ open FSharp.Compiler.CompilerGlobalState
|
|||
open FSharp.Compiler.DiagnosticsLogger
|
||||
open FSharp.Compiler.NameResolution
|
||||
open FSharp.Compiler.Syntax
|
||||
open FSharp.Compiler.SyntaxTrivia
|
||||
open FSharp.Compiler.SyntaxTreeOps
|
||||
open FSharp.Compiler.Text
|
||||
open FSharp.Compiler.Xml
|
||||
|
@ -122,7 +122,7 @@ let TcImplicitCtorLhs_Phase2A(cenv: cenv, env, tpenv, tcref: TyconRef, vis, attr
|
|||
|
||||
// NOTE: no attributes can currently be specified for the implicit constructor
|
||||
let attribs = TcAttributes cenv env (AttributeTargets.Constructor ||| AttributeTargets.Method) attrs
|
||||
let memberFlags = CtorMemberFlags SynMemberFlagsTrivia.Zero
|
||||
let memberFlags = CtorMemberFlags
|
||||
|
||||
let synArgInfos = List.map (SynInfo.InferSynArgInfoFromSimplePat []) spats
|
||||
let valSynData = SynValInfo([synArgInfos], SynInfo.unnamedRetVal)
|
||||
|
@ -136,7 +136,9 @@ let TcImplicitCtorLhs_Phase2A(cenv: cenv, env, tpenv, tcref: TyconRef, vis, attr
|
|||
let varReprInfo = InferGenericArityFromTyScheme prelimTyschemeG prelimValReprInfo
|
||||
let ctorValScheme = ValScheme(id, prelimTyschemeG, Some varReprInfo, None, Some memberInfo, false, ValInline.Never, NormalVal, vis, false, true, false, false)
|
||||
let paramNames = varReprInfo.ArgNames
|
||||
let xmlDoc = xmlDoc.ToXmlDoc(true, Some paramNames)
|
||||
|
||||
let checkXmlDocs = cenv.diagnosticOptions.CheckXmlDocs
|
||||
let xmlDoc = xmlDoc.ToXmlDoc(checkXmlDocs, Some paramNames)
|
||||
let ctorVal = MakeAndPublishVal cenv env (Parent tcref, false, ModuleOrMemberBinding, ValInRecScope isComplete, ctorValScheme, attribs, xmlDoc, None, false)
|
||||
ctorValScheme, ctorVal
|
||||
|
||||
|
@ -150,8 +152,8 @@ let TcImplicitCtorLhs_Phase2A(cenv: cenv, env, tpenv, tcref: TyconRef, vis, attr
|
|||
let cctorTy = mkFunTy g g.unit_ty g.unit_ty
|
||||
let valSynData = SynValInfo([[]], SynInfo.unnamedRetVal)
|
||||
let id = ident ("cctor", m)
|
||||
CheckForNonAbstractInterface ModuleOrMemberBinding tcref (ClassCtorMemberFlags SynMemberFlagsTrivia.Zero) id.idRange
|
||||
let memberInfo = MakeMemberDataAndMangledNameForMemberVal(g, tcref, false, [], [], (ClassCtorMemberFlags SynMemberFlagsTrivia.Zero), valSynData, id, false)
|
||||
CheckForNonAbstractInterface ModuleOrMemberBinding tcref ClassCtorMemberFlags id.idRange
|
||||
let memberInfo = MakeMemberDataAndMangledNameForMemberVal(g, tcref, false, [], [], ClassCtorMemberFlags, valSynData, id, false)
|
||||
let prelimValReprInfo = TranslateSynValInfo m (TcAttributes cenv env) valSynData
|
||||
let prelimTyschemeG = GeneralizedType(copyOfTyconTypars, cctorTy)
|
||||
let valReprInfo = InferGenericArityFromTyScheme prelimTyschemeG prelimValReprInfo
|
||||
|
@ -323,7 +325,7 @@ type IncrClassReprInfo =
|
|||
let tps, _, argInfos, _, _ = GetValReprTypeInCompiledForm g valReprInfo 0 v.Type v.Range
|
||||
|
||||
let valSynInfo = SynValInfo(argInfos |> List.mapSquared (fun (_, argInfo) -> SynArgInfo([], false, argInfo.Name)), SynInfo.unnamedRetVal)
|
||||
let memberFlags = (if isStatic then StaticMemberFlags else NonVirtualMemberFlags) SynMemberFlagsTrivia.Zero SynMemberKind.Member
|
||||
let memberFlags = (if isStatic then StaticMemberFlags else NonVirtualMemberFlags) SynMemberKind.Member
|
||||
let id = mkSynId v.Range name
|
||||
let memberInfo = MakeMemberDataAndMangledNameForMemberVal(g, tcref, false, [], [], memberFlags, valSynInfo, mkSynId v.Range name, true)
|
||||
|
||||
|
|
|
@ -289,6 +289,11 @@ and TcPat warnOnUpper (cenv: cenv) env valReprInfo vFlags (patEnv: TcPatLinearEn
|
|||
| SynPat.Or (pat1, pat2, m, _) ->
|
||||
TcPatOr warnOnUpper cenv env vFlags patEnv ty pat1 pat2 m
|
||||
|
||||
| SynPat.ListCons(pat1, pat2, m, trivia) ->
|
||||
let longDotId = SynLongIdent((mkSynCaseName trivia.ColonColonRange opNameCons), [], [Some (FSharp.Compiler.SyntaxTrivia.IdentTrivia.OriginalNotation "::")])
|
||||
let args = SynArgPats.Pats [ SynPat.Tuple(false, [ pat1; pat2 ], m) ]
|
||||
TcPatLongIdent warnOnUpper cenv env ad valReprInfo vFlags patEnv ty (longDotId, None, args, None, m)
|
||||
|
||||
| SynPat.Ands (pats, m) ->
|
||||
TcPatAnds warnOnUpper cenv env vFlags patEnv ty pats m
|
||||
|
||||
|
@ -418,6 +423,8 @@ and TcPatAnds warnOnUpper cenv env vFlags patEnv ty pats m =
|
|||
and TcPatTuple warnOnUpper cenv env vFlags patEnv ty isExplicitStruct args m =
|
||||
let g = cenv.g
|
||||
try
|
||||
CheckTupleIsCorrectLength g env m ty args (fun argTys -> TcPatterns warnOnUpper cenv env vFlags patEnv argTys args |> ignore)
|
||||
|
||||
let tupInfo, argTys = UnifyTupleTypeAndInferCharacteristics env.eContextInfo cenv env.DisplayEnv m ty isExplicitStruct args
|
||||
let argsR, acc = TcPatterns warnOnUpper cenv env vFlags patEnv argTys args
|
||||
let phase2 values = TPat_tuple(tupInfo, List.map (fun f -> f values) argsR, argTys, m)
|
||||
|
@ -471,13 +478,13 @@ and TcNullPat cenv env patEnv ty m =
|
|||
and CheckNoArgsForLiteral args m =
|
||||
match args with
|
||||
| SynArgPats.Pats []
|
||||
| SynArgPats.NamePatPairs ([], _) -> ()
|
||||
| SynArgPats.NamePatPairs (pats = []) -> ()
|
||||
| _ -> errorR (Error (FSComp.SR.tcLiteralDoesNotTakeArguments (), m))
|
||||
|
||||
and GetSynArgPatterns args =
|
||||
match args with
|
||||
| SynArgPats.Pats args -> args
|
||||
| SynArgPats.NamePatPairs (pairs, _) -> List.map (fun (_, _, pat) -> pat) pairs
|
||||
| SynArgPats.NamePatPairs (pats = pairs) -> List.map (fun (_, _, pat) -> pat) pairs
|
||||
|
||||
and TcArgPats warnOnUpper (cenv: cenv) env vFlags patEnv args =
|
||||
let g = cenv.g
|
||||
|
@ -548,8 +555,8 @@ and TcPatLongIdentNewDef warnOnUpperForId warnOnUpper (cenv: cenv) env ad valRep
|
|||
| [arg]
|
||||
when g.langVersion.SupportsFeature LanguageFeature.NameOf && IsNameOf cenv env ad m id ->
|
||||
match TcNameOfExpr cenv env tpenv (ConvSynPatToSynExpr arg) with
|
||||
| Expr.Const(c, m, _) -> (fun _ -> TPat_const (c, m)), patEnv
|
||||
| _ -> failwith "Impossible: TcNameOfExpr must return an Expr.Const"
|
||||
| Expr.Const(Const.String s, m, _) -> TcConstPat warnOnUpper cenv env vFlags patEnv ty (SynConst.String(s, SynStringKind.Regular, m)) m
|
||||
| _ -> failwith "Impossible: TcNameOfExpr must return an Expr.Const of type string"
|
||||
|
||||
| _ ->
|
||||
let _, acc = TcArgPats warnOnUpper cenv env vFlags patEnv args
|
||||
|
@ -565,7 +572,7 @@ and ApplyUnionCaseOrExn m (cenv: cenv) env overallTy item =
|
|||
UnifyTypes cenv env m overallTy g.exn_ty
|
||||
CheckTyconAccessible cenv.amap m ad ecref |> ignore
|
||||
let mkf mArgs args = TPat_exnconstr(ecref, args, unionRanges m mArgs)
|
||||
mkf, recdFieldTysOfExnDefRef ecref, [ for f in (recdFieldsOfExnDefRef ecref) -> f.Id ]
|
||||
mkf, recdFieldTysOfExnDefRef ecref, [ for f in (recdFieldsOfExnDefRef ecref) -> f ]
|
||||
|
||||
| Item.UnionCase(ucinfo, showDeprecated) ->
|
||||
if showDeprecated then
|
||||
|
@ -582,7 +589,7 @@ and ApplyUnionCaseOrExn m (cenv: cenv) env overallTy item =
|
|||
let inst = mkTyparInst ucref.TyconRef.TyparsNoRange ucinfo.TypeInst
|
||||
UnifyTypes cenv env m overallTy resTy
|
||||
let mkf mArgs args = TPat_unioncase(ucref, ucinfo.TypeInst, args, unionRanges m mArgs)
|
||||
mkf, actualTysOfUnionCaseFields inst ucref, [ for f in ucref.AllFieldsAsList -> f.Id ]
|
||||
mkf, actualTysOfUnionCaseFields inst ucref, [ for f in ucref.AllFieldsAsList -> f]
|
||||
|
||||
| _ ->
|
||||
invalidArg "item" "not a union case or exception reference"
|
||||
|
@ -599,8 +606,16 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m
|
|||
|
||||
let args, extraPatternsFromNames =
|
||||
match args with
|
||||
| SynArgPats.Pats args -> args, []
|
||||
| SynArgPats.NamePatPairs (pairs, m) ->
|
||||
| SynArgPats.Pats args ->
|
||||
if g.langVersion.SupportsFeature(LanguageFeature.MatchNotAllowedForUnionCaseWithNoData) then
|
||||
match args with
|
||||
| [ SynPat.Wild _ ] | [ SynPat.Named _ ] when argNames.IsEmpty ->
|
||||
warning(Error(FSComp.SR.matchNotAllowedForUnionCaseWithNoData(), m))
|
||||
args, []
|
||||
| _ -> args, []
|
||||
else
|
||||
args, []
|
||||
| SynArgPats.NamePatPairs (pairs, m, _) ->
|
||||
// rewrite patterns from the form (name-N = pat-N; ...) to (..._, pat-N, _...)
|
||||
// so type T = Case of name: int * value: int
|
||||
// | Case(value = v)
|
||||
|
@ -610,7 +625,7 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m
|
|||
let extraPatterns = List ()
|
||||
|
||||
for id, _, pat in pairs do
|
||||
match argNames |> List.tryFindIndex (fun id2 -> id.idText = id2.idText) with
|
||||
match argNames |> List.tryFindIndex (fun id2 -> id.idText = id2.Id.idText) with
|
||||
| None ->
|
||||
extraPatterns.Add pat
|
||||
match item with
|
||||
|
@ -656,10 +671,12 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m
|
|||
// note: we allow both 'C _' and 'C (_)' regardless of number of argument of the pattern
|
||||
| [SynPatErrorSkip(SynPat.Wild _ as e) | SynPatErrorSkip(SynPat.Paren(SynPatErrorSkip(SynPat.Wild _ as e), _))] -> List.replicate numArgTys e, []
|
||||
|
||||
|
||||
| args when numArgTys = 0 ->
|
||||
errorR (Error (FSComp.SR.tcUnionCaseDoesNotTakeArguments (), m))
|
||||
[], args
|
||||
if g.langVersion.SupportsFeature(LanguageFeature.MatchNotAllowedForUnionCaseWithNoData) then
|
||||
[], args
|
||||
else
|
||||
errorR (Error (FSComp.SR.tcUnionCaseDoesNotTakeArguments (), m))
|
||||
[], args
|
||||
|
||||
| arg :: rest when numArgTys = 1 ->
|
||||
if numArgTys = 1 && not (List.isEmpty rest) then
|
||||
|
@ -678,7 +695,14 @@ and TcPatLongIdentUnionCaseOrExnCase warnOnUpper cenv env ad vFlags patEnv ty (m
|
|||
elif numArgs < numArgTys then
|
||||
if numArgTys > 1 then
|
||||
// Expects tuple without enough args
|
||||
errorR (Error (FSComp.SR.tcUnionCaseExpectsTupledArguments numArgTys, m))
|
||||
let printTy = NicePrint.minimalStringOfType env.DisplayEnv
|
||||
let missingArgs =
|
||||
argNames.[numArgs..numArgTys - 1]
|
||||
|> List.map (fun id -> (if id.rfield_name_generated then "" else id.DisplayName + ": ") + printTy id.FormalType)
|
||||
|> String.concat (Environment.NewLine + "\t")
|
||||
|> fun s -> Environment.NewLine + "\t" + s
|
||||
|
||||
errorR (Error (FSComp.SR.tcUnionCaseExpectsTupledArguments(numArgTys, numArgs, missingArgs), m))
|
||||
else
|
||||
errorR (UnionCaseWrongArguments (env.DisplayEnv, numArgTys, numArgs, m))
|
||||
args @ (List.init (numArgTys - numArgs) (fun _ -> SynPat.Wild (m.MakeSynthetic()))), extraPatterns
|
||||
|
|
|
@ -232,7 +232,7 @@ type OverallTy =
|
|||
| MustEqual ty -> ty
|
||||
| MustConvertTo (_, ty) -> ty
|
||||
|
||||
exception ConstraintSolverTupleDiffLengths of displayEnv: DisplayEnv * TType list * TType list * range * range
|
||||
exception ConstraintSolverTupleDiffLengths of displayEnv: DisplayEnv * contextInfo: ContextInfo * TType list * TType list * range * range
|
||||
|
||||
exception ConstraintSolverInfiniteTypes of displayEnv: DisplayEnv * contextInfo: ContextInfo * TType * TType * range * range
|
||||
|
||||
|
@ -1225,10 +1225,10 @@ and SolveTypeEqualsTypeEqns csenv ndeep m2 trace cxsln origl1 origl2 =
|
|||
let rec loop l1 l2 =
|
||||
match l1, l2 with
|
||||
| [], [] -> CompleteD
|
||||
| h1 :: t1, h2 :: t2 ->
|
||||
| h1 :: t1, h2 :: t2 when t1.Length = t2.Length ->
|
||||
SolveTypeEqualsTypeKeepAbbrevsWithCxsln csenv ndeep m2 trace cxsln h1 h2 ++ (fun () -> loop t1 t2)
|
||||
| _ ->
|
||||
ErrorD(ConstraintSolverTupleDiffLengths(csenv.DisplayEnv, origl1, origl2, csenv.m, m2))
|
||||
ErrorD(ConstraintSolverTupleDiffLengths(csenv.DisplayEnv, csenv.eContextInfo, origl1, origl2, csenv.m, m2))
|
||||
loop origl1 origl2
|
||||
|
||||
and SolveFunTypeEqn csenv ndeep m2 trace cxsln domainTy1 domainTy2 rangeTy1 rangeTy2 = trackErrors {
|
||||
|
|
|
@ -141,7 +141,13 @@ type OverallTy =
|
|||
/// Represents a point where no subsumption/widening is possible
|
||||
member Commit: TType
|
||||
|
||||
exception ConstraintSolverTupleDiffLengths of displayEnv: DisplayEnv * TType list * TType list * range * range
|
||||
exception ConstraintSolverTupleDiffLengths of
|
||||
displayEnv: DisplayEnv *
|
||||
contextInfo: ContextInfo *
|
||||
TType list *
|
||||
TType list *
|
||||
range *
|
||||
range
|
||||
|
||||
exception ConstraintSolverInfiniteTypes of
|
||||
displayEnv: DisplayEnv *
|
||||
|
|
|
@ -638,7 +638,7 @@ type CalledMeth<'T>
|
|||
let pinfos = GetIntrinsicPropInfoSetsOfType infoReader (Some nm) ad AllowMultiIntfInstantiations.Yes IgnoreOverrides id.idRange returnedObjTy
|
||||
let pinfos = pinfos |> ExcludeHiddenOfPropInfos g infoReader.amap m
|
||||
match pinfos with
|
||||
| [pinfo] when pinfo.HasSetter && not pinfo.IsIndexer ->
|
||||
| [pinfo] when pinfo.HasSetter && not pinfo.IsStatic && not pinfo.IsIndexer ->
|
||||
let pminfo = pinfo.SetterMethod
|
||||
let pminst = freshenMethInfo m pminfo
|
||||
let propStaticTyOpt = if isTyparTy g returnedObjTy then Some returnedObjTy else None
|
||||
|
@ -646,10 +646,11 @@ type CalledMeth<'T>
|
|||
| _ ->
|
||||
let epinfos =
|
||||
match nameEnv with
|
||||
| Some ne -> ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader ne (Some nm) ad m returnedObjTy
|
||||
| Some ne -> ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader ne (Some nm) LookupIsInstance.Ambivalent ad m returnedObjTy
|
||||
| _ -> []
|
||||
|
||||
match epinfos with
|
||||
| [pinfo] when pinfo.HasSetter && not pinfo.IsIndexer ->
|
||||
| [pinfo] when pinfo.HasSetter && not pinfo.IsStatic && not pinfo.IsIndexer ->
|
||||
let pminfo = pinfo.SetterMethod
|
||||
let pminst =
|
||||
match minfo with
|
||||
|
@ -665,11 +666,11 @@ type CalledMeth<'T>
|
|||
Choice1Of2(AssignedItemSetter(id, AssignedPropSetter(propStaticTyOpt, pinfo, pminfo, pminst), e))
|
||||
| _ ->
|
||||
match infoReader.GetILFieldInfosOfType(Some(nm), ad, m, returnedObjTy) with
|
||||
| finfo :: _ ->
|
||||
| finfo :: _ when not finfo.IsStatic ->
|
||||
Choice1Of2(AssignedItemSetter(id, AssignedILFieldSetter(finfo), e))
|
||||
| _ ->
|
||||
match infoReader.TryFindRecdOrClassFieldInfoOfType(nm, m, returnedObjTy) with
|
||||
| ValueSome rfinfo ->
|
||||
| ValueSome rfinfo when not rfinfo.IsStatic ->
|
||||
Choice1Of2(AssignedItemSetter(id, AssignedRecdFieldSetter(rfinfo), e))
|
||||
| _ ->
|
||||
Choice2Of2(arg))
|
||||
|
|
|
@ -484,6 +484,19 @@ type NameResolutionEnv =
|
|||
// Helpers to do with extension members
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/// Indicates if a lookup requires a match on the instance/static characteristic.
|
||||
///
|
||||
/// This is not supplied at all lookup sites - in theory it could be, but currently diagnostics on many paths
|
||||
/// rely on returning all the content and then filtering it later for instance/static characteristic.
|
||||
///
|
||||
/// The isInstanceFilter also doesn't filter all content - it is currently only applied to filter out extension methods
|
||||
/// that have a static/instance mismatch.
|
||||
[<RequireQualifiedAccess>]
|
||||
type LookupIsInstance =
|
||||
| Ambivalent
|
||||
| Yes
|
||||
| No
|
||||
|
||||
/// Indicates if we only need one result or all possible results from a resolution.
|
||||
[<RequireQualifiedAccess>]
|
||||
type ResultCollectionSettings =
|
||||
|
@ -518,13 +531,17 @@ let IsMethInfoPlainCSharpStyleExtensionMember g m isEnclExtTy (minfo: MethInfo)
|
|||
let private GetCSharpStyleIndexedExtensionMembersForTyconRef (amap: Import.ImportMap) m (tcrefOfStaticClass: TyconRef) =
|
||||
let g = amap.g
|
||||
|
||||
if IsTyconRefUsedForCSharpStyleExtensionMembers g m tcrefOfStaticClass then
|
||||
let pri = NextExtensionMethodPriority()
|
||||
if g.langVersion.SupportsFeature(LanguageFeature.CSharpExtensionAttributeNotRequired) then
|
||||
let ty = generalizedTyconRef g tcrefOfStaticClass
|
||||
|
||||
let minfos = GetImmediateIntrinsicMethInfosOfType (None, AccessorDomain.AccessibleFromSomeFSharpCode) g amap m ty
|
||||
[ for minfo in minfos do
|
||||
if IsMethInfoPlainCSharpStyleExtensionMember g m true minfo then
|
||||
let minfos =
|
||||
GetImmediateIntrinsicMethInfosOfType (None, AccessorDomain.AccessibleFromSomeFSharpCode) g amap m ty
|
||||
|> List.filter (IsMethInfoPlainCSharpStyleExtensionMember g m true)
|
||||
|
||||
if IsTyconRefUsedForCSharpStyleExtensionMembers g m tcrefOfStaticClass || not minfos.IsEmpty then
|
||||
let pri = NextExtensionMethodPriority()
|
||||
|
||||
[ for minfo in minfos do
|
||||
let ilExtMem = ILExtMem (tcrefOfStaticClass, minfo, pri)
|
||||
|
||||
// The results are indexed by the TyconRef of the first 'this' argument, if any.
|
||||
|
@ -571,9 +588,60 @@ let private GetCSharpStyleIndexedExtensionMembersForTyconRef (amap: Import.Impor
|
|||
| None -> ()
|
||||
| Some (Some tcref) -> yield Choice1Of2(tcref, ilExtMem)
|
||||
| Some None -> yield Choice2Of2 ilExtMem ]
|
||||
else
|
||||
[]
|
||||
else
|
||||
[]
|
||||
if IsTyconRefUsedForCSharpStyleExtensionMembers g m tcrefOfStaticClass then
|
||||
let pri = NextExtensionMethodPriority()
|
||||
let ty = generalizedTyconRef g tcrefOfStaticClass
|
||||
let minfos = GetImmediateIntrinsicMethInfosOfType (None, AccessorDomain.AccessibleFromSomeFSharpCode) g amap m ty
|
||||
|
||||
[ for minfo in minfos do
|
||||
if IsMethInfoPlainCSharpStyleExtensionMember g m true minfo then
|
||||
let ilExtMem = ILExtMem (tcrefOfStaticClass, minfo, pri)
|
||||
// The results are indexed by the TyconRef of the first 'this' argument, if any.
|
||||
// So we need to go and crack the type of the 'this' argument.
|
||||
//
|
||||
// This is convoluted because we only need the ILTypeRef of the first argument, and we don't
|
||||
// want to read any other metadata as it can trigger missing-assembly errors. It turns out ImportILTypeRef
|
||||
// is less eager in reading metadata than GetParamTypes.
|
||||
//
|
||||
// We don't use the index for the IL extension method for tuple of F# function types (e.g. if extension
|
||||
// methods for tuple occur in C# code)
|
||||
let thisTyconRef =
|
||||
try
|
||||
let rs =
|
||||
match metadataOfTycon tcrefOfStaticClass.Deref, minfo with
|
||||
| ILTypeMetadata (TILObjectReprData(scoref, _, _)), ILMeth(_, ILMethInfo(_, _, _, ilMethod, _), _) ->
|
||||
match ilMethod.ParameterTypes with
|
||||
| firstTy :: _ ->
|
||||
match firstTy with
|
||||
| ILType.Boxed tspec | ILType.Value tspec ->
|
||||
let tref = (tspec |> rescopeILTypeSpec scoref).TypeRef
|
||||
if Import.CanImportILTypeRef amap m tref then
|
||||
let tcref = tref |> Import.ImportILTypeRef amap m
|
||||
if isCompiledTupleTyconRef g tcref || tyconRefEq g tcref g.fastFunc_tcr then None
|
||||
else Some tcref
|
||||
else None
|
||||
| _ -> None
|
||||
| _ -> None
|
||||
| _ ->
|
||||
// The results are indexed by the TyconRef of the first 'this' argument, if any.
|
||||
// So we need to go and crack the type of the 'this' argument.
|
||||
let thisTy = minfo.GetParamTypes(amap, m, generalizeTypars minfo.FormalMethodTypars).Head.Head
|
||||
match thisTy with
|
||||
| AppTy g (tcrefOfTypeExtended, _) when not (isByrefTy g thisTy) -> Some tcrefOfTypeExtended
|
||||
| _ -> None
|
||||
Some rs
|
||||
with e -> // Import of the ILType may fail, if so report the error and skip on
|
||||
errorRecovery e m
|
||||
None
|
||||
match thisTyconRef with
|
||||
| None -> ()
|
||||
| Some (Some tcref) -> yield Choice1Of2(tcref, ilExtMem)
|
||||
| Some None -> yield Choice2Of2 ilExtMem ]
|
||||
else
|
||||
[]
|
||||
|
||||
/// Query the declared properties of a type (including inherited properties)
|
||||
let IntrinsicPropInfosOfTypeInScope (infoReader: InfoReader) optFilter ad findFlag m ty =
|
||||
|
@ -603,29 +671,36 @@ let SelectPropInfosFromExtMembers (infoReader: InfoReader) ad optFilter declarin
|
|||
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 ExtensionPropInfosOfTypeInScope collectionSettings (infoReader:InfoReader) (nenv: NameResolutionEnv) optFilter isInstanceFilter 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.GetEntireTypeHierarchy(AllowMultiIntfInstantiations.Yes, m, ty)
|
||||
|> List.collect (fun ty ->
|
||||
match tryTcrefOfAppTy g ty with
|
||||
| ValueSome tcref ->
|
||||
let extMemInfos = nenv.eIndexedExtensionMembers.Find tcref
|
||||
SelectPropInfosFromExtMembers infoReader ad optFilter ty m extMemInfos
|
||||
| _ -> [])
|
||||
let pinfos =
|
||||
if collectionSettings = ResultCollectionSettings.AtMostOneResult && not (isNil extMemsDangling) then
|
||||
extMemsDangling
|
||||
else
|
||||
let extMemsFromHierarchy =
|
||||
infoReader.GetEntireTypeHierarchy(AllowMultiIntfInstantiations.Yes, m, ty)
|
||||
|> List.collect (fun ty ->
|
||||
match tryTcrefOfAppTy g ty with
|
||||
| ValueSome tcref ->
|
||||
let extMemInfos = nenv.eIndexedExtensionMembers.Find tcref
|
||||
SelectPropInfosFromExtMembers infoReader ad optFilter ty m extMemInfos
|
||||
| _ -> [])
|
||||
|
||||
extMemsDangling @ extMemsFromHierarchy
|
||||
extMemsDangling @ extMemsFromHierarchy
|
||||
pinfos
|
||||
|> List.filter (fun pinfo ->
|
||||
match isInstanceFilter with
|
||||
| LookupIsInstance.Ambivalent -> true
|
||||
| LookupIsInstance.Yes -> not pinfo.IsStatic
|
||||
| LookupIsInstance.No -> pinfo.IsStatic)
|
||||
|
||||
/// 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
|
||||
@ ExtensionPropInfosOfTypeInScope collectionSettings infoReader nenv optFilter LookupIsInstance.Ambivalent ad m ty
|
||||
|
||||
/// Get the available methods of a type (both declared and inherited)
|
||||
let IntrinsicMethInfosOfType (infoReader: InfoReader) optFilter ad allowMultiIntfInst findFlag m ty =
|
||||
|
@ -674,8 +749,8 @@ let SelectMethInfosFromExtMembers (infoReader: InfoReader) optFilter apparentTy
|
|||
| _ -> ()
|
||||
]
|
||||
|
||||
/// 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 =
|
||||
/// Query the available extension methods of a type (including extension methods for inherited types)
|
||||
let ExtensionMethInfosOfTypeInScope (collectionSettings: ResultCollectionSettings) (infoReader: InfoReader) (nenv: NameResolutionEnv) optFilter isInstanceFilter m ty =
|
||||
let extMemsDangling = SelectMethInfosFromExtMembers infoReader optFilter ty m nenv.eUnindexedExtensionMembers
|
||||
if collectionSettings = ResultCollectionSettings.AtMostOneResult && not (isNil extMemsDangling) then
|
||||
extMemsDangling
|
||||
|
@ -690,6 +765,11 @@ let ExtensionMethInfosOfTypeInScope (collectionSettings: ResultCollectionSetting
|
|||
SelectMethInfosFromExtMembers infoReader optFilter ty m extValRefs
|
||||
| _ -> [])
|
||||
extMemsDangling @ extMemsFromHierarchy
|
||||
|> List.filter (fun minfo ->
|
||||
match isInstanceFilter with
|
||||
| LookupIsInstance.Ambivalent -> true
|
||||
| LookupIsInstance.Yes -> minfo.IsInstance
|
||||
| LookupIsInstance.No -> not minfo.IsInstance)
|
||||
|
||||
/// Get all the available methods of a type (both intrinsic and extension)
|
||||
let AllMethInfosOfTypeInScope collectionSettings infoReader nenv optFilter ad findFlag m ty =
|
||||
|
@ -697,7 +777,7 @@ let AllMethInfosOfTypeInScope collectionSettings infoReader nenv optFilter ad fi
|
|||
if collectionSettings = ResultCollectionSettings.AtMostOneResult && not (isNil intrinsic) then
|
||||
intrinsic
|
||||
else
|
||||
intrinsic @ ExtensionMethInfosOfTypeInScope collectionSettings infoReader nenv optFilter m ty
|
||||
intrinsic @ ExtensionMethInfosOfTypeInScope collectionSettings infoReader nenv optFilter LookupIsInstance.Ambivalent m ty
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Helpers to do with building environments
|
||||
|
@ -954,8 +1034,8 @@ let ResolveProvidedTypeNameInEntity (amap, m, typeName, modref: ModuleOrNamespac
|
|||
/// Qualified lookups of type names where the number of generic arguments is known
|
||||
/// from context, e.g. Module.Type<args>. The full names suh as ``List`1`` can
|
||||
/// be used to qualify access if needed
|
||||
let LookupTypeNameInEntityHaveArity nm (staticResInfo: TypeNameResolutionStaticArgsInfo) (mty: ModuleOrNamespaceType) =
|
||||
let attempt1 = mty.TypesByMangledName.TryFind (staticResInfo.MangledNameForType nm)
|
||||
let LookupTypeNameInEntityHaveArity nm (typeNameResInfo: TypeNameResolutionStaticArgsInfo) (mty: ModuleOrNamespaceType) =
|
||||
let attempt1 = mty.TypesByMangledName.TryFind (typeNameResInfo.MangledNameForType nm)
|
||||
match attempt1 with
|
||||
| None -> mty.TypesByMangledName.TryFind nm
|
||||
| _ -> attempt1
|
||||
|
@ -1127,12 +1207,12 @@ let rec AddStaticContentOfTypeToNameEnv (g:TcGlobals) (amap: Import.ImportMap) a
|
|||
[|
|
||||
// Extension methods
|
||||
yield!
|
||||
ExtensionMethInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None m ty
|
||||
ExtensionMethInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None LookupIsInstance.No m ty
|
||||
|> ChooseMethInfosForNameEnv g m ty
|
||||
|
||||
// Extension properties
|
||||
yield!
|
||||
ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None ad m ty
|
||||
ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader nenv None LookupIsInstance.No ad m ty
|
||||
|> ChoosePropInfosForNameEnv g ty
|
||||
|
||||
// Events
|
||||
|
@ -2418,8 +2498,8 @@ let private ResolveObjectConstructorPrim (ncenv: NameResolver) edenv resInfo m a
|
|||
success (resInfo, Item.MakeCtorGroup ((tcrefOfAppTy g metadataTy).LogicalName, (defaultStructCtorInfo@ctorInfos)))
|
||||
|
||||
/// Perform name resolution for an identifier which must resolve to be an object constructor.
|
||||
let ResolveObjectConstructor (ncenv: NameResolver) edenv m ad ty =
|
||||
ResolveObjectConstructorPrim (ncenv: NameResolver) edenv [] m ad ty |?> (fun (_resInfo, item) -> item)
|
||||
let ResolveObjectConstructor (ncenv: NameResolver) denv m ad ty =
|
||||
ResolveObjectConstructorPrim (ncenv: NameResolver) denv [] m ad ty |?> (fun (_resInfo, item) -> item)
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Bind the "." notation (member lookup or lookup in a type)
|
||||
|
@ -2431,11 +2511,17 @@ exception IndeterminateType of range
|
|||
/// Indicates the kind of lookup being performed. Note, this type should be made private to nameres.fs.
|
||||
[<RequireQualifiedAccess>]
|
||||
type LookupKind =
|
||||
| RecdField
|
||||
| Pattern
|
||||
| Expr
|
||||
| Type
|
||||
| Ctor
|
||||
| RecdField
|
||||
|
||||
| Pattern
|
||||
|
||||
/// Indicates resolution within an expression, either A.B.C or expr.A.B.C. The isInstanceFilter
|
||||
/// optionally indicates whether we should filter content according to instance/static characteristic.
|
||||
| Expr of isInstanceFilter: LookupIsInstance
|
||||
|
||||
| Type
|
||||
|
||||
| Ctor
|
||||
|
||||
|
||||
/// Try to find a union case of a type, with the given name
|
||||
|
@ -2510,10 +2596,14 @@ let rec ResolveLongIdentInTypePrim (ncenv: NameResolver) nenv lookupKind (resInf
|
|||
let m = unionRanges m id.idRange
|
||||
let nm = id.idText // used to filter the searches of the tables
|
||||
let optFilter = Some nm // used to filter the searches of the tables
|
||||
let isLookUpExpr = (match lookupKind with LookupKind.Expr _ -> true | _ -> false)
|
||||
let isInstanceFilter = (match lookupKind with LookupKind.Expr isInstanceFilter -> isInstanceFilter | _ -> LookupIsInstance.Ambivalent)
|
||||
|
||||
let contentsSearchAccessible =
|
||||
|
||||
let unionCaseSearch =
|
||||
match lookupKind with
|
||||
| LookupKind.Expr | LookupKind.Pattern -> TryFindUnionCaseOfType g ty nm
|
||||
| LookupKind.Expr _ | LookupKind.Pattern -> TryFindUnionCaseOfType g ty nm
|
||||
| _ -> ValueNone
|
||||
|
||||
// Lookup: datatype constructors take precedence
|
||||
|
@ -2521,15 +2611,17 @@ let rec ResolveLongIdentInTypePrim (ncenv: NameResolver) nenv lookupKind (resInf
|
|||
| ValueSome ucase ->
|
||||
OneResult (success(resInfo, Item.UnionCase(ucase, false), rest))
|
||||
| ValueNone ->
|
||||
|
||||
let anonRecdSearch =
|
||||
match lookupKind with
|
||||
| LookupKind.Expr -> TryFindAnonRecdFieldOfType g ty nm
|
||||
| LookupKind.Expr _ -> TryFindAnonRecdFieldOfType g ty nm
|
||||
| _ -> None
|
||||
|
||||
match anonRecdSearch with
|
||||
| Some item ->
|
||||
OneResult (success(resInfo, item, rest))
|
||||
| None ->
|
||||
let isLookUpExpr = (lookupKind = LookupKind.Expr)
|
||||
|
||||
match TryFindIntrinsicNamedItemOfType ncenv.InfoReader (nm, ad, true) findFlag m ty with
|
||||
| Some (TraitItem (traitInfo :: _)) when isLookUpExpr ->
|
||||
success [resInfo, Item.Trait traitInfo, rest]
|
||||
|
@ -2538,7 +2630,7 @@ let rec ResolveLongIdentInTypePrim (ncenv: NameResolver) nenv lookupKind (resInf
|
|||
let pinfos = psets |> ExcludeHiddenOfPropInfos g ncenv.amap m
|
||||
|
||||
// fold the available extension members into the overload resolution
|
||||
let extensionPropInfos = ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv optFilter ad m ty
|
||||
let extensionPropInfos = ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv optFilter isInstanceFilter ad m ty
|
||||
|
||||
// make sure to keep the intrinsic pinfos before the extension pinfos in the list,
|
||||
// since later on this logic is used when giving preference to intrinsic definitions
|
||||
|
@ -2550,23 +2642,26 @@ let rec ResolveLongIdentInTypePrim (ncenv: NameResolver) nenv lookupKind (resInf
|
|||
let minfos = msets |> ExcludeHiddenOfMethInfos g ncenv.amap m
|
||||
|
||||
// fold the available extension members into the overload resolution
|
||||
let extensionMethInfos = ExtensionMethInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv optFilter m ty
|
||||
let extensionMethInfos = ExtensionMethInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv optFilter isInstanceFilter m ty
|
||||
|
||||
success [resInfo, Item.MakeMethGroup (nm, minfos@extensionMethInfos), rest]
|
||||
| Some (ILFieldItem (finfo :: _)) when (match lookupKind with LookupKind.Expr | LookupKind.Pattern -> true | _ -> false) ->
|
||||
|
||||
| Some (ILFieldItem (finfo :: _)) when (match lookupKind with LookupKind.Expr _ | LookupKind.Pattern -> true | _ -> false) ->
|
||||
success [resInfo, Item.ILField finfo, rest]
|
||||
|
||||
| Some (EventItem (einfo :: _)) when isLookUpExpr ->
|
||||
success [resInfo, Item.Event einfo, rest]
|
||||
|
||||
| Some (RecdFieldItem rfinfo) when (match lookupKind with LookupKind.Expr | LookupKind.RecdField | LookupKind.Pattern -> true | _ -> false) ->
|
||||
| Some (RecdFieldItem rfinfo) when (match lookupKind with LookupKind.Expr _ | LookupKind.RecdField | LookupKind.Pattern -> true | _ -> false) ->
|
||||
success [resInfo, Item.RecdField rfinfo, rest]
|
||||
|
||||
| _ ->
|
||||
|
||||
let pinfos = ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv optFilter ad m ty
|
||||
let pinfos = ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv optFilter isInstanceFilter ad m ty
|
||||
|
||||
if not (isNil pinfos) && isLookUpExpr then OneResult(success (resInfo, Item.Property (nm, pinfos), rest)) else
|
||||
let minfos = ExtensionMethInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv optFilter m ty
|
||||
|
||||
let minfos = ExtensionMethInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv optFilter isInstanceFilter m ty
|
||||
|
||||
if not (isNil minfos) && isLookUpExpr then
|
||||
success [resInfo, Item.MakeMethGroup (nm, minfos), rest]
|
||||
|
@ -2598,12 +2693,13 @@ let rec ResolveLongIdentInTypePrim (ncenv: NameResolver) nenv lookupKind (resInf
|
|||
|
||||
match nestedSearchAccessible with
|
||||
| Result res when not (isNil res) -> nestedSearchAccessible
|
||||
| Exception _ -> nestedSearchAccessible
|
||||
| _ ->
|
||||
let suggestMembers (addToBuffer: string -> unit) =
|
||||
for p in ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv None ad m ty do
|
||||
for p in ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv None LookupIsInstance.Ambivalent ad m ty do
|
||||
addToBuffer p.PropertyName
|
||||
|
||||
for m in ExtensionMethInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv None m ty do
|
||||
for m in ExtensionMethInfosOfTypeInScope ResultCollectionSettings.AllResults ncenv.InfoReader nenv None LookupIsInstance.Ambivalent m ty do
|
||||
addToBuffer m.DisplayName
|
||||
|
||||
for p in GetIntrinsicPropInfosOfType ncenv.InfoReader None ad AllowMultiIntfInstantiations.No findFlag m ty do
|
||||
|
@ -2617,7 +2713,7 @@ let rec ResolveLongIdentInTypePrim (ncenv: NameResolver) nenv lookupKind (resInf
|
|||
addToBuffer l
|
||||
|
||||
match lookupKind with
|
||||
| LookupKind.Expr | LookupKind.Pattern ->
|
||||
| LookupKind.Expr _ | LookupKind.Pattern ->
|
||||
match tryTcrefOfAppTy g ty with
|
||||
| ValueSome tcref ->
|
||||
for uc in tcref.UnionCasesArray do
|
||||
|
@ -2647,9 +2743,9 @@ and ResolveLongIdentInNestedTypes (ncenv: NameResolver) nenv lookupKind resInfo
|
|||
|> AtMostOneResult m)
|
||||
|
||||
/// Resolve a long identifier using type-qualified name resolution.
|
||||
let ResolveLongIdentInType sink ncenv nenv lookupKind m ad id findFlag typeNameResInfo ty =
|
||||
let ResolveLongIdentInType sink (ncenv: NameResolver) nenv lookupKind m ad id findFlag typeNameResInfo ty =
|
||||
let resInfo, item, rest =
|
||||
ResolveLongIdentInTypePrim (ncenv: NameResolver) nenv lookupKind ResolutionInfo.Empty 0 m ad id [] findFlag typeNameResInfo ty
|
||||
ResolveLongIdentInTypePrim ncenv nenv lookupKind ResolutionInfo.Empty 0 m ad id [] findFlag typeNameResInfo ty
|
||||
|> AtMostOneResult m
|
||||
|> ForceRaise
|
||||
|
||||
|
@ -2683,6 +2779,7 @@ let (|AccessibleEntityRef|_|) amap m ad (modref: ModuleOrNamespaceRef) mspec =
|
|||
let rec ResolveExprLongIdentInModuleOrNamespace (ncenv: NameResolver) nenv (typeNameResInfo: TypeNameResolutionInfo) ad resInfo depth m modref (mty: ModuleOrNamespaceType) (id: Ident) (rest: Ident list) =
|
||||
// resInfo records the modules or namespaces actually relevant to a resolution
|
||||
let m = unionRanges m id.idRange
|
||||
let lookupKind = LookupKind.Expr LookupIsInstance.No
|
||||
match mty.AllValsByLogicalName.TryGetValue id.idText with
|
||||
| true, vspec when IsValAccessible ad (mkNestedValRef modref vspec) ->
|
||||
success(resInfo, Item.Value (mkNestedValRef modref vspec), rest)
|
||||
|
@ -2718,7 +2815,7 @@ let rec ResolveExprLongIdentInModuleOrNamespace (ncenv: NameResolver) nenv (type
|
|||
let typeNameResInfo = TypeNameResolutionInfo.ResolveToTypeRefs typeNameResInfo.StaticArgsInfo
|
||||
CheckForTypeLegitimacyAndMultipleGenericTypeAmbiguities (tcrefs, typeNameResInfo, PermitDirectReferenceToGeneratedType.No, unionRanges m id.idRange)
|
||||
|
||||
ResolveLongIdentInTyconRefs ResultCollectionSettings.AtMostOneResult ncenv nenv LookupKind.Expr (depth+1) m ad id2 rest2 typeNameResInfo id.idRange tcrefs
|
||||
ResolveLongIdentInTyconRefs ResultCollectionSettings.AtMostOneResult ncenv nenv lookupKind (depth+1) m ad id2 rest2 typeNameResInfo id.idRange tcrefs
|
||||
|
||||
// Check if we've got some explicit type arguments
|
||||
| _ ->
|
||||
|
@ -2817,6 +2914,9 @@ let ResolveUnqualifiedTyconRefs nenv tcrefs =
|
|||
/// Not all of the sequence will necessarily be swallowed, i.e. we return some identifiers
|
||||
/// 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 lookupKind = LookupKind.Expr LookupIsInstance.No
|
||||
|
||||
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
|
||||
|
@ -2968,7 +3068,7 @@ let rec ResolveExprLongIdentPrim sink (ncenv: NameResolver) first fullyQualified
|
|||
let tcrefs =
|
||||
let typeNameResInfo = TypeNameResolutionInfo.ResolveToTypeRefs typeNameResInfo.StaticArgsInfo
|
||||
CheckForTypeLegitimacyAndMultipleGenericTypeAmbiguities (tcrefs, typeNameResInfo, PermitDirectReferenceToGeneratedType.No, unionRanges m id.idRange)
|
||||
ResolveLongIdentInTyconRefs ResultCollectionSettings.AtMostOneResult ncenv nenv LookupKind.Expr 1 m ad id2 rest2 typeNameResInfo id.idRange tcrefs
|
||||
ResolveLongIdentInTyconRefs ResultCollectionSettings.AtMostOneResult ncenv nenv lookupKind 1 m ad id2 rest2 typeNameResInfo id.idRange tcrefs
|
||||
| _ ->
|
||||
NoResultsOrUsefulErrors
|
||||
|
||||
|
@ -3590,7 +3690,7 @@ let ResolveFieldPrim sink (ncenv: NameResolver) nenv ad ty (mp, id: Ident) allFi
|
|||
|
||||
[(resInfo, item)]
|
||||
|
||||
let ResolveField sink ncenv nenv ad ty (mp, id) allFields =
|
||||
let ResolveField sink ncenv nenv ad ty mp id allFields =
|
||||
let res = ResolveFieldPrim sink ncenv nenv ad ty (mp, id) allFields
|
||||
// Register the results of any field paths "Module.Type" in "Module.Type.field" as a name resolution. (Note, the path resolution
|
||||
// info is only non-empty if there was a unique resolution of the field)
|
||||
|
@ -3610,7 +3710,8 @@ let ResolveField sink ncenv nenv ad ty (mp, id) allFields =
|
|||
//
|
||||
// QUERY (instantiationGenerator cleanup): it would be really nice not to flow instantiationGenerator to here.
|
||||
let private ResolveExprDotLongIdent (ncenv: NameResolver) m ad nenv ty (id: Ident) rest (typeNameResInfo: TypeNameResolutionInfo) findFlag =
|
||||
let adhocDotSearchAccessible = AtMostOneResult m (ResolveLongIdentInTypePrim ncenv nenv LookupKind.Expr ResolutionInfo.Empty 1 m ad id rest findFlag typeNameResInfo ty)
|
||||
let lookupKind = LookupKind.Expr LookupIsInstance.Yes
|
||||
let adhocDotSearchAccessible = AtMostOneResult m (ResolveLongIdentInTypePrim ncenv nenv lookupKind ResolutionInfo.Empty 1 m ad id rest findFlag typeNameResInfo ty)
|
||||
match adhocDotSearchAccessible with
|
||||
| Exception _ ->
|
||||
// If the dot is not resolved by adhoc overloading then look for a record field
|
||||
|
@ -3628,7 +3729,9 @@ let private ResolveExprDotLongIdent (ncenv: NameResolver) m ad nenv ty (id: Iden
|
|||
OneSuccess (ResolutionInfo.Empty, item, rest)
|
||||
| _ -> NoResultsOrUsefulErrors
|
||||
|
||||
let adhocDotSearchAll () = ResolveLongIdentInTypePrim ncenv nenv LookupKind.Expr ResolutionInfo.Empty 1 m AccessibleFromSomeFSharpCode id rest findFlag typeNameResInfo ty
|
||||
let adhocDotSearchAll () =
|
||||
let lookupKind = LookupKind.Expr LookupIsInstance.Ambivalent
|
||||
ResolveLongIdentInTypePrim ncenv nenv lookupKind ResolutionInfo.Empty 1 m AccessibleFromSomeFSharpCode id rest findFlag typeNameResInfo ty
|
||||
|
||||
dotFieldIdSearch +++ adhocDotSearchAll
|
||||
|> AtMostOneResult m
|
||||
|
@ -3741,15 +3844,16 @@ let (|NonOverridable|_|) namedItem =
|
|||
|
||||
/// Called for 'expression.Bar' - for VS IntelliSense, we can filter out static members from method groups
|
||||
/// Also called for 'GenericType<Args>.Bar' - for VS IntelliSense, we can filter out non-static members from method groups
|
||||
let ResolveExprDotLongIdentAndComputeRange (sink: TcResultsSink) (ncenv: NameResolver) wholem ad nenv ty lid (staticResInfo: TypeNameResolutionInfo) findFlag thisIsActuallyATyAppNotAnExpr =
|
||||
let ResolveExprDotLongIdentAndComputeRange (sink: TcResultsSink) (ncenv: NameResolver) wholem ad nenv ty lid (typeNameResInfo: TypeNameResolutionInfo) findFlag staticOnly =
|
||||
let resolveExpr findFlag =
|
||||
let resInfo, item, rest =
|
||||
match lid with
|
||||
| id :: rest ->
|
||||
ResolveExprDotLongIdent ncenv wholem ad nenv ty id rest staticResInfo findFlag
|
||||
ResolveExprDotLongIdent ncenv wholem ad nenv ty id rest typeNameResInfo findFlag
|
||||
| _ -> error(InternalError("ResolveExprDotLongIdentAndComputeRange", wholem))
|
||||
let itemRange = ComputeItemRange wholem lid rest
|
||||
resInfo, item, rest, itemRange
|
||||
|
||||
// "true" resolution
|
||||
let resInfo, item, rest, itemRange = resolveExpr findFlag
|
||||
ResolutionInfo.SendEntityPathToSink(sink, ncenv, nenv, ItemOccurence.Use, ad, resInfo, ResultTyparChecker(fun () -> CheckAllTyparsInferrable ncenv.amap itemRange item))
|
||||
|
@ -3769,7 +3873,6 @@ let ResolveExprDotLongIdentAndComputeRange (sink: TcResultsSink) (ncenv: NameRes
|
|||
item, itemRange, true
|
||||
|
||||
let callSink (refinedItem, tpinst) =
|
||||
let staticOnly = thisIsActuallyATyAppNotAnExpr
|
||||
let refinedItem = FilterMethodGroups ncenv itemRange refinedItem staticOnly
|
||||
let unrefinedItem = FilterMethodGroups ncenv itemRange unrefinedItem staticOnly
|
||||
CallMethodGroupNameResolutionSink sink (itemRange, nenv, refinedItem, unrefinedItem, tpinst, ItemOccurence.Use, ad)
|
||||
|
|
|
@ -525,6 +525,67 @@ type ResultCollectionSettings =
|
|||
| AllResults
|
||||
| AtMostOneResult
|
||||
|
||||
/// Indicates if a lookup requires a match on the instance/static characteristic.
|
||||
///
|
||||
/// This is not supplied at all lookup sites - in theory it could be, but currently diagnostics on many paths
|
||||
/// rely on returning all the content and then filtering it later for instance/static characteristic.
|
||||
///
|
||||
/// When applied, this also currently doesn't filter all content - it is currently only applied to filter out extension methods
|
||||
/// that have a static/instance mismatch.
|
||||
[<RequireQualifiedAccess>]
|
||||
type LookupIsInstance =
|
||||
| Ambivalent
|
||||
| Yes
|
||||
| No
|
||||
|
||||
/// Indicates the kind of lookup being performed. Note, this type should be made private to nameres.fs.
|
||||
[<RequireQualifiedAccess>]
|
||||
type LookupKind =
|
||||
| RecdField
|
||||
|
||||
| Pattern
|
||||
|
||||
/// Indicates resolution within an expression, either A.B.C (static) or expr.A.B.C (instance) and
|
||||
/// whether we should filter content according to instance/static characteristic.
|
||||
| Expr of isInstanceFilter: LookupIsInstance
|
||||
|
||||
| Type
|
||||
|
||||
| Ctor
|
||||
|
||||
/// Indicates if a warning should be given for the use of upper-case identifiers in patterns
|
||||
type WarnOnUpperFlag =
|
||||
| WarnOnUpperCase
|
||||
| AllIdsOK
|
||||
|
||||
/// Indicates whether we permit a direct reference to a type generator. Only set when resolving the
|
||||
/// right-hand-side of a [<Generate>] declaration.
|
||||
[<RequireQualifiedAccess>]
|
||||
type PermitDirectReferenceToGeneratedType =
|
||||
| Yes
|
||||
| No
|
||||
|
||||
/// Specifies extra work to do after overload resolution
|
||||
[<RequireQualifiedAccess>]
|
||||
type AfterResolution =
|
||||
/// Notification is not needed
|
||||
| DoNothing
|
||||
|
||||
/// Notify the sink of the information needed to complete recording a use of a symbol
|
||||
/// for the purposes of the language service. One of the callbacks should be called by
|
||||
/// the checker.
|
||||
///
|
||||
/// The first callback represents a case where we have learned the type
|
||||
/// instantiation of a generic method or value.
|
||||
///
|
||||
/// The second represents the case where we have resolved overloading and/or
|
||||
/// a specific override. The 'Item option' contains the candidate overrides.
|
||||
| RecordResolution of
|
||||
Item option *
|
||||
(TyparInstantiation -> unit) *
|
||||
(MethInfo * PropInfo option * TyparInstantiation -> unit) *
|
||||
(unit -> unit)
|
||||
|
||||
/// Temporarily redirect reporting of name resolution and type checking results
|
||||
val internal WithNewTypecheckResultsSink: ITypecheckResultsSink * TcResultsSink -> System.IDisposable
|
||||
|
||||
|
@ -556,37 +617,38 @@ val internal CallOpenDeclarationSink: TcResultsSink -> OpenDeclaration -> unit
|
|||
|
||||
/// Get all the available properties of a type (both intrinsic and extension)
|
||||
val internal AllPropInfosOfTypeInScope:
|
||||
ResultCollectionSettings ->
|
||||
InfoReader ->
|
||||
NameResolutionEnv ->
|
||||
string option ->
|
||||
AccessorDomain ->
|
||||
FindMemberFlag ->
|
||||
range ->
|
||||
TType ->
|
||||
collectionSettings: ResultCollectionSettings ->
|
||||
infoReader: InfoReader ->
|
||||
nenv: NameResolutionEnv ->
|
||||
optFilter: string option ->
|
||||
ad: AccessorDomain ->
|
||||
findFlag: FindMemberFlag ->
|
||||
m: range ->
|
||||
ty: TType ->
|
||||
PropInfo list
|
||||
|
||||
/// Get all the available properties of a type (only extension)
|
||||
val internal ExtensionPropInfosOfTypeInScope:
|
||||
ResultCollectionSettings ->
|
||||
InfoReader ->
|
||||
NameResolutionEnv ->
|
||||
string option ->
|
||||
AccessorDomain ->
|
||||
range ->
|
||||
TType ->
|
||||
collectionSettings: ResultCollectionSettings ->
|
||||
infoReader: InfoReader ->
|
||||
nenv: NameResolutionEnv ->
|
||||
optFilter: string option ->
|
||||
isInstanceFilter: LookupIsInstance ->
|
||||
ad: AccessorDomain ->
|
||||
m: range ->
|
||||
ty: TType ->
|
||||
PropInfo list
|
||||
|
||||
/// Get the available methods of a type (both declared and inherited)
|
||||
val internal AllMethInfosOfTypeInScope:
|
||||
ResultCollectionSettings ->
|
||||
InfoReader ->
|
||||
NameResolutionEnv ->
|
||||
string option ->
|
||||
AccessorDomain ->
|
||||
FindMemberFlag ->
|
||||
range ->
|
||||
TType ->
|
||||
collectionSettings: ResultCollectionSettings ->
|
||||
infoReader: InfoReader ->
|
||||
nenv: NameResolutionEnv ->
|
||||
optFilter: string option ->
|
||||
ad: AccessorDomain ->
|
||||
findFlag: FindMemberFlag ->
|
||||
m: range ->
|
||||
ty: TType ->
|
||||
MethInfo list
|
||||
|
||||
/// Used to report an error condition where name resolution failed due to an indeterminate type
|
||||
|
@ -598,118 +660,98 @@ exception internal UpperCaseIdentifierInPattern of range
|
|||
/// Generate a new reference to a record field with a fresh type instantiation
|
||||
val FreshenRecdFieldRef: NameResolver -> range -> RecdFieldRef -> RecdFieldInfo
|
||||
|
||||
/// Indicates the kind of lookup being performed. Note, this type should be made private to nameres.fs.
|
||||
[<RequireQualifiedAccess>]
|
||||
type LookupKind =
|
||||
| RecdField
|
||||
| Pattern
|
||||
| Expr
|
||||
| Type
|
||||
| Ctor
|
||||
|
||||
/// Indicates if a warning should be given for the use of upper-case identifiers in patterns
|
||||
type WarnOnUpperFlag =
|
||||
| WarnOnUpperCase
|
||||
| AllIdsOK
|
||||
|
||||
/// Indicates whether we permit a direct reference to a type generator. Only set when resolving the
|
||||
/// right-hand-side of a [<Generate>] declaration.
|
||||
[<RequireQualifiedAccess>]
|
||||
type PermitDirectReferenceToGeneratedType =
|
||||
| Yes
|
||||
| No
|
||||
|
||||
/// Resolve a long identifier to a namespace, module.
|
||||
val internal ResolveLongIdentAsModuleOrNamespace:
|
||||
TcResultsSink ->
|
||||
ResultCollectionSettings ->
|
||||
ImportMap ->
|
||||
range ->
|
||||
sink: TcResultsSink ->
|
||||
atMostOne: ResultCollectionSettings ->
|
||||
amap: ImportMap ->
|
||||
m: range ->
|
||||
first: bool ->
|
||||
FullyQualifiedFlag ->
|
||||
NameResolutionEnv ->
|
||||
AccessorDomain ->
|
||||
Ident ->
|
||||
Ident list ->
|
||||
fullyQualified: FullyQualifiedFlag ->
|
||||
nenv: NameResolutionEnv ->
|
||||
ad: AccessorDomain ->
|
||||
id: Ident ->
|
||||
rest: 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<Item>
|
||||
ncenv: NameResolver -> denv: DisplayEnv -> m: range -> ad: AccessorDomain -> ty: TType -> ResultOrException<Item>
|
||||
|
||||
/// Resolve a long identifier using type-qualified name resolution.
|
||||
val internal ResolveLongIdentInType:
|
||||
TcResultsSink ->
|
||||
NameResolver ->
|
||||
NameResolutionEnv ->
|
||||
LookupKind ->
|
||||
range ->
|
||||
AccessorDomain ->
|
||||
Ident ->
|
||||
FindMemberFlag ->
|
||||
TypeNameResolutionInfo ->
|
||||
TType ->
|
||||
sink: TcResultsSink ->
|
||||
ncenv: NameResolver ->
|
||||
nenv: NameResolutionEnv ->
|
||||
lookupKind: LookupKind ->
|
||||
m: range ->
|
||||
ad: AccessorDomain ->
|
||||
id: Ident ->
|
||||
findFlag: FindMemberFlag ->
|
||||
typeNameResInfo: TypeNameResolutionInfo ->
|
||||
ty: TType ->
|
||||
Item * Ident list
|
||||
|
||||
/// Resolve a long identifier when used in a pattern.
|
||||
val internal ResolvePatternLongIdent:
|
||||
TcResultsSink ->
|
||||
NameResolver ->
|
||||
WarnOnUpperFlag ->
|
||||
bool ->
|
||||
range ->
|
||||
AccessorDomain ->
|
||||
NameResolutionEnv ->
|
||||
TypeNameResolutionInfo ->
|
||||
Ident list ->
|
||||
sink: TcResultsSink ->
|
||||
ncenv: NameResolver ->
|
||||
warnOnUpper: WarnOnUpperFlag ->
|
||||
newDef: bool ->
|
||||
m: range ->
|
||||
ad: AccessorDomain ->
|
||||
nenv: NameResolutionEnv ->
|
||||
numTyArgsOpt: TypeNameResolutionInfo ->
|
||||
lid: Ident list ->
|
||||
Item
|
||||
|
||||
/// Resolve a long identifier representing a type name
|
||||
val internal ResolveTypeLongIdentInTyconRef:
|
||||
TcResultsSink ->
|
||||
NameResolver ->
|
||||
NameResolutionEnv ->
|
||||
TypeNameResolutionInfo ->
|
||||
AccessorDomain ->
|
||||
range ->
|
||||
ModuleOrNamespaceRef ->
|
||||
Ident list ->
|
||||
sink: TcResultsSink ->
|
||||
ncenv: NameResolver ->
|
||||
nenv: NameResolutionEnv ->
|
||||
typeNameResInfo: TypeNameResolutionInfo ->
|
||||
ad: AccessorDomain ->
|
||||
m: range ->
|
||||
tcref: TyconRef ->
|
||||
lid: Ident list ->
|
||||
TyconRef
|
||||
|
||||
/// Resolve a long identifier to a type definition
|
||||
val internal ResolveTypeLongIdent:
|
||||
TcResultsSink ->
|
||||
NameResolver ->
|
||||
ItemOccurence ->
|
||||
FullyQualifiedFlag ->
|
||||
NameResolutionEnv ->
|
||||
AccessorDomain ->
|
||||
Ident list ->
|
||||
TypeNameResolutionStaticArgsInfo ->
|
||||
PermitDirectReferenceToGeneratedType ->
|
||||
sink: TcResultsSink ->
|
||||
ncenv: NameResolver ->
|
||||
occurence: ItemOccurence ->
|
||||
fullyQualified: FullyQualifiedFlag ->
|
||||
nenv: NameResolutionEnv ->
|
||||
ad: AccessorDomain ->
|
||||
lid: Ident list ->
|
||||
staticResInfo: TypeNameResolutionStaticArgsInfo ->
|
||||
genOk: PermitDirectReferenceToGeneratedType ->
|
||||
ResultOrException<EnclosingTypeInst * TyconRef>
|
||||
|
||||
/// Resolve a long identifier to a field
|
||||
val internal ResolveField:
|
||||
TcResultsSink ->
|
||||
NameResolver ->
|
||||
NameResolutionEnv ->
|
||||
AccessorDomain ->
|
||||
TType ->
|
||||
Ident list * Ident ->
|
||||
Ident list ->
|
||||
FieldResolution list
|
||||
sink: TcResultsSink ->
|
||||
ncenv: NameResolver ->
|
||||
nenv: NameResolutionEnv ->
|
||||
ad: AccessorDomain ->
|
||||
ty: TType ->
|
||||
mp: Ident list ->
|
||||
id: Ident ->
|
||||
allFields: Ident list ->
|
||||
FieldResolution list
|
||||
|
||||
/// Resolve a long identifier occurring in an expression position
|
||||
val internal ResolveExprLongIdent:
|
||||
TcResultsSink ->
|
||||
NameResolver ->
|
||||
range ->
|
||||
AccessorDomain ->
|
||||
NameResolutionEnv ->
|
||||
TypeNameResolutionInfo ->
|
||||
Ident list ->
|
||||
sink: TcResultsSink ->
|
||||
ncenv: NameResolver ->
|
||||
m: range ->
|
||||
ad: AccessorDomain ->
|
||||
nenv: NameResolutionEnv ->
|
||||
typeNameResInfo: TypeNameResolutionInfo ->
|
||||
lid: Ident list ->
|
||||
ResultOrException<EnclosingTypeInst * Item * Ident list>
|
||||
|
||||
val internal getRecordFieldsInScope: NameResolutionEnv -> Item list
|
||||
|
@ -721,50 +763,29 @@ val internal ResolvePartialLongIdentToClassOrRecdFields:
|
|||
/// Return the fields for the given class or record
|
||||
val internal ResolveRecordOrClassFieldsOfType: NameResolver -> range -> AccessorDomain -> TType -> bool -> Item list
|
||||
|
||||
/// Specifies extra work to do after overload resolution
|
||||
[<RequireQualifiedAccess>]
|
||||
type AfterResolution =
|
||||
/// Notification is not needed
|
||||
| DoNothing
|
||||
|
||||
/// Notify the sink of the information needed to complete recording a use of a symbol
|
||||
/// for the purposes of the language service. One of the callbacks should be called by
|
||||
/// the checker.
|
||||
///
|
||||
/// The first callback represents a case where we have learned the type
|
||||
/// instantiation of a generic method or value.
|
||||
///
|
||||
/// The second represents the case where we have resolved overloading and/or
|
||||
/// a specific override. The 'Item option' contains the candidate overrides.
|
||||
| RecordResolution of
|
||||
Item option *
|
||||
(TyparInstantiation -> unit) *
|
||||
(MethInfo * PropInfo option * TyparInstantiation -> unit) *
|
||||
(unit -> unit)
|
||||
|
||||
/// Resolve a long identifier occurring in an expression position.
|
||||
val internal ResolveLongIdentAsExprAndComputeRange:
|
||||
TcResultsSink ->
|
||||
NameResolver ->
|
||||
range ->
|
||||
AccessorDomain ->
|
||||
NameResolutionEnv ->
|
||||
TypeNameResolutionInfo ->
|
||||
Ident list ->
|
||||
sink: TcResultsSink ->
|
||||
ncenv: NameResolver ->
|
||||
wholem: range ->
|
||||
ad: AccessorDomain ->
|
||||
nenv: NameResolutionEnv ->
|
||||
typeNameResInfo: TypeNameResolutionInfo ->
|
||||
lid: Ident list ->
|
||||
ResultOrException<EnclosingTypeInst * Item * range * Ident list * AfterResolution>
|
||||
|
||||
/// Resolve a long identifier occurring in an expression position, qualified by a type.
|
||||
val internal ResolveExprDotLongIdentAndComputeRange:
|
||||
TcResultsSink ->
|
||||
NameResolver ->
|
||||
range ->
|
||||
AccessorDomain ->
|
||||
NameResolutionEnv ->
|
||||
TType ->
|
||||
Ident list ->
|
||||
TypeNameResolutionInfo ->
|
||||
FindMemberFlag ->
|
||||
bool ->
|
||||
sink: TcResultsSink ->
|
||||
ncenv: NameResolver ->
|
||||
wholem: range ->
|
||||
ad: AccessorDomain ->
|
||||
nenv: NameResolutionEnv ->
|
||||
ty: TType ->
|
||||
lid: Ident list ->
|
||||
typeNameResInfo: TypeNameResolutionInfo ->
|
||||
findFlag: FindMemberFlag ->
|
||||
staticOnly: bool ->
|
||||
Item * range * Ident list * AfterResolution
|
||||
|
||||
/// A generator of type instantiations used when no more specific type instantiation is known.
|
||||
|
@ -775,13 +796,13 @@ val TryToResolveLongIdentAsType: NameResolver -> NameResolutionEnv -> range -> s
|
|||
|
||||
/// Resolve a (possibly incomplete) long identifier to a set of possible resolutions.
|
||||
val ResolvePartialLongIdent:
|
||||
NameResolver ->
|
||||
NameResolutionEnv ->
|
||||
(MethInfo -> TType -> bool) ->
|
||||
range ->
|
||||
AccessorDomain ->
|
||||
string list ->
|
||||
bool ->
|
||||
ncenv: NameResolver ->
|
||||
nenv: NameResolutionEnv ->
|
||||
isApplicableMeth: (MethInfo -> TType -> bool) ->
|
||||
m: range ->
|
||||
ad: AccessorDomain ->
|
||||
plid: string list ->
|
||||
allowObsolete: bool ->
|
||||
Item list
|
||||
|
||||
[<RequireQualifiedAccess>]
|
||||
|
|
|
@ -1743,7 +1743,7 @@ module TastDefinitionPrinting =
|
|||
let overallL = modifierAndMember ^^ (nameL |> addColonL) ^^ typL
|
||||
layoutXmlDocOfPropInfo denv infoReader pinfo overallL
|
||||
|
||||
let layoutTyconDefn (denv: DisplayEnv) (infoReader: InfoReader) ad m simplified typewordL (tcref: TyconRef) =
|
||||
let layoutTyconDefn (denv: DisplayEnv) (infoReader: InfoReader) ad m simplified isFirstType (tcref: TyconRef) =
|
||||
let g = denv.g
|
||||
// use 4-indent
|
||||
let (-*) = if denv.printVerboseSignatures then (-----) else (---)
|
||||
|
@ -1773,6 +1773,12 @@ module TastDefinitionPrinting =
|
|||
else
|
||||
None, tagUnknownType
|
||||
|
||||
let typewordL =
|
||||
if isFirstType then
|
||||
WordL.keywordType
|
||||
else
|
||||
wordL (tagKeyword "and") ^^ layoutAttribs denv start false tycon.TypeOrMeasureKind tycon.Attribs emptyL
|
||||
|
||||
let nameL = ConvertLogicalNameToDisplayLayout (tagger >> mkNav tycon.DefinitionRange >> wordL) tycon.DisplayNameCore
|
||||
|
||||
let nameL = layoutAccessibility denv tycon.Accessibility nameL
|
||||
|
@ -2124,7 +2130,7 @@ module TastDefinitionPrinting =
|
|||
|> addLhs
|
||||
|
||||
typeDeclL
|
||||
|> layoutAttribs denv start false tycon.TypeOrMeasureKind tycon.Attribs
|
||||
|> fun tdl -> if isFirstType then layoutAttribs denv start false tycon.TypeOrMeasureKind tycon.Attribs tdl else tdl
|
||||
|> layoutXmlDocOfEntity denv infoReader tcref
|
||||
|
||||
// Layout: exception definition
|
||||
|
@ -2154,8 +2160,8 @@ module TastDefinitionPrinting =
|
|||
| [] -> emptyL
|
||||
| [h] when h.IsFSharpException -> layoutExnDefn denv infoReader (mkLocalEntityRef h)
|
||||
| h :: t ->
|
||||
let x = layoutTyconDefn denv infoReader ad m false WordL.keywordType (mkLocalEntityRef h)
|
||||
let xs = List.map (mkLocalEntityRef >> layoutTyconDefn denv infoReader ad m false (wordL (tagKeyword "and"))) t
|
||||
let x = layoutTyconDefn denv infoReader ad m false true (mkLocalEntityRef h)
|
||||
let xs = List.map (mkLocalEntityRef >> layoutTyconDefn denv infoReader ad m false false) t
|
||||
aboveListL (x :: xs)
|
||||
|
||||
let rec fullPath (mspec: ModuleOrNamespace) acc =
|
||||
|
@ -2267,7 +2273,7 @@ module TastDefinitionPrinting =
|
|||
elif eref.IsFSharpException then
|
||||
layoutExnDefn denv infoReader eref
|
||||
else
|
||||
layoutTyconDefn denv infoReader ad m true WordL.keywordType eref
|
||||
layoutTyconDefn denv infoReader ad m true true eref
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
|
@ -2561,7 +2567,7 @@ let layoutExnDef denv infoReader x = x |> TastDefinitionPrinting.layoutExnDefn d
|
|||
|
||||
let stringOfTyparConstraints denv x = x |> PrintTypes.layoutConstraintsWithInfo denv SimplifyTypes.typeSimplificationInfo0 |> showL
|
||||
|
||||
let layoutTyconDefn denv infoReader ad m (* width *) x = TastDefinitionPrinting.layoutTyconDefn denv infoReader ad m true WordL.keywordType (mkLocalEntityRef x) (* |> Display.squashTo width *)
|
||||
let layoutTyconDefn denv infoReader ad m (* width *) x = TastDefinitionPrinting.layoutTyconDefn denv infoReader ad m true true (mkLocalEntityRef x) (* |> Display.squashTo width *)
|
||||
|
||||
let layoutEntityDefn denv infoReader ad m x = TastDefinitionPrinting.layoutEntityDefn denv infoReader ad m x
|
||||
|
||||
|
|
|
@ -143,7 +143,6 @@ let GetSubExprOfInput g (gtps, tyargs, tinst) (SubExpr(accessf, (ve2, v2))) =
|
|||
// The ints record which choices taken, e.g. tuple/record fields.
|
||||
type Path =
|
||||
| PathQuery of Path * Unique
|
||||
| PathConj of Path * int
|
||||
| PathTuple of Path * TypeInst * int
|
||||
| PathRecd of Path * TyconRef * TypeInst * int
|
||||
| PathUnionConstr of Path * UnionCaseRef * TypeInst * int
|
||||
|
@ -154,7 +153,6 @@ type Path =
|
|||
let rec pathEq p1 p2 =
|
||||
match p1, p2 with
|
||||
| PathQuery(p1, n1), PathQuery(p2, n2) -> (n1 = n2) && pathEq p1 p2
|
||||
| PathConj(p1, n1), PathConj(p2, n2) -> (n1 = n2) && pathEq p1 p2
|
||||
| PathTuple(p1, _, n1), PathTuple(p2, _, n2) -> (n1 = n2) && pathEq p1 p2
|
||||
| PathRecd(p1, _, _, n1), PathRecd(p2, _, _, n2) -> (n1 = n2) && pathEq p1 p2
|
||||
| PathUnionConstr(p1, _, _, n1), PathUnionConstr(p2, _, _, n2) -> (n1 = n2) && pathEq p1 p2
|
||||
|
@ -203,8 +201,6 @@ let RefuteDiscrimSet g m path discrims =
|
|||
let rec go path tm =
|
||||
match path with
|
||||
| PathQuery _ -> raise CannotRefute
|
||||
| PathConj (p, _j) ->
|
||||
go p tm
|
||||
| PathTuple (p, tys, j) ->
|
||||
let k, eCoversVals = mkOneKnown tm j tys
|
||||
go p (fun _ -> mkRefTupled g m k tys, eCoversVals)
|
||||
|
@ -391,8 +387,6 @@ type Frontier = Frontier of ClauseNumber * Actives * ValMap<Expr>
|
|||
type InvestigationPoint = Investigation of ClauseNumber * DecisionTreeTest * Path
|
||||
|
||||
// Note: actives must be a SortedDictionary
|
||||
// REVIEW: improve these data structures, though surprisingly these functions don't tend to show up
|
||||
// on profiling runs
|
||||
let rec isMemOfActives p1 actives =
|
||||
match actives with
|
||||
| [] -> false
|
||||
|
@ -654,9 +648,9 @@ let isDiscrimSubsumedBy g amap m discrim taken =
|
|||
match taken, discrim with
|
||||
| DecisionTreeTest.IsInst (_, tgtTy1), DecisionTreeTest.IsInst (_, tgtTy2) ->
|
||||
computeWhatFailingTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 = Implication.Fails
|
||||
| DecisionTreeTest.IsNull _, DecisionTreeTest.IsInst (_, tgtTy2) ->
|
||||
| DecisionTreeTest.IsNull, DecisionTreeTest.IsInst (_, tgtTy2) ->
|
||||
computeWhatFailingNullTestImpliesAboutTypeTest g tgtTy2 = Implication.Fails
|
||||
| DecisionTreeTest.IsInst (_, tgtTy1), DecisionTreeTest.IsNull _ ->
|
||||
| DecisionTreeTest.IsInst (_, tgtTy1), DecisionTreeTest.IsNull ->
|
||||
computeWhatFailingTypeTestImpliesAboutNullTest g tgtTy1 = Implication.Fails
|
||||
| _ ->
|
||||
false
|
||||
|
@ -696,7 +690,7 @@ let discrimWithinSimultaneousClass g amap m discrim prev =
|
|||
// Check that each previous test in the set, if successful, gives some information about this test
|
||||
prev |> List.forall (fun edge ->
|
||||
match edge with
|
||||
| DecisionTreeTest.IsNull _ -> true
|
||||
| DecisionTreeTest.IsNull -> true
|
||||
| DecisionTreeTest.IsInst (_, tgtTy1) -> computeWhatSuccessfulTypeTestImpliesAboutNullTest g tgtTy1 <> Implication.Nothing
|
||||
| _ -> false)
|
||||
|
||||
|
@ -704,7 +698,7 @@ let discrimWithinSimultaneousClass g amap m discrim prev =
|
|||
// Check that each previous test in the set, if successful, gives some information about this test
|
||||
prev |> List.forall (fun edge ->
|
||||
match edge with
|
||||
| DecisionTreeTest.IsNull _ -> true
|
||||
| DecisionTreeTest.IsNull -> true
|
||||
| DecisionTreeTest.IsInst (_, tgtTy1) -> computeWhatSuccessfulTypeTestImpliesAboutTypeTest g amap m tgtTy1 tgtTy2 <> Implication.Nothing
|
||||
| _ -> false)
|
||||
|
||||
|
@ -1507,7 +1501,7 @@ let CompilePatternBasic
|
|||
// F# exception definitions are sealed.
|
||||
[]
|
||||
|
||||
| DecisionTreeTest.IsNull _ ->
|
||||
| DecisionTreeTest.IsNull ->
|
||||
match computeWhatSuccessfulNullTestImpliesAboutTypeTest g tgtTy1 with
|
||||
| Implication.Succeeds -> [Frontier (i, newActives, valMap)]
|
||||
| Implication.Fails -> []
|
||||
|
@ -1543,7 +1537,7 @@ let CompilePatternBasic
|
|||
| Implication.Nothing ->
|
||||
[frontier]
|
||||
|
||||
| DecisionTreeTest.IsNull _ ->
|
||||
| DecisionTreeTest.IsNull ->
|
||||
match computeWhatSuccessfulNullTestImpliesAboutTypeTest g tgtTy1 with
|
||||
| Implication.Succeeds -> [Frontier (i, newActives, valMap)]
|
||||
| Implication.Fails -> []
|
||||
|
@ -1624,7 +1618,7 @@ let CompilePatternBasic
|
|||
subPats |> List.collect (fun subPat -> BindProjectionPattern (Active(inpPath, inpExpr, subPat)) activeState)
|
||||
|
||||
| TPat_conjs(subPats, _m) ->
|
||||
let newActives = List.mapi (mkSubActive (fun path j -> PathConj(path, j)) (fun _j -> inpAccess)) subPats
|
||||
let newActives = List.mapi (mkSubActive (fun path _j -> path) (fun _j -> inpAccess)) subPats
|
||||
BindProjectionPatterns newActives activeState
|
||||
|
||||
| TPat_range (c1, c2, m) ->
|
||||
|
|
|
@ -685,7 +685,7 @@ let CheckTypeInstNoInnerByrefs cenv env m tyargs =
|
|||
/// Applied functions get wrapped in coerce nodes for subsumption coercions
|
||||
let (|OptionalCoerce|) expr =
|
||||
match stripDebugPoints expr with
|
||||
| Expr.Op (TOp.Coerce _, _, [DebugPoints(Expr.App (f, _, _, [], _), _)], _) -> f
|
||||
| Expr.Op (TOp.Coerce, _, [DebugPoints(Expr.App (f, _, _, [], _), _)], _) -> f
|
||||
| _ -> expr
|
||||
|
||||
/// Check an expression doesn't contain a 'reraise'
|
||||
|
@ -1539,7 +1539,7 @@ and CheckExprOp cenv env (op, tyargs, args, m) ctxt expr =
|
|||
else
|
||||
{ scope = 1; flags = LimitFlags.None }
|
||||
|
||||
| TOp.LValueOp (LSet _, vref), _, [arg] ->
|
||||
| TOp.LValueOp (LSet, vref), _, [arg] ->
|
||||
let isVrefLimited = not (HasLimitFlag LimitFlags.StackReferringSpanLike (GetLimitVal cenv env m vref.Deref))
|
||||
let isArgLimited = HasLimitFlag LimitFlags.StackReferringSpanLike (CheckExprPermitByRefLike cenv env arg)
|
||||
if isVrefLimited && isArgLimited then
|
||||
|
@ -1901,7 +1901,7 @@ and CheckAttribArgExpr cenv env expr =
|
|||
| Const.Double _
|
||||
| Const.Single _
|
||||
| Const.Char _
|
||||
| Const.Zero _
|
||||
| Const.Zero
|
||||
| Const.String _ -> ()
|
||||
| _ ->
|
||||
if cenv.reportErrors then
|
||||
|
|
|
@ -438,6 +438,11 @@ type ILTypeInfo =
|
|||
|
||||
member x.IsValueType = x.RawMetadata.IsStructOrEnum
|
||||
|
||||
/// Indicates if the type is marked with the [<IsReadOnly>] attribute.
|
||||
member x.IsReadOnly (g: TcGlobals) =
|
||||
x.RawMetadata.CustomAttrs
|
||||
|> TryFindILAttribute g.attrib_IsReadOnlyAttribute
|
||||
|
||||
member x.Instantiate inst =
|
||||
let (ILTypeInfo(g, ty, tref, tdef)) = x
|
||||
ILTypeInfo(g, instType inst ty, tref, tdef)
|
||||
|
@ -993,15 +998,22 @@ type MethInfo =
|
|||
member x.IsStruct =
|
||||
isStructTy x.TcGlobals x.ApparentEnclosingType
|
||||
|
||||
/// Indicates if this method is read-only; usually by the [<IsReadOnly>] attribute.
|
||||
member x.IsOnReadOnlyType =
|
||||
let g = x.TcGlobals
|
||||
let typeInfo = ILTypeInfo.FromType g x.ApparentEnclosingType
|
||||
typeInfo.IsReadOnly g
|
||||
|
||||
/// Indicates if this method is read-only; usually by the [<IsReadOnly>] attribute on method or struct level.
|
||||
/// 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
|
||||
| ILMeth (g, ilMethInfo, _) ->
|
||||
ilMethInfo.IsReadOnly g || x.IsOnReadOnlyType
|
||||
| FSMeth _ -> false // F# defined methods not supported yet. Must be a language feature.
|
||||
| _ -> false
|
||||
|
||||
|
@ -2264,6 +2276,12 @@ type EventInfo =
|
|||
#endif
|
||||
override x.ToString() = "event " + x.EventName
|
||||
|
||||
/// Get custom attributes for events (only applicable for IL events)
|
||||
member x.GetCustomAttrs() =
|
||||
match x with
|
||||
| ILEvent(ILEventInfo(_, ilEventDef))-> ilEventDef.CustomAttrs
|
||||
| _ -> ILAttributes.Empty
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Helpers associated with getting and comparing method signatures
|
||||
|
||||
|
|
|
@ -1009,6 +1009,9 @@ type EventInfo =
|
|||
/// Get the delegate type associated with the event.
|
||||
member GetDelegateType: amap: ImportMap * m: range -> TType
|
||||
|
||||
/// Get custom attributes for events (only applicable for IL events)
|
||||
member GetCustomAttrs: unit -> ILAttributes
|
||||
|
||||
/// An exception type used to raise an error using the old error system.
|
||||
///
|
||||
/// Error text: "A definition to be compiled as a .NET event does not have the expected form. Only property members can be compiled as .NET events."
|
||||
|
|
|
@ -2847,9 +2847,7 @@ let ComputeDebugPointForBinding g bind =
|
|||
| DebugPointAtBinding.NoneAtDo, _ -> false, None
|
||||
| DebugPointAtBinding.NoneAtLet, _ -> false, None
|
||||
// Don't emit debug points for lambdas.
|
||||
| _,
|
||||
(Expr.Lambda _
|
||||
| Expr.TyLambda _) -> false, None
|
||||
| _, (Expr.Lambda _ | Expr.TyLambda _) -> false, None
|
||||
| DebugPointAtBinding.Yes m, _ -> false, Some m
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -4157,7 +4155,7 @@ and GenApp (cenv: cenv) cgbuf eenv (f, fty, tyargs, curriedArgs, m) sequel =
|
|||
| Expr.Val (v, _, m), _, [ arg ] when valRefEq g v g.methodhandleof_vref ->
|
||||
let (|OptionalCoerce|) x =
|
||||
match stripDebugPoints x with
|
||||
| Expr.Op (TOp.Coerce _, _, [ arg ], _) -> arg
|
||||
| Expr.Op (TOp.Coerce, _, [ arg ], _) -> arg
|
||||
| x -> x
|
||||
|
||||
let (|OptionalTyapp|) x =
|
||||
|
@ -4702,7 +4700,7 @@ and eligibleForFilter (cenv: cenv) expr =
|
|||
| Expr.Op (TOp.UnionCaseFieldGet _, _, _, _) -> true
|
||||
| Expr.Op (TOp.ValFieldGet _, _, _, _) -> true
|
||||
| Expr.Op (TOp.TupleFieldGet _, _, _, _) -> true
|
||||
| Expr.Op (TOp.Coerce _, _, _, _) -> true
|
||||
| Expr.Op (TOp.Coerce, _, _, _) -> true
|
||||
| Expr.Val _ -> true
|
||||
| _ -> false
|
||||
|
||||
|
@ -5141,21 +5139,10 @@ and GenAsmCode cenv cgbuf eenv (il, tyargs, args, returnTys, m) sequel =
|
|||
// For these we can just generate the argument and change the test (from a brfalse to a brtrue and vice versa)
|
||||
| ([ AI_ceq ],
|
||||
[ arg1
|
||||
Expr.Const ((Const.Bool false
|
||||
| Const.SByte 0y
|
||||
| Const.Int16 0s
|
||||
| Const.Int32 0
|
||||
| Const.Int64 0L
|
||||
| Const.Byte 0uy
|
||||
| Const.UInt16 0us
|
||||
| Const.UInt32 0u
|
||||
| Const.UInt64 0UL),
|
||||
Expr.Const ((Const.Bool false | Const.SByte 0y | Const.Int16 0s | Const.Int32 0 | Const.Int64 0L | Const.Byte 0uy | Const.UInt16 0us | Const.UInt32 0u | Const.UInt64 0UL),
|
||||
_,
|
||||
_) ],
|
||||
CmpThenBrOrContinue (1,
|
||||
[ I_brcmp ((BI_brfalse
|
||||
| BI_brtrue) as bi,
|
||||
label1) ]),
|
||||
CmpThenBrOrContinue (1, [ I_brcmp ((BI_brfalse | BI_brtrue) as bi, label1) ]),
|
||||
_) ->
|
||||
|
||||
let bi =
|
||||
|
@ -7594,7 +7581,7 @@ and GenDecisionTreeSwitch
|
|||
|
||||
// Use GenDecisionTreeTest to generate a single test for null (when no box required) where the success
|
||||
// is going to the immediate first node in the tree
|
||||
| TCase (DecisionTreeTest.IsNull _, (TDSuccess ([], 0) as successTree)) :: rest when
|
||||
| TCase (DecisionTreeTest.IsNull, (TDSuccess ([], 0) as successTree)) :: rest when
|
||||
rest.Length = (match defaultTargetOpt with
|
||||
| None -> 1
|
||||
| Some _ -> 0)
|
||||
|
@ -7910,9 +7897,7 @@ and GenDecisionTreeTest
|
|||
// If so, emit the failure logic, then came back and do the success target, then
|
||||
// do any postponed failure target.
|
||||
match successTree, failureTree with
|
||||
| TDSuccess _,
|
||||
(TDBind _
|
||||
| TDSwitch _) ->
|
||||
| TDSuccess _, (TDBind _ | TDSwitch _) ->
|
||||
|
||||
// OK, there is more logic in the decision tree on the failure branch
|
||||
let success = CG.GenerateDelayMark cgbuf "testSuccess"
|
||||
|
@ -10648,10 +10633,9 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
|
|||
| None -> None
|
||||
| Some memberInfo ->
|
||||
match name, memberInfo.MemberFlags.MemberKind with
|
||||
| ("Item"
|
||||
| "op_IndexedLookup"),
|
||||
(SynMemberKind.PropertyGet
|
||||
| SynMemberKind.PropertySet) when not (isNil (ArgInfosOfPropertyVal g vref.Deref)) ->
|
||||
| ("Item" | "op_IndexedLookup"), (SynMemberKind.PropertyGet | SynMemberKind.PropertySet) when
|
||||
not (isNil (ArgInfosOfPropertyVal g vref.Deref))
|
||||
->
|
||||
Some(
|
||||
mkILCustomAttribute (
|
||||
g.FindSysILTypeRef "System.Reflection.DefaultMemberAttribute",
|
||||
|
@ -11445,7 +11429,13 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) =
|
|||
let ilFieldName = ComputeFieldName exnc fld
|
||||
|
||||
let ilMethodDef =
|
||||
mkLdfldMethodDef (ilMethName, reprAccess, false, ilThisTy, ilFieldName, ilPropType, [])
|
||||
let def =
|
||||
mkLdfldMethodDef (ilMethName, reprAccess, false, ilThisTy, ilFieldName, ilPropType, [])
|
||||
|
||||
if ilPropName = "Message" then
|
||||
def.WithVirtual(true)
|
||||
else
|
||||
def
|
||||
|
||||
let ilFieldDef =
|
||||
mkILInstanceField (ilFieldName, ilPropType, None, ILMemberAccess.Assembly)
|
||||
|
@ -11532,6 +11522,7 @@ and GenExnDef cenv mgbuf eenv m (exnc: Tycon) =
|
|||
cenv.g.langVersion.SupportsFeature(LanguageFeature.BetterExceptionPrinting)
|
||||
&& not (exnc.HasMember g "get_Message" [])
|
||||
&& not (exnc.HasMember g "Message" [])
|
||||
&& not (fspecs |> List.exists (fun rf -> rf.DisplayNameCore = "Message"))
|
||||
then
|
||||
yield! GenPrintingMethod cenv eenv "get_Message" ilThisTy m
|
||||
]
|
||||
|
|
|
@ -300,7 +300,7 @@ type ImportedAssembly =
|
|||
IsProviderGenerated: bool
|
||||
mutable TypeProviders: Tainted<ITypeProvider> list
|
||||
#endif
|
||||
FSharpOptimizationData: Microsoft.FSharp.Control.Lazy<Option<Optimizer.LazyModuleInfo>>
|
||||
FSharpOptimizationData: Microsoft.FSharp.Control.Lazy<Optimizer.LazyModuleInfo option>
|
||||
}
|
||||
|
||||
type AvailableImportedAssembly =
|
||||
|
@ -517,6 +517,7 @@ type TcConfigBuilder =
|
|||
|
||||
/// show times between passes?
|
||||
mutable showTimes: bool
|
||||
mutable writeTimesToFile: string option
|
||||
mutable showLoadedAssemblies: bool
|
||||
mutable continueAfterParseFailure: bool
|
||||
|
||||
|
@ -740,6 +741,7 @@ type TcConfigBuilder =
|
|||
productNameForBannerText = FSharpProductName
|
||||
showBanner = true
|
||||
showTimes = false
|
||||
writeTimesToFile = None
|
||||
showLoadedAssemblies = false
|
||||
continueAfterParseFailure = false
|
||||
#if !NO_TYPEPROVIDERS
|
||||
|
@ -1296,6 +1298,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
|
|||
member _.productNameForBannerText = data.productNameForBannerText
|
||||
member _.showBanner = data.showBanner
|
||||
member _.showTimes = data.showTimes
|
||||
member _.writeTimesToFile = data.writeTimesToFile
|
||||
member _.showLoadedAssemblies = data.showLoadedAssemblies
|
||||
member _.continueAfterParseFailure = data.continueAfterParseFailure
|
||||
#if !NO_TYPEPROVIDERS
|
||||
|
@ -1405,14 +1408,13 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
|
|||
/// 'framework' reference set that is potentially shared across multiple compilations.
|
||||
member tcConfig.IsSystemAssembly(fileName: string) =
|
||||
try
|
||||
let dirName = Path.GetDirectoryName fileName
|
||||
let baseName = FileSystemUtils.fileNameWithoutExtension fileName
|
||||
|
||||
FileSystem.FileExistsShim fileName
|
||||
&& ((tcConfig.GetTargetFrameworkDirectories()
|
||||
|> List.exists (fun clrRoot -> clrRoot = Path.GetDirectoryName fileName))
|
||||
|| (tcConfig
|
||||
.FxResolver
|
||||
.GetSystemAssemblies()
|
||||
.Contains(FileSystemUtils.fileNameWithoutExtension fileName))
|
||||
|| tcConfig.FxResolver.IsInReferenceAssemblyPackDirectory fileName)
|
||||
&& ((tcConfig.GetTargetFrameworkDirectories() |> List.contains dirName)
|
||||
|| FxResolver.GetSystemAssemblies().Contains baseName
|
||||
|| FxResolver.IsReferenceAssemblyPackDirectoryApprox dirName)
|
||||
with _ ->
|
||||
false
|
||||
|
||||
|
|
|
@ -426,6 +426,8 @@ type TcConfigBuilder =
|
|||
|
||||
mutable showTimes: bool
|
||||
|
||||
mutable writeTimesToFile: string option
|
||||
|
||||
mutable showLoadedAssemblies: bool
|
||||
|
||||
mutable continueAfterParseFailure: bool
|
||||
|
@ -748,6 +750,8 @@ type TcConfig =
|
|||
|
||||
member showTimes: bool
|
||||
|
||||
member writeTimesToFile: string option
|
||||
|
||||
member showLoadedAssemblies: bool
|
||||
|
||||
member continueAfterParseFailure: bool
|
||||
|
|
|
@ -170,7 +170,7 @@ type Exception with
|
|||
| VirtualAugmentationOnNullValuedType m
|
||||
| NonVirtualAugmentationOnNullValuedType m
|
||||
| NonRigidTypar (_, _, _, _, _, m)
|
||||
| ConstraintSolverTupleDiffLengths (_, _, _, m, _)
|
||||
| ConstraintSolverTupleDiffLengths (_, _, _, _, m, _)
|
||||
| ConstraintSolverInfiniteTypes (_, _, _, _, m, _)
|
||||
| ConstraintSolverMissingConstraint (_, _, _, m, _)
|
||||
| ConstraintSolverTypesNotInEqualityRelation (_, _, _, m, _, _)
|
||||
|
@ -240,6 +240,7 @@ type Exception with
|
|||
// 24 cannot be reused
|
||||
| PatternMatchCompilation.MatchIncomplete _ -> 25
|
||||
| PatternMatchCompilation.RuleNeverMatched _ -> 26
|
||||
|
||||
| ValNotMutable _ -> 27
|
||||
| ValNotLocal _ -> 28
|
||||
| MissingFields _ -> 29
|
||||
|
@ -439,6 +440,7 @@ module OldStyleMessages =
|
|||
let ConstraintSolverTypesNotInSubsumptionRelationE () = Message("ConstraintSolverTypesNotInSubsumptionRelation", "%s%s%s")
|
||||
let ErrorFromAddingTypeEquation1E () = Message("ErrorFromAddingTypeEquation1", "%s%s%s")
|
||||
let ErrorFromAddingTypeEquation2E () = Message("ErrorFromAddingTypeEquation2", "%s%s%s")
|
||||
let ErrorFromAddingTypeEquationTuplesE () = Message("ErrorFromAddingTypeEquationTuples", "%d%s%d%s%s")
|
||||
let ErrorFromApplyingDefault1E () = Message("ErrorFromApplyingDefault1", "%s")
|
||||
let ErrorFromApplyingDefault2E () = Message("ErrorFromApplyingDefault2", "")
|
||||
let ErrorsFromAddingSubsumptionConstraintE () = Message("ErrorsFromAddingSubsumptionConstraint", "%s%s%s")
|
||||
|
@ -615,12 +617,28 @@ let OutputNameSuggestions (os: StringBuilder) suggestNames suggestionsF idText =
|
|||
os.AppendString " "
|
||||
os.AppendString(ConvertValLogicalNameToDisplayNameCore value)
|
||||
|
||||
let OutputTypesNotInEqualityRelationContextInfo contextInfo ty1 ty2 m (os: StringBuilder) fallback =
|
||||
match contextInfo with
|
||||
| ContextInfo.IfExpression range when equals range m -> os.AppendString(FSComp.SR.ifExpression (ty1, ty2))
|
||||
| ContextInfo.CollectionElement (isArray, range) when equals range m ->
|
||||
if isArray then
|
||||
os.AppendString(FSComp.SR.arrayElementHasWrongType (ty1, ty2))
|
||||
else
|
||||
os.AppendString(FSComp.SR.listElementHasWrongType (ty1, ty2))
|
||||
| ContextInfo.OmittedElseBranch range when equals range m -> os.AppendString(FSComp.SR.missingElseBranch (ty2))
|
||||
| ContextInfo.ElseBranchResult range when equals range m -> os.AppendString(FSComp.SR.elseBranchHasWrongType (ty1, ty2))
|
||||
| ContextInfo.FollowingPatternMatchClause range when equals range m ->
|
||||
os.AppendString(FSComp.SR.followingPatternMatchClauseHasWrongType (ty1, ty2))
|
||||
| ContextInfo.PatternMatchGuard range when equals range m -> os.AppendString(FSComp.SR.patternMatchGuardIsNotBool (ty2))
|
||||
| contextInfo -> fallback contextInfo
|
||||
|
||||
type Exception with
|
||||
|
||||
member exn.Output(os: StringBuilder, suggestNames) =
|
||||
|
||||
match exn with
|
||||
| ConstraintSolverTupleDiffLengths (_, tl1, tl2, m, m2) ->
|
||||
// TODO: this is now unused...?
|
||||
| ConstraintSolverTupleDiffLengths (_, _, tl1, tl2, m, m2) ->
|
||||
os.AppendString(ConstraintSolverTupleDiffLengthsE().Format tl1.Length tl2.Length)
|
||||
|
||||
if m.StartLine <> m2.StartLine then
|
||||
|
@ -661,19 +679,8 @@ type Exception with
|
|||
// REVIEW: consider if we need to show _cxs (the type parameter constraints)
|
||||
let ty1, ty2, _cxs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2
|
||||
|
||||
match contextInfo with
|
||||
| ContextInfo.IfExpression range when equals range m -> os.AppendString(FSComp.SR.ifExpression (ty1, ty2))
|
||||
| ContextInfo.CollectionElement (isArray, range) when equals range m ->
|
||||
if isArray then
|
||||
os.AppendString(FSComp.SR.arrayElementHasWrongType (ty1, ty2))
|
||||
else
|
||||
os.AppendString(FSComp.SR.listElementHasWrongType (ty1, ty2))
|
||||
| ContextInfo.OmittedElseBranch range when equals range m -> os.AppendString(FSComp.SR.missingElseBranch (ty2))
|
||||
| ContextInfo.ElseBranchResult range when equals range m -> os.AppendString(FSComp.SR.elseBranchHasWrongType (ty1, ty2))
|
||||
| ContextInfo.FollowingPatternMatchClause range when equals range m ->
|
||||
os.AppendString(FSComp.SR.followingPatternMatchClauseHasWrongType (ty1, ty2))
|
||||
| ContextInfo.PatternMatchGuard range when equals range m -> os.AppendString(FSComp.SR.patternMatchGuardIsNotBool (ty2))
|
||||
| _ -> os.AppendString(ConstraintSolverTypesNotInEqualityRelation2E().Format ty1 ty2)
|
||||
OutputTypesNotInEqualityRelationContextInfo contextInfo ty1 ty2 m os (fun _ ->
|
||||
os.AppendString(ConstraintSolverTypesNotInEqualityRelation2E().Format ty1 ty2))
|
||||
|
||||
if m.StartLine <> m2.StartLine then
|
||||
os.AppendString(SeeAlsoE().Format(stringOfRange m))
|
||||
|
@ -697,33 +704,15 @@ type Exception with
|
|||
->
|
||||
let ty1, ty2, tpcs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2
|
||||
|
||||
match contextInfo with
|
||||
| ContextInfo.IfExpression range when equals range m -> os.AppendString(FSComp.SR.ifExpression (ty1, ty2))
|
||||
|
||||
| ContextInfo.CollectionElement (isArray, range) when equals range m ->
|
||||
if isArray then
|
||||
os.AppendString(FSComp.SR.arrayElementHasWrongType (ty1, ty2))
|
||||
else
|
||||
os.AppendString(FSComp.SR.listElementHasWrongType (ty1, ty2))
|
||||
|
||||
| ContextInfo.OmittedElseBranch range when equals range m -> os.AppendString(FSComp.SR.missingElseBranch (ty2))
|
||||
|
||||
| ContextInfo.ElseBranchResult range when equals range m -> os.AppendString(FSComp.SR.elseBranchHasWrongType (ty1, ty2))
|
||||
|
||||
| ContextInfo.FollowingPatternMatchClause range when equals range m ->
|
||||
os.AppendString(FSComp.SR.followingPatternMatchClauseHasWrongType (ty1, ty2))
|
||||
|
||||
| ContextInfo.PatternMatchGuard range when equals range m -> os.AppendString(FSComp.SR.patternMatchGuardIsNotBool (ty2))
|
||||
|
||||
| ContextInfo.TupleInRecordFields ->
|
||||
os.AppendString(ErrorFromAddingTypeEquation1E().Format ty2 ty1 tpcs)
|
||||
os.AppendString(Environment.NewLine + FSComp.SR.commaInsteadOfSemicolonInRecord ())
|
||||
|
||||
| _ when ty2 = "bool" && ty1.EndsWithOrdinal(" ref") ->
|
||||
os.AppendString(ErrorFromAddingTypeEquation1E().Format ty2 ty1 tpcs)
|
||||
os.AppendString(Environment.NewLine + FSComp.SR.derefInsteadOfNot ())
|
||||
|
||||
| _ -> os.AppendString(ErrorFromAddingTypeEquation1E().Format ty2 ty1 tpcs)
|
||||
OutputTypesNotInEqualityRelationContextInfo contextInfo ty1 ty2 m os (fun contextInfo ->
|
||||
match contextInfo with
|
||||
| ContextInfo.TupleInRecordFields ->
|
||||
os.AppendString(ErrorFromAddingTypeEquation1E().Format ty2 ty1 tpcs)
|
||||
os.AppendString(Environment.NewLine + FSComp.SR.commaInsteadOfSemicolonInRecord ())
|
||||
| _ when ty2 = "bool" && ty1.EndsWithOrdinal(" ref") ->
|
||||
os.AppendString(ErrorFromAddingTypeEquation1E().Format ty2 ty1 tpcs)
|
||||
os.AppendString(Environment.NewLine + FSComp.SR.derefInsteadOfNot ())
|
||||
| _ -> os.AppendString(ErrorFromAddingTypeEquation1E().Format ty2 ty1 tpcs))
|
||||
|
||||
| ErrorFromAddingTypeEquation (_, _, _, _, (ConstraintSolverTypesNotInEqualityRelation (_, _, _, _, _, contextInfo) as e), _) when
|
||||
(match contextInfo with
|
||||
|
@ -736,6 +725,24 @@ type Exception with
|
|||
|
||||
| ErrorFromAddingTypeEquation(error = ConstraintSolverError _ as e) -> e.Output(os, suggestNames)
|
||||
|
||||
| ErrorFromAddingTypeEquation (_g, denv, ty1, ty2, ConstraintSolverTupleDiffLengths (_, contextInfo, tl1, tl2, _, _), m) ->
|
||||
let ty1, ty2, tpcs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2
|
||||
let messageArgs = tl1.Length, ty1, tl2.Length, ty2
|
||||
|
||||
if ty1 <> ty2 + tpcs then
|
||||
match contextInfo with
|
||||
| ContextInfo.IfExpression range when equals range m -> os.AppendString(FSComp.SR.ifExpressionTuple messageArgs)
|
||||
| ContextInfo.ElseBranchResult range when equals range m ->
|
||||
os.AppendString(FSComp.SR.elseBranchHasWrongTypeTuple messageArgs)
|
||||
| ContextInfo.FollowingPatternMatchClause range when equals range m ->
|
||||
os.AppendString(FSComp.SR.followingPatternMatchClauseHasWrongTypeTuple messageArgs)
|
||||
| ContextInfo.CollectionElement (isArray, range) when equals range m ->
|
||||
if isArray then
|
||||
os.AppendString(FSComp.SR.arrayElementHasWrongTypeTuple messageArgs)
|
||||
else
|
||||
os.AppendString(FSComp.SR.listElementHasWrongTypeTuple messageArgs)
|
||||
| _ -> os.AppendString(ErrorFromAddingTypeEquationTuplesE().Format tl1.Length ty1 tl2.Length ty2 tpcs)
|
||||
|
||||
| ErrorFromAddingTypeEquation (g, denv, ty1, ty2, e, _) ->
|
||||
if not (typeEquiv g ty1 ty2) then
|
||||
let ty1, ty2, tpcs = NicePrint.minimalStringsOfTwoTypes denv ty1 ty2
|
||||
|
@ -1083,7 +1090,7 @@ type Exception with
|
|||
| Parser.TOKEN_BAR_RBRACK -> SR.GetString("Parser.TOKEN.BAR.RBRACK")
|
||||
| Parser.TOKEN_BAR_RBRACE -> SR.GetString("Parser.TOKEN.BAR.RBRACE")
|
||||
| Parser.TOKEN_GREATER_RBRACK -> SR.GetString("Parser.TOKEN.GREATER.RBRACK")
|
||||
| Parser.TOKEN_RQUOTE_DOT _
|
||||
| Parser.TOKEN_RQUOTE_DOT
|
||||
| Parser.TOKEN_RQUOTE -> SR.GetString("Parser.TOKEN.RQUOTE")
|
||||
| Parser.TOKEN_RBRACK -> SR.GetString("Parser.TOKEN.RBRACK")
|
||||
| Parser.TOKEN_RBRACE
|
||||
|
@ -1110,8 +1117,8 @@ type Exception with
|
|||
| Parser.TOKEN_OTHEN -> SR.GetString("Parser.TOKEN.OTHEN")
|
||||
| Parser.TOKEN_ELSE
|
||||
| Parser.TOKEN_OELSE -> SR.GetString("Parser.TOKEN.OELSE")
|
||||
| Parser.TOKEN_LET _
|
||||
| Parser.TOKEN_OLET _ -> SR.GetString("Parser.TOKEN.OLET")
|
||||
| Parser.TOKEN_LET
|
||||
| Parser.TOKEN_OLET -> SR.GetString("Parser.TOKEN.OLET")
|
||||
| Parser.TOKEN_OBINDER
|
||||
| Parser.TOKEN_BINDER -> SR.GetString("Parser.TOKEN.BINDER")
|
||||
| Parser.TOKEN_OAND_BANG
|
||||
|
@ -2099,7 +2106,7 @@ type PhasedDiagnostic with
|
|||
Printf.bprintf buf "\n"
|
||||
|
||||
match e with
|
||||
| FormattedDiagnostic.Short (_, txt) -> buf.AppendString txt |> ignore
|
||||
| FormattedDiagnostic.Short (_, txt) -> buf.AppendString txt
|
||||
| FormattedDiagnostic.Long (_, details) ->
|
||||
match details.Location with
|
||||
| Some l when not l.IsEmpty -> buf.AppendString l.TextRepresentation
|
||||
|
|
|
@ -338,12 +338,12 @@ type ImportedAssembly =
|
|||
IsProviderGenerated: bool
|
||||
mutable TypeProviders: Tainted<ITypeProvider> list
|
||||
#endif
|
||||
FSharpOptimizationData: Microsoft.FSharp.Control.Lazy<Option<Optimizer.LazyModuleInfo>>
|
||||
FSharpOptimizationData: Microsoft.FSharp.Control.Lazy<Optimizer.LazyModuleInfo option>
|
||||
}
|
||||
|
||||
type AvailableImportedAssembly =
|
||||
| ResolvedImportedAssembly of ImportedAssembly
|
||||
| UnresolvedImportedAssembly of string
|
||||
| ResolvedImportedAssembly of ImportedAssembly * range
|
||||
| UnresolvedImportedAssembly of string * range
|
||||
|
||||
type CcuLoadFailureAction =
|
||||
| RaiseError
|
||||
|
@ -1024,33 +1024,77 @@ type TcImportsSafeDisposal
|
|||
dispose ()
|
||||
|
||||
#if !NO_TYPEPROVIDERS
|
||||
// These are hacks in order to allow TcImports to be held as a weak reference inside a type provider.
|
||||
// The reason is due to older type providers compiled using an older TypeProviderSDK, that SDK used reflection on fields and properties to determine the contract.
|
||||
// The reflection code has now since been removed, see here: https://github.com/fsprojects/FSharp.TypeProviders.SDK/pull/305. But we still need to work on older type providers.
|
||||
// One day we can remove these hacks when we deemed most if not all type providers were re-compiled using the newer TypeProviderSDK.
|
||||
// Yuck.
|
||||
type TcImportsDllInfoHack = { FileName: string }
|
||||
|
||||
and TcImportsWeakHack(tciLock: TcImportsLock, tcImports: WeakReference<TcImports>) =
|
||||
let mutable dllInfos: TcImportsDllInfoHack list = []
|
||||
// TcImports is held as a weak reference inside a TypeProviderConfig.
|
||||
//
|
||||
// Due to various historical bugs with the ReferencedAssemblies property of TypeProviderConfig,
|
||||
// type providers compiled using the TypeProvider SDK have picked up the unfortunate habit of using
|
||||
// private reflection on the TypeProviderConfig to correctly determine the ReferencedAssemblies.
|
||||
// These types thus also act as a stable facade supporting exactly the private reflection that is
|
||||
// used by type providers built with the TypeProvider SDK.
|
||||
//
|
||||
// The use of private reflection is highly unfortunate but has historically been the only way to
|
||||
// unblock several important type providers such as FSharp.Data when the weaknesses in reported
|
||||
// ReferencedAssemblies were determined.
|
||||
//
|
||||
// The use of private reflection was removed from the TypeProvider SDK, see
|
||||
// https://github.com/fsprojects/FSharp.TypeProviders.SDK/pull/305. But we still need to work on older type providers.
|
||||
//
|
||||
// however it was then reinstated
|
||||
//
|
||||
// https://github.com/fsprojects/FSharp.TypeProviders.SDK/pull/388
|
||||
//
|
||||
// All known issues TypeProviderConfig::ReferencedAssemblies are now fixed, meaning one day
|
||||
// we can remove the use of private reflection from the TPSDK (that is, once the F# tooling fixes
|
||||
// can be assumed to be shipped in all F# tooling where type providers have to load). After that,
|
||||
// once all type providers are updated, we will no longer need to have this fixed facade.
|
||||
|
||||
/// This acts as a stable type supporting the
|
||||
type TcImportsDllInfoFacade = { FileName: string }
|
||||
|
||||
type TcImportsWeakFacade(tciLock: TcImportsLock, tcImportsWeak: WeakReference<TcImports>) =
|
||||
|
||||
let mutable dllInfos: TcImportsDllInfoFacade list = []
|
||||
|
||||
// The name of these fields must not change, see above
|
||||
do assert (nameof (dllInfos) = "dllInfos")
|
||||
|
||||
member _.SetDllInfos(value: ImportedBinary list) =
|
||||
tciLock.AcquireLock(fun tcitok ->
|
||||
RequireTcImportsLock(tcitok, dllInfos)
|
||||
dllInfos <- value |> List.map (fun x -> { FileName = x.FileName }))
|
||||
|
||||
member _.Base: TcImportsWeakHack option =
|
||||
match tcImports.TryGetTarget() with
|
||||
| true, strong ->
|
||||
match strong.Base with
|
||||
let infos =
|
||||
[
|
||||
for x in value do
|
||||
let info = { FileName = x.FileName }
|
||||
// The name of this field must not change, see above
|
||||
assert (nameof (info.FileName) = "FileName")
|
||||
info
|
||||
]
|
||||
|
||||
dllInfos <- infos)
|
||||
|
||||
member this.Base: TcImportsWeakFacade option =
|
||||
// The name of this property msut not change, see above
|
||||
assert (nameof (this.Base) = "Base")
|
||||
|
||||
match tcImportsWeak.TryGetTarget() with
|
||||
| true, tcImports ->
|
||||
match tcImports.Base with
|
||||
| Some (baseTcImports: TcImports) -> Some baseTcImports.Weak
|
||||
| _ -> None
|
||||
| _ -> None
|
||||
|
||||
member _.SystemRuntimeContainsType typeName =
|
||||
match tcImports.TryGetTarget() with
|
||||
| true, strong -> strong.SystemRuntimeContainsType typeName
|
||||
match tcImportsWeak.TryGetTarget() with
|
||||
| true, tcImports -> tcImports.SystemRuntimeContainsType typeName
|
||||
| _ -> false
|
||||
|
||||
member _.AllAssemblyResolutions() =
|
||||
match tcImportsWeak.TryGetTarget() with
|
||||
| true, tcImports -> tcImports.AllAssemblyResolutions()
|
||||
| _ -> []
|
||||
|
||||
#endif
|
||||
/// Represents a table of imported assemblies with their resolutions.
|
||||
/// Is a disposable object, but it is recommended not to explicitly call Dispose unless you absolutely know nothing will be using its contents after the disposal.
|
||||
|
@ -1082,7 +1126,7 @@ and [<Sealed>] TcImports
|
|||
let mutable generatedTypeRoots =
|
||||
Dictionary<ILTypeRef, int * ProviderGeneratedType>()
|
||||
|
||||
let tcImportsWeak = TcImportsWeakHack(tciLock, WeakReference<_> this)
|
||||
let tcImportsWeak = TcImportsWeakFacade(tciLock, WeakReference<_> this)
|
||||
#endif
|
||||
|
||||
let disposal =
|
||||
|
@ -1140,29 +1184,29 @@ and [<Sealed>] TcImports
|
|||
| None -> false
|
||||
| None -> false
|
||||
|
||||
member internal tcImports.Base =
|
||||
member internal _.Base =
|
||||
CheckDisposed()
|
||||
importsBase
|
||||
|
||||
member tcImports.CcuTable =
|
||||
member _.CcuTable =
|
||||
tciLock.AcquireLock(fun tcitok ->
|
||||
RequireTcImportsLock(tcitok, ccuTable)
|
||||
CheckDisposed()
|
||||
ccuTable)
|
||||
|
||||
member tcImports.DllTable =
|
||||
member _.DllTable =
|
||||
tciLock.AcquireLock(fun tcitok ->
|
||||
RequireTcImportsLock(tcitok, dllTable)
|
||||
CheckDisposed()
|
||||
dllTable)
|
||||
|
||||
#if !NO_TYPEPROVIDERS
|
||||
member tcImports.Weak =
|
||||
member _.Weak =
|
||||
CheckDisposed()
|
||||
tcImportsWeak
|
||||
#endif
|
||||
|
||||
member tcImports.RegisterCcu ccuInfo =
|
||||
member _.RegisterCcu ccuInfo =
|
||||
tciLock.AcquireLock(fun tcitok ->
|
||||
CheckDisposed()
|
||||
RequireTcImportsLock(tcitok, ccuInfos)
|
||||
|
@ -1171,7 +1215,7 @@ and [<Sealed>] TcImports
|
|||
// Assembly Ref Resolution: remove this use of ccu.AssemblyName
|
||||
ccuTable <- NameMap.add ccuInfo.FSharpViewOfMetadata.AssemblyName ccuInfo ccuTable)
|
||||
|
||||
member tcImports.RegisterDll dllInfo =
|
||||
member _.RegisterDll dllInfo =
|
||||
tciLock.AcquireLock(fun tcitok ->
|
||||
CheckDisposed()
|
||||
RequireTcImportsLock(tcitok, dllInfos)
|
||||
|
@ -1182,7 +1226,7 @@ and [<Sealed>] TcImports
|
|||
#endif
|
||||
dllTable <- NameMap.add (getNameOfScopeRef dllInfo.ILScopeRef) dllInfo dllTable)
|
||||
|
||||
member tcImports.GetDllInfos() : ImportedBinary list =
|
||||
member _.GetDllInfos() : ImportedBinary list =
|
||||
tciLock.AcquireLock(fun tcitok ->
|
||||
CheckDisposed()
|
||||
RequireTcImportsLock(tcitok, dllInfos)
|
||||
|
@ -1191,7 +1235,7 @@ and [<Sealed>] TcImports
|
|||
| Some importsBase -> importsBase.GetDllInfos() @ dllInfos
|
||||
| None -> dllInfos)
|
||||
|
||||
member tcImports.AllAssemblyResolutions() =
|
||||
member _.AllAssemblyResolutions() =
|
||||
tciLock.AcquireLock(fun tcitok ->
|
||||
CheckDisposed()
|
||||
RequireTcImportsLock(tcitok, resolutions)
|
||||
|
@ -1223,7 +1267,7 @@ and [<Sealed>] TcImports
|
|||
| Some res -> res
|
||||
| None -> error (Error(FSComp.SR.buildCouldNotResolveAssembly assemblyName, m))
|
||||
|
||||
member tcImports.GetImportedAssemblies() =
|
||||
member _.GetImportedAssemblies() =
|
||||
tciLock.AcquireLock(fun tcitok ->
|
||||
CheckDisposed()
|
||||
RequireTcImportsLock(tcitok, ccuInfos)
|
||||
|
@ -1232,7 +1276,7 @@ and [<Sealed>] TcImports
|
|||
| Some importsBase -> List.append (importsBase.GetImportedAssemblies()) ccuInfos
|
||||
| None -> ccuInfos)
|
||||
|
||||
member tcImports.GetCcusExcludingBase() =
|
||||
member _.GetCcusExcludingBase() =
|
||||
tciLock.AcquireLock(fun tcitok ->
|
||||
CheckDisposed()
|
||||
RequireTcImportsLock(tcitok, ccuInfos)
|
||||
|
@ -1255,26 +1299,26 @@ and [<Sealed>] TcImports
|
|||
| None -> None
|
||||
|
||||
match look tcImports with
|
||||
| Some res -> ResolvedImportedAssembly res
|
||||
| Some res -> ResolvedImportedAssembly(res, m)
|
||||
| None ->
|
||||
tcImports.ImplicitLoadIfAllowed(ctok, m, assemblyName, lookupOnly)
|
||||
|
||||
match look tcImports with
|
||||
| Some res -> ResolvedImportedAssembly res
|
||||
| None -> UnresolvedImportedAssembly assemblyName
|
||||
| Some res -> ResolvedImportedAssembly(res, m)
|
||||
| None -> UnresolvedImportedAssembly(assemblyName, m)
|
||||
|
||||
member tcImports.FindCcu(ctok, m, assemblyName, lookupOnly) =
|
||||
CheckDisposed()
|
||||
|
||||
match tcImports.FindCcuInfo(ctok, m, assemblyName, lookupOnly) with
|
||||
| ResolvedImportedAssembly importedAssembly -> ResolvedCcu(importedAssembly.FSharpViewOfMetadata)
|
||||
| UnresolvedImportedAssembly assemblyName -> UnresolvedCcu assemblyName
|
||||
| ResolvedImportedAssembly (importedAssembly, _) -> ResolvedCcu(importedAssembly.FSharpViewOfMetadata)
|
||||
| UnresolvedImportedAssembly (assemblyName, _) -> UnresolvedCcu assemblyName
|
||||
|
||||
member tcImports.FindCcuFromAssemblyRef(ctok, m, assemblyRef: ILAssemblyRef) =
|
||||
CheckDisposed()
|
||||
|
||||
match tcImports.FindCcuInfo(ctok, m, assemblyRef.Name, lookupOnly = false) with
|
||||
| ResolvedImportedAssembly importedAssembly -> ResolvedCcu(importedAssembly.FSharpViewOfMetadata)
|
||||
| ResolvedImportedAssembly (importedAssembly, _) -> ResolvedCcu(importedAssembly.FSharpViewOfMetadata)
|
||||
| UnresolvedImportedAssembly _ -> UnresolvedCcu(assemblyRef.QualifiedName)
|
||||
|
||||
member tcImports.TryFindXmlDocumentationInfo(assemblyName: string) =
|
||||
|
@ -1393,7 +1437,7 @@ and [<Sealed>] TcImports
|
|||
// Yes, it is generative
|
||||
true, dllinfo.ProviderGeneratedStaticLinkMap
|
||||
|
||||
member tcImports.RecordGeneratedTypeRoot root =
|
||||
member _.RecordGeneratedTypeRoot root =
|
||||
tciLock.AcquireLock(fun tcitok ->
|
||||
// checking if given ProviderGeneratedType was already recorded before (probably for another set of static parameters)
|
||||
let (ProviderGeneratedType (_, ilTyRef, _)) = root
|
||||
|
@ -1407,7 +1451,7 @@ and [<Sealed>] TcImports
|
|||
|
||||
generatedTypeRoots[ilTyRef] <- (index, root))
|
||||
|
||||
member tcImports.ProviderGeneratedTypeRoots =
|
||||
member _.ProviderGeneratedTypeRoots =
|
||||
tciLock.AcquireLock(fun tcitok ->
|
||||
RequireTcImportsLock(tcitok, generatedTypeRoots)
|
||||
generatedTypeRoots.Values |> Seq.sortBy fst |> Seq.map snd |> Seq.toList)
|
||||
|
@ -1549,7 +1593,7 @@ and [<Sealed>] TcImports
|
|||
// types such as those in method signatures are currently converted on-demand. However ImportILAssembly does have to
|
||||
// convert the types that are constraints in generic parameters, which was the original motivation for making sure that
|
||||
// ImportILAssembly had a tcGlobals available when it really needs it.
|
||||
member tcImports.GetTcGlobals() : TcGlobals =
|
||||
member _.GetTcGlobals() : TcGlobals =
|
||||
CheckDisposed()
|
||||
|
||||
match tcGlobals with
|
||||
|
@ -1695,31 +1739,41 @@ and [<Sealed>] TcImports
|
|||
let name = AssemblyName.GetAssemblyName(resolution.resolvedPath)
|
||||
name.Version
|
||||
|
||||
// Note, this only captures systemRuntimeContainsTypeRef (which captures tcImportsWeak, using name tcImports)
|
||||
let systemRuntimeContainsType =
|
||||
let tcImports = tcImportsWeak
|
||||
|
||||
// The name of this captured value must not change, see comments on TcImportsWeakFacade above
|
||||
assert (nameof (tcImports) = "tcImports")
|
||||
|
||||
let mutable systemRuntimeContainsTypeRef =
|
||||
(fun typeName -> tcImports.SystemRuntimeContainsType typeName)
|
||||
|
||||
// When the tcImports is disposed the systemRuntimeContainsTypeRef thunk is replaced
|
||||
// with one raising an exception.
|
||||
tcImportsStrong.AttachDisposeTypeProviderAction(fun () ->
|
||||
systemRuntimeContainsTypeRef <- fun _ -> raise (ObjectDisposedException("The type provider has been disposed")))
|
||||
|
||||
(fun arg -> systemRuntimeContainsTypeRef arg)
|
||||
|
||||
// Note, this only captures tcImportsWeak
|
||||
let mutable getReferencedAssemblies =
|
||||
(fun () -> [| for r in tcImportsWeak.AllAssemblyResolutions() -> r.resolvedPath |])
|
||||
|
||||
// When the tcImports is disposed the getReferencedAssemblies thunk is replaced
|
||||
// with one raising an exception.
|
||||
tcImportsStrong.AttachDisposeTypeProviderAction(fun () ->
|
||||
getReferencedAssemblies <- fun _ -> raise (ObjectDisposedException("The type provider has been disposed")))
|
||||
|
||||
let typeProviderEnvironment =
|
||||
{
|
||||
ResolutionFolder = tcConfig.implicitIncludeDir
|
||||
OutputFile = tcConfig.outputFile
|
||||
ShowResolutionMessages = tcConfig.showExtensionTypeMessages
|
||||
ReferencedAssemblies = Array.distinct [| for r in tcImportsStrong.AllAssemblyResolutions() -> r.resolvedPath |]
|
||||
GetReferencedAssemblies = (fun () -> [| for r in tcImportsStrong.AllAssemblyResolutions() -> r.resolvedPath |])
|
||||
TemporaryFolder = FileSystem.GetTempPathShim()
|
||||
}
|
||||
|
||||
// The type provider should not hold strong references to disposed
|
||||
// TcImport objects. So the callbacks provided in the type provider config
|
||||
// dispatch via a thunk which gets set to a non-resource-capturing
|
||||
// failing function when the object is disposed.
|
||||
let systemRuntimeContainsType =
|
||||
// NOTE: do not touch this, edit: but we did, we had no choice - TPs cannot hold a strong reference on TcImports "ever".
|
||||
let tcImports = tcImportsWeak
|
||||
|
||||
let mutable systemRuntimeContainsTypeRef =
|
||||
fun typeName -> tcImports.SystemRuntimeContainsType typeName
|
||||
|
||||
tcImportsStrong.AttachDisposeTypeProviderAction(fun () ->
|
||||
systemRuntimeContainsTypeRef <- fun _ -> raise (ObjectDisposedException("The type provider has been disposed")))
|
||||
|
||||
fun arg -> systemRuntimeContainsTypeRef arg
|
||||
|
||||
let providers =
|
||||
[
|
||||
for designTimeAssemblyName in designTimeAssemblyNames do
|
||||
|
@ -1919,7 +1973,7 @@ and [<Sealed>] TcImports
|
|||
ccuinfo.TypeProviders <-
|
||||
tcImports.ImportTypeProviderExtensions(ctok, tcConfig, fileName, ilScopeRef, attrs, ccu.Contents, invalidateCcu, m)
|
||||
#endif
|
||||
[ ResolvedImportedAssembly ccuinfo ]
|
||||
[ ResolvedImportedAssembly(ccuinfo, m) ]
|
||||
|
||||
phase2
|
||||
|
||||
|
@ -2059,7 +2113,9 @@ and [<Sealed>] TcImports
|
|||
#if !NO_TYPEPROVIDERS
|
||||
ccuRawDataAndInfos |> List.iter (fun (_, _, phase2) -> phase2 ())
|
||||
#endif
|
||||
ccuRawDataAndInfos |> List.map p23 |> List.map ResolvedImportedAssembly
|
||||
ccuRawDataAndInfos
|
||||
|> List.map p23
|
||||
|> List.map (fun asm -> ResolvedImportedAssembly(asm, m))
|
||||
|
||||
phase2
|
||||
|
||||
|
@ -2160,10 +2216,10 @@ and [<Sealed>] TcImports
|
|||
})
|
||||
|> runMethod
|
||||
|
||||
let dllinfos, phase2s = results |> Array.choose id |> List.ofArray |> List.unzip
|
||||
let _dllinfos, phase2s = results |> Array.choose id |> List.ofArray |> List.unzip
|
||||
fixupOrphanCcus ()
|
||||
let ccuinfos = (List.collect (fun phase2 -> phase2 ()) phase2s)
|
||||
return dllinfos, ccuinfos
|
||||
let ccuinfos = List.collect (fun phase2 -> phase2 ()) phase2s
|
||||
return ccuinfos
|
||||
}
|
||||
|
||||
/// Note that implicit loading is not used for compilations from MSBuild, which passes ``--noframework``
|
||||
|
@ -2213,7 +2269,7 @@ and [<Sealed>] TcImports
|
|||
#endif
|
||||
|
||||
/// Only used by F# Interactive
|
||||
member tcImports.TryFindExistingFullyQualifiedPathBySimpleAssemblyName simpleAssemName : string option =
|
||||
member _.TryFindExistingFullyQualifiedPathBySimpleAssemblyName simpleAssemName : string option =
|
||||
tciLock.AcquireLock(fun tcitok ->
|
||||
RequireTcImportsLock(tcitok, resolutions)
|
||||
|
||||
|
@ -2221,14 +2277,14 @@ and [<Sealed>] TcImports
|
|||
|> Option.map (fun r -> r.resolvedPath))
|
||||
|
||||
/// Only used by F# Interactive
|
||||
member tcImports.TryFindExistingFullyQualifiedPathByExactAssemblyRef(assemblyRef: ILAssemblyRef) : string option =
|
||||
member _.TryFindExistingFullyQualifiedPathByExactAssemblyRef(assemblyRef: ILAssemblyRef) : string option =
|
||||
tciLock.AcquireLock(fun tcitok ->
|
||||
RequireTcImportsLock(tcitok, resolutions)
|
||||
|
||||
resolutions.TryFindByExactILAssemblyRef assemblyRef
|
||||
|> Option.map (fun r -> r.resolvedPath))
|
||||
|
||||
member tcImports.TryResolveAssemblyReference
|
||||
member _.TryResolveAssemblyReference
|
||||
(
|
||||
ctok,
|
||||
assemblyReference: AssemblyReference,
|
||||
|
@ -2325,7 +2381,7 @@ and [<Sealed>] TcImports
|
|||
|
||||
let primaryScopeRef =
|
||||
match primaryAssem with
|
||||
| _, [ ResolvedImportedAssembly ccu ] -> ccu.FSharpViewOfMetadata.ILScopeRef
|
||||
| [ ResolvedImportedAssembly (ccu, _) ] -> ccu.FSharpViewOfMetadata.ILScopeRef
|
||||
| _ -> failwith "primaryScopeRef - unexpected"
|
||||
|
||||
let resolvedAssemblies = tcResolutions.GetAssemblyResolutions()
|
||||
|
@ -2386,7 +2442,7 @@ and [<Sealed>] TcImports
|
|||
match resolvedAssemblyRef with
|
||||
| Some coreLibraryResolution ->
|
||||
match! frameworkTcImports.RegisterAndImportReferencedAssemblies(ctok, [ coreLibraryResolution ]) with
|
||||
| _, [ ResolvedImportedAssembly fslibCcuInfo ] ->
|
||||
| [ ResolvedImportedAssembly (fslibCcuInfo, _) ] ->
|
||||
return fslibCcuInfo.FSharpViewOfMetadata, fslibCcuInfo.ILScopeRef
|
||||
| _ ->
|
||||
return
|
||||
|
@ -2440,7 +2496,7 @@ and [<Sealed>] TcImports
|
|||
return tcGlobals, frameworkTcImports
|
||||
}
|
||||
|
||||
member tcImports.ReportUnresolvedAssemblyReferences knownUnresolved =
|
||||
member _.ReportUnresolvedAssemblyReferences knownUnresolved =
|
||||
// Report that an assembly was not resolved.
|
||||
let reportAssemblyNotResolved (file, originalReferences: AssemblyReference list) =
|
||||
originalReferences
|
||||
|
@ -2500,43 +2556,34 @@ and [<Sealed>] TcImports
|
|||
}
|
||||
|
||||
interface IDisposable with
|
||||
member tcImports.Dispose() = dispose ()
|
||||
member _.Dispose() = dispose ()
|
||||
|
||||
override tcImports.ToString() = "TcImports(...)"
|
||||
|
||||
/// 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, referenceRange, file) =
|
||||
let resolutions =
|
||||
CommitOperationResult(
|
||||
tcImports.TryResolveAssemblyReference(
|
||||
ctok,
|
||||
AssemblyReference(referenceRange, file, None),
|
||||
ResolveAssemblyReferenceMode.ReportErrors
|
||||
)
|
||||
)
|
||||
let RequireReferences (ctok, tcImports: TcImports, tcEnv, thisAssemblyName, resolutions) =
|
||||
|
||||
let dllinfos, ccuinfos =
|
||||
let ccuinfos =
|
||||
tcImports.RegisterAndImportReferencedAssemblies(ctok, resolutions)
|
||||
|> NodeCode.RunImmediateWithoutCancellation
|
||||
|
||||
let asms =
|
||||
ccuinfos
|
||||
|> List.map (function
|
||||
| ResolvedImportedAssembly asm -> asm
|
||||
| UnresolvedImportedAssembly assemblyName ->
|
||||
error (Error(FSComp.SR.buildCouldNotResolveAssemblyRequiredByFile (assemblyName, file), referenceRange)))
|
||||
| ResolvedImportedAssembly (asm, m) -> asm, m
|
||||
| UnresolvedImportedAssembly (assemblyName, m) -> error (Error(FSComp.SR.buildCouldNotResolveAssembly (assemblyName), m)))
|
||||
|
||||
let g = tcImports.GetTcGlobals()
|
||||
let amap = tcImports.GetImportMap()
|
||||
|
||||
let _openDecls, tcEnv =
|
||||
(tcEnv, asms)
|
||||
||> List.collectFold (fun tcEnv asm ->
|
||||
||> List.collectFold (fun tcEnv (asm, m) ->
|
||||
AddCcuToTcEnv(
|
||||
g,
|
||||
amap,
|
||||
referenceRange,
|
||||
m,
|
||||
tcEnv,
|
||||
thisAssemblyName,
|
||||
asm.FSharpViewOfMetadata,
|
||||
|
@ -2544,4 +2591,6 @@ let RequireDLL (ctok, tcImports: TcImports, tcEnv, thisAssemblyName, referenceRa
|
|||
asm.AssemblyInternalsVisibleToAttributes
|
||||
))
|
||||
|
||||
tcEnv, (dllinfos, asms)
|
||||
let asms = asms |> List.map fst
|
||||
|
||||
tcEnv, asms
|
||||
|
|
|
@ -116,7 +116,7 @@ type ImportedAssembly =
|
|||
IsProviderGenerated: bool
|
||||
mutable TypeProviders: Tainted<ITypeProvider> list
|
||||
#endif
|
||||
FSharpOptimizationData: Lazy<Option<LazyModuleInfo>> }
|
||||
FSharpOptimizationData: Lazy<LazyModuleInfo option> }
|
||||
|
||||
/// Tables of assembly resolutions
|
||||
[<Sealed>]
|
||||
|
@ -208,13 +208,12 @@ type TcImports =
|
|||
static member BuildTcImports:
|
||||
tcConfigP: TcConfigProvider * dependencyProvider: DependencyProvider -> NodeCode<TcGlobals * TcImports>
|
||||
|
||||
/// Process #r in F# Interactive.
|
||||
/// Process a group of #r in F# Interactive.
|
||||
/// Adds the reference to the tcImports and add the ccu to the type checking environment.
|
||||
val RequireDLL:
|
||||
val RequireReferences:
|
||||
ctok: CompilationThreadToken *
|
||||
tcImports: TcImports *
|
||||
tcEnv: TcEnv *
|
||||
thisAssemblyName: string *
|
||||
referenceRange: range *
|
||||
file: string ->
|
||||
TcEnv * (ImportedBinary list * ImportedAssembly list)
|
||||
resolutions: AssemblyResolution list ->
|
||||
TcEnv * ImportedAssembly list
|
||||
|
|
|
@ -69,7 +69,7 @@ and CompilerOption =
|
|||
name: string *
|
||||
argumentDescriptionString: string *
|
||||
actionSpec: OptionSpec *
|
||||
deprecationError: Option<exn> *
|
||||
deprecationError: exn option *
|
||||
helpText: string option
|
||||
|
||||
and CompilerOptionBlock =
|
||||
|
@ -581,7 +581,7 @@ let SetDeterministicSwitch (tcConfigB: TcConfigBuilder) switch =
|
|||
|
||||
let SetReferenceAssemblyOnlySwitch (tcConfigB: TcConfigBuilder) switch =
|
||||
match tcConfigB.emitMetadataAssembly with
|
||||
| MetadataAssemblyGeneration.None ->
|
||||
| MetadataAssemblyGeneration.None when tcConfigB.standalone = false && tcConfigB.extraStaticLinkRoots.IsEmpty ->
|
||||
tcConfigB.emitMetadataAssembly <-
|
||||
if (switch = OptionSwitch.On) then
|
||||
MetadataAssemblyGeneration.ReferenceOnly
|
||||
|
@ -591,7 +591,7 @@ let SetReferenceAssemblyOnlySwitch (tcConfigB: TcConfigBuilder) switch =
|
|||
|
||||
let SetReferenceAssemblyOutSwitch (tcConfigB: TcConfigBuilder) outputPath =
|
||||
match tcConfigB.emitMetadataAssembly with
|
||||
| MetadataAssemblyGeneration.None ->
|
||||
| MetadataAssemblyGeneration.None when tcConfigB.standalone = false && tcConfigB.extraStaticLinkRoots.IsEmpty ->
|
||||
if FileSystem.IsInvalidPathShim outputPath then
|
||||
error (Error(FSComp.SR.optsInvalidRefOut (), rangeCmdArgs))
|
||||
else
|
||||
|
@ -1304,9 +1304,12 @@ let advancedFlagsFsc tcConfigB =
|
|||
"standalone",
|
||||
tagNone,
|
||||
OptionUnit(fun _ ->
|
||||
tcConfigB.openDebugInformationForLaterStaticLinking <- true
|
||||
tcConfigB.standalone <- true
|
||||
tcConfigB.implicitlyResolveAssemblies <- true),
|
||||
match tcConfigB.emitMetadataAssembly with
|
||||
| MetadataAssemblyGeneration.None ->
|
||||
tcConfigB.openDebugInformationForLaterStaticLinking <- true
|
||||
tcConfigB.standalone <- true
|
||||
tcConfigB.implicitlyResolveAssemblies <- true
|
||||
| _ -> error (Error(FSComp.SR.optsInvalidRefAssembly (), rangeCmdArgs))),
|
||||
None,
|
||||
Some(FSComp.SR.optsStandalone ())
|
||||
)
|
||||
|
@ -1315,8 +1318,11 @@ let advancedFlagsFsc tcConfigB =
|
|||
"staticlink",
|
||||
tagFile,
|
||||
OptionString(fun s ->
|
||||
tcConfigB.extraStaticLinkRoots <- tcConfigB.extraStaticLinkRoots @ [ s ]
|
||||
tcConfigB.implicitlyResolveAssemblies <- true),
|
||||
match tcConfigB.emitMetadataAssembly with
|
||||
| MetadataAssemblyGeneration.None ->
|
||||
tcConfigB.extraStaticLinkRoots <- tcConfigB.extraStaticLinkRoots @ [ s ]
|
||||
tcConfigB.implicitlyResolveAssemblies <- true
|
||||
| _ -> error (Error(FSComp.SR.optsInvalidRefAssembly (), rangeCmdArgs))),
|
||||
None,
|
||||
Some(FSComp.SR.optsStaticlink ())
|
||||
)
|
||||
|
@ -1735,6 +1741,15 @@ let internalFlags (tcConfigB: TcConfigBuilder) =
|
|||
None
|
||||
)
|
||||
|
||||
// "Write timing profiles for compilation to a file"
|
||||
CompilerOption(
|
||||
"times",
|
||||
tagFile,
|
||||
OptionString(fun s -> tcConfigB.writeTimesToFile <- Some s),
|
||||
Some(InternalCommandLineOption("times", rangeCmdArgs)),
|
||||
None
|
||||
)
|
||||
|
||||
#if !NO_TYPEPROVIDERS
|
||||
// "Display information about extension type resolution")
|
||||
CompilerOption(
|
||||
|
@ -1770,13 +1785,31 @@ let compilingFsLibFlag (tcConfigB: TcConfigBuilder) =
|
|||
)
|
||||
|
||||
let compilingFsLib20Flag =
|
||||
CompilerOption("compiling-fslib-20", tagNone, OptionString(fun _ -> ()), None, None)
|
||||
CompilerOption(
|
||||
"compiling-fslib-20",
|
||||
tagNone,
|
||||
OptionString(fun _ -> ()),
|
||||
Some(DeprecatedCommandLineOptionNoDescription("--compiling-fslib-20", rangeCmdArgs)),
|
||||
None
|
||||
)
|
||||
|
||||
let compilingFsLib40Flag =
|
||||
CompilerOption("compiling-fslib-40", tagNone, OptionUnit(fun () -> ()), None, None)
|
||||
CompilerOption(
|
||||
"compiling-fslib-40",
|
||||
tagNone,
|
||||
OptionUnit(fun () -> ()),
|
||||
Some(DeprecatedCommandLineOptionNoDescription("--compiling-fslib-40", rangeCmdArgs)),
|
||||
None
|
||||
)
|
||||
|
||||
let compilingFsLibNoBigIntFlag =
|
||||
CompilerOption("compiling-fslib-nobigint", tagNone, OptionUnit(fun () -> ()), None, None)
|
||||
CompilerOption(
|
||||
"compiling-fslib-nobigint",
|
||||
tagNone,
|
||||
OptionUnit(fun () -> ()),
|
||||
Some(DeprecatedCommandLineOptionNoDescription("compiling-fslib-nobigint", rangeCmdArgs)),
|
||||
None
|
||||
)
|
||||
|
||||
let mlKeywordsFlag =
|
||||
CompilerOption(
|
||||
|
@ -2271,6 +2304,23 @@ let GetCoreFsiCompilerOptions (tcConfigB: TcConfigBuilder) =
|
|||
)
|
||||
]
|
||||
|
||||
let CheckAndReportSourceFileDuplicates (sourceFiles: ResizeArray<string>) =
|
||||
let visited = Dictionary.newWithSize (sourceFiles.Count * 2)
|
||||
let count = sourceFiles.Count
|
||||
|
||||
[
|
||||
for i = 0 to (count - 1) do
|
||||
let source = sourceFiles[i]
|
||||
|
||||
match visited.TryGetValue source with
|
||||
| true, duplicatePosition ->
|
||||
|
||||
warning (Error(FSComp.SR.buildDuplicateFile (source, i + 1, count, duplicatePosition + 1, count), range0))
|
||||
| false, _ ->
|
||||
visited.Add(source, i)
|
||||
yield source
|
||||
]
|
||||
|
||||
let ApplyCommandLineArgs (tcConfigB: TcConfigBuilder, sourceFiles: string list, argv) =
|
||||
try
|
||||
let sourceFilesAcc = ResizeArray sourceFiles
|
||||
|
@ -2280,7 +2330,7 @@ let ApplyCommandLineArgs (tcConfigB: TcConfigBuilder, sourceFiles: string list,
|
|||
sourceFilesAcc.Add name
|
||||
|
||||
ParseCompilerOptions(collect, GetCoreServiceCompilerOptions tcConfigB, argv)
|
||||
ResizeArray.toList sourceFilesAcc
|
||||
sourceFilesAcc |> CheckAndReportSourceFileDuplicates
|
||||
with e ->
|
||||
errorRecovery e range0
|
||||
sourceFiles
|
||||
|
@ -2312,80 +2362,47 @@ let PrintWholeAssemblyImplementation (tcConfig: TcConfig) outfile header expr =
|
|||
// ReportTime
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
let mutable tPrev: (DateTime * DateTime * float * int[]) option = None
|
||||
let mutable nPrev: string option = None
|
||||
let private SimulateException simulateConfig =
|
||||
match simulateConfig with
|
||||
| Some ("fsc-oom") -> raise (OutOfMemoryException())
|
||||
| Some ("fsc-an") -> raise (ArgumentNullException("simulated"))
|
||||
| Some ("fsc-invop") -> raise (InvalidOperationException())
|
||||
| Some ("fsc-av") -> raise (AccessViolationException())
|
||||
| Some ("fsc-aor") -> raise (ArgumentOutOfRangeException())
|
||||
| Some ("fsc-dv0") -> raise (DivideByZeroException())
|
||||
| Some ("fsc-nfn") -> raise (NotFiniteNumberException())
|
||||
| Some ("fsc-oe") -> raise (OverflowException())
|
||||
| Some ("fsc-atmm") -> raise (ArrayTypeMismatchException())
|
||||
| Some ("fsc-bif") -> raise (BadImageFormatException())
|
||||
| Some ("fsc-knf") -> raise (System.Collections.Generic.KeyNotFoundException())
|
||||
| Some ("fsc-ior") -> raise (IndexOutOfRangeException())
|
||||
| Some ("fsc-ic") -> raise (InvalidCastException())
|
||||
| Some ("fsc-ip") -> raise (InvalidProgramException())
|
||||
| Some ("fsc-ma") -> raise (MemberAccessException())
|
||||
| Some ("fsc-ni") -> raise (NotImplementedException())
|
||||
| Some ("fsc-nr") -> raise (NullReferenceException())
|
||||
| Some ("fsc-oc") -> raise (OperationCanceledException())
|
||||
| Some ("fsc-fail") -> failwith "simulated"
|
||||
| _ -> ()
|
||||
|
||||
let ReportTime (tcConfig: TcConfig) descr =
|
||||
let ReportTime =
|
||||
let mutable nPrev = None
|
||||
|
||||
match nPrev with
|
||||
| None -> ()
|
||||
| Some prevDescr ->
|
||||
if tcConfig.pause then
|
||||
dprintf "[done '%s', entering '%s'] press <enter> to continue... " prevDescr descr
|
||||
Console.ReadLine() |> ignore
|
||||
// Intentionally putting this right after the pause so a debugger can be attached.
|
||||
match tcConfig.simulateException with
|
||||
| Some ("fsc-oom") -> raise (OutOfMemoryException())
|
||||
| Some ("fsc-an") -> raise (ArgumentNullException("simulated"))
|
||||
| Some ("fsc-invop") -> raise (InvalidOperationException())
|
||||
| Some ("fsc-av") -> raise (AccessViolationException())
|
||||
| Some ("fsc-aor") -> raise (ArgumentOutOfRangeException())
|
||||
| Some ("fsc-dv0") -> raise (DivideByZeroException())
|
||||
| Some ("fsc-nfn") -> raise (NotFiniteNumberException())
|
||||
| Some ("fsc-oe") -> raise (OverflowException())
|
||||
| Some ("fsc-atmm") -> raise (ArrayTypeMismatchException())
|
||||
| Some ("fsc-bif") -> raise (BadImageFormatException())
|
||||
| Some ("fsc-knf") -> raise (System.Collections.Generic.KeyNotFoundException())
|
||||
| Some ("fsc-ior") -> raise (IndexOutOfRangeException())
|
||||
| Some ("fsc-ic") -> raise (InvalidCastException())
|
||||
| Some ("fsc-ip") -> raise (InvalidProgramException())
|
||||
| Some ("fsc-ma") -> raise (MemberAccessException())
|
||||
| Some ("fsc-ni") -> raise (NotImplementedException())
|
||||
| Some ("fsc-nr") -> raise (NullReferenceException())
|
||||
| Some ("fsc-oc") -> raise (OperationCanceledException())
|
||||
| Some ("fsc-fail") -> failwith "simulated"
|
||||
| _ -> ()
|
||||
fun (tcConfig: TcConfig) descr ->
|
||||
nPrev
|
||||
|> Option.iter (fun (prevDescr, prevAct) ->
|
||||
use _ = prevAct
|
||||
|
||||
if (tcConfig.showTimes || verbose) then
|
||||
// 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 p = Process.GetCurrentProcess()
|
||||
let utNow = p.UserProcessorTime.TotalSeconds
|
||||
let tNow = DateTime.Now
|
||||
let maxGen = GC.MaxGeneration
|
||||
let gcNow = [| for i in 0..maxGen -> GC.CollectionCount i |]
|
||||
let wsNow = p.WorkingSet64 / 1000000L
|
||||
if tcConfig.pause then
|
||||
dprintf "[done '%s', entering '%s'] press <enter> to continue... " prevDescr descr
|
||||
Console.ReadLine() |> ignore
|
||||
// Intentionally putting this right after the pause so a debugger can be attached.
|
||||
SimulateException tcConfig.simulateException)
|
||||
|
||||
let tStart =
|
||||
match tPrev, nPrev with
|
||||
| Some (tStart, tPrev, utPrev, gcPrev), Some prevDescr ->
|
||||
let spanGC = [| for i in 0..maxGen -> GC.CollectionCount i - gcPrev[i] |]
|
||||
let t = tNow - tStart
|
||||
let tDelta = tNow - tPrev
|
||||
let utDelta = utNow - utPrev
|
||||
|
||||
printf
|
||||
"Real: %4.1f Realdelta: %4.1f Cpu: %4.1f Cpudelta: %4.1f Mem: %3d"
|
||||
t.TotalSeconds
|
||||
tDelta.TotalSeconds
|
||||
utNow
|
||||
utDelta
|
||||
wsNow
|
||||
|
||||
printfn
|
||||
" G0: %3d G1: %2d G2: %2d [%s]"
|
||||
spanGC[Operators.min 0 maxGen]
|
||||
spanGC[Operators.min 1 maxGen]
|
||||
spanGC[Operators.min 2 maxGen]
|
||||
prevDescr
|
||||
|
||||
tStart
|
||||
|
||||
| _ -> DateTime.Now
|
||||
|
||||
tPrev <- Some(tStart, tNow, utNow, gcNow)
|
||||
|
||||
nPrev <- Some descr
|
||||
if descr <> "Exiting" then
|
||||
nPrev <- Some(descr, Activity.Profiling.startAndMeasureEnvironmentStats descr)
|
||||
else
|
||||
nPrev <- None
|
||||
|
||||
let ignoreFailureOnMono1_1_16 f =
|
||||
try
|
||||
|
|
|
@ -36,7 +36,7 @@ and CompilerOption =
|
|||
name: string *
|
||||
argumentDescriptionString: string *
|
||||
actionSpec: OptionSpec *
|
||||
deprecationError: Option<exn> *
|
||||
deprecationError: exn option *
|
||||
helpText: string option
|
||||
|
||||
and CompilerOptionBlock =
|
||||
|
@ -66,6 +66,8 @@ val GetCoreFsiCompilerOptions: TcConfigBuilder -> CompilerOptionBlock list
|
|||
|
||||
val GetCoreServiceCompilerOptions: TcConfigBuilder -> CompilerOptionBlock list
|
||||
|
||||
val CheckAndReportSourceFileDuplicates: ResizeArray<string> -> string list
|
||||
|
||||
/// Apply args to TcConfigBuilder and return new list of source files
|
||||
val ApplyCommandLineArgs: tcConfigB: TcConfigBuilder * sourceFiles: string list * argv: string list -> string list
|
||||
|
||||
|
@ -89,7 +91,7 @@ val DoWithColor: ConsoleColor -> (unit -> 'T) -> 'T
|
|||
|
||||
val DoWithDiagnosticColor: FSharpDiagnosticSeverity -> (unit -> 'T) -> 'T
|
||||
|
||||
val ReportTime: TcConfig -> string -> unit
|
||||
val ReportTime: (TcConfig -> string -> unit)
|
||||
|
||||
val GetAbbrevFlagSet: TcConfigBuilder -> bool -> Set<string>
|
||||
|
||||
|
|
|
@ -65,7 +65,11 @@ module AttributeHelpers =
|
|||
//----------------------------------------------------------------------------
|
||||
|
||||
/// Represents the configuration settings used to perform strong-name signing
|
||||
type StrongNameSigningInfo = StrongNameSigningInfo of delaysign: bool * publicsign: bool * signer: string option * container: string option
|
||||
type StrongNameSigningInfo =
|
||||
| StrongNameSigningInfo of delaysign: bool * publicsign: bool * signer: byte array option * container: string option
|
||||
|
||||
let GetStrongNameSigningInfo (delaysign, publicsign, signer, container) =
|
||||
StrongNameSigningInfo(delaysign, publicsign, signer, container)
|
||||
|
||||
/// Validate the attributes and configuration settings used to perform strong-name signing
|
||||
let ValidateKeySigningAttributes (tcConfig: TcConfig, tcGlobals, topAttrs) =
|
||||
|
@ -91,14 +95,24 @@ let ValidateKeySigningAttributes (tcConfig: TcConfig, tcGlobals, topAttrs) =
|
|||
|
||||
// if signer is set via an attribute, validate that it wasn't set via an option
|
||||
let signer =
|
||||
match signerAttrib with
|
||||
| Some signer ->
|
||||
if tcConfig.signer.IsSome && tcConfig.signer <> Some signer then
|
||||
warning (Error(FSComp.SR.fscKeyFileWarning (), rangeCmdArgs))
|
||||
tcConfig.signer
|
||||
else
|
||||
Some signer
|
||||
| None -> tcConfig.signer
|
||||
let signerFile =
|
||||
match signerAttrib with
|
||||
| Some signer ->
|
||||
if tcConfig.signer.IsSome && tcConfig.signer <> Some signer then
|
||||
warning (Error(FSComp.SR.fscKeyFileWarning (), rangeCmdArgs))
|
||||
tcConfig.signer
|
||||
else
|
||||
Some signer
|
||||
| None -> tcConfig.signer
|
||||
|
||||
match signerFile with
|
||||
| Some signerPath ->
|
||||
try
|
||||
Some(FileSystem.OpenFileForReadShim(signerPath).ReadAllBytes())
|
||||
with _ ->
|
||||
// Note :: don't use errorR here since we really want to fail and not produce a binary
|
||||
error (Error(FSComp.SR.fscKeyFileCouldNotBeOpened signerPath, rangeCmdArgs))
|
||||
| None -> None
|
||||
|
||||
// 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)
|
||||
|
@ -127,15 +141,11 @@ let GetStrongNameSigner signingInfo =
|
|||
| None ->
|
||||
match signer with
|
||||
| None -> None
|
||||
| Some s ->
|
||||
try
|
||||
if publicsign || delaysign then
|
||||
Some(ILStrongNameSigner.OpenPublicKeyOptions s publicsign)
|
||||
else
|
||||
Some(ILStrongNameSigner.OpenKeyPairFile s)
|
||||
with _ ->
|
||||
// Note :: don't use errorR here since we really want to fail and not produce a binary
|
||||
error (Error(FSComp.SR.fscKeyFileCouldNotBeOpened s, rangeCmdArgs))
|
||||
| Some bytes ->
|
||||
if publicsign || delaysign then
|
||||
Some(ILStrongNameSigner.OpenPublicKeyOptions bytes publicsign)
|
||||
else
|
||||
Some(ILStrongNameSigner.OpenKeyPairFile bytes)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Building the contents of the finalized IL module
|
||||
|
|
|
@ -15,6 +15,10 @@ open FSharp.Compiler.TypedTree
|
|||
/// Represents the configuration settings used to perform strong-name signing
|
||||
type StrongNameSigningInfo
|
||||
|
||||
/// Get the SigningInfo for specific values(delaysign, tcConfig.publicsign, signer, container)
|
||||
val GetStrongNameSigningInfo:
|
||||
delaysign: bool * publicsign: bool * signer: byte array option * container: string option -> StrongNameSigningInfo
|
||||
|
||||
/// Validate the attributes and configuration settings used to perform strong-name signing
|
||||
val ValidateKeySigningAttributes: tcConfig: TcConfig * tcGlobals: TcGlobals * TopAttribs -> StrongNameSigningInfo
|
||||
|
||||
|
|
|
@ -629,7 +629,7 @@ type internal FxResolver
|
|||
// A set of assemblies to always consider to be system assemblies. A common set of these can be used a shared
|
||||
// resources between projects in the compiler services. Also all assemblies where well-known system types exist
|
||||
// referenced from TcGlobals must be listed here.
|
||||
let systemAssemblies =
|
||||
static let systemAssemblies =
|
||||
HashSet
|
||||
[
|
||||
// NOTE: duplicates are ok in this list
|
||||
|
@ -807,17 +807,10 @@ type internal FxResolver
|
|||
"WindowsBase"
|
||||
]
|
||||
|
||||
member _.GetSystemAssemblies() = systemAssemblies
|
||||
static member GetSystemAssemblies() = systemAssemblies
|
||||
|
||||
member _.IsInReferenceAssemblyPackDirectory fileName =
|
||||
fxlock.AcquireLock(fun fxtok ->
|
||||
RequireFxResolverLock(fxtok, "assuming all member require lock")
|
||||
|
||||
match tryGetNetCoreRefsPackDirectoryRoot () |> replayWarnings with
|
||||
| _, Some root ->
|
||||
let path = Path.GetDirectoryName(fileName)
|
||||
path.StartsWith(root, StringComparison.OrdinalIgnoreCase)
|
||||
| _ -> false)
|
||||
static member IsReferenceAssemblyPackDirectoryApprox(dirName: string) =
|
||||
dirName.Contains "Microsoft.NETCore.App.Ref"
|
||||
|
||||
member _.TryGetSdkDir() =
|
||||
fxlock.AcquireLock(fun fxtok ->
|
||||
|
|
|
@ -28,12 +28,14 @@ type internal FxResolver =
|
|||
|
||||
member GetFrameworkRefsPackDirectory: unit -> string option
|
||||
|
||||
member GetSystemAssemblies: unit -> HashSet<string>
|
||||
static member GetSystemAssemblies: unit -> HashSet<string>
|
||||
|
||||
/// Gets the selected target framework moniker, e.g netcore3.0, net472, and the running rid of the current machine
|
||||
member GetTfmAndRid: unit -> string * string
|
||||
|
||||
member IsInReferenceAssemblyPackDirectory: fileName: string -> bool
|
||||
/// Determines if an assembly is in the core set of assemblies with high likelihood of
|
||||
/// being shared amongst a set of common scripting references
|
||||
static member IsReferenceAssemblyPackDirectoryApprox: dirName: string -> bool
|
||||
|
||||
member TryGetDesiredDotNetSdkVersionForDirectory: unit -> Result<string, exn>
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
module internal FSharp.Compiler.ParseAndCheckInputs
|
||||
|
||||
open System
|
||||
open System.Diagnostics
|
||||
open System.IO
|
||||
open System.Collections.Generic
|
||||
|
||||
|
@ -92,13 +93,13 @@ let PrependPathToSpec x (SynModuleOrNamespaceSig (longId, isRecursive, kind, dec
|
|||
|
||||
let PrependPathToInput x inp =
|
||||
match inp with
|
||||
| ParsedInput.ImplFile (ParsedImplFileInput (b, c, q, d, hd, impls, e, trivia)) ->
|
||||
| ParsedInput.ImplFile (ParsedImplFileInput (b, c, q, d, hd, impls, e, trivia, i)) ->
|
||||
ParsedInput.ImplFile(
|
||||
ParsedImplFileInput(b, c, PrependPathToQualFileName x q, d, hd, List.map (PrependPathToImpl x) impls, e, trivia)
|
||||
ParsedImplFileInput(b, c, PrependPathToQualFileName x q, d, hd, List.map (PrependPathToImpl x) impls, e, trivia, i)
|
||||
)
|
||||
|
||||
| ParsedInput.SigFile (ParsedSigFileInput (b, q, d, hd, specs, trivia)) ->
|
||||
ParsedInput.SigFile(ParsedSigFileInput(b, PrependPathToQualFileName x q, d, hd, List.map (PrependPathToSpec x) specs, trivia))
|
||||
| ParsedInput.SigFile (ParsedSigFileInput (b, q, d, hd, specs, trivia, i)) ->
|
||||
ParsedInput.SigFile(ParsedSigFileInput(b, PrependPathToQualFileName x q, d, hd, List.map (PrependPathToSpec x) specs, trivia, i))
|
||||
|
||||
let IsValidAnonModuleName (modname: string) =
|
||||
modname |> String.forall (fun c -> Char.IsLetterOrDigit c || c = '_')
|
||||
|
@ -148,8 +149,7 @@ let PostParseModuleImpl (_i, defaultNamespace, isLastCompiland, fileName, impl)
|
|||
|
||||
let trivia: SynModuleOrNamespaceTrivia =
|
||||
{
|
||||
ModuleKeyword = None
|
||||
NamespaceKeyword = None
|
||||
LeadingKeyword = SynModuleOrNamespaceLeadingKeyword.None
|
||||
}
|
||||
|
||||
SynModuleOrNamespace(modname, false, SynModuleOrNamespaceKind.AnonModule, defs, PreXmlDoc.Empty, [], None, m, trivia)
|
||||
|
@ -194,8 +194,7 @@ let PostParseModuleSpec (_i, defaultNamespace, isLastCompiland, fileName, intf)
|
|||
|
||||
let trivia: SynModuleOrNamespaceSigTrivia =
|
||||
{
|
||||
ModuleKeyword = None
|
||||
NamespaceKeyword = None
|
||||
LeadingKeyword = SynModuleOrNamespaceLeadingKeyword.None
|
||||
}
|
||||
|
||||
SynModuleOrNamespaceSig(modname, false, SynModuleOrNamespaceKind.AnonModule, defs, PreXmlDoc.Empty, [], None, m, trivia)
|
||||
|
@ -245,7 +244,8 @@ let PostParseModuleImpls
|
|||
isLastCompiland,
|
||||
ParsedImplFile (hashDirectives, impls),
|
||||
lexbuf: UnicodeLexing.Lexbuf,
|
||||
tripleSlashComments: range list
|
||||
tripleSlashComments: range list,
|
||||
identifiers: Set<string>
|
||||
) =
|
||||
let othersWithSameName =
|
||||
impls
|
||||
|
@ -285,7 +285,9 @@ let PostParseModuleImpls
|
|||
CodeComments = codeComments
|
||||
}
|
||||
|
||||
ParsedInput.ImplFile(ParsedImplFileInput(fileName, isScript, qualName, scopedPragmas, hashDirectives, impls, isLastCompiland, trivia))
|
||||
ParsedInput.ImplFile(
|
||||
ParsedImplFileInput(fileName, isScript, qualName, scopedPragmas, hashDirectives, impls, isLastCompiland, trivia, identifiers)
|
||||
)
|
||||
|
||||
let PostParseModuleSpecs
|
||||
(
|
||||
|
@ -294,7 +296,8 @@ let PostParseModuleSpecs
|
|||
isLastCompiland,
|
||||
ParsedSigFile (hashDirectives, specs),
|
||||
lexbuf: UnicodeLexing.Lexbuf,
|
||||
tripleSlashComments: range list
|
||||
tripleSlashComments: range list,
|
||||
identifiers: Set<string>
|
||||
) =
|
||||
let othersWithSameName =
|
||||
specs
|
||||
|
@ -333,7 +336,7 @@ let PostParseModuleSpecs
|
|||
CodeComments = codeComments
|
||||
}
|
||||
|
||||
ParsedInput.SigFile(ParsedSigFileInput(fileName, qualName, scopedPragmas, hashDirectives, specs, trivia))
|
||||
ParsedInput.SigFile(ParsedSigFileInput(fileName, qualName, scopedPragmas, hashDirectives, specs, trivia, identifiers))
|
||||
|
||||
type ModuleNamesDict = Map<string, Map<string, QualifiedNameOfFile>>
|
||||
|
||||
|
@ -378,26 +381,26 @@ let DeduplicateModuleName (moduleNamesDict: ModuleNamesDict) fileName (qualNameO
|
|||
let DeduplicateParsedInputModuleName (moduleNamesDict: ModuleNamesDict) input =
|
||||
match input with
|
||||
| ParsedInput.ImplFile implFile ->
|
||||
let (ParsedImplFileInput (fileName, isScript, qualNameOfFile, scopedPragmas, hashDirectives, modules, flags, trivia)) =
|
||||
let (ParsedImplFileInput (fileName, isScript, qualNameOfFile, scopedPragmas, hashDirectives, modules, flags, trivia, identifiers)) =
|
||||
implFile
|
||||
|
||||
let qualNameOfFileR, moduleNamesDictR =
|
||||
DeduplicateModuleName moduleNamesDict fileName qualNameOfFile
|
||||
|
||||
let implFileR =
|
||||
ParsedImplFileInput(fileName, isScript, qualNameOfFileR, scopedPragmas, hashDirectives, modules, flags, trivia)
|
||||
ParsedImplFileInput(fileName, isScript, qualNameOfFileR, scopedPragmas, hashDirectives, modules, flags, trivia, identifiers)
|
||||
|
||||
let inputR = ParsedInput.ImplFile implFileR
|
||||
inputR, moduleNamesDictR
|
||||
| ParsedInput.SigFile sigFile ->
|
||||
let (ParsedSigFileInput (fileName, qualNameOfFile, scopedPragmas, hashDirectives, modules, trivia)) =
|
||||
let (ParsedSigFileInput (fileName, qualNameOfFile, scopedPragmas, hashDirectives, modules, trivia, identifiers)) =
|
||||
sigFile
|
||||
|
||||
let qualNameOfFileR, moduleNamesDictR =
|
||||
DeduplicateModuleName moduleNamesDict fileName qualNameOfFile
|
||||
|
||||
let sigFileR =
|
||||
ParsedSigFileInput(fileName, qualNameOfFileR, scopedPragmas, hashDirectives, modules, trivia)
|
||||
ParsedSigFileInput(fileName, qualNameOfFileR, scopedPragmas, hashDirectives, modules, trivia, identifiers)
|
||||
|
||||
let inputT = ParsedInput.SigFile sigFileR
|
||||
inputT, moduleNamesDictR
|
||||
|
@ -428,6 +431,28 @@ let ParseInput
|
|||
|
||||
try
|
||||
let input =
|
||||
let identStore = HashSet<string>()
|
||||
|
||||
let identCaptureLexer x =
|
||||
let token = lexer x
|
||||
|
||||
match token with
|
||||
| Parser.token.PERCENT_OP ident
|
||||
| Parser.token.FUNKY_OPERATOR_NAME ident
|
||||
| Parser.token.ADJACENT_PREFIX_OP ident
|
||||
| Parser.token.PLUS_MINUS_OP ident
|
||||
| Parser.token.INFIX_AMP_OP ident
|
||||
| Parser.token.INFIX_STAR_DIV_MOD_OP ident
|
||||
| Parser.token.PREFIX_OP ident
|
||||
| Parser.token.INFIX_BAR_OP ident
|
||||
| Parser.token.INFIX_AT_HAT_OP ident
|
||||
| Parser.token.INFIX_COMPARE_OP ident
|
||||
| Parser.token.INFIX_STAR_STAR_OP ident
|
||||
| Parser.token.IDENT ident -> identStore.Add ident |> ignore
|
||||
| _ -> ()
|
||||
|
||||
token
|
||||
|
||||
if FSharpMLCompatFileSuffixes |> List.exists (FileSystemUtils.checkSuffix fileName) then
|
||||
if lexbuf.SupportsFeature LanguageFeature.MLCompatRevisions then
|
||||
errorR (Error(FSComp.SR.buildInvalidSourceFileExtensionML fileName, rangeStartup))
|
||||
|
@ -436,19 +461,19 @@ let ParseInput
|
|||
|
||||
// Call the appropriate parser - for signature files or implementation files
|
||||
if FSharpImplFileSuffixes |> List.exists (FileSystemUtils.checkSuffix fileName) then
|
||||
let impl = Parser.implementationFile lexer lexbuf
|
||||
let impl = Parser.implementationFile identCaptureLexer lexbuf
|
||||
|
||||
let tripleSlashComments =
|
||||
LexbufLocalXmlDocStore.ReportInvalidXmlDocPositions(lexbuf)
|
||||
|
||||
PostParseModuleImpls(defaultNamespace, fileName, isLastCompiland, impl, lexbuf, tripleSlashComments)
|
||||
PostParseModuleImpls(defaultNamespace, fileName, isLastCompiland, impl, lexbuf, tripleSlashComments, Set identStore)
|
||||
elif FSharpSigFileSuffixes |> List.exists (FileSystemUtils.checkSuffix fileName) then
|
||||
let intfs = Parser.signatureFile lexer lexbuf
|
||||
let intfs = Parser.signatureFile identCaptureLexer lexbuf
|
||||
|
||||
let tripleSlashComments =
|
||||
LexbufLocalXmlDocStore.ReportInvalidXmlDocPositions(lexbuf)
|
||||
|
||||
PostParseModuleSpecs(defaultNamespace, fileName, isLastCompiland, intfs, lexbuf, tripleSlashComments)
|
||||
PostParseModuleSpecs(defaultNamespace, fileName, isLastCompiland, intfs, lexbuf, tripleSlashComments, Set identStore)
|
||||
else if lexbuf.SupportsFeature LanguageFeature.MLCompatRevisions then
|
||||
error (Error(FSComp.SR.buildInvalidSourceFileExtensionUpdated fileName, rangeStartup))
|
||||
else
|
||||
|
@ -484,7 +509,6 @@ let TestInteractionParserAndExit (tokenizer: Tokenizer, lexbuf: LexBuffer<char>,
|
|||
while true do
|
||||
match (Parser.interaction (fun _ -> tokenizer ()) lexbuf) with
|
||||
| ParsedScriptInteraction.Definitions (l, m) -> printfn "Parsed OK, got %d defs @ %a" l.Length outputRange m
|
||||
| ParsedScriptInteraction.HashDirective (_, m) -> printfn "Parsed OK, got hash @ %a" outputRange m
|
||||
|
||||
exiter.Exit 0
|
||||
|
||||
|
@ -521,7 +545,8 @@ let EmptyParsedInput (fileName, isLastCompiland) =
|
|||
{
|
||||
ConditionalDirectives = []
|
||||
CodeComments = []
|
||||
}
|
||||
},
|
||||
Set.empty
|
||||
)
|
||||
)
|
||||
else
|
||||
|
@ -537,7 +562,8 @@ let EmptyParsedInput (fileName, isLastCompiland) =
|
|||
{
|
||||
ConditionalDirectives = []
|
||||
CodeComments = []
|
||||
}
|
||||
},
|
||||
Set.empty
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -845,10 +871,7 @@ let ProcessMetaCommandsFromInput
|
|||
| ParsedHashDirective ("nowarn", ParsedHashDirectiveArguments numbers, m) ->
|
||||
List.fold (fun state d -> nowarnF state (m, d)) state numbers
|
||||
|
||||
| ParsedHashDirective (("reference"
|
||||
| "r"),
|
||||
ParsedHashDirectiveArguments args,
|
||||
m) ->
|
||||
| ParsedHashDirective (("reference" | "r"), ParsedHashDirectiveArguments args, m) ->
|
||||
matchedm <- m
|
||||
ProcessDependencyManagerDirective Directive.Resolution args m state
|
||||
|
||||
|
@ -1181,6 +1204,9 @@ let CheckOneInputAux
|
|||
|
||||
cancellable {
|
||||
try
|
||||
use _ =
|
||||
Activity.start "ParseAndCheckInputs.CheckOneInput" [| Activity.Tags.fileName, inp.FileName |]
|
||||
|
||||
CheckSimulateException tcConfig
|
||||
|
||||
let m = inp.Range
|
||||
|
@ -1214,7 +1240,8 @@ let CheckOneInputAux
|
|||
checkForErrors,
|
||||
conditionalDefines,
|
||||
tcSink,
|
||||
tcConfig.internalTestSpanStackReferring)
|
||||
tcConfig.internalTestSpanStackReferring,
|
||||
tcConfig.diagnosticsOptions)
|
||||
tcState.tcsTcSigEnv
|
||||
file
|
||||
|
||||
|
@ -1292,7 +1319,8 @@ let CheckOneInputAux
|
|||
tcConfig.internalTestSpanStackReferring,
|
||||
tcState.tcsTcImplEnv,
|
||||
rootSigOpt,
|
||||
file
|
||||
file,
|
||||
tcConfig.diagnosticsOptions
|
||||
)
|
||||
|
||||
let tcState =
|
||||
|
@ -1371,10 +1399,8 @@ let CheckMultipleInputsFinish (results, tcState: TcState) =
|
|||
|
||||
let CheckOneInputAndFinish (checkForErrors, tcConfig: TcConfig, tcImports, tcGlobals, prefixPathOpt, tcSink, tcState, input) =
|
||||
cancellable {
|
||||
Logger.LogBlockStart LogCompilerFunctionId.CompileOps_TypeCheckOneInputAndFinishEventually
|
||||
let! result, tcState = CheckOneInput(checkForErrors, tcConfig, tcImports, tcGlobals, prefixPathOpt, tcSink, tcState, input, false)
|
||||
let finishedResult = CheckMultipleInputsFinish([ result ], tcState)
|
||||
Logger.LogBlockStop LogCompilerFunctionId.CompileOps_TypeCheckOneInputAndFinishEventually
|
||||
return finishedResult
|
||||
}
|
||||
|
||||
|
@ -1489,7 +1515,8 @@ let CheckMultipleInputsInParallel
|
|||
tcConfig.internalTestSpanStackReferring,
|
||||
tcStateForImplFile.tcsTcImplEnv,
|
||||
Some rootSig,
|
||||
file
|
||||
file,
|
||||
tcConfig.diagnosticsOptions
|
||||
)
|
||||
|> Cancellable.runWithoutCancellation
|
||||
|
||||
|
|
|
@ -515,13 +515,23 @@ module ScriptPreprocessClosure =
|
|||
match lastParsedInput with
|
||||
| Some (ParsedInput.ImplFile lastParsedImplFile) ->
|
||||
|
||||
let (ParsedImplFileInput (name, isScript, qualNameOfFile, scopedPragmas, hashDirectives, implFileFlags, _, trivia)) =
|
||||
let (ParsedImplFileInput (name, isScript, qualNameOfFile, scopedPragmas, hashDirectives, implFileFlags, _, trivia, identifiers)) =
|
||||
lastParsedImplFile
|
||||
|
||||
let isLastCompiland = (true, tcConfig.target.IsExe)
|
||||
|
||||
let lastParsedImplFileR =
|
||||
ParsedImplFileInput(name, isScript, qualNameOfFile, scopedPragmas, hashDirectives, implFileFlags, isLastCompiland, trivia)
|
||||
ParsedImplFileInput(
|
||||
name,
|
||||
isScript,
|
||||
qualNameOfFile,
|
||||
scopedPragmas,
|
||||
hashDirectives,
|
||||
implFileFlags,
|
||||
isLastCompiland,
|
||||
trivia,
|
||||
identifiers
|
||||
)
|
||||
|
||||
let lastClosureFileR =
|
||||
ClosureFile(fileName, m, Some(ParsedInput.ImplFile lastParsedImplFileR), parseDiagnostics, metaDiagnostics, nowarns)
|
||||
|
|
|
@ -514,10 +514,6 @@ let StaticLink (ctok, tcConfig: TcConfig, tcImports: TcImports, ilGlobals: ILGlo
|
|||
id
|
||||
else
|
||||
(fun ilxMainModule ->
|
||||
match tcConfig.emitMetadataAssembly with
|
||||
| MetadataAssemblyGeneration.None -> ()
|
||||
| _ -> error (Error(FSComp.SR.optsInvalidRefAssembly (), rangeCmdArgs))
|
||||
|
||||
ReportTime tcConfig "Find assembly references"
|
||||
|
||||
let dependentILModules =
|
||||
|
|
|
@ -532,11 +532,11 @@ let main1
|
|||
|
||||
// Process command line, flags and collect filenames
|
||||
let sourceFiles =
|
||||
|
||||
// The ParseCompilerOptions function calls imperative function to process "real" args
|
||||
// Rather than start processing, just collect names, then process them.
|
||||
try
|
||||
let files = ProcessCommandLineFlags(tcConfigB, lcidFromCodePage, argv)
|
||||
let files = CheckAndReportSourceFileDuplicates(ResizeArray.ofList files)
|
||||
AdjustForScriptCompile(tcConfigB, files, lexResourceManager, dependencyProvider)
|
||||
with e ->
|
||||
errorRecovery e rangeStartup
|
||||
|
@ -577,6 +577,20 @@ let main1
|
|||
delayForFlagsLogger.CommitDelayedDiagnostics(diagnosticsLoggerProvider, tcConfigB, exiter)
|
||||
exiter.Exit 1
|
||||
|
||||
if tcConfig.showTimes then
|
||||
Activity.Profiling.addConsoleListener () |> disposables.Register
|
||||
|
||||
tcConfig.writeTimesToFile
|
||||
|> Option.iter (fun f ->
|
||||
Activity.CsvExport.addCsvFileListener f |> disposables.Register
|
||||
|
||||
Activity.start
|
||||
"FSC compilation"
|
||||
[
|
||||
Activity.Tags.project, tcConfig.outputFile |> Option.defaultValue String.Empty
|
||||
]
|
||||
|> disposables.Register)
|
||||
|
||||
let diagnosticsLogger = diagnosticsLoggerProvider.CreateLogger(tcConfigB, exiter)
|
||||
|
||||
// Install the global error logger and never remove it. This logger does have all command-line flags considered.
|
||||
|
@ -589,7 +603,7 @@ let main1
|
|||
AbortOnError(diagnosticsLogger, exiter)
|
||||
|
||||
// Resolve assemblies
|
||||
ReportTime tcConfig "Import mscorlib and FSharp.Core.dll"
|
||||
ReportTime tcConfig "Import mscorlib+FSharp.Core"
|
||||
let foundationalTcConfigP = TcConfigProvider.Constant tcConfig
|
||||
|
||||
let sysRes, otherRes, knownUnresolved =
|
||||
|
@ -710,7 +724,6 @@ let main2
|
|||
exiter: Exiter,
|
||||
ilSourceDocs))
|
||||
=
|
||||
|
||||
if tcConfig.typeCheckOnly then
|
||||
exiter.Exit 0
|
||||
|
||||
|
@ -764,7 +777,7 @@ let main2
|
|||
if tcConfig.printSignature || tcConfig.printAllSignatureFiles then
|
||||
InterfaceFileWriter.WriteInterfaceFile(tcGlobals, tcConfig, InfoReader(tcGlobals, tcImports.GetImportMap()), typedImplFiles)
|
||||
|
||||
ReportTime tcConfig "Write XML document signatures"
|
||||
ReportTime tcConfig "Write XML doc signatures"
|
||||
|
||||
if tcConfig.xmlDocOutputFile.IsSome then
|
||||
XmlDocWriter.ComputeXmlDocSigs(tcGlobals, generatedCcu)
|
||||
|
@ -818,7 +831,6 @@ let main3
|
|||
exiter: Exiter,
|
||||
ilSourceDocs))
|
||||
=
|
||||
|
||||
// Encode the signature data
|
||||
ReportTime tcConfig "Encode Interface Data"
|
||||
let exportRemapping = MakeExportRemapping generatedCcu generatedCcu.Contents
|
||||
|
@ -914,7 +926,6 @@ let main4
|
|||
exiter: Exiter,
|
||||
ilSourceDocs))
|
||||
=
|
||||
|
||||
match tcImportsCapture with
|
||||
| None -> ()
|
||||
| Some f -> f tcImports
|
||||
|
@ -1049,7 +1060,6 @@ let main6
|
|||
exiter: Exiter,
|
||||
ilSourceDocs))
|
||||
=
|
||||
|
||||
ReportTime tcConfig "Write .NET Binary"
|
||||
|
||||
use _ = UseBuildPhase BuildPhase.Output
|
||||
|
@ -1092,7 +1102,6 @@ let main6
|
|||
pdbfile = None
|
||||
emitTailcalls = tcConfig.emitTailcalls
|
||||
deterministic = tcConfig.deterministic
|
||||
showTimes = tcConfig.showTimes
|
||||
portablePDB = false
|
||||
embeddedPDB = false
|
||||
embedAllSource = tcConfig.embedAllSource
|
||||
|
@ -1123,7 +1132,6 @@ let main6
|
|||
pdbfile = pdbfile
|
||||
emitTailcalls = tcConfig.emitTailcalls
|
||||
deterministic = tcConfig.deterministic
|
||||
showTimes = tcConfig.showTimes
|
||||
portablePDB = tcConfig.portablePDB
|
||||
embeddedPDB = tcConfig.embeddedPDB
|
||||
embedAllSource = tcConfig.embedAllSource
|
||||
|
|
|
@ -19,11 +19,16 @@ undefinedNamePatternDiscriminator,"The pattern discriminator '%s' is not defined
|
|||
replaceWithSuggestion,"Replace with '%s'"
|
||||
addIndexerDot,"Add . for indexer access."
|
||||
listElementHasWrongType,"All elements of a list must be implicitly convertible to the type of the first element, which here is '%s'. This element has type '%s'."
|
||||
listElementHasWrongTypeTuple,"All elements of a list must be implicitly convertible to the type of the first element, which here is a tuple of length %d of type\n %s \nThis element is a tuple of length %d of type\n %s \n"
|
||||
arrayElementHasWrongType,"All elements of an array must be implicitly convertible to the type of the first element, which here is '%s'. This element has type '%s'."
|
||||
arrayElementHasWrongTypeTuple,"All elements of an array must be implicitly convertible to the type of the first element, which here is a tuple of length %d of type\n %s \nThis element is a tuple of length %d of type\n %s \n"
|
||||
missingElseBranch,"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 '%s'."
|
||||
ifExpression,"The 'if' expression needs to have type '%s' to satisfy context type requirements. It currently has type '%s'."
|
||||
ifExpressionTuple,"The 'if' expression needs to return a tuple of length %d of type\n %s \nto satisfy context type requirements. It currently returns a tuple of length %d of type\n %s \n"
|
||||
elseBranchHasWrongType,"All branches of an 'if' expression must return values implicitly convertible to the type of the first branch, which here is '%s'. This branch returns a value of type '%s'."
|
||||
elseBranchHasWrongTypeTuple,"All branches of an 'if' expression must return values implicitly convertible to the type of the first branch, which here is a tuple of length %d of type\n %s \nThis branch returns a tuple of length %d of type\n %s \n"
|
||||
followingPatternMatchClauseHasWrongType,"All branches of a pattern match expression must return values implicitly convertible to the type of the first branch, which here is '%s'. This branch returns a value of type '%s'."
|
||||
followingPatternMatchClauseHasWrongTypeTuple,"All branches of a pattern match expression must return values implicitly convertible to the type of the first branch, which here is a tuple of length %d of type\n %s \nThis branch returns a tuple of length %d of type\n %s \n"
|
||||
patternMatchGuardIsNotBool,"A pattern match guard must be of type 'bool', but this 'when' expression is of type '%s'."
|
||||
commaInsteadOfSemicolonInRecord,"A ';' is used to separate field values in records. Consider replacing ',' with ';'."
|
||||
derefInsteadOfNot,"The '!' operator is used to dereference a ref cell. Consider using 'not expr' here."
|
||||
|
@ -55,7 +60,6 @@ tupleRequiredInAbstractMethod,"\nA tuple type is required for one or more argume
|
|||
226,buildInvalidSourceFileExtensionUpdated,"The file extension of '%s' is not recognized. Source files must have extension .fs, .fsi, .fsx or .fsscript"
|
||||
226,buildInvalidSourceFileExtensionML,"The file extension of '%s' is not recognized. Source files must have extension .fs, .fsi, .fsx or .fsscript. To enable the deprecated use of .ml or .mli extensions, use '--langversion:5.0' and '--mlcompatibility'."
|
||||
227,buildCouldNotResolveAssembly,"Could not resolve assembly '%s'"
|
||||
228,buildCouldNotResolveAssemblyRequiredByFile,"Could not resolve assembly '%s' required by '%s'"
|
||||
229,buildErrorOpeningBinaryFile,"Error opening binary file '%s': %s"
|
||||
231,buildDifferentVersionMustRecompile,"The F#-compiled DLL '%s' needs to be recompiled to be used with this version of F#"
|
||||
232,buildInvalidHashIDirective,"Invalid directive. Expected '#I \"<path>\"'."
|
||||
|
@ -572,7 +576,7 @@ tcCouldNotFindIDisposable,"Couldn't find Dispose on IDisposable, or it was overl
|
|||
724,tcInvalidIndexIntoActivePatternArray,"Internal error. Invalid index into active pattern array"
|
||||
725,tcUnionCaseDoesNotTakeArguments,"This union case does not take arguments"
|
||||
726,tcUnionCaseRequiresOneArgument,"This union case takes one argument"
|
||||
727,tcUnionCaseExpectsTupledArguments,"This union case expects %d arguments in tupled form"
|
||||
727,tcUnionCaseExpectsTupledArguments,"This union case expects %d arguments in tupled form, but was given %d. The missing field arguments may be any of:%s"
|
||||
728,tcFieldIsNotStatic,"Field '%s' is not static"
|
||||
729,tcFieldNotLiteralCannotBeUsedInPattern,"This field is not a literal and cannot be used in a pattern"
|
||||
730,tcRequireVarConstRecogOrLiteral,"This is not a variable, constant, active recognizer or literal"
|
||||
|
@ -958,10 +962,6 @@ typeInfoFromFirst,"from %s"
|
|||
typeInfoFromNext,"also from %s"
|
||||
typeInfoGeneratedProperty,"generated property"
|
||||
typeInfoGeneratedType,"generated type"
|
||||
assemblyResolutionFoundByAssemblyFoldersKey,"Found by AssemblyFolders registry key"
|
||||
assemblyResolutionFoundByAssemblyFoldersExKey,"Found by AssemblyFoldersEx registry key"
|
||||
assemblyResolutionNetFramework,".NET Framework"
|
||||
assemblyResolutionGAC,"Global Assembly Cache"
|
||||
1089,recursiveClassHierarchy,"Recursive class hierarchy in type '%s'"
|
||||
1090,InvalidRecursiveReferenceToAbstractSlot,"Invalid recursive reference to an abstract slot"
|
||||
1091,eventHasNonStandardType,"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<_,_>'."
|
||||
|
@ -1165,7 +1165,7 @@ fscTooManyErrors,"Exiting - too many errors"
|
|||
2025,fscAssemblyWildcardAndDeterminism,"An %s specified version '%s', but this value is a wildcard, and you have requested a deterministic build, these are in conflict."
|
||||
2028,optsInvalidPathMapFormat,"Invalid path map. Mappings must be comma separated and of the format 'path=sourcePath'"
|
||||
2029,optsInvalidRefOut,"Invalid reference assembly path'"
|
||||
2030,optsInvalidRefAssembly,"Invalid use of emitting a reference assembly, do not use '--staticlink', or '--refonly' and '--refout' together."
|
||||
2030,optsInvalidRefAssembly,"Invalid use of emitting a reference assembly, do not use '--standalone or --staticlink' with '--refonly or --refout'."
|
||||
3000,etIllegalCharactersInNamespaceName,"Character '%s' is not allowed in provided namespace name '%s'"
|
||||
3001,etNullOrEmptyMemberName,"The provided type '%s' returned a member with a null or empty member name"
|
||||
3002,etNullMember,"The provided type '%s' returned a null member"
|
||||
|
@ -1373,7 +1373,7 @@ tcTupleStructMismatch,"One tuple type is a struct tuple, the other is a referenc
|
|||
3201,tcModuleAbbrevFirstInMutRec,"In a recursive declaration group, module abbreviations must come after all 'open' declarations and before other declarations"
|
||||
3202,tcUnsupportedMutRecDecl,"This declaration is not supported in recursive declaration groups"
|
||||
3203,parsInvalidUseOfRec,"Invalid use of 'rec' keyword"
|
||||
3204,tcStructUnionMultiCaseDistinctFields,"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."
|
||||
3204,tcStructUnionMultiCaseDistinctFields,"If a multicase union type is a struct, then all union cases must have unique names. For example: 'type A = B of b: int | C of c: int'."
|
||||
3206,CallerMemberNameIsOverriden,"The CallerMemberNameAttribute applied to parameter '%s' will have no effect. It is overridden by the CallerFilePathAttribute."
|
||||
3207,tcFixedNotAllowed,"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'"
|
||||
3208,tcCouldNotFindOffsetToStringData,"Could not find method System.Runtime.CompilerServices.OffsetToStringData in references when building 'fixed' expression."
|
||||
|
@ -1555,6 +1555,12 @@ featureSelfTypeConstraints,"self type constraints"
|
|||
featureRequiredProperties,"support for required properties"
|
||||
featureInitProperties,"support for consuming init properties"
|
||||
featureLowercaseDUWhenRequireQualifiedAccess,"Allow lowercase DU when RequireQualifiedAccess attribute"
|
||||
featureMatchNotAllowedForUnionCaseWithNoData,"Pattern match discard is not allowed for union case that takes no data."
|
||||
featureCSharpExtensionAttributeNotRequired,"Allow implicit Extension attribute on declaring types, modules"
|
||||
featureErrorForNonVirtualMembersOverrides,"Raises errors for non-virtual members overrides"
|
||||
featureWarningWhenInliningMethodImplNoInlineMarkedFunction,"Raises warnings when 'let inline ... =' is used together with [<MethodImpl(MethodImplOptions.NoInlining)>] attribute. Function is not getting inlined."
|
||||
featureArithmeticInLiterals,"Allow arithmetic and logical operations in literals"
|
||||
featureErrorReportingOnStaticClasses,"Error reporting on static classes"
|
||||
3353,fsiInvalidDirective,"Invalid directive '#%s %s'"
|
||||
3354,tcNotAFunctionButIndexerNamedIndexingNotYetEnabled,"This value supports indexing, e.g. '%s.[index]'. The syntax '%s[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation."
|
||||
3354,tcNotAFunctionButIndexerIndexingNotYetEnabled,"This expression supports indexing, e.g. 'expr.[index]'. The syntax 'expr[index]' requires /langversion:preview. See https://aka.ms/fsharp-index-notation."
|
||||
|
@ -1653,3 +1659,13 @@ reprStateMachineInvalidForm,"The state machine has an unexpected form"
|
|||
3536,tcUsingInterfaceWithStaticAbstractMethodAsType,"'%s' is normally used as a type constraint in generic code, e.g. \"'T when ISomeInterface<'T>\" or \"let f (x: #ISomeInterface<_>)\". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn \"3536\"' or '--nowarn:3536'."
|
||||
3537,tcTraitHasMultipleSupportTypes,"The trait '%s' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance."
|
||||
3545,tcMissingRequiredMembers,"The following required properties have to be initalized:%s"
|
||||
3546,parsExpectingPatternInTuple,"Expecting pattern"
|
||||
3547,parsExpectedPatternAfterToken,"Expected a pattern after this point"
|
||||
3548,matchNotAllowedForUnionCaseWithNoData,"Pattern discard is not allowed for union case that takes no data."
|
||||
3549,tcSynTypeOrInvalidInDeclaration,"SynType.Or is not permitted in this declaration"
|
||||
3550,chkDuplicatedMethodParameter,"Duplicate parameter. The parameter '%s' has been used more that once in this method."
|
||||
featureEscapeBracesInFormattableString,"Escapes curly braces before calling FormattableStringFactory.Create when interpolated string literal is typed as FormattableString"
|
||||
3551,buildDuplicateFile,"The source file '%s' (at position %d/%d) already appeared in the compilation list (at position %d/%d). Please verify that it is included only once in the project file."
|
||||
3552,chkConstructorWithArgumentsOnStaticClasses,"If a type uses both [<Sealed>] and [<AbstractClass>] attributes, it means it is static. Constructor with arguments is not allowed."
|
||||
3553,chkAdditionalConstructorOnStaticClasses,"If a type uses both [<Sealed>] and [<AbstractClass>] attributes, it means it is static. Additional constructor is not allowed."
|
||||
3554,chkInstanceMemberOnStaticClasses,"If a type uses both [<Sealed>] and [<AbstractClass>] attributes, it means it is static. Instance members are not allowed."
|
||||
|
|
|
@ -573,7 +573,7 @@
|
|||
<data name="Parser.TOKEN.AND" xml:space="preserve">
|
||||
<value>keyword 'and'</value>
|
||||
</data>
|
||||
!<data name="Parser.TOKEN.AND.BANG" xml:space="preserve">
|
||||
<data name="Parser.TOKEN.AND.BANG" xml:space="preserve">
|
||||
<value>keyword 'and!'</value>
|
||||
</data>
|
||||
<data name="Parser.TOKEN.AS" xml:space="preserve">
|
||||
|
@ -907,7 +907,7 @@
|
|||
<value>This expression is a function value, i.e. is missing arguments. Its type is {0}.</value>
|
||||
</data>
|
||||
<data name="UnitTypeExpected" xml:space="preserve">
|
||||
<value>The result of this expression has type '{0}' 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'.</value>
|
||||
<value>The result of this expression has type '{0}' 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'.</value>
|
||||
</data>
|
||||
<data name="UnitTypeExpectedWithEquality" xml:space="preserve">
|
||||
<value>The result of this equality expression has type '{0}' and is implicitly discarded. Consider using 'let' to bind the result to a name, e.g. 'let result = expression'.</value>
|
||||
|
@ -1054,7 +1054,7 @@
|
|||
<value>Override implementations should be given as part of the initial declaration of a type.</value>
|
||||
</data>
|
||||
<data name="IntfImplInIntrinsicAugmentation" xml:space="preserve">
|
||||
<value>Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.</value>
|
||||
<value>Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.</value>
|
||||
</data>
|
||||
<data name="IntfImplInExtrinsicAugmentation" xml:space="preserve">
|
||||
<value>Interface implementations should be given on the initial declaration of a type.</value>
|
||||
|
@ -1110,4 +1110,7 @@
|
|||
<data name="NotUpperCaseConstructorWithoutRQA" xml:space="preserve">
|
||||
<value>Lowercase discriminated union cases are only allowed when using RequireQualifiedAccess attribute</value>
|
||||
</data>
|
||||
<data name="ErrorFromAddingTypeEquationTuples" xml:space="preserve">
|
||||
<value>Type mismatch. Expecting a tuple of length {0} of type\n {1} \nbut given a tuple of length {2} of type\n {3} {4}\n</value>
|
||||
</data>
|
||||
</root>
|
|
@ -13,7 +13,7 @@
|
|||
<AssemblyName>FSharp.Compiler.Service</AssemblyName>
|
||||
<AllowCrossTargeting>true</AllowCrossTargeting>
|
||||
<DefineConstants>$(DefineConstants);COMPILER</DefineConstants>
|
||||
<DefineConstants Condition="'$(FSHARPCORE_USE_PACKAGE)' == 'true'">$(DefineConstants);USE_SHIPPED_FSCORE</DefineConstants>
|
||||
<DefineConstants Condition="'$(FSHARPCORE_USE_PACKAGE)' == 'true'">$(DefineConstants);FSHARPCORE_USE_PACKAGE</DefineConstants>
|
||||
<OtherFlags>$(OtherFlags) --extraoptimizationloops:1</OtherFlags>
|
||||
<!-- 1182: Unused variables -->
|
||||
<OtherFlags>$(OtherFlags) --warnon:1182</OtherFlags>
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
<!-- The FSharp.Compiler.Service dll provides a referencable public interface for tool builders -->
|
||||
<PropertyGroup Condition="'$(Configuration)' != 'Proto'">
|
||||
<CompressMetadata Condition="'$(CompressAllMetadata)' != 'true'">false</CompressMetadata>
|
||||
<CompressMetadata Condition="'$(CompressAllMetadata)' != 'true'">false</CompressMetadata>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
@ -57,6 +57,7 @@
|
|||
<NuspecProperty Include="SystemBuffersPackageVersion=$(SystemBuffersVersion)" />
|
||||
<NuspecProperty Include="SystemCollectionsImmutablePackageVersion=$(SystemCollectionsImmutableVersion)" />
|
||||
<NuspecProperty Include="SystemMemoryPackageVersion=$(SystemMemoryVersion)" />
|
||||
<NuspecProperty Include="SystemDiagnosticsDiagnosticSourcePackageVersion=$(SystemDiagnosticsDiagnosticSourceVersion)" />
|
||||
<NuspecProperty Include="SystemReflectionEmitPackageVersion=$(SystemReflectionEmitVersion)" />
|
||||
<NuspecProperty Include="SystemReflectionMetadataPackageVersion=$(SystemReflectionMetadataVersion)" />
|
||||
<NuspecProperty Include="SystemRuntimeCompilerServicesUnsafePackageVersion=$(SystemRuntimeCompilerServicesUnsafeVersion)" />
|
||||
|
@ -69,9 +70,9 @@
|
|||
<InternalsVisibleTo Include="fsi" />
|
||||
<InternalsVisibleTo Include="fsiAnyCpu" />
|
||||
<InternalsVisibleTo Include="fsiArm64" />
|
||||
<InternalsVisibleTo Include="FSharp.Compiler.Server.Shared" />
|
||||
<InternalsVisibleTo Include="VisualFSharp.Salsa" />
|
||||
<InternalsVisibleTo Include="VisualFSharp.UnitTests" />
|
||||
<InternalsVisibleTo Include="FSharp.Compiler.ComponentTests" />
|
||||
<InternalsVisibleTo Include="FSharp.Compiler.UnitTests" />
|
||||
<InternalsVisibleTo Include="FSharp.Compiler.Service.Tests" />
|
||||
<InternalsVisibleTo Include="HostedCompilerServer" />
|
||||
|
@ -92,6 +93,8 @@
|
|||
<Link>FSStrings.resx</Link>
|
||||
<LogicalName>FSStrings.resources</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Utilities\Activity.fsi" />
|
||||
<Compile Include="Utilities\Activity.fs" />
|
||||
<Compile Include="Utilities\sformat.fsi" />
|
||||
<Compile Include="Utilities\sformat.fs" />
|
||||
<Compile Include="Utilities\sr.fsi" />
|
||||
|
@ -132,8 +135,6 @@
|
|||
<Compile Include="Utilities\range.fsi" />
|
||||
<Compile Include="Utilities\range.fs" />
|
||||
<EmbeddedText Include="Facilities\UtilsStrings.txt" />
|
||||
<Compile Include="Facilities\Logger.fsi" />
|
||||
<Compile Include="Facilities\Logger.fs" />
|
||||
<Compile Include="Facilities\LanguageFeatures.fsi" />
|
||||
<Compile Include="Facilities\LanguageFeatures.fs" />
|
||||
<Compile Include="Facilities\DiagnosticOptions.fsi" />
|
||||
|
@ -456,12 +457,12 @@
|
|||
<Compile Include="Service\ServiceStructure.fs" />
|
||||
<Compile Include="Service\ServiceAnalysis.fsi" />
|
||||
<Compile Include="Service\ServiceAnalysis.fs" />
|
||||
<Compile Include="Interactive\FSharpInteractiveServer.fsi" />
|
||||
<Compile Include="Interactive\FSharpInteractiveServer.fs" />
|
||||
<Compile Include="Interactive\ControlledExecution.fs" />
|
||||
<Compile Include="Interactive\fsi.fsi" />
|
||||
<Compile Include="Interactive\fsi.fs" />
|
||||
<!-- A legacy resolver used to help with scripting diagnostics in the Visual Studio tools -->
|
||||
<Compile Include="Legacy\LegacyMSBuildReferenceResolver.fsi" Condition="'$(MonoPackaging)' != 'true'" />
|
||||
<Compile Include="Legacy\LegacyMSBuildReferenceResolver.fs" Condition="'$(MonoPackaging)' != 'true'" />
|
||||
<!-- an old API for testing the compiler and gathering diagnostics in-memory -->
|
||||
<Compile Include="Legacy\LegacyHostedCompilerForTesting.fs" Condition="'$(MonoPackaging)' != 'true'" />
|
||||
</ItemGroup>
|
||||
|
@ -489,11 +490,9 @@
|
|||
<PackageReference Include="System.Reflection.Emit" Version="$(SystemReflectionEmitVersion)" />
|
||||
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" />
|
||||
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
|
||||
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourceVersion)" />
|
||||
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafeVersion)" />
|
||||
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildVersion)" />
|
||||
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildVersion)" />
|
||||
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -6,11 +6,9 @@
|
|||
<dependencies>
|
||||
<group targetFramework=".NETStandard2.0">
|
||||
<dependency id="FSharp.Core" version="$FSharpCorePackageVersion$" exclude="Build,Analyzers" />
|
||||
<dependency id="Microsoft.Build.Framework" version="$MicrosoftBuildFrameworkPackageVersion$" exclude="Build,Analyzers" />
|
||||
<dependency id="Microsoft.Build.Tasks.Core" version="$MicrosoftBuildTasksCorePackageVersion$" exclude="Build,Analyzers" />
|
||||
<dependency id="Microsoft.Build.Utilities.Core" version="$MicrosoftBuildUtilitiesCorePackageVersion$" exclude="Build,Analyzers" />
|
||||
<dependency id="System.Buffers" version="$SystemBuffersPackageVersion$" exclude="Build,Analyzers" />
|
||||
<dependency id="System.Collections.Immutable" version="$SystemCollectionsImmutablePackageVersion$" exclude="Build,Analyzers" />
|
||||
<dependency id="System.Diagnostics.DiagnosticSource" version="$SystemDiagnosticsDiagnosticSourcePackageVersion$" exclude="Build,Analyzers" />
|
||||
<dependency id="System.Memory" version="$SystemMemoryPackageVersion$" exclude="Build,Analyzers" />
|
||||
<dependency id="System.Reflection.Emit" version="$SystemReflectionEmitPackageVersion$" exclude="Build,Analyzers" />
|
||||
<dependency id="System.Reflection.Metadata" version="$SystemReflectionMetadataPackageVersion$" exclude="Build,Analyzers" />
|
||||
|
|
|
@ -106,6 +106,16 @@ type NodeCodeBuilder() =
|
|||
}
|
||||
)
|
||||
|
||||
[<DebuggerHidden; DebuggerStepThrough>]
|
||||
member _.Using(value: IDisposable, binder: IDisposable -> NodeCode<'U>) =
|
||||
Node(
|
||||
async {
|
||||
use _ = value
|
||||
return! binder value |> Async.AwaitNodeCode
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
let node = NodeCodeBuilder()
|
||||
|
||||
[<AbstractClass; Sealed>]
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
module internal FSharp.Compiler.BuildGraph
|
||||
|
||||
open System
|
||||
open System.Diagnostics
|
||||
open System.Threading
|
||||
open System.Threading.Tasks
|
||||
open FSharp.Compiler.DiagnosticsLogger
|
||||
|
@ -43,10 +44,12 @@ type NodeCodeBuilder =
|
|||
|
||||
member Combine: x1: NodeCode<unit> * x2: NodeCode<'T> -> NodeCode<'T>
|
||||
|
||||
/// A limited form 'use' for establishing the compilation globals. (Note
|
||||
/// that a proper generic 'use' could be implemented but has not currently been necessary)
|
||||
/// A limited form 'use' for establishing the compilation globals.
|
||||
member Using: CompilationGlobalsScope * (CompilationGlobalsScope -> NodeCode<'T>) -> NodeCode<'T>
|
||||
|
||||
/// A generic 'use' that disposes of the IDisposable at the end of the computation.
|
||||
member Using: IDisposable * (IDisposable -> NodeCode<'T>) -> NodeCode<'T>
|
||||
|
||||
/// Specifies code that can be run as part of the build graph.
|
||||
val node: NodeCodeBuilder
|
||||
|
||||
|
|
|
@ -31,3 +31,6 @@ type FSharpDiagnosticOptions =
|
|||
WarnAsError = []
|
||||
WarnAsWarn = []
|
||||
}
|
||||
|
||||
member x.CheckXmlDocs =
|
||||
List.contains 3390 x.WarnOn && not (List.contains 3390 x.WarnOff)
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче