diff --git a/.github/workflows/branch-merge.yml b/.github/workflows/branch-merge.yml
index 24b3989856c..de5a568d7bd 100644
--- a/.github/workflows/branch-merge.yml
+++ b/.github/workflows/branch-merge.yml
@@ -16,7 +16,3 @@ jobs:
uses: dotnet/arcade/.github/workflows/inter-branch-merge-base.yml@main
with:
configuration_file_path: '.config/service-branch-merge.json'
- feature-lsp-flow:
- uses: dotnet/arcade/.github/workflows/inter-branch-merge-base.yml@main
- with:
- configuration_file_path: '.config/feature-lsp-branch-merge.json'
\ No newline at end of file
diff --git a/azure-pipelines-PR.yml b/azure-pipelines-PR.yml
index 313ddee65cc..563f0afcbfb 100644
--- a/azure-pipelines-PR.yml
+++ b/azure-pipelines-PR.yml
@@ -113,14 +113,16 @@ stages:
steps:
- checkout: self
clean: true
+ # We first download a publicly available .NET SDK. That one has support for `path` in global.json. dotnet.cmd script can then download a version which is not yet shipped, but matches global.json.
- task: UseDotNet@2
displayName: install SDK
inputs:
packageType: sdk
- useGlobalJson: true
+ version: '10.x'
includePreviewVersions: true
workingDirectory: $(Build.SourcesDirectory)
installationPath: $(Build.SourcesDirectory)/.dotnet
+ - script: .\eng\common\dotnet.cmd
- script: .\eng\test-determinism.cmd -configuration Debug
env:
FSHARP_EXPERIMENTAL_FEATURES: $(_experimental_flag)
@@ -142,23 +144,16 @@ stages:
clean: true
- script: dotnet --list-sdks
displayName: Report dotnet SDK versions
- - task: UseDotNet@2
- displayName: install SDK
- inputs:
- packageType: sdk
- useGlobalJson: true
- includePreviewVersions: true
- workingDirectory: $(Build.SourcesDirectory)
- installationPath: $(Agent.ToolsDirectory)/dotnet
- - script: dotnet tool restore
+
+ - script: ./eng/common/dotnet.sh tool restore
env:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Install tools
- - script: dotnet fsi src/Compiler/FSCompCheck.fsx
+ - script: ./eng/common/dotnet.sh fsi src/Compiler/FSCompCheck.fsx
env:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Check error code sorting in src/Compiler/FSComp.txt
- - script: dotnet fantomas . --check
+ - script: ./eng/common/dotnet.sh fantomas . --check
env:
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1
displayName: Check code formatting (run 'dotnet fantomas .' to fix)
@@ -181,14 +176,16 @@ stages:
steps:
- checkout: self
clean: true
+ # We first download a publicly available .NET SDK. That one has support for `path` in global.json. dotnet.cmd script can then download a version which is not yet shipped, but matches global.json.
- task: UseDotNet@2
displayName: install SDK
inputs:
packageType: sdk
- useGlobalJson: true
+ version: '10.x'
includePreviewVersions: true
workingDirectory: $(Build.SourcesDirectory)
- installationPath: $(Agent.ToolsDirectory)/dotnet
+ installationPath: $(Build.SourcesDirectory)/.dotnet
+ - script: ./eng/common/dotnet.sh
- pwsh: ./check.ps1 -project $(_project)
workingDirectory: $(Build.SourcesDirectory)/buildtools/checkpackages
env:
@@ -769,15 +766,7 @@ stages:
clean: true
- script: dotnet --list-sdks
displayName: Report dotnet SDK versions
- - task: UseDotNet@2
- displayName: install SDK
- inputs:
- packageType: sdk
- useGlobalJson: true
- includePreviewVersions: true
- workingDirectory: $(Build.SourcesDirectory)
- installationPath: $(Agent.ToolsDirectory)/dotnet
- - script: dotnet build .\FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\"
+ - script: .\eng\common\dotnet.cmd build .\FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\"
workingDirectory: $(Build.SourcesDirectory)
displayName: Regular rebuild of FSharp.Compiler.Service.sln
continueOnError: false
@@ -795,15 +784,7 @@ stages:
clean: true
- script: dotnet --list-sdks
displayName: Report dotnet SDK versions
- - task: UseDotNet@2
- displayName: install SDK
- inputs:
- packageType: sdk
- useGlobalJson: true
- includePreviewVersions: true
- workingDirectory: $(Build.SourcesDirectory)
- installationPath: $(Agent.ToolsDirectory)/dotnet
- - script: dotnet build ./FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\"
+ - script: ./eng/common/dotnet.sh build ./FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\"
workingDirectory: $(Build.SourcesDirectory)
displayName: Regular rebuild of FSharp.Compiler.Service.sln
continueOnError: false
@@ -821,15 +802,7 @@ stages:
clean: true
- script: dotnet --list-sdks
displayName: Report dotnet SDK versions
- - task: UseDotNet@2
- displayName: install SDK
- inputs:
- packageType: sdk
- useGlobalJson: true
- includePreviewVersions: true
- workingDirectory: $(Build.SourcesDirectory)
- installationPath: $(Agent.ToolsDirectory)/dotnet
- - script: dotnet build ./FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\"
+ - script: ./eng/common/dotnet.sh build ./FSharp.Compiler.Service.sln /bl:\"artifacts/log/$(_BuildConfig)/ServiceRegularBuild.binlog\"
workingDirectory: $(Build.SourcesDirectory)
displayName: Regular rebuild of FSharp.Compiler.Service.sln
continueOnError: false
@@ -869,16 +842,16 @@ stages:
steps:
- checkout: self
clean: true
+ # We first download a publicly available .NET SDK. That one has support for `path` in global.json. dotnet.cmd script can then download a version which is not yet shipped, but matches global.json.
- task: UseDotNet@2
displayName: install SDK
inputs:
packageType: sdk
- useGlobalJson: true
+ version: '10.x'
includePreviewVersions: true
workingDirectory: $(Build.SourcesDirectory)
- installationPath: $(Agent.ToolsDirectory)/dotnet
- - script: dotnet --list-sdks
- displayName: Report dotnet SDK versions
+ installationPath: $(Build.SourcesDirectory)/.dotnet
+ - script: .\eng\common\dotnet.cmd
- script: .\Build.cmd $(_kind) -pack -c $(_BuildConfig)
env:
NativeToolsOnMachine: true
@@ -900,14 +873,16 @@ stages:
steps:
- checkout: self
clean: true
+ # We first download a publicly available .NET SDK. That one has support for `path` in global.json. dotnet.cmd script can then download a version which is not yet shipped, but matches global.json.
- task: UseDotNet@2
displayName: install SDK
inputs:
packageType: sdk
- useGlobalJson: true
+ version: '10.x'
includePreviewVersions: true
workingDirectory: $(Build.SourcesDirectory)
- installationPath: $(Agent.ToolsDirectory)/dotnet
+ installationPath: $(Build.SourcesDirectory)/.dotnet
+ - script: .\eng\common\dotnet.cmd
- script: dotnet tool restore
displayName: Restore dotnet tools
- pwsh: .\tests\ILVerify\ilverify.ps1
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 5e098d1702b..7c73c7aec82 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -36,29 +36,29 @@
-
+
https://github.com/dotnet/arcade
- 12d3a9f5d6138e22270694574e73e4c58a815795
+ c9a95aeae77ee977969fa38ad73ed1d8dd96b93f
-
+
https://dev.azure.com/dnceng/internal/_git/dotnet-optimization
- b1f3f5c40f86362217f1b98952d5c6562d609619
+ 671d4f2460fa41be5135f5d5803c33ab926eb135
-
+
https://dev.azure.com/dnceng/internal/_git/dotnet-optimization
- b1f3f5c40f86362217f1b98952d5c6562d609619
+ 671d4f2460fa41be5135f5d5803c33ab926eb135
-
+
https://dev.azure.com/dnceng/internal/_git/dotnet-optimization
- b1f3f5c40f86362217f1b98952d5c6562d609619
+ 671d4f2460fa41be5135f5d5803c33ab926eb135
-
+
https://dev.azure.com/dnceng/internal/_git/dotnet-optimization
- b1f3f5c40f86362217f1b98952d5c6562d609619
+ 671d4f2460fa41be5135f5d5803c33ab926eb135
-
+
https://dev.azure.com/dnceng/internal/_git/dotnet-optimization
- b1f3f5c40f86362217f1b98952d5c6562d609619
+ 671d4f2460fa41be5135f5d5803c33ab926eb135
diff --git a/eng/Versions.props b/eng/Versions.props
index c185f005329..1dbfb2a63a6 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -208,10 +208,10 @@
2.2.0
- 1.0.0-prerelease.25309.1
- 1.0.0-prerelease.25309.1
- 1.0.0-prerelease.25309.1
- 1.0.0-prerelease.25309.1
- 1.0.0-prerelease.25309.1
+ 1.0.0-prerelease.25323.1
+ 1.0.0-prerelease.25323.1
+ 1.0.0-prerelease.25323.1
+ 1.0.0-prerelease.25323.1
+ 1.0.0-prerelease.25323.1
diff --git a/eng/common/build.ps1 b/eng/common/build.ps1
index ae2309e312d..8cfee107e7a 100644
--- a/eng/common/build.ps1
+++ b/eng/common/build.ps1
@@ -21,6 +21,7 @@ Param(
[switch] $publish,
[switch] $clean,
[switch][Alias('pb')]$productBuild,
+ [switch]$fromVMR,
[switch][Alias('bl')]$binaryLog,
[switch][Alias('nobl')]$excludeCIBinarylog,
[switch] $ci,
@@ -74,6 +75,7 @@ function Print-Usage() {
Write-Host " -nativeToolsOnMachine Sets the native tools on machine environment variable (indicating that the script should use native tools on machine)"
Write-Host " -nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')"
Write-Host " -buildCheck Sets /check msbuild parameter"
+ Write-Host " -fromVMR Set when building from within the VMR"
Write-Host ""
Write-Host "Command line arguments not listed above are passed thru to msbuild."
@@ -128,6 +130,7 @@ function Build {
/p:Test=$test `
/p:Pack=$pack `
/p:DotNetBuild=$productBuild `
+ /p:DotNetBuildFromVMR=$fromVMR `
/p:IntegrationTest=$integrationTest `
/p:PerformanceTest=$performanceTest `
/p:Sign=$sign `
diff --git a/eng/common/build.sh b/eng/common/build.sh
index da906da2026..9767bb411a4 100755
--- a/eng/common/build.sh
+++ b/eng/common/build.sh
@@ -43,6 +43,7 @@ usage()
echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')"
echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')"
echo " --buildCheck Sets /check msbuild parameter"
+ echo " --fromVMR Set when building from within the VMR"
echo ""
echo "Command line arguments not listed above are passed thru to msbuild."
echo "Arguments can also be passed in with a single hyphen."
@@ -64,6 +65,7 @@ restore=false
build=false
source_build=false
product_build=false
+from_vmr=false
rebuild=false
test=false
integration_test=false
@@ -89,7 +91,7 @@ verbosity='minimal'
runtime_source_feed=''
runtime_source_feed_key=''
-properties=''
+properties=()
while [[ $# > 0 ]]; do
opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")"
case "$opt" in
@@ -142,6 +144,9 @@ while [[ $# > 0 ]]; do
restore=true
pack=true
;;
+ -fromvmr|-from-vmr)
+ from_vmr=true
+ ;;
-test|-t)
test=true
;;
@@ -187,7 +192,7 @@ while [[ $# > 0 ]]; do
shift
;;
*)
- properties="$properties $1"
+ properties+=("$1")
;;
esac
@@ -221,7 +226,7 @@ function Build {
InitializeCustomToolset
if [[ ! -z "$projects" ]]; then
- properties="$properties /p:Projects=$projects"
+ properties+=("/p:Projects=$projects")
fi
local bl=""
@@ -243,6 +248,7 @@ function Build {
/p:Build=$build \
/p:DotNetBuild=$product_build \
/p:DotNetBuildSourceOnly=$source_build \
+ /p:DotNetBuildFromVMR=$from_vmr \
/p:Rebuild=$rebuild \
/p:Test=$test \
/p:Pack=$pack \
@@ -251,7 +257,7 @@ function Build {
/p:Sign=$sign \
/p:Publish=$publish \
/p:RestoreStaticGraphEnableBinaryLogger=$binary_log \
- $properties
+ ${properties[@]+"${properties[@]}"}
ExitWithExitCode 0
}
diff --git a/eng/common/core-templates/job/onelocbuild.yml b/eng/common/core-templates/job/onelocbuild.yml
index 00feec8ebbc..8034815f421 100644
--- a/eng/common/core-templates/job/onelocbuild.yml
+++ b/eng/common/core-templates/job/onelocbuild.yml
@@ -86,8 +86,7 @@ jobs:
isAutoCompletePrSelected: ${{ parameters.AutoCompletePr }}
${{ if eq(parameters.CreatePr, true) }}:
isUseLfLineEndingsSelected: ${{ parameters.UseLfLineEndings }}
- ${{ if eq(parameters.RepoType, 'gitHub') }}:
- isShouldReusePrSelected: ${{ parameters.ReusePr }}
+ isShouldReusePrSelected: ${{ parameters.ReusePr }}
packageSourceAuth: patAuth
patVariable: ${{ parameters.CeapexPat }}
${{ if eq(parameters.RepoType, 'gitHub') }}:
@@ -118,4 +117,4 @@ jobs:
pathToPublish: '$(Build.SourcesDirectory)/eng/Localize/'
publishLocation: Container
artifactName: Loc
- condition: ${{ parameters.condition }}
\ No newline at end of file
+ condition: ${{ parameters.condition }}
diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml
index 4f1dc42e02c..d5303229c97 100644
--- a/eng/common/core-templates/job/publish-build-assets.yml
+++ b/eng/common/core-templates/job/publish-build-assets.yml
@@ -32,6 +32,12 @@ parameters:
# Optional: 🌤️ or not the build has assets it wants to publish to BAR
isAssetlessBuild: false
+ # Optional, publishing version
+ publishingVersion: 3
+
+ # Optional: A minimatch pattern for the asset manifests to publish to BAR
+ assetManifestsPattern: '*/manifests/**/*.xml'
+
jobs:
- job: Asset_Registry_Publish
@@ -77,13 +83,31 @@ jobs:
clean: true
- ${{ if eq(parameters.isAssetlessBuild, 'false') }}:
- - task: DownloadPipelineArtifact@2
- displayName: Download Asset Manifests
- inputs:
- artifactName: AssetManifests
- targetPath: '$(Build.StagingDirectory)/AssetManifests'
- condition: ${{ parameters.condition }}
- continueOnError: ${{ parameters.continueOnError }}
+ - ${{ if eq(parameters.publishingVersion, 3) }}:
+ - task: DownloadPipelineArtifact@2
+ displayName: Download Asset Manifests
+ inputs:
+ artifactName: AssetManifests
+ targetPath: '$(Build.StagingDirectory)/AssetManifests'
+ condition: ${{ parameters.condition }}
+ continueOnError: ${{ parameters.continueOnError }}
+ - ${{ if eq(parameters.publishingVersion, 4) }}:
+ - task: DownloadPipelineArtifact@2
+ displayName: Download V4 asset manifests
+ inputs:
+ itemPattern: '*/manifests/**/*.xml'
+ targetPath: '$(Build.StagingDirectory)/AllAssetManifests'
+ condition: ${{ parameters.condition }}
+ continueOnError: ${{ parameters.continueOnError }}
+ - task: CopyFiles@2
+ displayName: Copy V4 asset manifests to AssetManifests
+ inputs:
+ SourceFolder: '$(Build.StagingDirectory)/AllAssetManifests'
+ Contents: ${{ parameters.assetManifestsPattern }}
+ TargetFolder: '$(Build.StagingDirectory)/AssetManifests'
+ flattenFolders: true
+ condition: ${{ parameters.condition }}
+ continueOnError: ${{ parameters.continueOnError }}
- task: NuGetAuthenticate@1
@@ -120,6 +144,17 @@ jobs:
Copy-Item -Path $symbolExclusionfile -Destination "$(Build.StagingDirectory)/ReleaseConfigs"
}
+ - ${{ if eq(parameters.publishingVersion, 4) }}:
+ - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml
+ parameters:
+ is1ESPipeline: ${{ parameters.is1ESPipeline }}
+ args:
+ targetPath: '$(Build.ArtifactStagingDirectory)/MergedManifest.xml'
+ artifactName: AssetManifests
+ displayName: 'Publish Merged Manifest'
+ retryCountOnTaskFailure: 10 # for any logs being locked
+ sbomEnabled: false # we don't need SBOM for logs
+
- template: /eng/common/core-templates/steps/publish-build-artifacts.yml
parameters:
is1ESPipeline: ${{ parameters.is1ESPipeline }}
diff --git a/eng/common/core-templates/steps/install-microbuild.yml b/eng/common/core-templates/steps/install-microbuild.yml
index a3540ba00c7..f3064a7834e 100644
--- a/eng/common/core-templates/steps/install-microbuild.yml
+++ b/eng/common/core-templates/steps/install-microbuild.yml
@@ -30,6 +30,10 @@ steps:
${{ if and(eq(parameters.enableMicrobuildForMacAndLinux, 'true'), ne(variables['Agent.Os'], 'Windows_NT')) }}:
azureSubscription: 'MicroBuild Signing Task (DevDiv)'
useEsrpCli: true
+ ${{ elseif eq(variables['System.TeamProject'], 'DevDiv') }}:
+ ConnectedPMEServiceName: 6cc74545-d7b9-4050-9dfa-ebefcc8961ea
+ ${{ else }}:
+ ConnectedPMEServiceName: 248d384a-b39b-46e3-8ad5-c2c210d5e7ca
env:
TeamName: $(_TeamName)
MicroBuildOutputFolderOverride: ${{ parameters.microBuildOutputFolder }}
diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml
index 0dde553c3eb..acf16ed3496 100644
--- a/eng/common/core-templates/steps/source-build.yml
+++ b/eng/common/core-templates/steps/source-build.yml
@@ -38,11 +38,6 @@ steps:
targetRidArgs='/p:TargetRid=${{ parameters.platform.targetRID }}'
fi
- baseRidArgs=
- if [ '${{ parameters.platform.baseRID }}' != '' ]; then
- baseRidArgs='/p:BaseRid=${{ parameters.platform.baseRID }}'
- fi
-
portableBuildArgs=
if [ '${{ parameters.platform.portableBuild }}' != '' ]; then
portableBuildArgs='/p:PortableBuild=${{ parameters.platform.portableBuild }}'
@@ -55,7 +50,6 @@ steps:
${{ parameters.platform.buildArguments }} \
$internalRuntimeDownloadArgs \
$targetRidArgs \
- $baseRidArgs \
$portableBuildArgs \
displayName: Build
diff --git a/eng/common/core-templates/steps/source-index-stage1-publish.yml b/eng/common/core-templates/steps/source-index-stage1-publish.yml
index 99c2326fc19..c2917c1efc1 100644
--- a/eng/common/core-templates/steps/source-index-stage1-publish.yml
+++ b/eng/common/core-templates/steps/source-index-stage1-publish.yml
@@ -1,15 +1,15 @@
parameters:
sourceIndexUploadPackageVersion: 2.0.0-20250425.2
- sourceIndexProcessBinlogPackageVersion: 1.0.1-20250425.2
+ sourceIndexProcessBinlogPackageVersion: 1.0.1-20250515.1
sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json
binlogPath: artifacts/log/Debug/Build.binlog
steps:
- task: UseDotNet@2
- displayName: "Source Index: Use .NET 8 SDK"
+ displayName: "Source Index: Use .NET 9 SDK"
inputs:
packageType: sdk
- version: 8.0.x
+ version: 9.0.x
installationPath: $(Agent.TempDirectory)/dotnet
workingDirectory: $(Agent.TempDirectory)
diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh
index d6f005b5dab..8abfb71f727 100755
--- a/eng/common/cross/build-rootfs.sh
+++ b/eng/common/cross/build-rootfs.sh
@@ -295,8 +295,8 @@ while :; do
;;
noble) # Ubuntu 24.04
__CodeName=noble
- if [[ -n "$__LLDB_Package" ]]; then
- __LLDB_Package="liblldb-18-dev"
+ if [[ -z "$__LLDB_Package" ]]; then
+ __LLDB_Package="liblldb-19-dev"
fi
;;
stretch) # Debian 9
diff --git a/eng/common/dotnet.cmd b/eng/common/dotnet.cmd
new file mode 100755
index 00000000000..527fa4bb38f
--- /dev/null
+++ b/eng/common/dotnet.cmd
@@ -0,0 +1,7 @@
+@echo off
+
+:: This script is used to install the .NET SDK.
+:: It will also invoke the SDK with any provided arguments.
+
+powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0dotnet.ps1""" %*"
+exit /b %ErrorLevel%
diff --git a/eng/common/dotnet.ps1 b/eng/common/dotnet.ps1
new file mode 100755
index 00000000000..45e5676c9eb
--- /dev/null
+++ b/eng/common/dotnet.ps1
@@ -0,0 +1,11 @@
+# This script is used to install the .NET SDK.
+# It will also invoke the SDK with any provided arguments.
+
+. $PSScriptRoot\tools.ps1
+$dotnetRoot = InitializeDotNetCli -install:$true
+
+# Invoke acquired SDK with args if they are provided
+if ($args.count -gt 0) {
+ $env:DOTNET_NOLOGO=1
+ & "$dotnetRoot\dotnet.exe" $args
+}
diff --git a/eng/common/dotnet.sh b/eng/common/dotnet.sh
new file mode 100755
index 00000000000..2ef68235675
--- /dev/null
+++ b/eng/common/dotnet.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+# This script is used to install the .NET SDK.
+# It will also invoke the SDK with any provided arguments.
+
+source="${BASH_SOURCE[0]}"
+# resolve $SOURCE until the file is no longer a symlink
+while [[ -h $source ]]; do
+ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+ source="$(readlink "$source")"
+
+ # if $source was a relative symlink, we need to resolve it relative to the path where the
+ # symlink file was located
+ [[ $source != /* ]] && source="$scriptroot/$source"
+done
+scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+
+source $scriptroot/tools.sh
+InitializeDotNetCli true # install
+
+# Invoke acquired SDK with args if they are provided
+if [[ $# > 0 ]]; then
+ __dotnetDir=${_InitializeDotNetCli}
+ dotnetPath=${__dotnetDir}/dotnet
+ ${dotnetPath} "$@"
+fi
diff --git a/eng/common/internal/NuGet.config b/eng/common/internal/NuGet.config
index 19d3d311b16..f70261ed689 100644
--- a/eng/common/internal/NuGet.config
+++ b/eng/common/internal/NuGet.config
@@ -4,4 +4,7 @@
+
+
+
diff --git a/eng/common/templates/vmr-build-pr.yml b/eng/common/templates/vmr-build-pr.yml
index 670cf32c3bd..ce3c29a62fa 100644
--- a/eng/common/templates/vmr-build-pr.yml
+++ b/eng/common/templates/vmr-build-pr.yml
@@ -1,14 +1,23 @@
+# This pipeline is used for running the VMR verification of the PR changes in repo-level PRs.
+#
+# It will run a full set of verification jobs defined in:
+# https://github.com/dotnet/dotnet/blob/10060d128e3f470e77265f8490f5e4f72dae738e/eng/pipelines/templates/stages/vmr-build.yml#L27-L38
+#
+# For repos that do not need to run the full set, you would do the following:
+#
+# 1. Copy this YML file to a repo-specific location, i.e. outside of eng/common.
+#
+# 2. Add `verifications` parameter to VMR template reference
+#
+# Examples:
+# - For source-build stage 1 verification, add the following:
+# verifications: [ "source-build-stage1" ]
+#
+# - For Windows only verifications, add the following:
+# verifications: [ "unified-build-windows-x64", "unified-build-windows-x86" ]
+
trigger: none
-pr:
- branches:
- include:
- - main
- - release/*
- paths:
- exclude:
- - documentation/*
- - README.md
- - CODEOWNERS
+pr: none
variables:
- template: /eng/common/templates/variables/pool-providers.yml@self
diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1
index 5f40a3f8238..40f0aa86128 100644
--- a/eng/common/tools.ps1
+++ b/eng/common/tools.ps1
@@ -65,8 +65,8 @@ $ErrorActionPreference = 'Stop'
# Base-64 encoded SAS token that has permission to storage container described by $runtimeSourceFeed
[string]$runtimeSourceFeedKey = if (Test-Path variable:runtimeSourceFeedKey) { $runtimeSourceFeedKey } else { $null }
-# True if the build is a product build
-[bool]$productBuild = if (Test-Path variable:productBuild) { $productBuild } else { $false }
+# True when the build is running within the VMR.
+[bool]$fromVMR = if (Test-Path variable:fromVMR) { $fromVMR } else { $false }
function Create-Directory ([string[]] $path) {
New-Item -Path $path -Force -ItemType 'Directory' | Out-Null
@@ -644,7 +644,6 @@ function GetNuGetPackageCachePath() {
$env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\'
} else {
$env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages\'
- $env:RESTORENOHTTPCACHE = $true
}
}
@@ -766,28 +765,13 @@ function MSBuild() {
$toolsetBuildProject = InitializeToolset
$basePath = Split-Path -parent $toolsetBuildProject
- $possiblePaths = @(
- # new scripts need to work with old packages, so we need to look for the old names/versions
- (Join-Path $basePath (Join-Path $buildTool.Framework 'Microsoft.DotNet.ArcadeLogging.dll')),
- (Join-Path $basePath (Join-Path $buildTool.Framework 'Microsoft.DotNet.Arcade.Sdk.dll')),
-
- # This list doesn't need to be updated anymore and can eventually be removed.
- (Join-Path $basePath (Join-Path net9.0 'Microsoft.DotNet.ArcadeLogging.dll')),
- (Join-Path $basePath (Join-Path net9.0 'Microsoft.DotNet.Arcade.Sdk.dll')),
- (Join-Path $basePath (Join-Path net8.0 'Microsoft.DotNet.ArcadeLogging.dll')),
- (Join-Path $basePath (Join-Path net8.0 'Microsoft.DotNet.Arcade.Sdk.dll'))
- )
- $selectedPath = $null
- foreach ($path in $possiblePaths) {
- if (Test-Path $path -PathType Leaf) {
- $selectedPath = $path
- break
- }
- }
+ $selectedPath = Join-Path $basePath (Join-Path $buildTool.Framework 'Microsoft.DotNet.ArcadeLogging.dll')
+
if (-not $selectedPath) {
- Write-PipelineTelemetryError -Category 'Build' -Message 'Unable to find arcade sdk logger assembly.'
+ Write-PipelineTelemetryError -Category 'Build' -Message "Unable to find arcade sdk logger assembly: $selectedPath"
ExitWithExitCode 1
}
+
$args += "/logger:$selectedPath"
}
@@ -850,8 +834,8 @@ function MSBuild-Core() {
}
# When running on Azure Pipelines, override the returned exit code to avoid double logging.
- # Skip this when the build is a child of the VMR orchestrator build.
- if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$productBuild) {
+ # Skip this when the build is a child of the VMR build.
+ if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$fromVMR) {
Write-PipelineSetResult -Result "Failed" -Message "msbuild execution failed."
# Exiting with an exit code causes the azure pipelines task to log yet another "noise" error
# The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error
diff --git a/eng/common/tools.sh b/eng/common/tools.sh
index 25f5932eee9..3def02a638d 100755
--- a/eng/common/tools.sh
+++ b/eng/common/tools.sh
@@ -72,8 +72,8 @@ fi
runtime_source_feed=${runtime_source_feed:-''}
runtime_source_feed_key=${runtime_source_feed_key:-''}
-# True if the build is a product build
-product_build=${product_build:-false}
+# True when the build is running within the VMR.
+from_vmr=${from_vmr:-false}
# Resolve any symlinks in the given path.
function ResolvePath {
@@ -345,14 +345,12 @@ function InitializeBuildTool {
_InitializeBuildToolCommand="msbuild"
}
-# Set RestoreNoHttpCache as a workaround for https://github.com/NuGet/Home/issues/3116
function GetNuGetPackageCachePath {
if [[ -z ${NUGET_PACKAGES:-} ]]; then
if [[ "$use_global_nuget_cache" == true ]]; then
export NUGET_PACKAGES="$HOME/.nuget/packages/"
else
export NUGET_PACKAGES="$repo_root/.packages/"
- export RESTORENOHTTPCACHE=true
fi
fi
@@ -449,27 +447,13 @@ function MSBuild {
fi
local toolset_dir="${_InitializeToolset%/*}"
- # new scripts need to work with old packages, so we need to look for the old names/versions
- local selectedPath=
- local possiblePaths=()
- possiblePaths+=( "$toolset_dir/net/Microsoft.DotNet.ArcadeLogging.dll" )
- possiblePaths+=( "$toolset_dir/net/Microsoft.DotNet.Arcade.Sdk.dll" )
-
- # This list doesn't need to be updated anymore and can eventually be removed.
- possiblePaths+=( "$toolset_dir/net9.0/Microsoft.DotNet.ArcadeLogging.dll" )
- possiblePaths+=( "$toolset_dir/net9.0/Microsoft.DotNet.Arcade.Sdk.dll" )
- possiblePaths+=( "$toolset_dir/net8.0/Microsoft.DotNet.ArcadeLogging.dll" )
- possiblePaths+=( "$toolset_dir/net8.0/Microsoft.DotNet.Arcade.Sdk.dll" )
- for path in "${possiblePaths[@]}"; do
- if [[ -f $path ]]; then
- selectedPath=$path
- break
- fi
- done
+ local selectedPath="$toolset_dir/net/Microsoft.DotNet.ArcadeLogging.dll"
+
if [[ -z "$selectedPath" ]]; then
- Write-PipelineTelemetryError -category 'Build' "Unable to find arcade sdk logger assembly."
+ Write-PipelineTelemetryError -category 'Build' "Unable to find arcade sdk logger assembly: $selectedPath"
ExitWithExitCode 1
fi
+
args+=( "-logger:$selectedPath" )
fi
@@ -506,8 +490,8 @@ function MSBuild-Core {
echo "Build failed with exit code $exit_code. Check errors above."
# When running on Azure Pipelines, override the returned exit code to avoid double logging.
- # Skip this when the build is a child of the VMR orchestrator build.
- if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$product_build" != true ]]; then
+ # Skip this when the build is a child of the VMR build.
+ if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$from_vmr" != true ]]; then
Write-PipelineSetResult -result "Failed" -message "msbuild execution failed."
# Exiting with an exit code causes the azure pipelines task to log yet another "noise" error
# The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error
@@ -530,6 +514,7 @@ function GetDarc {
fi
"$eng_root/common/darc-init.sh" --toolpath "$darc_path" $version
+ darc_tool="$darc_path/darc"
}
# Returns a full path to an Arcade SDK task project file.
diff --git a/eng/common/vmr-sync.ps1 b/eng/common/vmr-sync.ps1
index 8c3c91ce8de..97302f3205b 100644
--- a/eng/common/vmr-sync.ps1
+++ b/eng/common/vmr-sync.ps1
@@ -103,14 +103,14 @@ Set-StrictMode -Version Latest
Highlight 'Installing .NET, preparing the tooling..'
. .\eng\common\tools.ps1
$dotnetRoot = InitializeDotNetCli -install:$true
+$darc = Get-Darc
$dotnet = "$dotnetRoot\dotnet.exe"
-& "$dotnet" tool restore
Highlight "Starting the synchronization of VMR.."
# Synchronize the VMR
$darcArgs = (
- "darc", "vmr", "forwardflow",
+ "vmr", "forwardflow",
"--tmp", $tmpDir,
"--$verbosity",
$vmrDir
@@ -124,7 +124,7 @@ if ($azdevPat) {
$darcArgs += ("--azdev-pat", $azdevPat)
}
-& "$dotnet" $darcArgs
+& "$darc" $darcArgs
if ($LASTEXITCODE -eq 0) {
Highlight "Synchronization succeeded"
diff --git a/eng/common/vmr-sync.sh b/eng/common/vmr-sync.sh
index 86d77ccf5b4..44239e331c0 100644
--- a/eng/common/vmr-sync.sh
+++ b/eng/common/vmr-sync.sh
@@ -164,9 +164,9 @@ set -e
highlight 'Installing .NET, preparing the tooling..'
source "./eng/common/tools.sh"
InitializeDotNetCli true
+GetDarc
dotnetDir=$( cd ./.dotnet/; pwd -P )
dotnet=$dotnetDir/dotnet
-"$dotnet" tool restore
highlight "Starting the synchronization of VMR.."
set +e
@@ -186,7 +186,9 @@ fi
# Synchronize the VMR
-"$dotnet" darc vmr forwardflow \
+export DOTNET_ROOT="$dotnetDir"
+
+"$darc_tool" vmr forwardflow \
--tmp "$tmp_dir" \
$azdev_pat \
--$verbosity \
diff --git a/global.json b/global.json
index d18020f5c59..e3af831b336 100644
--- a/global.json
+++ b/global.json
@@ -1,10 +1,15 @@
{
"sdk": {
- "version": "10.0.100-preview.3.25201.16",
- "allowPrerelease": true
+ "version": "10.0.100-preview.6.25315.102",
+ "allowPrerelease": true,
+ "paths": [
+ ".dotnet",
+ "$host$"
+ ],
+ "errorMessage": "The .NET SDK could not be found, please run ./eng/common/dotnet.sh."
},
"tools": {
- "dotnet": "10.0.100-preview.3.25201.16",
+ "dotnet": "10.0.100-preview.6.25315.102",
"vs": {
"version": "17.8",
"components": [
@@ -17,7 +22,7 @@
"perl": "5.38.2.2"
},
"msbuild-sdks": {
- "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25271.2",
+ "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25323.3",
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2"
}
}
diff --git a/src/Compiler/SyntaxTree/SyntaxTree.fsi b/src/Compiler/SyntaxTree/SyntaxTree.fsi
index 15c8cf4a02e..aa6f394d6c4 100644
--- a/src/Compiler/SyntaxTree/SyntaxTree.fsi
+++ b/src/Compiler/SyntaxTree/SyntaxTree.fsi
@@ -1731,7 +1731,15 @@ type SynModuleDecl =
/// An 'expr' within a module.
| Expr of expr: SynExpr * range: range
- /// One or more 'type' definitions within a module
+ ///
+ /// A type definition group ('type T1 ... and T2 ...') or a single 'type' definition within a module.
+ ///
+ ///
+ ///
+ /// Consecutive 'type' keywords (e.g. type T1 ... type T2 ...) are represented individually, with
+ /// separate Types syntax tree nodes for each.
+ /// Only the 'and' keyword causes multiple types to be aggregated into a single Types node.
+ ///
| Types of typeDefns: SynTypeDefn list * range: range
/// An 'exception' definition within a module
diff --git a/src/Compiler/Utilities/Activity.fs b/src/Compiler/Utilities/Activity.fs
index 121b52cf07f..818d22e6f81 100644
--- a/src/Compiler/Utilities/Activity.fs
+++ b/src/Compiler/Utilities/Activity.fs
@@ -89,7 +89,7 @@ module internal Activity =
let private activitySource = new ActivitySource(ActivityNames.FscSourceName)
- let start (name: string) (tags: (string * string) seq) : ActivityDisposable =
+ let start (name: string) (tags: (string * string) seq) : System.IDisposable | null =
let activity = activitySource.CreateActivity(name, ActivityKind.Internal)
match activity with
@@ -100,7 +100,7 @@ module internal Activity =
activity.Start()
- let startNoTags (name: string) : ActivityDisposable = activitySource.StartActivity name
+ let startNoTags (name: string) : System.IDisposable | null = activitySource.StartActivity name
let addEventWithTags name (tags: (string * objnull) seq) =
match Activity.Current with
@@ -127,7 +127,7 @@ module internal Activity =
let private profiledSource = new ActivitySource(ActivityNames.ProfiledSourceName)
- let startAndMeasureEnvironmentStats (name: string) : ActivityDisposable = profiledSource.StartActivity(name)
+ let startAndMeasureEnvironmentStats (name: string) : System.IDisposable | null = profiledSource.StartActivity(name)
type private GCStats = int[]
diff --git a/src/Compiler/Utilities/Activity.fsi b/src/Compiler/Utilities/Activity.fsi
index 773c7528869..83d4b2772ec 100644
--- a/src/Compiler/Utilities/Activity.fsi
+++ b/src/Compiler/Utilities/Activity.fsi
@@ -40,16 +40,16 @@ module internal Activity =
module Events =
val cacheHit: string
- val startNoTags: name: string -> ActivityDisposable
+ val startNoTags: name: string -> System.IDisposable | null
- val start: name: string -> tags: (string * string) seq -> ActivityDisposable
+ val start: name: string -> tags: (string * string) seq -> System.IDisposable | null
val addEvent: name: string -> unit
val addEventWithTags: name: string -> tags: (string * objnull) seq -> unit
module Profiling =
- val startAndMeasureEnvironmentStats: name: string -> ActivityDisposable
+ val startAndMeasureEnvironmentStats: name: string -> System.IDisposable | null
val addConsoleListener: unit -> IDisposable
module CsvExport =
diff --git a/src/Compiler/Utilities/NullnessShims.fs b/src/Compiler/Utilities/NullnessShims.fs
index 848bf650e98..7e96db2f495 100644
--- a/src/Compiler/Utilities/NullnessShims.fs
+++ b/src/Compiler/Utilities/NullnessShims.fs
@@ -23,12 +23,6 @@ module internal NullnessShims =
| _, null -> false
| x, y -> nonNullEqualityFunc !!x !!y
-#if BUILDING_WITH_LKG
- type ActivityDisposable = System.IDisposable
-#else
- type ActivityDisposable = System.IDisposable | null
-#endif
-
#if NET5_0_OR_GREATER
// Argument type for overriding System.Object.Equals(arg)
// Desktop frameworks as well as netstandard need plain 'obj' and are not annotated, NET5 and higher can use (obj|null)
diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/AbbreviationTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/AbbreviationTests.fs
new file mode 100644
index 00000000000..26966e72782
--- /dev/null
+++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/AbbreviationTests.fs
@@ -0,0 +1,189 @@
+// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
+
+module ErrorMessages.AbbreviationTests
+
+open Xunit
+open FSharp.Test.Compiler
+
+[]
+let ``Members 01`` () =
+ Fsx """
+type StringAlias = string
+
+type StringAlias with
+ member x.Length = x.Length
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 964, Line 4, Col 6, Line 4, Col 17, "Type abbreviations cannot have augmentations")
+ (Error 895, Line 5, Col 5, Line 5, Col 31, "Type abbreviations cannot have members")
+ ]
+
+[]
+let ``Members 02 - Interface impl`` () =
+ Fsx """
+type IntAlias = int
+
+type IntAlias with
+ interface System.IComparable with
+ member x.CompareTo(obj) = 0
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 964, Line 4, Col 6, Line 4, Col 14, "Type abbreviations cannot have augmentations")
+ (Error 906, Line 5, Col 15, Line 5, Col 33, "Type abbreviations cannot have interface declarations")
+ (Error 909, Line 5, Col 15, Line 5, Col 33, "All implemented interfaces should be declared on the initial declaration of the type")
+ ]
+
+[]
+let ``Members 03 - Members and interface`` () =
+ Fsx """
+type FloatAlias = float
+
+type FloatAlias with
+ member x.IsNaN = System.Double.IsNaN(x)
+ interface System.IConvertible
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 964, Line 4, Col 6, Line 4, Col 16, "Type abbreviations cannot have augmentations")
+ (Error 906, Line 6, Col 15, Line 6, Col 34, "Type abbreviations cannot have interface declarations")
+ (Error 909, Line 6, Col 15, Line 6, Col 34, "All implemented interfaces should be declared on the initial declaration of the type")
+ ]
+
+[]
+let ``Multiple types 01`` () =
+ Fsx """
+type ListAlias = int list
+type ArrayAlias = string[]
+
+type ListAlias with
+ member x.Head = x.Head
+
+type ArrayAlias with
+ member x.Length = x.Length
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 964, Line 5, Col 6, Line 5, Col 15, "Type abbreviations cannot have augmentations")
+ (Error 895, Line 6, Col 5, Line 6, Col 27, "Type abbreviations cannot have members")
+ (Error 964, Line 8, Col 6, Line 8, Col 16, "Type abbreviations cannot have augmentations")
+ (Error 895, Line 9, Col 5, Line 9, Col 31, "Type abbreviations cannot have members")
+ ]
+
+[]
+let ``Multiple types 02 - With interface`` () =
+ Fsx """
+type ArrayAlias = string[]
+
+type ArrayAlias with
+ interface System.Collections.IEnumerable with
+ member x.GetEnumerator() = null
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 964, Line 4, Col 6, Line 4, Col 16, "Type abbreviations cannot have augmentations")
+ (Error 906, Line 5, Col 15, Line 5, Col 45, "Type abbreviations cannot have interface declarations")
+ (Error 909, Line 5, Col 15, Line 5, Col 45, "All implemented interfaces should be declared on the initial declaration of the type")
+ ]
+[]
+let ``Nested 01`` () =
+ Fsx """
+namespace Test
+
+type Alias1 = int
+
+module Nested =
+ type Alias2 = string
+
+ type Alias1 with
+ member x.Value = x
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 964, Line 9, Col 10, Line 9, Col 16, "Type abbreviations cannot have augmentations");
+ (Error 895, Line 10, Col 9, Line 10, Col 27, "Type abbreviations cannot have members");
+ ]
+
+[]
+let ``Nested 02 - Different namespace`` () =
+ Fsx """
+namespace Test
+
+module Nested =
+ type Alias2 = string
+
+ type Alias2 with
+ interface System.IComparable with
+ member x.CompareTo(obj) = 0
+
+open Nested
+
+type Alias2 with
+ member x.ToUpper() = x.ToUpper()
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 964, Line 7, Col 10, Line 7, Col 16, "Type abbreviations cannot have augmentations");
+ (Error 906, Line 8, Col 19, Line 8, Col 37, "Type abbreviations cannot have interface declarations");
+ (Error 909, Line 8, Col 19, Line 8, Col 37, "All implemented interfaces should be declared on the initial declaration of the type");
+ (Error 964, Line 13, Col 6, Line 13, Col 12, "Type abbreviations cannot have augmentations");
+ (Error 895, Line 14, Col 5, Line 14, Col 37, "Type abbreviations cannot have members");
+ (Error 644, Line 14, Col 14, Line 14, Col 21, "Namespaces cannot contain extension members except in the same file and namespace declaration group where the type is defined. Consider using a module to hold declarations of extension members.");
+ ]
+
+[]
+let ``Generic 01`` () =
+ Fsx """
+type Result<'T> = Result<'T, string>
+
+type Result<'T> with
+ member x.IsOk = match x with Ok _ -> true | Error _ -> false
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 964, Line 4, Col 6, Line 4, Col 12, "Type abbreviations cannot have augmentations");
+ (Error 895, Line 5, Col 5, Line 5, Col 65, "Type abbreviations cannot have members");
+ ]
+
+[]
+let ``Generic 02 - Interface`` () =
+ Fsx """
+type MyList<'a> = 'a list
+
+type MyList<'a> with
+ interface seq<'a> with
+ member x.GetEnumerator() = (x :> seq<'a>).GetEnumerator()
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 964, Line 4, Col 6, Line 4, Col 12, "Type abbreviations cannot have augmentations");
+ (Error 906, Line 5, Col 15, Line 5, Col 22, "Type abbreviations cannot have interface declarations");
+ (Error 909, Line 5, Col 15, Line 5, Col 22, "All implemented interfaces should be declared on the initial declaration of the type")
+ ]
+
+[]
+let ``Property getters and setters`` () =
+ Fsx """
+type IntRef = int ref
+
+type IntRef with
+ member x.Value
+ with get() = !x
+ and set(v) = x := v
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 964, Line 4, Col 6, Line 4, Col 12, "Type abbreviations cannot have augmentations")
+ (Error 895, Line 5, Col 5, Line 6, Col 1, "Type abbreviations cannot have members")
+ ]
\ No newline at end of file
diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/NamespaceTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/NamespaceTests.fs
new file mode 100644
index 00000000000..f989220189e
--- /dev/null
+++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/NamespaceTests.fs
@@ -0,0 +1,83 @@
+// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
+
+module ErrorMessages.NamespaceTests
+
+open Xunit
+open FSharp.Test.Compiler
+
+[]
+let ``Value bindings 01`` () =
+ Fsx """
+namespace TestNamespace
+
+let x = 1
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 201, Line 4, Col 5, Line 4, Col 6, "Namespaces cannot contain values. Consider using a module to hold your value declarations.")
+ ]
+
+[]
+let ``Value bindings 02 - Multiple`` () =
+ Fsx """
+namespace TestNamespace
+
+let x = 1
+let y = 2
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 201, Line 4, Col 5, Line 4, Col 6, "Namespaces cannot contain values. Consider using a module to hold your value declarations.")
+ (Error 201, Line 5, Col 5, Line 5, Col 6, "Namespaces cannot contain values. Consider using a module to hold your value declarations.")
+ ]
+
+[]
+let ``Function bindings`` () =
+ Fsx """
+namespace TestNamespace
+
+let add x y = x + y
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 201, Line 4, Col 5, Line 4, Col 12, "Namespaces cannot contain values. Consider using a module to hold your value declarations.")
+ ]
+
+[]
+let ``Multiple namespaces`` () =
+ Fsx """
+namespace Namespace1
+
+let x = 1
+
+namespace Namespace2
+
+let y = 2
+
+namespace Namespace3
+
+let z = 3
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 201, Line 4, Col 5, Line 4, Col 6, "Namespaces cannot contain values. Consider using a module to hold your value declarations.")
+ (Error 201, Line 8, Col 5, Line 8, Col 6, "Namespaces cannot contain values. Consider using a module to hold your value declarations.")
+ (Error 201, Line 12, Col 5, Line 12, Col 6, "Namespaces cannot contain values. Consider using a module to hold your value declarations.")
+ ]
+
+[]
+let ``Do expressions`` () =
+ Fsx """
+namespace TestNamespace
+
+do printfn "test"
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 201, Line 4, Col 1, Line 4, Col 18, "Namespaces cannot contain values. Consider using a module to hold your value declarations.")
+ ]
\ No newline at end of file
diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnitOfMeasureTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnitOfMeasureTests.fs
index 36ef76e772d..8e49da35fbd 100644
--- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnitOfMeasureTests.fs
+++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/UnitOfMeasureTests.fs
@@ -6,7 +6,7 @@ open Xunit
open FSharp.Test.Compiler
[]
-let ``Error - Expected unit-of-measure type parameter must be marked with the [] attribute.`` () =
+let ``Missing Measure attribute on type parameter`` () =
Fsx """
type A<[]'u>(x : int<'u>) =
member this.X = x
@@ -33,7 +33,7 @@ type FooExt =
]
[]
-let ``Expected unit-of-measure type parameter must be marked with the [] attribute.`` () =
+let ``With Measure attribute on type parameter`` () =
Fsx """
type A<[]'u>(x : int<'u>) =
member this.X = x
@@ -50,3 +50,194 @@ type FooExt =
|> typecheck
|> shouldSucceed
+[]
+let ``Instance members 01`` () =
+ Fsx """
+[]
+type kg =
+ member x.Value = 1.0
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 897, Line 4, Col 5, Line 4, Col 25, "Measure declarations may have only static members")
+ ]
+
+[]
+let ``Instance members 02 - Multiple`` () =
+ Fsx """
+[]
+type kg =
+ member x.Value = 1.0
+ member x.GetWeight() = 2.0
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 897, Line 4, Col 5, Line 4, Col 25, "Measure declarations may have only static members")
+ (Error 897, Line 5, Col 5, Line 5, Col 31, "Measure declarations may have only static members")
+ ]
+
+[]
+let ``Constructors`` () =
+ Fsx """
+[]
+type meter =
+ new() = { }
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 904, Line 4, Col 5, Line 4, Col 16, "Measure declarations may have only static members: constructors are not available")
+ ]
+
+[]
+let ``Type parameters`` () =
+ Fsx """
+[]
+type meter<'a> =
+ class end
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 928, Line 3, Col 6, Line 3, Col 11, "Measure definitions cannot have type parameters");
+ ]
+
+[]
+let ``Inherit declarations`` () =
+ Fsx """
+[]
+type Fahrenheit =
+ inherit Foo()
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 962, Line 4, Col 5, Line 4, Col 18, "This 'inherit' declaration has arguments, but is not in a type with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'.")
+ (Error 39, Line 4, Col 13, Line 4, Col 16, "The type 'Foo' is not defined.")
+ (Error 897, Line 4, Col 5, Line 4, Col 18, "Measure declarations may have only static members")
+ ]
+
+[]
+let ``Instance let bindings`` () =
+ Fsx """
+[]
+type Celsius =
+ let instanceValue = 10
+ do printfn "init"
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 963, Line 4, Col 5, Line 4, Col 27, "This definition may only be used in a type with a primary constructor. Consider adding arguments to your type definition, e.g. 'type X(args) = ...'.")
+ (Error 897, Line 4, Col 5, Line 4, Col 27, "Measure declarations may have only static members")
+ (Error 897, Line 5, Col 5, Line 5, Col 22, "Measure declarations may have only static members")
+ ]
+
+[]
+let ``Mixed valid and invalid 01`` () =
+ Fsx """
+[]
+type Kelvin =
+ static member AbsoluteZero = -273.15 // OK
+ member x.Value = 0.0 // Error: instance member
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 897, Line 5, Col 5, Line 5, Col 25, "Measure declarations may have only static members")
+ ]
+
+[]
+let ``Mixed valid and invalid 02 - Constructor`` () =
+ Fsx """
+[]
+type Kelvin =
+ static member AbsoluteZero = -273.15 // OK
+ new() = { } // Error: constructor
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 904, Line 5, Col 5, Line 5, Col 16, "Measure declarations may have only static members: constructors are not available")
+ ]
+[]
+let ``Implicit constructor`` () =
+ Fsx """
+[]
+type newton() =
+ let force = 10.0
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 897, Line 3, Col 6, Line 3, Col 12, "Measure declarations may have only static members")
+ (Error 897, Line 4, Col 5, Line 4, Col 21, "Measure declarations may have only static members")
+ ]
+
+[]
+let ``Augmentations 01`` () =
+ Fsx """
+[]
+type joule
+
+type joule with
+ member x.Energy = 1.0
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 897, Line 6, Col 5, Line 6, Col 26, "Measure declarations may have only static members")
+ ]
+
+[]
+let ``Augmentations 02 - Multiple errors`` () =
+ Fsx """
+[]
+type joule
+
+type joule with
+ member x.Energy = 1.0
+ new() = { }
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 897, Line 6, Col 5, Line 6, Col 26, "Measure declarations may have only static members")
+ (Error 904, Line 7, Col 5, Line 7, Col 16, "Measure declarations may have only static members: constructors are not available")
+ ]
+
+[]
+let ``Complex with type parameters`` () =
+ Fsx """
+[]
+type pascal<'a> =
+ new() = { }
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 928, Line 3, Col 6, Line 3, Col 12, "Measure definitions cannot have type parameters")
+ (Error 904, Line 4, Col 5, Line 4, Col 16, "Measure declarations may have only static members: constructors are not available")
+ ]
+
+[]
+let ``Let binding order`` () =
+ Fsx """
+[]
+type volt =
+ static let y = 2 // OK
+ let z = 3
+ member this.Voltage = 0.0
+ static member Current = 1.0 // OK
+ do printfn "hello"
+ """
+ |> typecheck
+ |> shouldFail
+ |> withDiagnostics [
+ (Error 960, Line 8, Col 5, Line 8, Col 23, "'let' and 'do' bindings must come before member and interface definitions in type definitions")
+ (Error 897, Line 5, Col 5, Line 5, Col 14, "Measure declarations may have only static members")
+ (Error 897, Line 8, Col 5, Line 8, Col 23, "Measure declarations may have only static members")
+ (Error 897, Line 6, Col 5, Line 6, Col 30, "Measure declarations may have only static members")
+ ]
\ No newline at end of file
diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj
index 952624f9fcd..f0cb13ea71e 100644
--- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj
+++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj
@@ -226,6 +226,8 @@
+
+