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

Commitac68fa2

Browse files
committed
Merge branch 'fsharp4' ofhttp://github.com/Microsoft/visualfsharp into appveyor
2 parents140d0b3 +f6cea7c commitac68fa2

File tree

33 files changed

+348
-114
lines changed

33 files changed

+348
-114
lines changed

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,8 @@ tests/fsharpqa/Source/CodeGen/EmittedIL/QueryExpressionStepping/Utils.dll
9494
tests/fsharpqa/Source/CodeGen/EmittedIL/ComputationExpressions/ComputationExprLibrary.dll
9595

9696
*.csproj.user
97+
98+
*.ide
99+
*.log
100+
*.jrs
101+
*.chk

‎src/fsharp/FSComp.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,8 @@ lexfltSeparatorTokensOfPatternMatchMisaligned,"The '|' tokens separating rules o
10221022
1130,nrInvalidFieldLabel,"Invalid field label"
10231023
1132,nrInvalidExpression,"Invalid expression '%s'"
10241024
1133,nrNoConstructorsAvailableForType,"No constructors are available for the type '%s'"
1025-
1134,nrUnionTypeNeedsQualifiedAccess,"The union type for union case '%s' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('%s') in the name you are using.""
1025+
1134,nrUnionTypeNeedsQualifiedAccess,"The union type for union case '%s' was defined with the RequireQualifiedAccessAttribute. Include the name of the union type ('%s') in the name you are using."
1026+
1135,nrRecordTypeNeedsQualifiedAccess,"The record type for the record field '%s' was defined with the RequireQualifiedAccessAttribute. Include the name of the record type ('%s') in the name you are using."
10261027
# -----------------------------------------------------------------------------
10271028
# ilwrite.fs errors
10281029
# -----------------------------------------------------------------------------

‎src/fsharp/FSharp.Core.Unittests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ open System
99
openFSharp.Core.Unittests.LibraryTestFx
1010
openNUnit.Framework
1111

