Skip to content

Commit

Permalink
Merge branch 'main' into fix-18198
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarfgp authored Jan 27, 2025
2 parents bdf1189 + 06e27ed commit 8a6d628
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 68 deletions.
10 changes: 10 additions & 0 deletions DEVGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@ or
> Please note, that by default, **Release** version of IL baseline tests will be running in CI, so when updating baseline (.bsl) files, make sure to add `-c Release` flag to the build command.

### Parallel execution of tests

Tests utilizing xUnit framework by default run in parallel. If your tests depend on some shared state or are time-critical, you can add the module to predefined `NotThreadSafeResourceCollection` to prevent parallel execution.
For example:
```fsharp
[<Collection(nameof NotThreadSafeResourceCollection)>]
module TimeCritical =
```


### Updating FCS surface area baselines

```bash
Expand Down
5 changes: 0 additions & 5 deletions src/Compiler/Service/IncrementalBuild.fs
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,6 @@ type TcInfoExtras =
member x.TcSymbolUses =
x.tcSymbolUses

module ValueOption =
let toOption = function
| ValueSome x -> Some x
| _ -> None

type private SingleFileDiagnostics = (PhasedDiagnostic * FSharpDiagnosticSeverity) array
type private TypeCheck = TcInfo * TcResultsSinkImpl * CheckedImplFile option * string * SingleFileDiagnostics

Expand Down
6 changes: 3 additions & 3 deletions src/Compiler/TypedTree/TypedTree.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2122,7 +2122,7 @@ type ModuleOrNamespaceType(kind: ModuleOrNamespaceKind, vals: QueueList<Val>, en
|> List.tryFind (fun v -> match key.TypeForLinkage with
| None -> true
| Some keyTy -> ccu.MemberSignatureEquality(keyTy, v.Type))
|> ValueOptionInternal.ofOption
|> ValueOption.ofOption

/// Get a table of values indexed by logical name
member _.AllValsByLogicalName =
Expand Down Expand Up @@ -4237,7 +4237,7 @@ type UnionCaseRef =
/// Try to dereference the reference
member x.TryUnionCase =
x.TyconRef.TryDeref
|> ValueOptionInternal.bind (fun tcref -> tcref.GetUnionCaseByName x.CaseName |> ValueOptionInternal.ofOption)
|> ValueOption.bind (fun tcref -> tcref.GetUnionCaseByName x.CaseName |> ValueOption.ofOption)

/// Get the attributes associated with the union case
member x.Attribs = x.UnionCase.Attribs
Expand Down Expand Up @@ -4300,7 +4300,7 @@ type RecdFieldRef =
/// Try to dereference the reference
member x.TryRecdField =
x.TyconRef.TryDeref
|> ValueOptionInternal.bind (fun tcref -> tcref.GetFieldByName x.FieldName |> ValueOptionInternal.ofOption)
|> ValueOption.bind (fun tcref -> tcref.GetFieldByName x.FieldName |> ValueOption.ofOption)

/// Get the attributes associated with the compiled property of the record field
member x.PropertyAttribs = x.RecdField.PropertyAttribs
Expand Down
6 changes: 3 additions & 3 deletions src/Compiler/TypedTree/TypedTreeOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3526,11 +3526,11 @@ let IsMatchingFSharpAttributeOpt g attrOpt (Attrib(tcref2, _, _, _, _, _, _)) =

[<return: Struct>]
let (|ExtractAttribNamedArg|_|) nm args =
args |> List.tryPick (function AttribNamedArg(nm2, _, _, v) when nm = nm2 -> Some v | _ -> None) |> ValueOptionInternal.ofOption
args |> List.tryPick (function AttribNamedArg(nm2, _, _, v) when nm = nm2 -> Some v | _ -> None) |> ValueOption.ofOption

[<return: Struct>]
let (|ExtractILAttributeNamedArg|_|) nm (args: ILAttributeNamedArg list) =
args |> List.tryPick (function nm2, _, _, v when nm = nm2 -> Some v | _ -> None) |> ValueOptionInternal.ofOption
args |> List.tryPick (function nm2, _, _, v when nm = nm2 -> Some v | _ -> None) |> ValueOption.ofOption

[<return: Struct>]
let (|StringExpr|_|) = function Expr.Const (Const.String n, _, _) -> ValueSome n | _ -> ValueNone
Expand Down
12 changes: 0 additions & 12 deletions src/Compiler/Utilities/illib.fs
Original file line number Diff line number Diff line change
Expand Up @@ -715,18 +715,6 @@ module Span =

state

module ValueOptionInternal =

let inline ofOption x =
match x with
| Some x -> ValueSome x
| None -> ValueNone

let inline bind ([<InlineIfLambda>] f) x =
match x with
| ValueSome x -> f x
| ValueNone -> ValueNone

module String =
let make (n: int) (c: char) : string = String(c, n)

Expand Down
6 changes: 0 additions & 6 deletions src/Compiler/Utilities/illib.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,6 @@ module internal ResizeArray =
module internal Span =
val inline exists: predicate: ('T -> bool) -> span: Span<'T> -> bool

module internal ValueOptionInternal =

val inline ofOption: x: 'a option -> 'a voption

val inline bind: f: ('a -> 'b voption) -> x: 'a voption -> 'b voption

module internal String =

val make: n: int -> c: char -> string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,23 @@ module CustomAttributes_AttributeUsage =
|> verifyCompileAndRun
|> shouldSucceed

// SOURCE=AssemblyVersion03.fs # AssemblyVersion03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion03.fs"|])>]
let ``AssemblyVersion03_fs`` compilation =
compilation
|> withOptions ["--nowarn:52"]
|> verifyCompileAndRun
|> shouldSucceed

// SOURCE=AssemblyVersion04.fs # AssemblyVersion04.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion04.fs"|])>]
let ``AssemblyVersion04_fs`` compilation =
compilation
|> withOptions ["--nowarn:52"]
|> verifyCompileAndRun
|> shouldSucceed
[<Collection(nameof NotThreadSafeResourceCollection)>]
module TimeCritical =
// SOURCE=AssemblyVersion03.fs # AssemblyVersion03.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion03.fs"|])>]
let ``AssemblyVersion03_fs`` compilation =
compilation
|> withOptions ["--nowarn:52"]
|> verifyCompileAndRun
|> shouldSucceed

// SOURCE=AssemblyVersion04.fs # AssemblyVersion04.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AssemblyVersion04.fs"|])>]
let ``AssemblyVersion04_fs`` compilation =
compilation
|> withOptions ["--nowarn:52"]
|> verifyCompileAndRun
|> shouldSucceed

// SOURCE=AttributeTargetsIsCtor01.fs # AttributeTargetsIsCtor01.fs
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"AttributeTargetsIsCtor01.fs"|])>]
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.Test.Utilities/Utilities.fs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ let main argv = 0"""
Project directory: %s{projectDirectory}
STDOUT: %s{output}
STDERR: %s{errors}
An error occurred getting netcoreapp references: %A{e}
An error occurred getting netcoreapp references (compare the output of `dotnet --list-sdks` and/or the contents of the local `/.dotnet` directory against what is in `global.json`): %A{e}
"""
raise (Exception (message, e))
finally
Expand Down
13 changes: 0 additions & 13 deletions vsintegration/src/FSharp.Editor/Common/Extensions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -327,19 +327,6 @@ module Option =
else
None

[<RequireQualifiedAccess>]
module ValueOption =

let inline ofOption o =
match o with
| Some v -> ValueSome v
| _ -> ValueNone

let inline toOption o =
match o with
| ValueSome v -> Some v
| _ -> None

[<RequireQualifiedAccess>]
module IEnumerator =
let chooseV f (e: IEnumerator<'T>) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@ type Mode =
| WithSettings of CodeFixesOptions

module ValueOption =
let inline toOption o =
match o with
| ValueSome v -> Some v
| _ -> None

let inline ofOption o =
match o with
| Some v -> ValueSome v
| _ -> ValueNone

let inline either f y o =
match o with
| ValueSome v -> f v
Expand Down

0 comments on commit 8a6d628

Please sign in to comment.