Skip to content

Commit beb2416

Browse files
committed
Revert binary breaking change from 52a7252
1 parent 7e2a0db commit beb2416

File tree

5 files changed

+34
-32
lines changed

5 files changed

+34
-32
lines changed

src/fsharp/FSharp.Core/array.fs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace Microsoft.FSharp.Collections
1111
open Microsoft.FSharp.Core.Operators
1212
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators
1313
open Microsoft.FSharp.Core.SR
14+
open Microsoft.FSharp.Core.LanguagePrimitives.ErrorStrings
1415
#if FX_NO_ICLONEABLE
1516
open Microsoft.FSharp.Core.ICloneableExtensions
1617
#else
@@ -461,7 +462,7 @@ namespace Microsoft.FSharp.Collections
461462
checkNonNull "array" array
462463
let len = array.Length
463464
if len = 0 then
464-
invalidArg "array" LanguagePrimitives.ErrorStrings.InputArrayEmptyString
465+
invalidArg "array" InputArrayEmptyString
465466
else
466467
let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(f)
467468
let mutable res = array.[0]
@@ -473,7 +474,7 @@ namespace Microsoft.FSharp.Collections
473474
let reduceBack f (array : _[]) =
474475
checkNonNull "array" array
475476
let len = array.Length
476-
if len = 0 then invalidArg "array" LanguagePrimitives.ErrorStrings.InputArrayEmptyString
477+
if len = 0 then invalidArg "array" InputArrayEmptyString
477478
else foldSubRight f array 0 (len - 2) array.[len - 1]
478479

479480
[<CompiledName("SortInPlaceWith")>]
@@ -574,7 +575,7 @@ namespace Microsoft.FSharp.Collections
574575
[<CompiledName("Min")>]
575576
let inline min (array:_[]) =
576577
checkNonNull "array" array
577-
if array.Length = 0 then invalidArg "array" LanguagePrimitives.ErrorStrings.InputArrayEmptyString
578+
if array.Length = 0 then invalidArg "array" InputArrayEmptyString
578579
let mutable acc = array.[0]
579580
for i = 1 to array.Length - 1 do
580581
let curr = array.[i]
@@ -585,7 +586,7 @@ namespace Microsoft.FSharp.Collections
585586
[<CompiledName("MinBy")>]
586587
let inline minBy f (array:_[]) =
587588
checkNonNull "array" array
588-
if array.Length = 0 then invalidArg "array" LanguagePrimitives.ErrorStrings.InputArrayEmptyString
589+
if array.Length = 0 then invalidArg "array" InputArrayEmptyString
589590
let mutable accv = array.[0]
590591
let mutable acc = f accv
591592
for i = 1 to array.Length - 1 do
@@ -599,7 +600,7 @@ namespace Microsoft.FSharp.Collections
599600
[<CompiledName("Max")>]
600601
let inline max (array:_[]) =
601602
checkNonNull "array" array
602-
if array.Length = 0 then invalidArg "array" LanguagePrimitives.ErrorStrings.InputArrayEmptyString
603+
if array.Length = 0 then invalidArg "array" InputArrayEmptyString
603604
let mutable acc = array.[0]
604605
for i = 1 to array.Length - 1 do
605606
let curr = array.[i]
@@ -610,7 +611,7 @@ namespace Microsoft.FSharp.Collections
610611
[<CompiledName("MaxBy")>]
611612
let inline maxBy f (array:_[]) =
612613
checkNonNull "array" array
613-
if array.Length = 0 then invalidArg "array" LanguagePrimitives.ErrorStrings.InputArrayEmptyString
614+
if array.Length = 0 then invalidArg "array" InputArrayEmptyString
614615
let mutable accv = array.[0]
615616
let mutable acc = f accv
616617
for i = 1 to array.Length - 1 do

src/fsharp/FSharp.Core/local.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ namespace Microsoft.FSharp.Primitives.Basics
44

55
open Microsoft.FSharp.Core
66
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators
7+
open Microsoft.FSharp.Core.LanguagePrimitives.ErrorStrings
78
open Microsoft.FSharp.Collections
89
open Microsoft.FSharp.Core.Operators
910
open System.Diagnostics.CodeAnalysis
@@ -241,7 +242,7 @@ module internal List =
241242

242243

243244
let init count f =
244-
if count < 0 then invalidArg "count" LanguagePrimitives.ErrorStrings.InputMustBeNonNegativeString
245+
if count < 0 then invalidArg "count" InputMustBeNonNegativeString
245246
if count = 0 then []
246247
else
247248
let res = freshConsNoTail (f 0)
@@ -559,7 +560,7 @@ module internal Array =
559560
(# "newarr !0" type ('T) count : 'T array #)
560561

561562
let inline init (count:int) (f: int -> 'T) =
562-
if count < 0 then invalidArg "count" LanguagePrimitives.ErrorStrings.InputMustBeNonNegativeString
563+
if count < 0 then invalidArg "count" InputMustBeNonNegativeString
563564
let arr = (zeroCreateUnchecked count : 'T array)
564565
for i = 0 to count - 1 do
565566
arr.[i] <- f i

src/fsharp/FSharp.Core/prim-types.fs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -646,17 +646,17 @@ namespace Microsoft.FSharp.Core
646646

647647
module LanguagePrimitives =
648648

649-
[<Sealed>]
650-
type (* internal *) ErrorStrings =
649+
650+
module (* internal *) ErrorStrings =
651651
// inline functions cannot call GetString, so we must make these bits public
652-
static member AddressOpNotFirstClassString with get () = SR.GetString(SR.addressOpNotFirstClass)
653-
static member NoNegateMinValueString with get () = SR.GetString(SR.noNegateMinValue)
652+
let AddressOpNotFirstClassString = SR.GetString(SR.addressOpNotFirstClass)
653+
let NoNegateMinValueString = SR.GetString(SR.noNegateMinValue)
654654
// needs to be public to be visible from inline function 'average' and others
655-
static member InputSequenceEmptyString with get () = SR.GetString(SR.inputSequenceEmpty)
655+
let InputSequenceEmptyString = SR.GetString(SR.inputSequenceEmpty)
656656
// needs to be public to be visible from inline function 'average' and others
657-
static member InputArrayEmptyString with get () = SR.GetString(SR.arrayWasEmpty)
657+
let InputArrayEmptyString = SR.GetString(SR.arrayWasEmpty)
658658
// needs to be public to be visible from inline function 'average' and others
659-
static member InputMustBeNonNegativeString with get () = SR.GetString(SR.inputMustBeNonNegative)
659+
let InputMustBeNonNegativeString = SR.GetString(SR.inputMustBeNonNegative)
660660

661661
[<CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")>] // nested module OK
662662
module IntrinsicOperators =

src/fsharp/FSharp.Core/prim-types.fsi

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -983,23 +983,22 @@ namespace Microsoft.FSharp.Core
983983
val inline DivideByInt< ^T > : x:^T -> y:int -> ^T when ^T : (static member DivideByInt : ^T * int -> ^T)
984984

985985
/// <summary>For compiler use only</summary>
986-
[<Sealed>]
987-
type (* internal *) ErrorStrings =
986+
module (* internal *) ErrorStrings =
988987

989988
[<CompilerMessage("This value is for use by compiled F# code and should not be used directly", 1204, IsHidden=true)>]
990-
static member InputSequenceEmptyString : string with get
989+
val InputSequenceEmptyString : string
991990

992991
[<CompilerMessage("This value is for use by compiled F# code and should not be used directly", 1204, IsHidden=true)>]
993-
static member InputArrayEmptyString : string with get
992+
val InputArrayEmptyString : string
994993

995994
[<CompilerMessage("This value is for use by compiled F# code and should not be used directly", 1204, IsHidden=true)>]
996-
static member AddressOpNotFirstClassString : string with get
995+
val AddressOpNotFirstClassString : string
997996

998997
[<CompilerMessage("This value is for use by compiled F# code and should not be used directly", 1204, IsHidden=true)>]
999-
static member NoNegateMinValueString : string with get
998+
val NoNegateMinValueString : string
1000999

10011000
[<CompilerMessage("This value is for use by compiled F# code and should not be used directly", 1204, IsHidden=true)>]
1002-
static member InputMustBeNonNegativeString : string with get
1001+
val InputMustBeNonNegativeString : string
10031002

10041003

10051004
//-------------------------------------------------------------------------

src/fsharp/FSharp.Core/seq.fs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@ namespace Microsoft.FSharp.Collections
803803
open System.Collections.Generic
804804
open Microsoft.FSharp.Core
805805
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators
806+
open Microsoft.FSharp.Core.LanguagePrimitives.ErrorStrings
806807
open Microsoft.FSharp.Core.Operators
807808
open Microsoft.FSharp.Core.CompilerServices
808809
open Microsoft.FSharp.Control
@@ -1046,7 +1047,7 @@ namespace Microsoft.FSharp.Collections
10461047
let reduce f (source : seq<'T>) =
10471048
checkNonNull "source" source
10481049
use e = source.GetEnumerator()
1049-
if not (e.MoveNext()) then invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
1050+
if not (e.MoveNext()) then invalidArg "source" InputSequenceEmptyString;
10501051
let f = OptimizedClosures.FSharpFunc<_,_,_>.Adapt(f)
10511052
let mutable state = e.Current
10521053
while e.MoveNext() do
@@ -1374,7 +1375,7 @@ namespace Microsoft.FSharp.Collections
13741375
acc <- Checked.(+) acc e.Current
13751376
count <- count + 1
13761377
if count = 0 then
1377-
invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString
1378+
invalidArg "source" InputSequenceEmptyString
13781379
LanguagePrimitives.DivideByInt< (^a) > acc count
13791380

13801381
[<CompiledName("AverageBy")>]
@@ -1387,15 +1388,15 @@ namespace Microsoft.FSharp.Collections
13871388
acc <- Checked.(+) acc (f e.Current)
13881389
count <- count + 1
13891390
if count = 0 then
1390-
invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
1391+
invalidArg "source" InputSequenceEmptyString;
13911392
LanguagePrimitives.DivideByInt< (^U) > acc count
13921393

13931394
[<CompiledName("Min")>]
13941395
let inline min (source: seq<_>) =
13951396
checkNonNull "source" source
13961397
use e = source.GetEnumerator()
13971398
if not (e.MoveNext()) then
1398-
invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
1399+
invalidArg "source" InputSequenceEmptyString;
13991400
let mutable acc = e.Current
14001401
while e.MoveNext() do
14011402
let curr = e.Current
@@ -1408,7 +1409,7 @@ namespace Microsoft.FSharp.Collections
14081409
checkNonNull "source" source
14091410
use e = source.GetEnumerator()
14101411
if not (e.MoveNext()) then
1411-
invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
1412+
invalidArg "source" InputSequenceEmptyString;
14121413
let first = e.Current
14131414
let mutable acc = f first
14141415
let mutable accv = first
@@ -1442,7 +1443,7 @@ namespace Microsoft.FSharp.Collections
14421443
checkNonNull "source" source
14431444
use e = source.GetEnumerator()
14441445
if not (e.MoveNext()) then
1445-
invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
1446+
invalidArg "source" InputSequenceEmptyString;
14461447
let mutable acc = e.Current
14471448
while e.MoveNext() do
14481449
let curr = e.Current
@@ -1455,7 +1456,7 @@ namespace Microsoft.FSharp.Collections
14551456
checkNonNull "source" source
14561457
use e = source.GetEnumerator()
14571458
if not (e.MoveNext()) then
1458-
invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
1459+
invalidArg "source" InputSequenceEmptyString;
14591460
let first = e.Current
14601461
let mutable acc = f first
14611462
let mutable accv = first
@@ -1545,7 +1546,7 @@ namespace Microsoft.FSharp.Collections
15451546
checkNonNull "source" source
15461547
use e = source.GetEnumerator()
15471548
if (e.MoveNext()) then e.Current
1548-
else invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString
1549+
else invalidArg "source" InputSequenceEmptyString
15491550

15501551
[<CompiledName("Last")>]
15511552
let last (source : seq<_>) =
@@ -1556,7 +1557,7 @@ namespace Microsoft.FSharp.Collections
15561557
while (e.MoveNext()) do res <- e.Current
15571558
res
15581559
else
1559-
invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString
1560+
invalidArg "source" InputSequenceEmptyString
15601561

15611562

15621563
[<CompiledName("ExactlyOne")>]
@@ -1570,4 +1571,4 @@ namespace Microsoft.FSharp.Collections
15701571
else
15711572
v
15721573
else
1573-
invalidArg "source" LanguagePrimitives.ErrorStrings.InputSequenceEmptyString
1574+
invalidArg "source" InputSequenceEmptyString

0 commit comments

Comments
 (0)