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

Commit00217e7

Browse files
detect that a type has indexer
1 parent9d6168c commit00217e7

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

‎src/fsharp/TypeChecker.fs‎

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8228,21 +8228,16 @@ and Propagate cenv overallTy env tpenv (expr: ApplicableExpr) exprty delayed =
82288228

82298229
let flag =
82308230
match expr.Expr with
8231-
| Expr.App(Expr.Val (d,_,m),_,_,_,_) ->
8232-
8231+
| Expr.Val (d,_,_)
8232+
| Expr.App(Expr.Val (d,_,_),_,_,_,_) ->
82338233
let typ = d.Type
8234-
8235-
match InfoReader.TryFindIntrinsicNamedItemOfType cenv.infoReader ("Item", AccessibleFromEverywhere) FindMemberFlag.IgnoreOverrides m typ with
8236-
| Some (PropertyItem _) -> true
8237-
// HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_Dictionary typ ||
8238-
// HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_IDictionary typ ||
8239-
// HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_List typ ||
8240-
// HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_IList typ ||
8241-
// HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_IReadOnlyList typ ||
8242-
// HasHeadType cenv.g cenv.g.tcref_System_Collections_Generic_ICollection typ ||
8243-
// isArray1DTy cenv.g typ ||
8244-
// isListTy cenv.g typ
8245-
| _ -> false
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
82468241
| _ -> false
82478242

82488243
error (NotAFunction(denv,overallTy,flag,mExpr,mArg))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp