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

Commiteb3bb2e

Browse files
committed
remove auto-quotation for 'raw' Expr arguments
1 parentbdee98e commiteb3bb2e

File tree

5 files changed

+0
-86
lines changed

5 files changed

+0
-86
lines changed

‎src/fsharp/tastops.fs‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5064,9 +5064,7 @@ let ComputeFieldName tycon f =
50645064
//-------------------------------------------------------------------------
50655065

50665066
letisQuotedExprTy g ty=match tywith AppTy g(tcref,_)-> tyconRefEq g tcref g.expr_tcr|_->false
5067-
letisRawQuotedExprTy g ty=match tywith AppTy g(tcref,_)-> tyconRefEq g tcref g.raw_expr_tcr|_->false
50685067
letdestQuotedExprTy g ty=match tywith AppTy g(_,[ty])-> ty|_-> failwith"destQuotedExprTy"
5069-
letdestRawQuotedExprTy g ty=match tywith AppTy g(_,[ty])-> ty|_-> failwith"destRawQuotedExprTy"
50705068

50715069
letmkQuotedExprTy g ty= TType_app(g.expr_tcr,[ty])
50725070
letmkRawQuotedExprTy g= TType_app(g.raw_expr_tcr,[])
@@ -6030,18 +6028,6 @@ let mkCallLiftValueWithDefn g m qty e1 =
60306028
| None->
60316029
Expr.Quote(e1, ref None,false, m, qty)
60326030

6033-
letmkCallLiftValueWithDefnRaw g m qty e1=
6034-
assert isRawQuotedExprTy g qty
6035-
letvref= ValRefForIntrinsic g.lift_value_with_defn_info
6036-
// Use "Expr.WithValue" if it exists in FSharp.Core
6037-
match vref.TryDerefwith
6038-
| Some_->
6039-
letcopyOfExpr= copyExpr g ValCopyFlag.CloneAll e1
6040-
letquoteOfCopyOfExpr= Expr.Quote(copyOfExpr, ref None,false, m, qty)
6041-
mkApps g(typedExprForIntrinsic g m g.lift_value_with_defn_info,[],[mkTupledNoTypes g m[mkBox(tyOfExpr g e1) e1 m; mkCallTypeOf g m(tyOfExpr g e1); quoteOfCopyOfExpr]], m)
6042-
| None->
6043-
Expr.Quote(e1, ref None,false, m, qty)
6044-
60456031
letmkCallCheckThis g m ty e1=
60466032
mkApps g(typedExprForIntrinsic g m g.check_this_info,[[ty]],[e1], m)
60476033

‎src/fsharp/tastops.fsi‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,10 +1096,8 @@ val destInt32 : Expr -> int32 option
10961096
// Primitives associated with quotations
10971097
//-------------------------------------------------------------------------
10981098
1099-
val isRawQuotedExprTy: TcGlobals-> TType-> bool
11001099
val isQuotedExprTy: TcGlobals-> TType-> bool
11011100
val destQuotedExprTy: TcGlobals-> TType-> TType
1102-
val destRawQuotedExprTy: TcGlobals-> TType-> TType
11031101
val mkQuotedExprTy: TcGlobals-> TType-> TType
11041102
val mkRawQuotedExprTy: TcGlobals-> TType
11051103
val mspec_Type_GetTypeFromHandle: ILGlobals-> ILMethodSpec
@@ -1149,7 +1147,6 @@ val mkCallUnpickleQuotation : TcGlobals -> range -> Expr -> Expr -> Expr -> Exp
11491147
val mkCallCastQuotation: TcGlobals-> range-> TType-> Expr-> Expr
11501148
val mkCallLiftValueWithName: TcGlobals-> range-> TType-> string-> Expr-> Expr
11511149
val mkCallLiftValueWithDefn: TcGlobals-> range-> TType-> Expr-> Expr
1152-
val mkCallLiftValueWithDefnRaw: TcGlobals-> range-> TType-> Expr-> Expr
11531150
val mkCallSeqCollect: TcGlobals-> range-> TType-> TType-> Expr-> Expr-> Expr
11541151
val mkCallSeqUsing: TcGlobals-> range-> TType-> TType-> Expr-> Expr-> Expr
11551152
val mkCallSeqDelay: TcGlobals-> range-> TType-> Expr-> Expr

