Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit52a7252

Browse files
committed
fix LanguagePrimitives.ErrorStrings messages depends on culture
the SR.GetString use CultureInfo.CurrentUICulture, so need to be invoked atruntime not bound when the module ErrorStrings is opened
1 parent58981ec commit52a7252

File tree

5 files changed

+32
-34
lines changed

5 files changed

+32
-34
lines changed

‎src/fsharp/FSharp.Core/array.fs‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ namespace Microsoft.FSharp.Collections
1111
openMicrosoft.FSharp.Core.Operators
1212
openMicrosoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators
1313
openMicrosoft.FSharp.Core.SR
14-
openMicrosoft.FSharp.Core.LanguagePrimitives.ErrorStrings
1514
#if FX_NO_ICLONEABLE
1615
openMicrosoft.FSharp.Core.ICloneableExtensions
1716
#else
@@ -462,7 +461,7 @@ namespace Microsoft.FSharp.Collections
462461
checkNonNull"array" array
463462
letlen= array.Length
464463
if len=0then
465-
invalidArg"array" InputArrayEmptyString
464+
invalidArg"array"LanguagePrimitives.ErrorStrings.InputArrayEmptyString
466465
else
467466
letf= OptimizedClosures.FSharpFunc<_,_,_>.Adapt(f)
468467
let mutableres= array.[0]
@@ -474,7 +473,7 @@ namespace Microsoft.FSharp.Collections
474473
letreduceBack f(array:_[])=
475474
checkNonNull"array" array
476475
letlen= array.Length
477-
if len=0then invalidArg"array" InputArrayEmptyString
476+
if len=0then invalidArg"array"LanguagePrimitives.ErrorStrings.InputArrayEmptyString
478477
else foldSubRight f array0(len-2) array.[len-1]
479478

480479
[<CompiledName("SortInPlaceWith")>]
@@ -575,7 +574,7 @@ namespace Microsoft.FSharp.Collections
575574
[<CompiledName("Min")>]
576575
let inlinemin(array:_[])=
577576
checkNonNull"array" array
578-
if array.Length=0then invalidArg"array" InputArrayEmptyString
577+
if array.Length=0then invalidArg"array"LanguagePrimitives.ErrorStrings.InputArrayEmptyString
579578
let mutableacc= array.[0]
580579
for i=1to array.Length-1do
581580
letcurr= array.[i]
@@ -586,7 +585,7 @@ namespace Microsoft.FSharp.Collections
586585
[<CompiledName("MinBy")>]
587586
let inlineminBy f(array:_[])=
588587
checkNonNull"array" array
589-
if array.Length=0then invalidArg"array" InputArrayEmptyString
588+
if array.Length=0then invalidArg"array"LanguagePrimitives.ErrorStrings.InputArrayEmptyString
590589
let mutableaccv= array.[0]
591590
let mutableacc= f accv
592591
for i=1to array.Length-1do
@@ -600,7 +599,7 @@ namespace Microsoft.FSharp.Collections
600599
[<CompiledName("Max")>]
601600
let inlinemax(array:_[])=
602601
checkNonNull"array" array
603-
if array.Length=0then invalidArg"array" InputArrayEmptyString
602+
if array.Length=0then invalidArg"array"LanguagePrimitives.ErrorStrings.InputArrayEmptyString
604603
let mutableacc= array.[0]
605604
for i=1to array.Length-1do
606605
letcurr= array.[i]
@@ -611,7 +610,7 @@ namespace Microsoft.FSharp.Collections
611610
[<CompiledName("MaxBy")>]
612611
let inlinemaxBy f(array:_[])=
613612
checkNonNull"array" array
614-
if array.Length=0then invalidArg"array" InputArrayEmptyString
613+
if array.Length=0then invalidArg"array"LanguagePrimitives.ErrorStrings.InputArrayEmptyString
615614
let mutableaccv= array.[0]
616615
let mutableacc= f accv
617616
for i=1to array.Length-1do

‎src/fsharp/FSharp.Core/local.fs‎

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

