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

Commitbe48342

Browse files
committed
allow first-class use of ReflectedDefinition methods
1 parent23d00fd commitbe48342

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

‎src/fsharp/tc.fs‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8527,11 +8527,15 @@ and TcMethodApplicationThen
85278527

85288528
PropagateThenTcDelayed cenv overallTy env tpenv mWholeExpr (MakeApplicableExprNoFlex cenv expr) exprty atomicFlag delayed
85298529

8530-
and GetNewInferenceTypeForMethodArg cenv x =
8530+
/// Infer initial type information at the callsite from the syntax of an argument, prior to overload resolution.
8531+
and GetNewInferenceTypeForMethodArg cenv env tpenv x =
85318532
match x with
8532-
| SynExprParen(a,_,_,_) -> GetNewInferenceTypeForMethodArg cenv a
8533-
| SynExpr.AddressOf(true,a,_,_) -> mkByrefTy cenv.g (GetNewInferenceTypeForMethodArg cenv a)
8534-
| SynExpr.Lambda(_,_,_,a,_) -> (NewInferenceType () --> GetNewInferenceTypeForMethodArg cenv a)
8533+
| SynExprParen(a,_,_,_) -> GetNewInferenceTypeForMethodArg cenv env tpenv a
8534+
| SynExpr.AddressOf(true,a,_,_) -> mkByrefTy cenv.g (GetNewInferenceTypeForMethodArg cenv env tpenv a)
8535+
| SynExpr.Lambda(_,_,_,a,_) -> mkFunTy (NewInferenceType ()) (GetNewInferenceTypeForMethodArg cenv env tpenv a)
8536+
| SynExpr.Quote(_,raw,a,_,_) ->
8537+
if raw then mkRawQuotedExprTy cenv.g
8538+
else mkQuotedExprTy cenv.g (GetNewInferenceTypeForMethodArg cenv env tpenv a)
85358539
| _ -> NewInferenceType ()
85368540

85378541
/// Method calls, property lookups, attribute constructions etc. get checked through here
@@ -8558,8 +8562,8 @@ and TcMethodApplication
85588562

85598563
let denv = env.DisplayEnv
85608564

8561-
let isSimpleFormalArg (isParamArrayArg, isOutArg, optArgInfo: OptionalArgInfo,reflArgInfo: ReflectedArgInfo) =
8562-
not isParamArrayArg && not isOutArg && not optArgInfo.IsOptional&& not reflArgInfo.AutoQuote
8565+
let isSimpleFormalArg (isParamArrayArg, isOutArg, optArgInfo: OptionalArgInfo,_reflArgInfo: ReflectedArgInfo) =
8566+
not isParamArrayArg && not isOutArg && not optArgInfo.IsOptional
85638567

85648568
let callerObjArgTys = objArgs |> List.map (tyOfExpr cenv.g)
85658569

@@ -8608,7 +8612,7 @@ and TcMethodApplication
86088612
else
86098613
unnamedCurriedCallerArgs,namedCurriedCallerArgs
86108614

8611-
let MakeUnnamedCallerArgInfo x = (x, GetNewInferenceTypeForMethodArg cenv x, x.Range)
8615+
let MakeUnnamedCallerArgInfo x = (x, GetNewInferenceTypeForMethodArg cenvenv tpenvx, x.Range)
86128616

86138617
// "single named item" rule. This is where we have a single accessible method
86148618
// member x.M(arg1)
@@ -8651,7 +8655,7 @@ and TcMethodApplication
86518655
| _ ->
86528656
let unnamedCurriedCallerArgs = unnamedCurriedCallerArgs |> List.mapSquared MakeUnnamedCallerArgInfo
86538657
let namedCurriedCallerArgs = namedCurriedCallerArgs |> List.mapSquared (fun (isOpt,nm,x) ->
8654-
let ty = GetNewInferenceTypeForMethodArg cenv x
8658+
let ty = GetNewInferenceTypeForMethodArg cenvenv tpenvx
86558659
// #435263 : compiler crash with .net optional parameters and F# optional syntax
86568660
// named optional arguments should always have option type
86578661
let ty = if isOpt then mkOptionTy denv.g ty else ty

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp