Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/Compiler/Checking/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,7 @@ let FreshenAbstractSlot g amap m synTyparDecls absMethInfo =
//-------------------------------------------------------------------------

/// Helper used to check record expressions and record patterns
let BuildFieldMap (cenv: cenv) env isPartial ty flds m =
let BuildFieldMap (cenv: cenv) env isPartial ty (flds: ((Ident list * Ident) * 'T) list) m =
let g = cenv.g
let ad = env.eAccessRights

Expand All @@ -1792,7 +1792,8 @@ let BuildFieldMap (cenv: cenv) env isPartial ty flds m =
let allFields = flds |> List.map (fun ((_, ident), _) -> ident)
flds
|> List.map (fun (fld, fldExpr) ->
let frefSet = ResolveField cenv.tcSink cenv.nameResolver env.eNameResEnv ad ty fld allFields
let (fldPath, fldId) = fld
let frefSet = ResolveField cenv.tcSink cenv.nameResolver env.eNameResEnv ad ty fldPath fldId allFields
fld, frefSet, fldExpr)

let relevantTypeSets =
Expand Down Expand Up @@ -6163,7 +6164,8 @@ and TcTyparExprThen (cenv: cenv) overallTy env tpenv synTypar m delayed =
let tp, tpenv = TcTypar cenv env NoNewTypars tpenv synTypar
let mExprAndLongId = unionRanges synTypar.Range ident.idRange
let ty = mkTyparTy tp
let item, _rest = ResolveLongIdentInType cenv.tcSink cenv.nameResolver env.NameEnv LookupKind.Expr ident.idRange ad ident IgnoreOverrides TypeNameResolutionInfo.Default ty
let lookupKind = LookupKind.Expr LookupIsInstance.Ambivalent
let item, _rest = ResolveLongIdentInType cenv.tcSink cenv.nameResolver env.NameEnv lookupKind ident.idRange ad ident IgnoreOverrides TypeNameResolutionInfo.Default ty
let delayed3 =
match rest with
| [] -> delayed2
Expand Down Expand Up @@ -10614,7 +10616,8 @@ and TcAttributeEx canFail (cenv: cenv) (env: TcEnv) attrTgt attrEx (synAttr: Syn
attributeAssignedNamedItems |> List.map (fun (CallerNamedArg(id, CallerArg(callerArgTy, m, isOpt, callerArgExpr))) ->
if isOpt then error(Error(FSComp.SR.tcOptionalArgumentsCannotBeUsedInCustomAttribute(), m))
let m = callerArgExpr.Range
let setterItem, _ = ResolveLongIdentInType cenv.tcSink cenv.nameResolver env.NameEnv LookupKind.Expr m ad id IgnoreOverrides TypeNameResolutionInfo.Default ty
let lookupKind = LookupKind.Expr LookupIsInstance.Ambivalent
let setterItem, _ = ResolveLongIdentInType cenv.tcSink cenv.nameResolver env.NameEnv lookupKind m ad id IgnoreOverrides TypeNameResolutionInfo.Default ty
let nm, isProp, argTy =
match setterItem with
| Item.Property (_, [pinfo]) ->
Expand Down
11 changes: 6 additions & 5 deletions src/Compiler/Checking/MethodCalls.fs
Original file line number Diff line number Diff line change
Expand Up @@ -634,18 +634,19 @@ type CalledMeth<'T>
let pinfos = GetIntrinsicPropInfoSetsOfType infoReader (Some nm) ad AllowMultiIntfInstantiations.Yes IgnoreOverrides id.idRange returnedObjTy
let pinfos = pinfos |> ExcludeHiddenOfPropInfos g infoReader.amap m
match pinfos with
| [pinfo] when pinfo.HasSetter && not pinfo.IsIndexer ->
| [pinfo] when pinfo.HasSetter && not pinfo.IsStatic && not pinfo.IsIndexer ->
let pminfo = pinfo.SetterMethod
let pminst = freshenMethInfo m pminfo
let propStaticTyOpt = if isTyparTy g returnedObjTy then Some returnedObjTy else None
Choice1Of2(AssignedItemSetter(id, AssignedPropSetter(propStaticTyOpt, pinfo, pminfo, pminst), e))
| _ ->
let epinfos =
match nameEnv with
| Some ne -> ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader ne (Some nm) ad m returnedObjTy
| Some ne -> ExtensionPropInfosOfTypeInScope ResultCollectionSettings.AllResults infoReader ne (Some nm) LookupIsInstance.Ambivalent ad m returnedObjTy
| _ -> []

match epinfos with
| [pinfo] when pinfo.HasSetter && not pinfo.IsIndexer ->
| [pinfo] when pinfo.HasSetter && not pinfo.IsStatic && not pinfo.IsIndexer ->
let pminfo = pinfo.SetterMethod
let pminst =
match minfo with
Expand All @@ -661,11 +662,11 @@ type CalledMeth<'T>
Choice1Of2(AssignedItemSetter(id, AssignedPropSetter(propStaticTyOpt, pinfo, pminfo, pminst), e))
| _ ->
match infoReader.GetILFieldInfosOfType(Some(nm), ad, m, returnedObjTy) with
| finfo :: _ ->
| finfo :: _ when not finfo.IsStatic ->
Choice1Of2(AssignedItemSetter(id, AssignedILFieldSetter(finfo), e))
| _ ->
match infoReader.TryFindRecdOrClassFieldInfoOfType(nm, m, returnedObjTy) with
| ValueSome rfinfo ->
| ValueSome rfinfo when not rfinfo.IsStatic ->
Choice1Of2(AssignedItemSetter(id, AssignedRecdFieldSetter(rfinfo), e))
| _ ->
Choice2Of2(arg))
Expand Down
Loading