提交 dc8a26e6 编写于 作者: S Steffen Forkmann 提交者: GitHub

Merge pull request #23 from vasily-kirichenko/better-indexer-detection

Better indexer detection
...@@ -8220,26 +8220,29 @@ and Propagate cenv overallTy env tpenv (expr: ApplicableExpr) exprty delayed = ...@@ -8220,26 +8220,29 @@ and Propagate cenv overallTy env tpenv (expr: ApplicableExpr) exprty delayed =
propagate delayedList' mExprAndArg resultTy propagate delayedList' mExprAndArg resultTy
| None -> | None ->
let mArg = arg.Range let mArg = arg.Range
match arg with match arg with
| SynExpr.CompExpr _ -> () | SynExpr.CompExpr _ -> ()
| _ -> | SynExpr.ArrayOrListOfSeqExpr _ ->
// 'delayed' is about to be dropped on the floor, first do rudimentary checking to get name resolutions in its body // 'delayed' is about to be dropped on the floor, first do rudimentary checking to get name resolutions in its body
RecordNameAndTypeResolutions_IdeallyWithoutHavingOtherEffects_Delayed cenv env tpenv delayed RecordNameAndTypeResolutions_IdeallyWithoutHavingOtherEffects_Delayed cenv env tpenv delayed
match expr.Expr with let flag =
| Expr.Val (d,_,_) when match expr.Expr with
let typ = d.Type | Expr.Val (d,_,_)
HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_Dictionary typ || | Expr.App(Expr.Val (d,_,_),_,_,_,_) ->
HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_IDictionary typ || let typ = d.Type
HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_List typ || isArray1DTy cenv.g typ ||
HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_IList typ || if isAppTy cenv.g typ then
HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_IReadOnlyList typ || let tcref = tcrefOfAppTy cenv.g typ
HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_ICollection typ || let _, entityTy = generalizeTyconRef tcref
isArray1DTy cenv.g typ || let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy
isListTy cenv.g typ props |> List.exists (fun x -> x.PropertyName = "Item")
-> else false
error (NotAFunction(denv,overallTy,true,mExpr,mArg)) | _ -> false
| _ -> error (NotAFunction(denv,overallTy,false,mExpr,mArg))
error (NotAFunction(denv,overallTy,flag,mExpr,mArg))
| _ ->
error (NotAFunction(denv,overallTy,false,mExpr,mArg))
propagate delayed expr.Range exprty propagate delayed expr.Range exprty
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册