提交 b6c307aa 编写于 作者: S Steffen Forkmann 提交者: Kevin Ransom (msft)

Do we really need to keep resolving after we already found a type? (#5644)

* Do we really need to keep resolving after we already found a type?

* Do we really need to keep resolving after we already found a type?

* simplify check
上级 8fbd6bf8
......@@ -3829,30 +3829,27 @@ let TryToResolveLongIdentAsType (ncenv: NameResolver) (nenv: NameResolutionEnv)
match List.tryLast plid with
| Some id ->
// Look for values called 'id' that accept the dot-notation
let ty, isItemVal =
(match nenv.eUnqualifiedItems |> Map.tryFind id with
let ty =
match nenv.eUnqualifiedItems |> Map.tryFind id with
// v.lookup : member of a value
| Some v ->
match v with
| Item.Value x ->
let ty = x.Type
let ty = if x.BaseOrThisInfo = CtorThisVal && isRefCellTy g ty then destRefCellTy g ty else ty
Some ty, true
| _ -> None, false
| None -> None, false)
if isItemVal then ty
else
(ty, LookupTypeNameInEnvNoArity OpenQualified id nenv)
||> List.fold (fun resTy tcref ->
// type.lookup : lookup a static something in a type
| Some v ->
match v with
| Item.Value x ->
let ty = x.Type
let ty = if x.BaseOrThisInfo = CtorThisVal && isRefCellTy g ty then destRefCellTy g ty else ty
Some ty
| _ -> None
| None -> None
match ty with
| Some _ -> ty
| _ ->
// type.lookup : lookup a static something in a type
LookupTypeNameInEnvNoArity OpenQualified id nenv
|> List.tryHead
|> Option.map (fun tcref ->
let tcref = ResolveNestedTypeThroughAbbreviation ncenv tcref m
let ty = FreshenTycon ncenv m tcref
let resTy =
match resTy with
| Some _ -> resTy
| None -> Some ty
resTy)
FreshenTycon ncenv m tcref)
| _ -> None
/// allowObsolete - specifies whether we should return obsolete types & modules
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册