@@ -2563,17 +2563,7 @@ let ResolveFieldPrim (ncenv:NameResolver) nenv ad typ (mp,id:Ident) allFields =
25632563 let m = id.idRange
25642564 match mp with
25652565 | [] ->
2566- if isAppTy g typ then
2567- match ncenv.InfoReader.TryFindRecdOrClassFieldInfoOfType( id.idText, m, typ) with
2568- | Some ( RecdFieldInfo(_, rfref)) -> [ ResolutionInfo.Empty, FieldResolution( rfref, false )]
2569- | None ->
2570- let typeName = NicePrint.minimalStringOfType nenv.eDisplayEnv typ
2571- if isRecdTy g typ then
2572- // record label doesn't belong to record type -> predict other labels of same record
2573- error( Error( SuggestOtherLabelsOfSameRecordType nenv typeName id allFields, m))
2574- else
2575- error( Error( FSComp.SR.nrTypeDoesNotContainSuchField( typeName, id.idText), m))
2576- else
2566+ let lookup () =
25772567 let frefs =
25782568 try Map.find id.idText nenv.eFieldLabels
25792569 with :? KeyNotFoundException ->
@@ -2584,7 +2574,19 @@ let ResolveFieldPrim (ncenv:NameResolver) nenv ad typ (mp,id:Ident) allFields =
25842574 frefs
25852575 |> ListSet.setify ( fun fref1 fref2 -> tyconRefEq g fref1.TyconRef fref2.TyconRef)
25862576 |> List.map ( fun x -> ResolutionInfo.Empty, FieldResolution( x, false ))
2587-
2577+
2578+ if isAppTy g typ then
2579+ match ncenv.InfoReader.TryFindRecdOrClassFieldInfoOfType( id.idText, m, typ) with
2580+ | Some ( RecdFieldInfo(_, rfref)) -> [ ResolutionInfo.Empty, FieldResolution( rfref, false )]
2581+ | None ->
2582+ let typeName = NicePrint.minimalStringOfType nenv.eDisplayEnv typ
2583+ if isRecdTy g typ then
2584+ // record label doesn't belong to record type -> predict other labels of same record
2585+ error( Error( SuggestOtherLabelsOfSameRecordType nenv typeName id allFields, m))
2586+ else
2587+ lookup()
2588+ else
2589+ lookup()
25882590 | _ ->
25892591 let lid = ( mp@[ id])
25902592 let tyconSearch ad =
0 commit comments