Skip to content

Commit 3b0d500

Browse files
committed
Exposing slot signature of members in object expressions
1 parent 839bab6 commit 3b0d500

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/fsharp/vs/Exprs.fs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ type E =
108108
| ILAsm of string * FSharpType list * FSharpExpr list
109109

110110
/// Used to represent the information at an object expression member
111-
and [<Sealed>] FSharpObjectExprOverride(gps: FSharpGenericParameter list, args:FSharpMemberFunctionOrValue list list, body: FSharpExpr) =
111+
and [<Sealed>] FSharpObjectExprOverride(sgn: FSharpAbstractSignature, gps: FSharpGenericParameter list, args:FSharpMemberFunctionOrValue list list, body: FSharpExpr) =
112+
member __.Signature = sgn
112113
member __.GenericParameters = gps
113114
member __.CurriedParameterGroups = args
114115
member __.Body = body
@@ -444,13 +445,14 @@ module FSharpExprConvert =
444445
| Expr.Obj (_lambdaId,typ,_basev,basecall,overrides, iimpls,_m) ->
445446
let basecallR = ConvExpr cenv env basecall
446447
let ConvertMethods methods =
447-
[ for (TObjExprMethod(_slotsig,_,tps,tmvs,body,_)) in methods ->
448+
[ for (TObjExprMethod(slotsig,_,tps,tmvs,body,_)) in methods ->
448449
let vslR = List.map (List.map (ConvVal cenv)) tmvs
450+
let sgn = FSharpAbstractSignature(cenv, slotsig)
449451
let tpsR = [ for tp in tps -> FSharpGenericParameter(cenv,tp) ]
450452
let env = ExprTranslationEnv.Empty.BindTypars (Seq.zip tps tpsR |> Seq.toList)
451453
let env = env.BindCurriedVals tmvs
452454
let bodyR = ConvExpr cenv env body
453-
FSharpObjectExprOverride(tpsR, vslR, bodyR) ]
455+
FSharpObjectExprOverride(sgn, tpsR, vslR, bodyR) ]
454456
let overridesR = ConvertMethods overrides
455457
let iimplsR = List.map (fun (ty,impls) -> ConvType cenv ty, ConvertMethods impls) iimpls
456458

src/fsharp/vs/Exprs.fsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ and [<Sealed>] FSharpExpr =
5656

5757
/// Represents a checked method in an object expression, as seen by the F# language.
5858
and [<Sealed>] FSharpObjectExprOverride =
59+
/// The signature of the implemented abstract slot
60+
member Signature : FSharpAbstractSignature
5961
/// The generic parameters of the method
6062
member GenericParameters : FSharpGenericParameter list
6163
/// The parameters of the method

src/fsharp/vs/Symbols.fsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ and [<Class>] FSharpAbstractParameter =
312312

313313
/// Represents the signature of an abstract slot of a class or interface
314314
and [<Class>] FSharpAbstractSignature =
315+
internal new : Impl.cenv * SlotSig -> FSharpAbstractSignature
315316

316317
/// Get the arguments of the abstract slot
317318
member AbstractArguments : IList<IList<FSharpAbstractParameter>>

0 commit comments

Comments
 (0)