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

Commitdc8a26e

Browse files
authored
Merge pull requestfsharp#23 from vasily-kirichenko/better-indexer-detection
Better indexer detection
2 parentsf08dd58 +12deda4 commitdc8a26e

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

‎src/fsharp/TypeChecker.fs‎

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8220,26 +8220,29 @@ and Propagate cenv overallTy env tpenv (expr: ApplicableExpr) exprty delayed =
82208220
propagate delayedList' mExprAndArg resultTy
82218221
| None ->
82228222
let mArg = arg.Range
8223-
match arg with
8223+
match arg with
82248224
| SynExpr.CompExpr _ -> ()
8225-
| _ ->
8225+
|SynExpr.ArrayOrListOfSeqExpr_ ->
82268226
// 'delayed' is about to be dropped on the floor, first do rudimentary checking to get name resolutions in its body
82278227
RecordNameAndTypeResolutions_IdeallyWithoutHavingOtherEffects_Delayed cenv env tpenv delayed
82288228

8229-
match expr.Expr with
8230-
| Expr.Val (d,_,_) when
8231-
let typ = d.Type
8232-
HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_Dictionary typ ||
8233-
HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_IDictionary typ ||
8234-
HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_List typ ||
8235-
HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_IList typ ||
8236-
HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_IReadOnlyList typ ||
8237-
HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_ICollection typ ||
8238-
isArray1DTy cenv.g typ ||
8239-
isListTy cenv.g typ
8240-
->
8241-
error (NotAFunction(denv,overallTy,true,mExpr,mArg))
8242-
| _ -> error (NotAFunction(denv,overallTy,false,mExpr,mArg))
8229+
let flag =
8230+
match expr.Expr with
8231+
| Expr.Val (d,_,_)
8232+
| Expr.App(Expr.Val (d,_,_),_,_,_,_) ->
8233+
let typ = d.Type
8234+
isArray1DTy cenv.g typ ||
8235+
if isAppTy cenv.g typ then
8236+
let tcref = tcrefOfAppTy cenv.g typ
8237+
let _, entityTy = generalizeTyconRef tcref
8238+
let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy
8239+
props |> List.exists (fun x -> x.PropertyName = "Item")
8240+
else false
8241+
| _ -> false
8242+
8243+
error (NotAFunction(denv,overallTy,flag,mExpr,mArg))
8244+
| _ ->
8245+
error (NotAFunction(denv,overallTy,false,mExpr,mArg))
82438246

82448247
propagate delayed expr.Range exprty
82458248

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp