Skip to content

Commit

Permalink
Merge branch 'main' into ber.a-metadata-extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
psfinaki authored Jun 21, 2024
2 parents 385cb52 + 85bc468 commit 3bd447f
Show file tree
Hide file tree
Showing 110 changed files with 2,233 additions and 804 deletions.
7 changes: 7 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
<OtherFlags Condition="'$(BuildNoRealsig)' != 'true'">$(OtherFlags) --realsig+</OtherFlags>
</PropertyGroup>

<PropertyGroup>
<!-- Set PublishReadyToRun to speed up the build. -->
<EnablePublishReadyToRun>true</EnablePublishReadyToRun>
<!-- Crossgen2 is not built with source-built Mono-based .NET SDKs. -->
<EnablePublishReadyToRun Condition="'$(SourceBuildUseMonoRuntime)' == 'true'">false</EnablePublishReadyToRun>
</PropertyGroup>

<Import Project="$(RepoRoot)/Directory.Build.props.user" Condition="Exists('$(RepoRoot)/Directory.Build.props.user')" />

<PropertyGroup Condition="'$(BUILDING_USING_DOTNET)' == 'true'">
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ stages:
# MacOS
- job: MacOS
pool:
vmImage: macos-11
vmImage: macos-12
variables:
- name: _SignType
value: Test
Expand Down Expand Up @@ -642,7 +642,7 @@ stages:
# Plain FCS build Mac
- job: Plain_Build_MacOS
pool:
vmImage: macos-11
vmImage: macos-12
variables:
- name: _BuildConfig
value: Debug
Expand Down Expand Up @@ -722,4 +722,4 @@ stages:
targetPath: './artifacts/log/Release/AheadOfTime/Trimming/'
artifactName: 'Trim Test Logs Attempt $(System.JobAttempt) Logs $(_kind)'
continueOnError: true
condition: always()
condition: always()
2 changes: 1 addition & 1 deletion buildtools/AssemblyCheck/AssemblyCheck.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<PropertyGroup>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishReadyToRun>$(EnablePublishReadyToRun)</PublishReadyToRun>
<RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion buildtools/fslex/fslex.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<PropertyGroup>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishReadyToRun>$(EnablePublishReadyToRun)</PublishReadyToRun>
<RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion buildtools/fsyacc/fsyacc.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<PropertyGroup>
<PublishReadyToRun>true</PublishReadyToRun>
<PublishReadyToRun>$(EnablePublishReadyToRun)</PublishReadyToRun>
<RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
</PropertyGroup>

Expand Down
3 changes: 3 additions & 0 deletions docs/release-notes/.FSharp.Compiler.Service/8.0.400.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Fixed