‎src/fsharp/tc.fs‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8978,15 +8978,6 @@ and TcMethodApplication
89788978
Expr.Quote(callerArgExpr, ref None, false, m, calledArgTy)
89798979
| ReflectedArgInfo.None -> failwith "unreachable" // unreachable due to reflArgInfo.AutoQuote condition
89808980

8981-
elif reflArgInfo.AutoQuote && isRawQuotedExprTy cenv.g calledArgTy && not (isRawQuotedExprTy cenv.g callerArgTy) then
8982-
match reflArgInfo with
8983-
| ReflectedArgInfo.Quote true ->
8984-
mkCallLiftValueWithDefnRaw cenv.g m calledArgTy callerArgExpr
8985-
| ReflectedArgInfo.Quote false ->
8986-
Expr.Quote(callerArgExpr, ref None, false, m, calledArgTy)
8987-
| ReflectedArgInfo.None -> failwith "unreachable" // unreachable due to reflArgInfo.AutoQuote condition
8988-
8989-
89908981
// Note: out args do not need to be coerced
89918982
elif isOutArg then
89928983
callerArgExpr

‎src/fsharp/typrelns.fs‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,9 +1598,6 @@ let AdjustCalledArgType (infoReader:InfoReader) isConstraint (calledArg: CalledA
15981598
elif calledArg.ReflArgInfo.AutoQuote&& isQuotedExprTy g calledArgTy&&not(isQuotedExprTy g callerArgTy)then
15991599
destQuotedExprTy g calledArgTy
16001600

1601-
elif calledArg.ReflArgInfo.AutoQuote&& isRawQuotedExprTy g calledArgTy&&not(isQuotedExprTy g callerArgTy)&&not(isRawQuotedExprTy g callerArgTy)then
1602-
g.obj_ty
1603-
16041601
else calledArgTy
16051602

16061603
// Adjust the called argument type to take into account whether the caller's argument is M(?arg=Some(3)) or M(arg=1)

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

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,18 +2429,9 @@ module TestAutoQuoteAtStaticMethodCalls =
24292429
static memberPlotThreeArg(w:int,[<ReflectedDefinition>]x:Expr<'T>,y:int)=
24302430
sprintf"%A"(w,x,y)|> cleanup
24312431

2432-
static memberPlotRaw([<ReflectedDefinition>]x:Expr)=
2433-
sprintf"%A" x|> cleanup
2434-
24352432
static memberPlotParams([<ReflectedDefinition; System.ParamArray>]x:Expr<int>[])=
24362433
sprintf"%A" x|> cleanup
24372434

2438-
static memberPlotRawParams([<ReflectedDefinition; System.ParamArray>]x:Expr[])=
2439-
sprintf"%A" x|> cleanup
2440-
2441-
static memberRawParams([<System.ParamArray>]x:Expr[])=
2442-
sprintf"%A" x|> cleanup
2443-
24442435
static memberPlotEval([<ReflectedDefinition(true)>]x:Expr<'T>)=
24452436
sprintf"%A" x|> cleanup
24462437

@@ -2458,32 +2449,14 @@ module TestAutoQuoteAtStaticMethodCalls =
24582449

24592450
C.Plot(x+ y* z)|> shouldEqual"testd109701""Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])"
24602451

2461-
C.PlotRaw(x+ y* z)|> shouldEqual"testd109702""Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])"
2462-
24632452
C.PlotTwoArg(x+ y* z,108)|> shouldEqual"testd109703""(Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])]),108)"
24642453

24652454
C.PlotThreeArg(107, x+ y* z,108)|> shouldEqual"testd109704""(107,Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])]),108)"
24662455

2467-
C.RawParams()|> shouldEqual"testd109705""[||]"
2468-
2469-
C.RawParams(<@ xb&& yb|| zb@>,<@ x+ y* z@>)|> shouldEqual"testd109706""[|IfThenElse(IfThenElse(PropertyGet(None,xb,[]),PropertyGet(None,yb,[]),Value(false)),Value(true),ValueWithName(true,zb));Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])|]"
2470-
2471-
C.PlotRawParams()|> shouldEqual"testd109707""[||]"
2472-
24732456
C.PlotParams(1,2)|> shouldEqual"testd109708""[|Value(1);Value(2)|]"
24742457

24752458
C.PlotParams(x+ y)|> shouldEqual"testd109709""[|Call(None,op_Addition,[PropertyGet(None,x,[]),PropertyGet(None,y,[])])|]"
24762459

2477-
C.PlotRawParams(x+ y* z)|> shouldEqual"testd10970A""[|Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])|]"
2478-
2479-
C.PlotRawParams((xb&& yb|| zb),(x+ y* z))|> shouldEqual"testd10970B""[|IfThenElse(IfThenElse(PropertyGet(None,xb,[]),PropertyGet(None,yb,[]),Value(false)),Value(true),ValueWithName(true,zb));Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])|]"
2480-
2481-
C.PlotRawParams(x+ y* z, x+ y* z, x+ y* z)|> shouldEqual"testd10970C""[|Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])]);Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])]);Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])|]"
2482-
2483-
C.PlotRawParams([||])|> shouldEqual"testd10970D""[||]"
2484-
2485-
C.PlotRawParams([|<@@ x+ y* z@@>|])|> shouldEqual"testd10970E""""[|Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])|]"""
2486-
24872460
C.Plot(fun(x,y,z)-> xb&& yb|| zb)|> shouldEqual"testd10970F""Lambda(tupledArg,Let(x,TupleGet(tupledArg,0),Let(y,TupleGet(tupledArg,1),Let(z,TupleGet(tupledArg,2),IfThenElse(IfThenElse(PropertyGet(None,xb,[]),PropertyGet(None,yb,[]),Value(false)),Value(true),ValueWithName(true,zb))))))"
24882461

24892462
C.Plot(fun x-> x)|> shouldEqual"testd109710""Lambda(x,x)"
@@ -2510,21 +2483,12 @@ module TestAutoQuoteAtInstanceMethodCalls =
25102483
member__.PlotThreeArg(w:int,[<ReflectedDefinition>]x:Expr<'T>,y:int)=
25112484
sprintf"%A"(w,x,y)|> cleanup
25122485

2513-
member__.PlotRaw([<ReflectedDefinition>]x:Expr)=
2514-
sprintf"%A" x|> cleanup
2515-
25162486
member__.PlotParams([<ReflectedDefinition; System.ParamArray>]x:Expr<int>[])=
25172487
sprintf"%A" x|> cleanup
25182488

2519-
member__.PlotRawParams([<ReflectedDefinition; System.ParamArray>]x:Expr[])=
2520-
sprintf"%A" x|> cleanup
2521-
25222489
member__.Item([<ReflectedDefinition>]x:Expr<'T>)=
25232490
sprintf"%A" x|> cleanup
25242491

2525-
member__.RawParams([<System.ParamArray>]x:Expr[])=
2526-
sprintf"%A" x|> cleanup
2527-
25282492
member__.PlotEval([<ReflectedDefinition(true)>]x:Expr<'T>)=
25292493
sprintf"%A" x|> cleanup
25302494

@@ -2570,32 +2534,14 @@ module TestAutoQuoteAtInstanceMethodCalls =
25702534

25712535
c.[x+ y* z]|> shouldEqual"testd109701""Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])"
25722536

2573-
c.PlotRaw(x+ y* z)|> shouldEqual"testd109702""Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])"
2574-
25752537
c.PlotTwoArg(x+ y* z,108)|> shouldEqual"testd109703""(Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])]),108)"
25762538

25772539
c.PlotThreeArg(107, x+ y* z,108)|> shouldEqual"testd109704""(107,Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])]),108)"
25782540

2579-
c.RawParams()|> shouldEqual"testd109705""[||]"
2580-
2581-
c.RawParams(<@ xb&& yb|| zb@>,<@ x+ y* z@>)|> shouldEqual"testd109706""[|IfThenElse(IfThenElse(PropertyGet(None,xb,[]),PropertyGet(None,yb,[]),Value(false)),Value(true),ValueWithName(true,zb));Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])|]"
2582-
2583-
c.PlotRawParams()|> shouldEqual"testd109707""[||]"
2584-
25852541
c.PlotParams(1,2)|> shouldEqual"testd109708""[|Value(1);Value(2)|]"
25862542

25872543
c.PlotParams(x+ y)|> shouldEqual"testd109709""[|Call(None,op_Addition,[PropertyGet(None,x,[]),PropertyGet(None,y,[])])|]"
25882544

2589-
c.PlotRawParams(x+ y* z)|> shouldEqual"testd10970A""[|Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])|]"
2590-
2591-
c.PlotRawParams((xb&& yb|| zb),(x+ y* z))|> shouldEqual"testd10970B""[|IfThenElse(IfThenElse(PropertyGet(None,xb,[]),PropertyGet(None,yb,[]),Value(false)),Value(true),ValueWithName(true,zb));Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])|]"
2592-
2593-
c.PlotRawParams(x+ y* z, x+ y* z, x+ y* z)|> shouldEqual"testd10970C""[|Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])]);Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])]);Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])|]"
2594-
2595-
c.PlotRawParams([||])|> shouldEqual"testd10970D""[||]"
2596-
2597-
c.PlotRawParams([|<@@ x+ y* z@@>|])|> shouldEqual"testd10970E""""[|Call(None,op_Addition,[PropertyGet(None,x,[]),Call(None,op_Multiply,[PropertyGet(None,y,[]),ValueWithName(1,z)])])|]"""
2598-
25992545
c.Plot(fun(x,y,z)-> xb&& yb|| zb)|> shouldEqual"testd10970F""Lambda(tupledArg,Let(x,TupleGet(tupledArg,0),Let(y,TupleGet(tupledArg,1),Let(z,TupleGet(tupledArg,2),IfThenElse(IfThenElse(PropertyGet(None,xb,[]),PropertyGet(None,yb,[]),Value(false)),Value(true),ValueWithName(true,zb))))))"
26002546

26012547
c.Plot(fun x-> x)|> shouldEqual"testd109710""Lambda(x,x)"
@@ -2618,7 +2564,6 @@ module TestsForUsingReflectedDefinitionArgumentsAsFirstClassValues =
26182564
openSystem
26192565

26202566
typeFirstClassTests()=
2621-
static memberPlotRawExpr([<ReflectedDefinition>]x:Expr)= x.ToString()
26222567
static memberPlotExpr([<ReflectedDefinition>]x:Expr<'T>)= x.ToString()
26232568
static memberPlotExprOverloadedByType([<ReflectedDefinition>]x:Expr<int>)= x.ToString()
26242569
static memberPlotExprOverloadedByType([<ReflectedDefinition>]x:Expr<string>)= x.ToString()
@@ -2666,8 +2611,6 @@ module TestsForUsingReflectedDefinitionArgumentsAsFirstClassValues =
26662611
(FirstClassTests.PlotLinqOverloadedByShape: Expression<Func<int,int>>-> string)// doesn't auto-quote implicit var
26672612
// EXPECTED AND CONSISTENT: (C.PlotLinqOverloadedByShape : (int -> int) -> string) // auto- - though not very useful
26682613

2669-
(FirstClassTests.PlotRawExpr: Expr-> string)// doesn't auto-quote implicit var
2670-
(FirstClassTests.PlotRawExpr: obj-> string)// does auto-quote implicit var
26712614
(FirstClassTests.PlotExpr: Expr<int>-> string)// doesn't auto-quote implicit var
26722615
(FirstClassTests.PlotExpr: int-> string)// does auto-quote implicit var
26732616
(FirstClassTests.PlotExprOverloadedByType: Expr<int>-> string)// doesn't auto-quote implicit var

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp