Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update packages and fix some inlining/private stuff that the 8.0.300 … #1293

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ framework: netstandard2.0, netstandard2.1, net6.0, net7.0, net8.0

source https://api.nuget.org/v3/index.json
# this is the FCS nightly feed, re-enable at your own risk!
source: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json
# source: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json
#source: ./libs
storage: none
strategy: min
Expand All @@ -13,7 +13,7 @@ lowest_matching: true

nuget BenchmarkDotNet 0.13.5
nuget Fantomas.Client >= 0.9
nuget FSharp.Compiler.Service >= 43.8.300-preview.24205.4
nuget FSharp.Compiler.Service >= 43.8.300
nuget Ionide.Analyzers 0.10.0
nuget FSharp.Analyzers.Build 0.3.0
nuget Ionide.ProjInfo >= 0.64.0
Expand Down
21 changes: 10 additions & 11 deletions paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,22 @@ NUGET
FParsec (1.1.1) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net5.0)) (&& (== netstandard2.1) (>= net5.0))
FSharp.Core (>= 4.3.4)
FSharp.Analyzers.Build (0.3)
FSharp.Compiler.Service (43.8.300)
FSharp.Core (8.0.300)
System.Buffers (>= 4.5.1)
System.Collections.Immutable (>= 7.0)
System.Diagnostics.DiagnosticSource (>= 7.0.2)
System.Memory (>= 4.5.5)
System.Reflection.Emit (>= 4.7)
System.Reflection.Metadata (>= 7.0)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
FSharp.Control.AsyncSeq (3.2.1)
FSharp.Core (>= 4.7.2)
Microsoft.Bcl.AsyncInterfaces (>= 5.0)
FSharp.Control.Reactive (5.0.5) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0))
FSharp.Core (>= 4.7.2)
System.Reactive (>= 5.0 < 6.0)
FSharp.Core (8.0.300)
FSharp.Data.Adaptive (1.2.13)
FSharp.Core (>= 4.7)
System.Reflection.Emit.Lightweight (>= 4.6)
Expand Down Expand Up @@ -751,14 +761,3 @@ NUGET
Expecto (>= 10.0 < 11.0) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0))
FSharp.Core (>= 7.0.200) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0))
System.Collections.Immutable (>= 6.0) - restriction: || (== net6.0) (== net7.0) (== net8.0) (&& (== netstandard2.0) (>= net6.0)) (&& (== netstandard2.1) (>= net6.0))
remote: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json
FSharp.Compiler.Service (43.8.300-preview.24205.4)
FSharp.Core (8.0.300-beta.24205.4)
System.Buffers (>= 4.5.1)
System.Collections.Immutable (>= 7.0)
System.Diagnostics.DiagnosticSource (>= 7.0.2)
System.Memory (>= 4.5.5)
System.Reflection.Emit (>= 4.7)
System.Reflection.Metadata (>= 7.0)
System.Runtime.CompilerServices.Unsafe (>= 6.0)
FSharp.Core (8.0.300-beta.24205.4)
7 changes: 4 additions & 3 deletions src/FsAutoComplete.Core/InlayHints.fs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ let private getFirstPositionAfterParen (str: string) startPos =
| str when startPos > str.Length -> -1
| str -> str.IndexOf('(', startPos) + 1

let private maxHintLength = 30
[<Literal>]
let maxHintLength = 30

let inline private shouldTruncate (s: string) = s.Length > maxHintLength
let inline shouldTruncate (s: string) = s.Length > maxHintLength

let inline private tryTruncate (s: string) =
let inline tryTruncate (s: string) =
if shouldTruncate s then
s.Substring(0, maxHintLength) + "..." |> Some
else
Expand Down
70 changes: 35 additions & 35 deletions src/FsAutoComplete/CodeFixes/AdjustConstant.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ open Microsoft.FSharp.Core.LanguagePrimitives
///
/// Note: As constant, because F# doesn't have `#define`
[<Literal>]
let private DEBUG = false
let DEBUG = false

let inline private unreachable () = invalidOp "unreachable"
let inline unreachable () = invalidOp "unreachable"