* Extended #help directive in fsi to show documentation in the REPL. ([PR #17140](https://github.com/dotnet/fsharp/pull/17140))
* Fix internal error when dotting into delegates with multiple type parameters. ([PR #17227](https://github.com/dotnet/fsharp/pull/17227))
* Error for partial implementation of interface with static and non-static abstract members. ([Issue #17138](https://github.com/dotnet/fsharp/issues/17138), [PR #17160](https://github.com/dotnet/fsharp/pull/17160))
* Optimize simple mappings with preludes in computed collections. ([PR #17067](https://github.com/dotnet/fsharp/pull/17067))
Expand All @@ -20,6 +21,8 @@
### Added

* Generate new `Equals` overload to avoid boxing for structural comparison ([PR #16857](https://github.com/dotnet/fsharp/pull/16857))
* Allow #nowarn to support the FS prefix on error codes to disable warnings ([Issue #17206](https://github.com/dotnet/fsharp/issues/16447), [PR #17209](https://github.com/dotnet/fsharp/pull/17209))
* Allow ParsedHashDirectives to have argument types other than strings ([Issue #17240](https://github.com/dotnet/fsharp/issues/16447), [PR #17209](https://github.com/dotnet/fsharp/pull/17209))
* Parser: better recovery for unfinished patterns ([PR #17231](https://github.com/dotnet/fsharp/pull/17231))
* Parser: recover on empty match clause ([PR #17233](https://github.com/dotnet/fsharp/pull/17233))

Expand Down
2 changes: 2 additions & 0 deletions docs/release-notes/.Language/preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Bidirectional F#/C# interop for 'unmanaged' constraint. ([PR #12154](https://github.com/dotnet/fsharp/pull/12154))
* Make `.Is*` discriminated union properties visible. ([Language suggestion #222](https://github.com/fsharp/fslang-suggestions/issues/222), [PR #16341](https://github.com/dotnet/fsharp/pull/16341))
* Allow returning bool instead of unit option for partial active patterns. ([Language suggestion #1041](https://github.com/fsharp/fslang-suggestions/issues/1041), [PR #16473](https://github.com/dotnet/fsharp/pull/16473))
* Allow #nowarn to support the FS prefix on error codes to disable warnings ([Issue #17206](https://github.com/dotnet/fsharp/issues/16447), [PR #17209](https://github.com/dotnet/fsharp/pull/17209))
* Allow ParsedHashDirectives to have argument types other than strings ([Issue #17240](https://github.com/dotnet/fsharp/issues/16447), [PR #17209](https://github.com/dotnet/fsharp/pull/17209))

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion eng/SourceBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
-bl enables the binlogs for the tools and Proto builds, which make debugging failures here easier
-->
<Exec
Command="./build.sh --bootstrap --skipBuild -bl $(SourceBuildBootstrapTfmArg)"
Command="./build.sh --bootstrap --skipBuild -bl $(SourceBuildBootstrapTfmArg) /p:SourceBuildUseMonoRuntime=$(SourceBuildUseMonoRuntime)"
WorkingDirectory="$(InnerSourceBuildRepoRoot)"
EnvironmentVariables="@(InnerBuildEnv);DotNetBuildFromSource=true" />
</Target>
Expand Down
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.24310.5">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="8.0.0-beta.24311.3">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>9f6799fdc16ae19b3e9478c55b997a6aab839d09</Sha>
<Sha>c214b6ad17aedca4fa48294d80f6c52ef2463081</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="1.0.0-beta.23475.1" CoherentParentDependency="Microsoft.DotNet.Arcade.Sdk">
Expand Down
2 changes: 1 addition & 1 deletion eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ function BuildSolution {
fi

BuildMessage="Error building tools"
local args=" publish $repo_root/proto.proj $blrestore $bltools /p:Configuration=Proto /p:ArcadeBuildFromSource=$source_build"
local args=" publish $repo_root/proto.proj $blrestore $bltools /p:Configuration=Proto /p:ArcadeBuildFromSource=$source_build $properties"
echo $args
"$DOTNET_INSTALL_DIR/dotnet" $args #$args || exit $?
fi
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"perl": "5.38.2.2"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24310.5",
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24311.3",
"Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.23255.2"
}
}
21 changes: 12 additions & 9 deletions src/Compiler/Driver/CompilerConfig.fs
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,19 @@ let ResolveFileUsingPaths (paths, m, fileName) =
let searchMessage = String.concat "\n " paths
raise (FileNameNotResolved(fileName, searchMessage, m))

let GetWarningNumber (m, warningNumber: string) =
let GetWarningNumber (m, warningNumber: string, prefixSupported) =
try
// Okay so ...
// #pragma strips FS of the #pragma "FS0004" and validates the warning number
// therefore if we have warning id that starts with a numeric digit we convert it to Some (int32)
// anything else is ignored None
let warningNumber =
if warningNumber.StartsWithOrdinal "FS" then
if prefixSupported then
warningNumber.Substring 2
else
raise (new ArgumentException())
else
warningNumber

if Char.IsDigit(warningNumber[0]) then
Some(int32 warningNumber)
elif warningNumber.StartsWithOrdinal "FS" then
raise (ArgumentException())
else
None
with _ ->
Expand Down Expand Up @@ -918,7 +921,7 @@ type TcConfigBuilder =
member tcConfigB.TurnWarningOff(m, s: string) =
use _ = UseBuildPhase BuildPhase.Parameter

match GetWarningNumber(m, s) with
match GetWarningNumber(m, s, tcConfigB.langVersion.SupportsFeature(LanguageFeature.ParsedHashDirectiveArgumentNonQuotes)) with
| None -> ()
| Some n ->
// nowarn:62 turns on mlCompatibility, e.g. shows ML compat items in intellisense menus
Expand All @@ -933,7 +936,7 @@ type TcConfigBuilder =
member tcConfigB.TurnWarningOn(m, s: string) =
use _ = UseBuildPhase BuildPhase.Parameter

match GetWarningNumber(m, s) with
match GetWarningNumber(m, s, tcConfigB.langVersion.SupportsFeature(LanguageFeature.ParsedHashDirectiveArgumentNonQuotes)) with
| None -> ()
| Some n ->
// warnon 62 turns on mlCompatibility, e.g. shows ML compat items in intellisense menus
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/Driver/CompilerConfig.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ val TryResolveFileUsingPaths: paths: string seq * m: range * fileName: string ->

val ResolveFileUsingPaths: paths: string seq * m: range * fileName: string -> string

val GetWarningNumber: m: range * warningNumber: string -> int option
val GetWarningNumber: m: range * warningNumber: string * prefixSupported: bool -> int option

/// Get the name used for FSharp.Core
val GetFSharpCoreLibraryName: unit -> string
Expand Down
122 changes: 83 additions & 39 deletions src/Compiler/Driver/ParseAndCheckInputs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,26 @@ let PostParseModuleSpec (_i, defaultNamespace, isLastCompiland, fileName, intf)

SynModuleOrNamespaceSig(lid, isRecursive, kind, decls, xmlDoc, attributes, None, range, trivia)

let GetScopedPragmasForHashDirective hd =
let GetScopedPragmasForHashDirective hd (langVersion: LanguageVersion) =
let supportsNonStringArguments =
langVersion.SupportsFeature(LanguageFeature.ParsedHashDirectiveArgumentNonQuotes)

[
match hd with
| ParsedHashDirective("nowarn", numbers, m) ->
for s in numbers do
match s with
| ParsedHashDirectiveArgument.SourceIdentifier _ -> ()
| ParsedHashDirectiveArgument.String(s, _, _) ->
match GetWarningNumber(m, s) with
| None -> ()
| Some n -> ScopedPragma.WarningOff(m, n)
let warningNumber =
match supportsNonStringArguments, s with
| _, ParsedHashDirectiveArgument.SourceIdentifier _ -> None
| true, ParsedHashDirectiveArgument.LongIdent _ -> None
| true, ParsedHashDirectiveArgument.Int32(n, _) -> GetWarningNumber(m, string n, true)
| true, ParsedHashDirectiveArgument.Ident(s, _) -> GetWarningNumber(m, s.idText, true)
| _, ParsedHashDirectiveArgument.String(s, _, _) -> GetWarningNumber(m, s, true)
| _ -> None

match warningNumber with
| None -> ()
| Some n -> ScopedPragma.WarningOff(m, n)
| _ -> ()
]

Expand Down Expand Up @@ -272,10 +281,10 @@ let PostParseModuleImpls
for SynModuleOrNamespace(decls = decls) in impls do
for d in decls do
match d with
| SynModuleDecl.HashDirective(hd, _) -> yield! GetScopedPragmasForHashDirective hd
| SynModuleDecl.HashDirective(hd, _) -> yield! GetScopedPragmasForHashDirective hd lexbuf.LanguageVersion
| _ -> ()
for hd in hashDirectives do
yield! GetScopedPragmasForHashDirective hd
yield! GetScopedPragmasForHashDirective hd lexbuf.LanguageVersion
]

let conditionalDirectives = LexbufIfdefStore.GetTrivia(lexbuf)
Expand Down Expand Up @@ -323,10 +332,10 @@ let PostParseModuleSpecs
for SynModuleOrNamespaceSig(decls = decls) in specs do
for d in decls do
match d with
| SynModuleSigDecl.HashDirective(hd, _) -> yield! GetScopedPragmasForHashDirective hd
| SynModuleSigDecl.HashDirective(hd, _) -> yield! GetScopedPragmasForHashDirective hd lexbuf.LanguageVersion
| _ -> ()
for hd in hashDirectives do
yield! GetScopedPragmasForHashDirective hd
yield! GetScopedPragmasForHashDirective hd lexbuf.LanguageVersion
]

let conditionalDirectives = LexbufIfdefStore.GetTrivia(lexbuf)
Expand Down Expand Up @@ -888,55 +897,90 @@ let ProcessMetaCommandsFromInput

try
match hash with
| ParsedHashDirective("I", ParsedHashDirectiveArguments args, m) ->
| ParsedHashDirective("I", [ path ], m) ->
if not canHaveScriptMetaCommands then
errorR (HashIncludeNotAllowedInNonScript m)
else
let arguments = parsedHashDirectiveStringArguments [ path ] tcConfig.langVersion

match args with
| [ path ] ->
matchedm <- m
tcConfig.AddIncludePath(m, path, pathOfMetaCommandSource)
state
| _ ->
errorR (Error(FSComp.SR.buildInvalidHashIDirective (), m))
state
| ParsedHashDirective("nowarn", ParsedHashDirectiveArguments numbers, m) ->
List.fold (fun state d -> nowarnF state (m, d)) state numbers
match arguments with
| [ path ] ->
matchedm <- m
tcConfig.AddIncludePath(m, path, pathOfMetaCommandSource)
| _ -> errorR (Error(FSComp.SR.buildInvalidHashIDirective (), m))

| ParsedHashDirective(("reference" | "r"), ParsedHashDirectiveArguments args, m) ->
matchedm <- m
ProcessDependencyManagerDirective Directive.Resolution args m state
state

| ParsedHashDirective("i", ParsedHashDirectiveArguments args, m) ->
matchedm <- m
ProcessDependencyManagerDirective Directive.Include args m state
| ParsedHashDirective("nowarn", hashArguments, m) ->
let arguments = parsedHashDirectiveArguments hashArguments tcConfig.langVersion
List.fold (fun state d -> nowarnF state (m, d)) state arguments

| ParsedHashDirective("load", ParsedHashDirectiveArguments args, m) ->
| ParsedHashDirective(("reference" | "r") as c, [], m) ->
if not canHaveScriptMetaCommands then
errorR (HashDirectiveNotAllowedInNonScript m)
else
let arg = (parsedHashDirectiveArguments [] tcConfig.langVersion)
warning (Error((FSComp.SR.fsiInvalidDirective (c, String.concat " " arg)), m))

state

| ParsedHashDirective(("reference" | "r"), [ reference ], m) ->
if not canHaveScriptMetaCommands then
errorR (HashDirectiveNotAllowedInNonScript m)
state
else
let arguments =
parsedHashDirectiveStringArguments [ reference ] tcConfig.langVersion

match arguments with
| [ reference ] ->
matchedm <- m
ProcessDependencyManagerDirective Directive.Resolution [ reference ] m state
| _ -> state

match args with
| _ :: _ ->
| ParsedHashDirective("i", [ path ], m) ->
if not canHaveScriptMetaCommands then
errorR (HashDirectiveNotAllowedInNonScript m)
state
else
matchedm <- m
args |> List.iter (fun path -> loadSourceF state (m, path))
| _ -> errorR (Error(FSComp.SR.buildInvalidHashloadDirective (), m))
let arguments = parsedHashDirectiveStringArguments [ path ] tcConfig.langVersion

match arguments with
| [ path ] -> ProcessDependencyManagerDirective Directive.Include [ path ] m state
| _ -> state

| ParsedHashDirective("load", paths, m) ->
if not canHaveScriptMetaCommands then
errorR (HashDirectiveNotAllowedInNonScript m)
else
let arguments = parsedHashDirectiveArguments paths tcConfig.langVersion

match arguments with
| _ :: _ ->
matchedm <- m
arguments |> List.iter (fun path -> loadSourceF state (m, path))
| _ -> errorR (Error(FSComp.SR.buildInvalidHashloadDirective (), m))

state
| ParsedHashDirective("time", ParsedHashDirectiveArguments args, m) ->

| ParsedHashDirective("time", switch, m) ->
if not canHaveScriptMetaCommands then
errorR (HashDirectiveNotAllowedInNonScript m)
else
let arguments = parsedHashDirectiveArguments switch tcConfig.langVersion

match args with
| [] -> ()
| [ "on" | "off" ] -> ()
| _ -> errorR (Error(FSComp.SR.buildInvalidHashtimeDirective (), m))
match arguments with
| [] -> matchedm <- m
| [ "on" | "off" ] -> matchedm <- m
| _ -> errorR (Error(FSComp.SR.buildInvalidHashtimeDirective (), m))

state

| _ ->

(* warning(Error("This meta-command has been ignored", m)) *)
state

with RecoverableException e ->
errorRecovery e matchedm
state
Expand Down
3 changes: 3 additions & 0 deletions src/Compiler/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1752,3 +1752,6 @@ featureReuseSameFieldsInStructUnions,"Share underlying fields in a [<Struct>] di
3868,tcActivePatternArgsCountNotMatchOnlyPat,"This active pattern expects exactly one pattern argument, e.g., '%s pat'."
3868,tcActivePatternArgsCountNotMatchArgs,"This active pattern expects %d expression argument(s), e.g., '%s%s'."
3868,tcActivePatternArgsCountNotMatchArgsAndPat,"This active pattern expects %d expression argument(s) and a pattern argument, e.g., '%s%s pat'."
featureParsedHashDirectiveArgumentNonString,"# directives with non-quoted string arguments"
3869,featureParsedHashDirectiveUnexpectedInteger,"Unexpected integer literal '%d'."
3869,featureParsedHashDirectiveUnexpectedIdentifier,"Unexpected identifier '%s'."
Loading

0 comments on commit 3bd447f

Please sign in to comment.