@@ -1115,9 +1115,37 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
11151115 | P m ->
11161116 let minfo = m.GetterMethod
11171117 FSharpMemberOrFunctionOrValue( cenv, M minfo, Item.MethodGroup ( minfo.DisplayName,[ minfo]))
1118- | E _
1119- | M _
1120- | V _ -> invalidOp " the value or member doesn't have an associated getter method"
1118+ | E _ | M _ | V _ -> invalidOp " the value or member doesn't have an associated getter method"
1119+
1120+ member __.EventAddMethod =
1121+ checkIsResolved()
1122+ match d with
1123+ | E e ->
1124+ let minfo = e.GetAddMethod()
1125+ FSharpMemberOrFunctionOrValue( cenv, M minfo, Item.MethodGroup ( minfo.DisplayName,[ minfo]))
1126+ | P _ | M _ | V _ -> invalidOp " the value or member doesn't have an associated add method"
1127+
1128+ member __.EventRemoveMethod =
1129+ checkIsResolved()
1130+ match d with
1131+ | E e ->
1132+ let minfo = e.GetRemoveMethod()
1133+ FSharpMemberOrFunctionOrValue( cenv, M minfo, Item.MethodGroup ( minfo.DisplayName,[ minfo]))
1134+ | P _ | M _ | V _ -> invalidOp " the value or member doesn't have an associated remove method"
1135+
1136+ member __.EventDelegateType =
1137+ checkIsResolved()
1138+ match d with
1139+ | E e -> FSharpType( cenv, e.GetDelegateType( cenv.amap, range0))
1140+ | P _ | M _ | V _ -> invalidOp " the value or member doesn't have an associated event delegate type"
1141+
1142+ member __.EventIsStandard =
1143+ checkIsResolved()
1144+ match d with
1145+ | E e ->
1146+ let dty = e.GetDelegateType( cenv.amap, range0)
1147+ TryDestStandardDelegateTyp cenv.infoReader range0 AccessibleFromSomewhere dty |> isSome
1148+ | P _ | M _ | V _ -> invalidOp " the value or member is not an event"
11211149
11221150 member __.HasSetterMethod =
11231151 if isUnresolved() then false
@@ -1446,9 +1474,15 @@ and FSharpMemberOrFunctionOrValue(cenv, d:FSharpMemberOrValData, item) =
14461474 | E e ->
14471475 // INCOMPLETENESS: Attribs is empty here, so we can't look at return attributes for .NET or F# methods
14481476 let retInfo : ArgReprInfo = { Name= None; Attribs= [] }
1449- let rty = PropTypOfEventInfo cenv.infoReader range0 AccessibleFromSomewhere e
1450- let _ , rty , _cxs = PrettyTypes.PrettifyTypes1 cenv.g rty
1477+ let rty =
1478+ try PropTypOfEventInfo cenv.infoReader range0 AccessibleFromSomewhere e
1479+ with _ ->
1480+ // For non-standard events, just use the delegate type as the ReturnParameter type
1481+ e.GetDelegateType( cenv.amap, range0)
1482+
1483+ let _ , rty , _cxs = PrettyTypes.PrettifyTypes1 cenv.g rty
14511484 FSharpParameter( cenv, rty, retInfo, x.DeclarationLocationOpt, isParamArrayArg= false , isOutArg= false , isOptionalArg= false )
1485+
14521486 | P p ->
14531487 // INCOMPLETENESS: Attribs is empty here, so we can't look at return attributes for .NET or F# methods
14541488 let retInfo : ArgReprInfo = { Name= None; Attribs= [] }
@@ -1815,7 +1849,7 @@ and FSharpParameter(cenv, typ:TType, topArgInfo:ArgReprInfo, mOpt, isParamArrayA
18151849
18161850and FSharpAssemblySignature internal ( cenv , topAttribs : TypeChecker.TopAttribs option , mtyp : ModuleOrNamespaceType ) =
18171851
1818- new ( g , thisCcu , tcImports , topAttribs , mtyp ) = FSharpAssemblySignature( cenv( g, thisCcu, tcImports), topAttribs, mtyp)
1852+ new ( g , thisCcu , tcImports , topAttribs , mtyp ) = FSharpAssemblySignature( cenv( g, thisCcu, tcImports), topAttribs, mtyp)
18191853
18201854 member __.Entities =
18211855
@@ -1824,7 +1858,11 @@ and FSharpAssemblySignature internal (cenv, topAttribs: TypeChecker.TopAttribs o
18241858 if entity.IsNamespace then
18251859 yield ! loop entity.ModuleOrNamespaceType
18261860 else
1827- yield FSharpEntity( cenv, mkLocalEntityRef entity) |]
1861+ let entityRef =
1862+ match tryRescopeEntity cenv.thisCcu entity with
1863+ | None -> mkLocalEntityRef entity
1864+ | Some eref -> eref
1865+ yield FSharpEntity( cenv, entityRef) |]
18281866
18291867 loop mtyp |> makeReadOnlyCollection
18301868
@@ -1839,7 +1877,7 @@ and FSharpAssemblySignature internal (cenv, topAttribs: TypeChecker.TopAttribs o
18391877
18401878and FSharpAssembly internal ( cenv , ccu : CcuThunk ) =
18411879
1842- new ( g , thisCcu , tcImports , ccu ) = FSharpAssembly( cenv( g, thisCcu , tcImports), ccu)
1880+ new ( g , tcImports , ccu ) = FSharpAssembly( cenv( g, ccu , tcImports), ccu)
18431881
18441882 member __.RawCcuThunk = ccu
18451883 member __.QualifiedName = match ccu.QualifiedName with None -> " " | Some s -> s
0 commit comments