12+
moduleLeakUtils=
13+
// when testing for liveness, the things that we want to observe must always be created in
14+
// a nested function call to avoid the GC (possibly) treating them as roots past the last use in the block.
15+
// We also need something non trivial to disuade the compiler from inlining in Release builds.
16+
typeToRun<'a>(f: unit->'a)=
17+
memberthis.Invoke()= f()
18+
19+
letrun(toRun:ToRun<'a>)= toRun.Invoke()
1220

1321
// ---------------------------------------------------
1422

@@ -191,6 +199,41 @@ type AsyncModule() =
191199

192200
for_i=1to50do test()
193201

202+
203+
[<Test>]
204+
memberthis.``Async.AwaitWaitHandle does not leak memory``()=
205+
// This test checks that AwaitWaitHandle does not leak continuations (described in #131),
206+
// We only test the worst case - when the AwaitWaitHandle is already set.
207+
use manualResetEvent=new System.Threading.ManualResetEvent(true)
208+
209+
lettryToLeak()=
210+
letresource=
211+
LeakUtils.ToRun(fun()->
212+
letresource= obj()
213+
letwork=
214+
async{
215+
let!_= Async.AwaitWaitHandle manualResetEvent
216+
GC.KeepAlive(resource)
217+
return()
218+
}
219+
220+
work|> Async.RunSynchronously|> ignore
221+
WeakReference(resource))
222+
|> LeakUtils.run
223+
224+
Assert.IsTrue(resource.IsAlive)
225+
226+
GC.Collect()
227+
GC.WaitForPendingFinalizers()
228+
GC.Collect()
229+
GC.WaitForPendingFinalizers()
230+
GC.Collect()
231+
232+
Assert.IsFalse(resource.IsAlive)
233+
234+
// The leak hangs on a race condition which is really hard to trigger in F# 3.0, hence the 100000 runs...
235+
for_in1..100do tryToLeak()
236+
194237
[<Test>]
195238
memberthis.``AwaitWaitHandle.DisposedWaitHandle2``()=
196239
letwh=new System.Threading.ManualResetEvent(false)

‎src/fsharp/FSharp.Core.Unittests/SurfaceArea.4.0.fs‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2795,14 +2795,17 @@ Microsoft.FSharp.Core.ReferenceEqualityAttribute: System.String ToString()
27952795
Microsoft.FSharp.Core.ReferenceEqualityAttribute: System.Type GetType()
27962796
Microsoft.FSharp.Core.ReferenceEqualityAttribute: Void .ctor()
27972797
Microsoft.FSharp.Core.ReflectedDefinitionAttribute: Boolean Equals(System.Object)
2798+
Microsoft.FSharp.Core.ReflectedDefinitionAttribute: Boolean IncludeValue
27982799
Microsoft.FSharp.Core.ReflectedDefinitionAttribute: Boolean IsDefaultAttribute()
27992800
Microsoft.FSharp.Core.ReflectedDefinitionAttribute: Boolean Match(System.Object)
2801+
Microsoft.FSharp.Core.ReflectedDefinitionAttribute: Boolean get_IncludeValue()
28002802
Microsoft.FSharp.Core.ReflectedDefinitionAttribute: Int32 GetHashCode()
28012803
Microsoft.FSharp.Core.ReflectedDefinitionAttribute: System.Object TypeId
28022804
Microsoft.FSharp.Core.ReflectedDefinitionAttribute: System.Object get_TypeId()
28032805
Microsoft.FSharp.Core.ReflectedDefinitionAttribute: System.String ToString()
28042806
Microsoft.FSharp.Core.ReflectedDefinitionAttribute: System.Type GetType()
28052807
Microsoft.FSharp.Core.ReflectedDefinitionAttribute: Void .ctor()
2808+
Microsoft.FSharp.Core.ReflectedDefinitionAttribute: Void .ctor(Boolean)
28062809
Microsoft.FSharp.Core.RequireQualifiedAccessAttribute: Boolean Equals(System.Object)
28072810
Microsoft.FSharp.Core.RequireQualifiedAccessAttribute: Boolean IsDefaultAttribute()
28082811
Microsoft.FSharp.Core.RequireQualifiedAccessAttribute: Boolean Match(System.Object)
@@ -3210,6 +3213,7 @@ Microsoft.FSharp.Linq.RuntimeHelpers.Grouping`2[K,T]: System.Type GetType()
32103213
Microsoft.FSharp.Linq.RuntimeHelpers.Grouping`2[K,T]: Void .ctor(K, System.Collections.Generic.IEnumerable`1[T])
32113214
Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: Boolean Equals(System.Object)
32123215
Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: Int32 GetHashCode()
3216+
Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: Microsoft.FSharp.Quotations.FSharpExpr SubstHelperRaw(Microsoft.FSharp.Quotations.FSharpExpr, Microsoft.FSharp.Quotations.FSharpVar[], System.Object[])
32133217
Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: Microsoft.FSharp.Quotations.FSharpExpr`1[T] SubstHelper[T](Microsoft.FSharp.Quotations.FSharpExpr, Microsoft.FSharp.Quotations.FSharpVar[], System.Object[])
32143218
Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: System.Linq.Expressions.Expression QuotationToExpression(Microsoft.FSharp.Quotations.FSharpExpr)
32153219
Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter: System.Linq.Expressions.Expression`1[T] ImplicitExpressionConversionHelper[T](T)
@@ -3299,6 +3303,8 @@ Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr P
32993303
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr PropertySet(Microsoft.FSharp.Quotations.FSharpExpr, System.Reflection.PropertyInfo, Microsoft.FSharp.Quotations.FSharpExpr, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Quotations.FSharpExpr]])
33003304
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr PropertySet(System.Reflection.PropertyInfo, Microsoft.FSharp.Quotations.FSharpExpr, Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Quotations.FSharpExpr]])
33013305
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr Quote(Microsoft.FSharp.Quotations.FSharpExpr)
3306+
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr QuoteRaw(Microsoft.FSharp.Quotations.FSharpExpr)
3307+
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr QuoteTyped(Microsoft.FSharp.Quotations.FSharpExpr)
33023308
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr Sequential(Microsoft.FSharp.Quotations.FSharpExpr, Microsoft.FSharp.Quotations.FSharpExpr)
33033309
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr Substitute(Microsoft.FSharp.Core.FSharpFunc`2[Microsoft.FSharp.Quotations.FSharpVar,Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Quotations.FSharpExpr]])
33043310
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr TryFinally(Microsoft.FSharp.Quotations.FSharpExpr, Microsoft.FSharp.Quotations.FSharpExpr)
@@ -3307,19 +3313,24 @@ Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr T
33073313
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr TypeTest(Microsoft.FSharp.Quotations.FSharpExpr, System.Type)
33083314
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr UnionCaseTest(Microsoft.FSharp.Quotations.FSharpExpr, Microsoft.FSharp.Reflection.UnionCaseInfo)
33093315
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr Value(System.Object, System.Type)
3316+
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr ValueWithName(System.Object, System.Type, System.String)
3317+
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr ValueWithName[T](T, System.String)
33103318
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr Value[T](T)
33113319
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr Var(Microsoft.FSharp.Quotations.FSharpVar)
33123320
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr VarSet(Microsoft.FSharp.Quotations.FSharpVar, Microsoft.FSharp.Quotations.FSharpExpr)
33133321
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr WhileLoop(Microsoft.FSharp.Quotations.FSharpExpr, Microsoft.FSharp.Quotations.FSharpExpr)
3322+
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr WithValue(System.Object, System.Type, Microsoft.FSharp.Quotations.FSharpExpr)
33143323
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr`1[T] Cast[T](Microsoft.FSharp.Quotations.FSharpExpr)
33153324
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr`1[T] GlobalVar[T](System.String)
3325+
Microsoft.FSharp.Quotations.FSharpExpr: Microsoft.FSharp.Quotations.FSharpExpr`1[T] WithValue[T](T, Microsoft.FSharp.Quotations.FSharpExpr`1[T])
33163326
Microsoft.FSharp.Quotations.FSharpExpr: System.Collections.Generic.IEnumerable`1[Microsoft.FSharp.Quotations.FSharpVar] GetFreeVars()
33173327
Microsoft.FSharp.Quotations.FSharpExpr: System.String ToString()
33183328
Microsoft.FSharp.Quotations.FSharpExpr: System.String ToString(Boolean)
33193329
Microsoft.FSharp.Quotations.FSharpExpr: System.Type GetType()
33203330
Microsoft.FSharp.Quotations.FSharpExpr: System.Type Type
33213331
Microsoft.FSharp.Quotations.FSharpExpr: System.Type get_Type()
33223332
Microsoft.FSharp.Quotations.FSharpExpr: Void RegisterReflectedDefinitions(System.Reflection.Assembly, System.String, Byte[])
3333+
Microsoft.FSharp.Quotations.FSharpExpr: Void RegisterReflectedDefinitions(System.Reflection.Assembly, System.String, Byte[], System.Type[])
33233334
Microsoft.FSharp.Quotations.FSharpExpr`1[T]: Boolean Equals(System.Object)
33243335
Microsoft.FSharp.Quotations.FSharpExpr`1[T]: Int32 GetHashCode()
33253336
Microsoft.FSharp.Quotations.FSharpExpr`1[T]: Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Quotations.FSharpExpr] CustomAttributes
@@ -3350,6 +3361,8 @@ Microsoft.FSharp.Quotations.PatternsModule: Int32 GetHashCode()
33503361
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Quotations.FSharpExpr]] NewTuplePattern(Microsoft.FSharp.Quotations.FSharpExpr)
33513362
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Quotations.FSharpExpr] AddressOfPattern(Microsoft.FSharp.Quotations.FSharpExpr)
33523363
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Quotations.FSharpExpr] QuotePattern(Microsoft.FSharp.Quotations.FSharpExpr)
3364+
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Quotations.FSharpExpr] QuoteRawPattern(Microsoft.FSharp.Quotations.FSharpExpr)
3365+
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Quotations.FSharpExpr] QuoteTypedPattern(Microsoft.FSharp.Quotations.FSharpExpr)
33533366
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Quotations.FSharpVar] VarPattern(Microsoft.FSharp.Quotations.FSharpExpr)
33543367
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[Microsoft.FSharp.Collections.FSharpList`1[System.Tuple`2[Microsoft.FSharp.Quotations.FSharpVar,Microsoft.FSharp.Quotations.FSharpExpr]],Microsoft.FSharp.Quotations.FSharpExpr]] LetRecursivePattern(Microsoft.FSharp.Quotations.FSharpExpr)
33553368
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`2[Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Quotations.FSharpExpr],System.Reflection.FieldInfo]] FieldGetPattern(Microsoft.FSharp.Quotations.FSharpExpr)
@@ -3374,6 +3387,8 @@ Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1
33743387
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Quotations.FSharpExpr],System.Reflection.PropertyInfo,Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Quotations.FSharpExpr]]] PropertyGetPattern(Microsoft.FSharp.Quotations.FSharpExpr)
33753388
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[Microsoft.FSharp.Quotations.FSharpExpr,Microsoft.FSharp.Quotations.FSharpExpr,Microsoft.FSharp.Quotations.FSharpExpr]] IfThenElsePattern(Microsoft.FSharp.Quotations.FSharpExpr)
33763389
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[Microsoft.FSharp.Quotations.FSharpVar,Microsoft.FSharp.Quotations.FSharpExpr,Microsoft.FSharp.Quotations.FSharpExpr]] LetPattern(Microsoft.FSharp.Quotations.FSharpExpr)
3390+
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[System.Object,System.Type,Microsoft.FSharp.Quotations.FSharpExpr]] WithValuePattern(Microsoft.FSharp.Quotations.FSharpExpr)
3391+
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[System.Object,System.Type,System.String]] ValueWithNamePattern(Microsoft.FSharp.Quotations.FSharpExpr)
33773392
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`3[System.Type,Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Quotations.FSharpVar],Microsoft.FSharp.Quotations.FSharpExpr]] NewDelegatePattern(Microsoft.FSharp.Quotations.FSharpExpr)
33783393
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`4[Microsoft.FSharp.Core.FSharpOption`1[Microsoft.FSharp.Quotations.FSharpExpr],System.Reflection.PropertyInfo,Microsoft.FSharp.Collections.FSharpList`1[Microsoft.FSharp.Quotations.FSharpExpr],Microsoft.FSharp.Quotations.FSharpExpr]] PropertySetPattern(Microsoft.FSharp.Quotations.FSharpExpr)
33793394
Microsoft.FSharp.Quotations.PatternsModule: Microsoft.FSharp.Core.FSharpOption`1[System.Tuple`4[Microsoft.FSharp.Quotations.FSharpVar,Microsoft.FSharp.Quotations.FSharpExpr,Microsoft.FSharp.Quotations.FSharpExpr,Microsoft.FSharp.Quotations.FSharpExpr]] ForIntegerRangeLoopPattern(Microsoft.FSharp.Quotations.FSharpExpr)

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

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,25 +79,25 @@ module Nullable =
7979
openSystem
8080

8181
[<CompiledName("ToUInt8")>]
82-
letinlineuint8(x:Nullable< ^T>)=ifx.HasValuethenNullable(Operators.byte x.Value)elseNullable()
82+
letinlineuint8(x:Nullable<_>)=ifx.HasValuethenNullable(Operators.byte x.Value)elseNullable()
8383

8484
[<CompiledName("ToInt8")>]
85-
letinlineint8(x:Nullable< ^T>)=ifx.HasValuethenNullable(Operators.sbyte x.Value)elseNullable()
85+
letinlineint8(x:Nullable<_>)=ifx.HasValuethenNullable(Operators.sbyte x.Value)elseNullable()
8686

8787
[<CompiledName("ToByte")>]
88-
letinlinebyte(x:Nullable< ^T>)=ifx.HasValuethenNullable(Operators.byte x.Value)elseNullable()
88+
letinlinebyte(x:Nullable<_>)=ifx.HasValuethenNullable(Operators.byte x.Value)elseNullable()
8989

9090
[<CompiledName("ToSByte")>]
91-
letinlinesbyte(x:Nullable< ^T>)=ifx.HasValuethenNullable(Operators.sbyte x.Value)elseNullable()
91+
letinlinesbyte(x:Nullable<_>)=ifx.HasValuethenNullable(Operators.sbyte x.Value)elseNullable()
9292

9393
[<CompiledName("ToInt16")>]
94-
letinlineint16(x:Nullable< ^T>)=ifx.HasValuethenNullable(Operators.int16 x.Value)elseNullable()
94+
letinlineint16(x:Nullable<_>)=ifx.HasValuethenNullable(Operators.int16 x.Value)elseNullable()
9595

9696
[<CompiledName("ToUInt16")>]
97-
letinlineuint16(x:Nullable< ^T>)=ifx.HasValuethenNullable(Operators.uint16 x.Value)elseNullable()
97+
letinlineuint16(x:Nullable<_>)=ifx.HasValuethenNullable(Operators.uint16 x.Value)elseNullable()
9898

9999
[<CompiledName("ToInt")>]
100-
letinlineint(x:Nullable< ^T>)=ifx.HasValuethenNullable(Operators.int x.Value)elseNullable()
100+
letinlineint(x:Nullable<_>)=ifx.HasValuethenNullable(Operators.int x.Value)elseNullable()
101101

102102
[<CompiledName("ToEnum")>]
103103
letinlineenum(x:Nullable< int32>)=ifx.HasValuethenNullable(Operators.enum x.Value)elseNullable()
@@ -207,9 +207,11 @@ module LeafExpressionConverter =
207207
|>System.Reflection.MethodInfo.GetMethodFromHandle
208208
:?>MethodInfo
209209

210-
letSubstHelper<'T>(q:Expr,x:Var[],y:obj[]):Expr<'T>=
210+
letSubstHelperRaw(q:Expr,x:Var[],y:obj[]):Expr=
211211
letd= Map.ofArray(Array.zip x y)
212-
q.Substitute(fun v-> v|> d.TryFind|> Option.map(fun x-> Expr.Value(x, v.Type)))|> Expr.Cast
212+
q.Substitute(fun v-> v|> d.TryFind|> Option.map(fun x-> Expr.Value(x, v.Type)))
213+
214+
letSubstHelper<'T>(q:Expr,x:Var[],y:obj[]):Expr<'T>= SubstHelperRaw(q,x,y)|> Expr.Cast
213215

214216
letshowAll=
215217
#if FX_RESHAPED_REFLECTION
@@ -385,6 +387,12 @@ module LeafExpressionConverter =
385387
methodhandleof(fun(x:Expr,y:Var[],z:obj[])-> SubstHelper<obj>(x,y,z))
386388
|> System.Reflection.MethodInfo.GetMethodFromHandle
387389
:?> MethodInfo
390+
391+
letsubstHelperRawMeth=
392+
methodhandleof(fun(x:Expr,y:Var[],z:obj[])-> SubstHelperRaw(x,y,z))
393+
|> System.Reflection.MethodInfo.GetMethodFromHandle
394+
:?> MethodInfo
395+
388396
let(-->)ty1 ty2= Reflection.FSharpType.MakeFunctionType(ty1, ty2)
389397

390398
/// Extract member initialization expression stored in 'MemberInitializationHelper' (by QueryExtensions.fs)
@@ -762,7 +770,7 @@ module LeafExpressionConverter =
762770
| Patterns.IfThenElse(g, t, e)->
763771
Expression.Condition(ConvExprToLinqInContext env g, ConvExprToLinqInContext env t, ConvExprToLinqInContext env e)|> asExpr
764772

765-
| Patterns.Quote x->
773+
| Patterns.QuoteTyped x->
766774
letfvs= x.GetFreeVars()
767775

768776
Expression.Call(substHelperMeth.MakeGenericMethod[| x.Type|],
@@ -771,6 +779,15 @@ module LeafExpressionConverter =
771779
(Expression.NewArrayInit(typeof<obj>,[|for fvin fvs-> Expression.Convert(env.varEnv.[fv], typeof<obj>)|> asExpr|])|> asExpr)|])
772780
|> asExpr
773781

782+
| Patterns.QuoteRaw x->
783+
letfvs= x.GetFreeVars()
784+
785+
Expression.Call(substHelperRawMeth,
786+
[|(Expression.Constant x)|> asExpr;
787+
(Expression.NewArrayInit(typeof<Var>,[|for fvin fvs-> Expression.Constant fv|> asExpr|])|> asExpr);
788+
(Expression.NewArrayInit(typeof<obj>,[|for fvin fvs-> Expression.Convert(env.varEnv.[fv], typeof<obj>)|> asExpr|])|> asExpr)|])
789+
|> asExpr
790+
774791
| Patterns.Let(v, e, b)->
775792
letvP= ConvVarToLinq v
776793
letenvinner={ envwith varEnv= Map.add v(vP|> asExpr) env.varEnv}

‎src/fsharp/FSharp.Core/Linq.fsi‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,5 +303,8 @@ namespace Microsoft.FSharp.Linq.RuntimeHelpers
303303
///A runtime helper used to evaluate nested quotation literals.
304304
val SubstHelper:Expr*Var[]*obj[]->Expr<'T>
305305

306+
///A runtime helper used to evaluate nested quotation literals.
307+
val SubstHelperRaw:Expr*Var[]*obj[]->Expr
308+
306309
val internal(|SpecificCallToMethod|_|):System.RuntimeMethodHandle->(Expr->(Expr option*Type list*Expr list)option)
307310
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp