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

Commit8c1c159

Browse files
dsymeKevinRansom
authored andcommitted
fix 4220 - struct enumerables caused problem (dotnet#4811)
* fix 4220 - struct enumerables caused problem* fix build
1 parentb435796 commit8c1c159

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

‎src/fsharp/LowerCallsAndSeqs.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ let LowerSeqExpr g amap overallExpr =
303303
(mkLambdaNoType g m enumv
304304
(mkCallSeqGenerated g m genElemTy(mkUnitDelayLambda g m(callNonOverloadedMethod g amap m"MoveNext" inpEnumTy[enume]))
305305
(mkInvisibleLet m v(callNonOverloadedMethod g amap m"get_Current" inpEnumTy[enume])
306-
body))))
306+
(mkCoerceIfNeeded g(mkSeqTy g genElemTy)(tyOfExpr gbody) body)))))
307307

308308
| SeqTryFinally(e1,compensation,m)->
309309
// printfn "found Seq.try/finally"

‎src/fsharp/TypeChecker.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17172,13 +17172,13 @@ let TypeCheckOneImplFile
1717217172
topAttrs.assemblyAttrs |> List.iter (function
1717317173
| Attrib(tref, _, [ AttribExpr(Expr.Const (Const.String(version), range, _), _) ] , _, _, _, _) ->
1717417174
let attrName = tref.CompiledRepresentationForNamedType.FullName
17175-
let isValid =
17175+
let isValid() =
1717617176
try IL.parseILVersion version |> ignore; true
1717717177
with _ -> false
1717817178
match attrName with
1717917179
| "System.Reflection.AssemblyInformationalVersionAttribute"
1718017180
| "System.Reflection.AssemblyFileVersionAttribute" //TODO compile error like c# compiler?
17181-
| "System.Reflection.AssemblyVersionAttribute" when not isValid ->
17181+
| "System.Reflection.AssemblyVersionAttribute" when not(isValid()) ->
1718217182
warning(Error(FSComp.SR.fscBadAssemblyVersion(attrName, version), range))
1718317183
| _ -> ()
1718417184
| _ -> ())

‎tests/fsharp/core/seq/test.fsx‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,9 +712,24 @@ module InfiniteSequenceExpressionsExecuteWithFiniteResources =
712712
yield factorial x
713713
]
714714

715-
for fin factorialsdo printf"%i" f
715+
check"vlklmkkl" factorials[1;1;2;6;24;120;720;5040;40320;362880;3628800]
716716
TestRecFuncInSeq()
717717

718+
moduleTestCollectOnStructSeq=
719+
openSystem
720+
721+
[<Struct>]
722+
typeS=
723+
interface System.Collections.Generic.IEnumerable<int>with
724+
memberx.GetEnumerator()=(seq{yield1;yield2}).GetEnumerator()
725+
interface System.Collections.IEnumerablewith
726+
memberx.GetEnumerator()=(seq{yield1;yield2}:> System.Collections.IEnumerable).GetEnumerator()
727+
728+
letiterate(x:S)=
729+
seq{yield! Seq.collect(fun _-> x)[1]}
730+
731+
check"ccekecnwe"(iterate(Unchecked.defaultof<S>)|> Seq.length)2
732+
718733
(*---------------------------------------------------------------------------
719734
!* wrap up
720735
*---------------------------------------------------------------------------*)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp