File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
src/FSharpPlus/Extensions Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -187,8 +187,8 @@ module Dict =
187187 member __.Count = System.Int32.MaxValue
188188 member __.ContainsKey ( _key : 'TKey ) = true
189189 member __.Contains ( item : KeyValuePair < 'TKey , 'TValue >) = obj.ReferenceEquals ( item.Value, source)
190- member __.GetEnumerator () = Seq.empty.GetEnumerator () :> System .Collections .IEnumerator
191- member __.GetEnumerator () = Seq.empty.GetEnumerator () : IEnumerator < KeyValuePair < 'TKey , 'TValue >>
190+ member __.GetEnumerator () = invalidOp " Key set is potentially infinite. " : System .Collections .IEnumerator
191+ member __.GetEnumerator () = invalidOp " Key set is potentially infinite. " : IEnumerator < KeyValuePair < 'TKey , 'TValue >>
192192 member __.IsReadOnly = true
193193 member __.Values = icollection source
194194 member __.Item
Original file line number Diff line number Diff line change @@ -436,6 +436,17 @@ module Functor =
436436 Assert.IsInstanceOf< Option< Async< int>>> ( Some testVal10)
437437 areEqual 2 ( testVal10 |> Async.RunSynchronously)
438438
439+ let testVal11 = (+) " h" <!> dict [ 1 , " i" ; 2 , " ello" ]
440+ CollectionAssert.AreEqual ( dict [( 1 , " hi" ); ( 2 , " hello" )], testVal11)
441+
442+ let testVal12 : IDictionary < int , string > =
443+ try
444+ (+) <!> result " h" <*> dict [ 1 , " i" ; 2 , " ello" ]
445+ with _ -> dict [ 0 , " failure" ]
446+ CollectionAssert.AreEqual ( dict [ 0 , " failure" ], testVal12)
447+
448+
449+
439450 [<Test>]
440451 let unzip () =
441452 let testVal = unzip { Head = ( 1 , 'a' ); Tail = [( 2 , 'b' );( 3 , 'b' )]}
You can’t perform that action at this time.
0 commit comments