/// Returns `SynConst` and its range at passed `pos`
///
Expand All @@ -29,7 +29,7 @@ let inline private unreachable () = invalidOp "unreachable"
/// Note:
/// Might be erroneous Constant -> containing `value` is then default (`0`).
/// Check by comparing returned range with existing Diagnostics.
let private tryFindConstant ast pos =
let tryFindConstant ast pos =
let rec findConst range constant =
match constant with
| SynConst.Measure(constant = c; constantRange = constantRange) when rangeContainsPos constantRange pos ->
Expand Down Expand Up @@ -61,7 +61,7 @@ let private tryFindConstant ast pos =
/// Computes the absolute of `n`
///
/// Unlike `abs` or `Math.Abs` this here handles `MinValue` and does not throw `OverflowException`.
type private Int =
type Int =
static member inline abs(n: sbyte) : byte = if n >= 0y then byte n else byte (0y - n)

static member inline abs(n: int16) : uint16 = if n >= 0s then uint16 n else uint16 (0s - n)
Expand All @@ -80,17 +80,17 @@ type private Int =

static member inline abs(n: nativeint) : unativeint = if n >= 0n then unativeint n else unativeint (0n - n)

type private Offset = int
type Offset = int

/// Range inside a **single** line inside a source text.
///
/// Invariant: `Start.Line = End.Line` (-> `Range.inSingleLine`)
type private RangeInLine = Range
type RangeInLine = Range

module private Range =
module Range =
let inline inSingleLine (range: Range) = range.Start.Line = range.End.Line

type private Range with
type Range with

member inline range.Length = range.End.Character - range.Start.Character

Expand All @@ -107,7 +107,7 @@ type private Range with
/// Unlike `LSP.Range`: just Offsets, not Positions (Line & Character)
[<IsReadOnly; Struct>]
[<StructuredFormatDisplay("{DisplayText}")>]
type private ORange =
type ORange =
{ Start: Offset
End: Offset }

Expand Down Expand Up @@ -156,7 +156,7 @@ type private ORange =

static member inline CoverAllOf(text: ReadOnlySpan<_>) = { Start = 0; End = text.Length }

module private ORange =
module ORange =
/// Returns range that contains `range1` as well as `range2` with their extrema as border.
///
/// Note: if there's a gap between `range1` and `range2` that gap is included in output range:
Expand Down Expand Up @@ -211,7 +211,7 @@ module private ORange =
End = range.End - dEnd }

[<Extension>]
type private Extensions() =
type Extensions() =
/// Returns `-1` if no matching element
[<Extension>]
static member inline TryFindIndex(span: ReadOnlySpan<_>, [<InlineIfLambda>] f) =
Expand All @@ -233,7 +233,7 @@ type private Extensions() =

count

module private Parse =
module Parse =
/// Note: LHS does not include position with `f(char) = true`, but instead is first on RHS
let inline until (text: ReadOnlySpan<char>, range: ORange, [<InlineIfLambda>] f) =
let text = range.SpanIn text
Expand All @@ -255,11 +255,11 @@ module private Parse =
else range.EmptyAtStart, range

/// Helper functions to splat tuples. With inlining: prevent tuple creation
module private Tuple =
module Tuple =
let inline splatR value (a, b) = (value, a, b)
let inline splatL (a, b) value = (a, b, value)

module private Char =
module Char =
let inline isDigitOrUnderscore c = Char.IsDigit c || c = '_'

let inline isHexDigitOrUnderscore c = isDigitOrUnderscore c || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F')
Expand All @@ -280,7 +280,7 @@ type CharFormat =
/// `\U000000E7`
| Utf32Hexadecimal

type private CharConstant =
type CharConstant =
{
Range: Range

Expand All @@ -296,7 +296,7 @@ type private CharConstant =

member c.IsByte = not c.SuffixRange.IsEmpty

module private CharConstant =
module CharConstant =
let inline isAsciiByte (text: ReadOnlySpan<char>) = text.EndsWith "'B"

/// `'a'`, `'\n'`, `'\231'`, `'\xE7'`, `'\u00E7'`, `'\U000000E7'`
Expand Down Expand Up @@ -340,11 +340,11 @@ module private CharConstant =
SuffixRange = suffixRange }

[<Struct>]
type private Sign =
type Sign =
| Negative
| Positive

module private Sign =
module Sign =
/// Returns `Positive` in case of no sign
let inline parse (text: ReadOnlySpan<char>, range: ORange) =
let text = range.SpanIn text
Expand All @@ -370,7 +370,7 @@ type Base =
/// `0b`
| Binary

module private Base =
module Base =
/// Returns `Decimal` in case of no base
let inline parse (text: ReadOnlySpan<char>, range: ORange) =
let text = range.SpanIn(text)
Expand All @@ -396,7 +396,7 @@ module private Base =
/// * required digits
/// * optional underscores inside
/// * optional suffix
type private IntConstant =
type IntConstant =
{ Range: Range

Sign: Sign
Expand All @@ -410,7 +410,7 @@ type private IntConstant =

SuffixRange: ORange }

module private IntConstant =
module IntConstant =
/// Note: Does not handle ASCII byte. Check with `CharConstant.isAsciiByte` and then parse with `CharConstant.parse`
let parse (lineStr: ReadOnlySpan<char>, constRange: RangeInLine, constant: SynConst) =
let text = constRange.SpanIn(lineStr)
Expand All @@ -434,7 +434,7 @@ module private IntConstant =

[<RequireQualifiedAccess>]
[<Struct>]
type private FloatValue =
type FloatValue =
| Float of f: float
| Float32 of f32: float32
| Decimal of d: decimal
Expand All @@ -446,7 +446,7 @@ type private FloatValue =
/// Float Constant (without Hex/Oct/Bin form -- just Decimal & Scientific)
///
/// Includes `float32`, `float`, `decimal`
type private FloatConstant =
type FloatConstant =
{
Range: Range

Expand Down Expand Up @@ -475,7 +475,7 @@ type private FloatConstant =
member c.IsScientific = not c.ExponentRange.IsEmpty
member c.ValueRange = ORange.union c.IntRange c.ExponentRange

module private FloatConstant =
module FloatConstant =
let inline isIntFloat (text: ReadOnlySpan<char>) = text.EndsWith "lf" || text.EndsWith "LF"

/// Note: Does not handle Hex/Oct/Bin form (`lf` or `LF` suffix). Check with `FloatConstant.isIntFloat` and then parse with `IntConstant.parse`
Expand Down Expand Up @@ -563,15 +563,15 @@ module Title =
let toUtf16Hexadecimal = sprintf "Convert to `%s`"
let toUtf32Hexadecimal = sprintf "Convert to `%s`"

let inline private mkFix doc title edits =
let inline mkFix doc title edits =
{ Title = title
File = doc
Edits = edits
Kind = FixKind.Refactor
SourceDiagnostic = None }


module private DigitGroup =
module DigitGroup =
let removeFix (doc: TextDocumentIdentifier) (lineStr: String) (constantRange: Range) (localRange: ORange) =
let text = localRange.SpanIn(constantRange, lineStr)

Expand Down Expand Up @@ -613,7 +613,7 @@ module private DigitGroup =

res

module private Format =
module Format =
module Char =
/// Returns `None` for "invisible" chars (`Char.IsControl`)
/// -- with the exception of some chars that can be represented via escape sequence
Expand Down Expand Up @@ -677,7 +677,7 @@ module private Format =
let absValue = abs n
$"-0b%B{absValue}"

module private CommonFixes =
module CommonFixes =
open FSharp.Compiler.Symbols

/// Adding a sign might lead to invalid code:
Expand Down Expand Up @@ -914,8 +914,8 @@ module private CommonFixes =
else
[]

module private CharFix =
let private debugFix doc (lineStr: String) (constant: CharConstant) =
module CharFix =
let debugFix doc (lineStr: String) (constant: CharConstant) =
let data =
let full = constant.Range.SpanIn(lineStr).ToString()
let value = constant.ValueRange.SpanIn(full).ToString()
Expand Down Expand Up @@ -986,8 +986,8 @@ module private CharFix =
if DEBUG then
debugFix doc lineStr constant ]

module private IntFix =
let private debugFix doc (lineStr: String) (constant: IntConstant) =
module IntFix =
let debugFix doc (lineStr: String) (constant: IntConstant) =
let data =
let full = constant.Range.SpanIn(lineStr).ToString()

Expand Down Expand Up @@ -1398,7 +1398,7 @@ module private IntFix =
| [] -> separateDigitGroupsFix doc lineStr constant
| fix -> fix

let private replaceIntWithNameFix
let replaceIntWithNameFix
doc
(pos: FcsPos)
(lineStr: String)
Expand Down Expand Up @@ -1485,8 +1485,8 @@ module private IntFix =
if DEBUG then
debugFix doc lineStr constant ]

module private FloatFix =
let private debugFix doc (lineStr: String) (constant: FloatConstant) =
module FloatFix =
let debugFix doc (lineStr: String) (constant: FloatConstant) =
let data =
let full = constant.Range.SpanIn(lineStr).ToString()

Expand Down
Loading