@@ -118,7 +118,28 @@ module Impl =
118118 | FSharpOrArrayOrByrefOrTupleOrExnTypeMetadata ->
119119 entity.Accessibility
120120
121-
121+ let getLiteralValue = function
122+ | Some lv ->
123+ match lv with
124+ | Const.Bool v -> Some( box v)
125+ | Const.SByte v -> Some( box v)
126+ | Const.Byte v -> Some( box v)
127+ | Const.Int16 v -> Some( box v)
128+ | Const.UInt16 v -> Some( box v)
129+ | Const.Int32 v -> Some( box v)
130+ | Const.UInt32 v -> Some( box v)
131+ | Const.Int64 v -> Some( box v)
132+ | Const.UInt64 v -> Some( box v)
133+ | Const.IntPtr v -> Some( box v)
134+ | Const.UIntPtr v -> Some( box v)
135+ | Const.Single v -> Some( box v)
136+ | Const.Double v -> Some( box v)
137+ | Const.Char v -> Some( box v)
138+ | Const.String v -> Some( box v)
139+ | Const.Decimal v -> Some( box v)
140+ | Const.Unit
141+ | Const.Zero -> None
142+ | None -> None
122143
123144
124145 type cenv ( g : TcGlobals , thisCcu : CcuThunk , tcImports : TcImports ) =
@@ -638,29 +659,9 @@ and FSharpField(cenv, d: FSharpFieldData) =
638659 d.RecdField.LiteralValue.IsSome
639660
640661 member __.LiteralValue =
641- if isUnresolved() then None else
642- match d.RecdField.LiteralValue with
643- | Some lv ->
644- match lv with
645- | Const.Bool v -> Some( box v)
646- | Const.SByte v -> Some( box v)
647- | Const.Byte v -> Some( box v)
648- | Const.Int16 v -> Some( box v)
649- | Const.UInt16 v -> Some( box v)
650- | Const.Int32 v -> Some( box v)
651- | Const.UInt32 v -> Some( box v)
652- | Const.Int64 v -> Some( box v)
653- | Const.UInt64 v -> Some( box v)
654- | Const.IntPtr v -> Some( box v)
655- | Const.UIntPtr v -> Some( box v)
656- | Const.Single v -> Some( box v)
657- | Const.Double v -> Some( box v)
658- | Const.Char v -> Some( box v)
659- | Const.String v -> Some( box v)
660- | Const.Decimal v -> Some( box v)
661- | Const.Unit
662- | Const.Zero -> None
663- | None -> None
662+ if isUnresolved()
663+ then None
664+ else getLiteralValue d.RecdField.LiteralValue
664665
665666 member __.IsVolatile =
666667 if isUnresolved() then false else
@@ -1489,20 +1490,35 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
14891490 v.Attribs |> List.map ( fun a -> FSharpAttribute( cenv, AttribInfo.FSAttribInfo( cenv.g, a)))
14901491 |> makeReadOnlyCollection
14911492
1492- (*
1493+
14931494 /// Is this "base" in "base.M(...)"
1494- member __.IsBaseValue : bool
1495+ member __.IsBaseValue =
1496+ if isUnresolved() then false else
1497+ match d with
1498+ | M _ | P _ | E _ -> false
1499+ | V v -> match v.BaseOrThisInfo with BaseVal -> true | _ -> false
14951500
1496- /// Is this the "x" in "type C() as x = ..."
1497- member __.IsConstructorThisValue : bool
14981501
1499- /// Is this the "x" in "member __.M = ..."
1500- member __.IsMemberThisValue : bool
1502+ /// Is this the "x" in "type C() as x = ..."
1503+ member __.IsConstructorThisValue =
1504+ if isUnresolved() then false else
1505+ match d with
1506+ | M _ | P _ | E _ -> false
1507+ | V v -> match v.BaseOrThisInfo with CtorThisVal -> true | _ -> false
15011508
1502- /// Is this a [<Literal>] value, and if so what value?
1503- member __.LiteralValue : obj // may be null
1509+ /// Is this the "x" in "member x.M = ..."
1510+ member __.IsMemberThisValue =
1511+ if isUnresolved() then false else
1512+ match d with
1513+ | M _ | P _ | E _ -> false
1514+ | V v -> match v.BaseOrThisInfo with MemberThisVal -> true | _ -> false
15041515
1505- *)
1516+ /// Is this a [<Literal>] value, and if so what value? (may be null)
1517+ member __.LiteralValue =
1518+ if isUnresolved() then None else
1519+ match d with
1520+ | M _ | P _ | E _ -> None
1521+ | V v -> getLiteralValue v.LiteralValue
15061522
15071523 /// How visible is this?
15081524 member this.Accessibility : FSharpAccessibility =
0 commit comments