55
openMicrosoft.FSharp.Core
66
openMicrosoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators
7-
openMicrosoft.FSharp.Core.LanguagePrimitives.ErrorStrings
87
openMicrosoft.FSharp.Collections
98
openMicrosoft.FSharp.Core.Operators
109
openSystem.Diagnostics.CodeAnalysis
@@ -242,7 +241,7 @@ module internal List =
242241

243242

244243
letinit count f=
245-
if count<0then invalidArg"count" InputMustBeNonNegativeString
244+
if count<0then invalidArg"count"LanguagePrimitives.ErrorStrings.InputMustBeNonNegativeString
246245
if count=0then[]
247246
else
248247
letres= freshConsNoTail(f0)
@@ -560,7 +559,7 @@ module internal Array =
560559
(#"newarr !0" type('T) count: 'T array #)
561560

562561
let inlineinit(count:int)(f:int->'T)=
563-
if count<0then invalidArg"count" InputMustBeNonNegativeString
562+
if count<0then invalidArg"count"LanguagePrimitives.ErrorStrings.InputMustBeNonNegativeString
564563
letarr=(zeroCreateUnchecked count: 'T array)
565564
for i=0to count-1do
566565
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
moduleLanguagePrimitives=
648648

649-
650-
module(* internal*)ErrorStrings=
649+
[<Sealed>]
650+
type(* internal*)ErrorStrings=
651651
//inlinefunctionscannotcallGetString,sowemustmakethesebitspublic
652-
letAddressOpNotFirstClassString=SR.GetString(SR.addressOpNotFirstClass)
653-
letNoNegateMinValueString=SR.GetString(SR.noNegateMinValue)
652+
staticmemberAddressOpNotFirstClassStringwithget()=SR.GetString(SR.addressOpNotFirstClass)
653+
staticmemberNoNegateMinValueStringwithget()=SR.GetString(SR.noNegateMinValue)
654654
//needstobepublictobevisiblefrominlinefunction'average'andothers
655-
letInputSequenceEmptyString=SR.GetString(SR.inputSequenceEmpty)
655+
staticmemberInputSequenceEmptyStringwithget()=SR.GetString(SR.inputSequenceEmpty)
656656
//needstobepublictobevisiblefrominlinefunction'average'andothers
657-
letInputArrayEmptyString=SR.GetString(SR.arrayWasEmpty)
657+
staticmemberInputArrayEmptyStringwithget()=SR.GetString(SR.arrayWasEmpty)
658658
//needstobepublictobevisiblefrominlinefunction'average'andothers
659-
letInputMustBeNonNegativeString=SR.GetString(SR.inputMustBeNonNegative)
659+
staticmemberInputMustBeNonNegativeStringwithget()=SR.GetString(SR.inputMustBeNonNegative)
660660

661661
[<CodeAnalysis.SuppressMessage("Microsoft.Design","CA1034:NestedTypesShouldNotBeVisible")>]//nestedmoduleOK
662662
moduleIntrinsicOperators=

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -983,22 +983,23 @@ 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 internal use only</summary>
986-
module(*internal*)ErrorStrings=
986+
[<Sealed>]
987+
type(*internal*)ErrorStrings=
987988

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

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

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

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

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

10031004

10041005
//-------------------------------------------------------------------------

‎src/fsharp/FSharp.Core/seq.fs‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,6 @@ namespace Microsoft.FSharp.Collections
803803
openSystem.Collections.Generic
804804
openMicrosoft.FSharp.Core
805805
openMicrosoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators
806-
openMicrosoft.FSharp.Core.LanguagePrimitives.ErrorStrings
807806
openMicrosoft.FSharp.Core.Operators
808807
openMicrosoft.FSharp.Core.CompilerServices
809808
openMicrosoft.FSharp.Control
@@ -1047,7 +1046,7 @@ namespace Microsoft.FSharp.Collections
10471046
letreduce f(source:seq<'T>)=
10481047
checkNonNull"source" source
10491048
use e= source.GetEnumerator()
1050-
ifnot(e.MoveNext())then invalidArg"source" InputSequenceEmptyString;
1049+
ifnot(e.MoveNext())then invalidArg"source"LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
10511050
letf= OptimizedClosures.FSharpFunc<_,_,_>.Adapt(f)
10521051
let mutablestate= e.Current
10531052
while e.MoveNext()do
@@ -1375,7 +1374,7 @@ namespace Microsoft.FSharp.Collections
13751374
acc<- Checked.(+) acc e.Current
13761375
count<- count+1
13771376
if count=0then
1378-
invalidArg"source" InputSequenceEmptyString
1377+
invalidArg"source"LanguagePrimitives.ErrorStrings.InputSequenceEmptyString
13791378
LanguagePrimitives.DivideByInt<(^a)> acc count
13801379

13811380
[<CompiledName("AverageBy")>]
@@ -1388,15 +1387,15 @@ namespace Microsoft.FSharp.Collections
13881387
acc<- Checked.(+) acc(f e.Current)
13891388
count<- count+1
13901389
if count=0then
1391-
invalidArg"source" InputSequenceEmptyString;
1390+
invalidArg"source"LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
13921391
LanguagePrimitives.DivideByInt<(^U)> acc count
13931392

13941393
[<CompiledName("Min")>]
13951394
let inlinemin(source:seq<_>)=
13961395
checkNonNull"source" source
13971396
use e= source.GetEnumerator()
13981397
ifnot(e.MoveNext())then
1399-
invalidArg"source" InputSequenceEmptyString;
1398+
invalidArg"source"LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
14001399
let mutableacc= e.Current
14011400
while e.MoveNext()do
14021401
letcurr= e.Current
@@ -1409,7 +1408,7 @@ namespace Microsoft.FSharp.Collections
14091408
checkNonNull"source" source
14101409
use e= source.GetEnumerator()
14111410
ifnot(e.MoveNext())then
1412-
invalidArg"source" InputSequenceEmptyString;
1411+
invalidArg"source"LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
14131412
letfirst= e.Current
14141413
let mutableacc= f first
14151414
let mutableaccv= first
@@ -1443,7 +1442,7 @@ namespace Microsoft.FSharp.Collections
14431442
checkNonNull"source" source
14441443
use e= source.GetEnumerator()
14451444
ifnot(e.MoveNext())then
1446-
invalidArg"source" InputSequenceEmptyString;
1445+
invalidArg"source"LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
14471446
let mutableacc= e.Current
14481447
while e.MoveNext()do
14491448
letcurr= e.Current
@@ -1456,7 +1455,7 @@ namespace Microsoft.FSharp.Collections
14561455
checkNonNull"source" source
14571456
use e= source.GetEnumerator()
14581457
ifnot(e.MoveNext())then
1459-
invalidArg"source" InputSequenceEmptyString;
1458+
invalidArg"source"LanguagePrimitives.ErrorStrings.InputSequenceEmptyString;
14601459
letfirst= e.Current
14611460
let mutableacc= f first
14621461
let mutableaccv= first
@@ -1546,7 +1545,7 @@ namespace Microsoft.FSharp.Collections
15461545
checkNonNull"source" source
15471546
use e= source.GetEnumerator()
15481547
if(e.MoveNext())then e.Current
1549-
else invalidArg"source" InputSequenceEmptyString
1548+
else invalidArg"source"LanguagePrimitives.ErrorStrings.InputSequenceEmptyString
15501549

15511550
[<CompiledName("Last")>]
15521551
letlast(source:seq<_>)=
@@ -1557,7 +1556,7 @@ namespace Microsoft.FSharp.Collections
15571556
while(e.MoveNext())do res<- e.Current
15581557
res
15591558
else
1560-
invalidArg"source" InputSequenceEmptyString
1559+
invalidArg"source"LanguagePrimitives.ErrorStrings.InputSequenceEmptyString
15611560

15621561

15631562
[<CompiledName("ExactlyOne")>]
@@ -1571,4 +1570,4 @@ namespace Microsoft.FSharp.Collections
15711570
else
15721571
v
15731572
else
1574-
invalidArg"source" InputSequenceEmptyString
1573+
invalidArg"source"LanguagePrimitives.ErrorStrings.InputSequenceEmptyString

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp