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

Commit707fac8

Browse files
committed
Extract function
1 parent027f97b commit707fac8

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

‎src/fsharp/InfoReader.fs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,17 @@ let GetImmediateIntrinsicPropInfosOfType (optFilter,ad) g amap m typ =
155155
letpinfos= pinfos|> List.filter(IsPropInfoAccessible g amap m ad)
156156
pinfos
157157

158+
// Checks whether the given type has an indexer property.
159+
letIsIndexerType g amap typ=
160+
isArray1DTy g typ||
161+
isListTy g typ||
162+
match tryDestAppTy g typwith
163+
| Some tcref->
164+
let_,entityTy= generalizeTyconRef tcref
165+
letprops= GetImmediateIntrinsicPropInfosOfType(None, AccessibleFromSomeFSharpCode) g amap range0 entityTy
166+
props|> List.exists(fun x-> x.PropertyName="Item")
167+
|_->false
168+
158169

159170
/// Sets of methods up the hierarchy, ignoring duplicates by name and sig.
160171
/// Used to collect sets of virtual methods, protected methods, protected

‎src/fsharp/TypeChecker.fs‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8225,18 +8225,7 @@ and Propagate cenv overallTy env tpenv (expr: ApplicableExpr) exprty delayed =
82258225
| 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
8228-
8229-
let flag =
8230-
let typ = expr.Type
8231-
isArray1DTy cenv.g typ ||
8232-
if isAppTy cenv.g typ then
8233-
let tcref = tcrefOfAppTy cenv.g typ
8234-
let _, entityTy = generalizeTyconRef tcref
8235-
let props = GetImmediateIntrinsicPropInfosOfType (None, AccessibleFromSomeFSharpCode) cenv.g cenv.amap range0 entityTy
8236-
props |> List.exists (fun x -> x.PropertyName = "Item")
8237-
else false
8238-
8239-
error (NotAFunction(denv,overallTy,flag,mExpr,mArg))
8228+
error (NotAFunction(denv,overallTy,IsIndexerType cenv.g cenv.amap expr.Type,mExpr,mArg))
82408229
| _ ->
82418230
// 'delayed' is about to be dropped on the floor, first do rudimentary checking to get name resolutions in its body
82428231
RecordNameAndTypeResolutions_IdeallyWithoutHavingOtherEffects_Delayed cenv env tpenv delayed

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp