Skip to content

Commit

Permalink
Merge pull request #13795 from dotnet/merges/main-to-release/dev17.4
Browse files Browse the repository at this point in the history
Merge main to release/dev17.4
  • Loading branch information
dotnet-bot authored Aug 27, 2022
2 parents 4ea0cae + 9d84a7a commit 4d29724
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/Compiler/Checking/AttributeChecking.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ open Internal.Utilities.Library
open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler
open FSharp.Compiler.DiagnosticsLogger
open FSharp.Compiler.Features
open FSharp.Compiler.Import
open FSharp.Compiler.Infos
open FSharp.Compiler.TcGlobals
Expand All @@ -21,8 +22,6 @@ open FSharp.Compiler.TypeHierarchy
#if !NO_TYPEPROVIDERS
open FSharp.Compiler.TypeProviders
open FSharp.Core.CompilerServices
open Features

#endif

exception ObsoleteWarning of string * range
Expand Down
6 changes: 6 additions & 0 deletions src/FSharp.Core/prim-types.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4107,6 +4107,7 @@ namespace Microsoft.FSharp.Collections
let start = if i < 0 then 0 else i
PrivateListHelpers.sliceTake (j - start) (PrivateListHelpers.sliceSkip start l)

[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
member l.GetReverseIndex(_: int, offset: int) =
l.Length - offset - 1

Expand Down Expand Up @@ -6902,6 +6903,7 @@ namespace Microsoft.FSharp.Core
[<AutoOpen>]
module ArrayExtensions =
type ``[,,,]``<'T> with
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
member arr.GetReverseIndex(dim: int, offset: int) =
let len =
match dim with
Expand All @@ -6914,6 +6916,7 @@ namespace Microsoft.FSharp.Core
len - offset - 1

type ``[,,]``<'T> with
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
member arr.GetReverseIndex(dim: int, offset: int) =
let len =
match dim with
Expand All @@ -6925,6 +6928,7 @@ namespace Microsoft.FSharp.Core
len - offset - 1

type ``[,]``<'T> with
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
member arr.GetReverseIndex(dim: int, offset: int) =
let len =
match dim with
Expand All @@ -6935,9 +6939,11 @@ namespace Microsoft.FSharp.Core
len - offset - 1

type ``[]``<'T> with
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
member arr.GetReverseIndex (_: int, offset: int) = arr.Length - offset - 1

type String with
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
member str.GetReverseIndex (_: int, offset: int) = str.Length - offset - 1

namespace Microsoft.FSharp.Control
Expand Down
6 changes: 6 additions & 0 deletions src/FSharp.Core/prim-types.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -2555,6 +2555,7 @@ namespace Microsoft.FSharp.Collections
/// <param name="offset">The offset from the end.</param>
///
/// <returns>The corresponding index from the start.</returns>
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
member GetReverseIndex: rank: int * offset: int -> int

/// <summary>Returns a list with <c>head</c> as its first element and <c>tail</c> as its subsequent elements</summary>
Expand Down Expand Up @@ -4608,6 +4609,7 @@ namespace Microsoft.FSharp.Core
/// <param name="offset">The offset from the end.</param>
///
/// <returns>The corresponding index from the start.</returns>
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
member GetReverseIndex: rank: int * offset: int -> int

type ``[,,]``<'T> with
Expand All @@ -4617,6 +4619,7 @@ namespace Microsoft.FSharp.Core
/// <param name="offset">The offset from the end.</param>
///
/// <returns>The corresponding index from the start.</returns>
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
member GetReverseIndex: rank: int * offset: int -> int

type ``[,]``<'T> with
Expand All @@ -4626,6 +4629,7 @@ namespace Microsoft.FSharp.Core
/// <param name="offset">The offset from the end.</param>
///
/// <returns>The corresponding index from the start.</returns>
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
member GetReverseIndex: rank: int * offset: int -> int

type ``[]``<'T> with
Expand All @@ -4635,6 +4639,7 @@ namespace Microsoft.FSharp.Core
/// <param name="offset">The offset from the end.</param>
///
/// <returns>The corresponding index from the start.</returns>
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
member GetReverseIndex: rank: int * offset: int -> int

type System.String with
Expand All @@ -4644,6 +4649,7 @@ namespace Microsoft.FSharp.Core
/// <param name="offset">The offset from the end.</param>
///
/// <returns>The corresponding index from the start.</returns>
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
member GetReverseIndex: rank: int * offset: int -> int

/// <summary>A module of compiler intrinsic functions for efficient implementations of F# integer ranges
Expand Down

0 comments on commit 4d29724

Please sign in to comment.