Skip to content

Commit 1692dda

Browse files
dsymeKevinRansom
authored andcommitted
Fix 592 - bad metadata for fake event properties
1 parent c5fb101 commit 1692dda

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

src/fsharp/TypeRelations.fs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,9 +1438,11 @@ module DispatchSlotChecking =
14381438
allImmediateMembersThatMightImplementDispatchSlots |> List.iter (fun overrideBy ->
14391439

14401440
let isFakeEventProperty = overrideBy.IsFSharpEventProperty(g)
1441-
if not isFakeEventProperty then
1442-
1443-
let overriden =
1441+
let overriden =
1442+
if isFakeEventProperty then
1443+
let slotsigs = overrideBy.MemberInfo.Value.ImplementedSlotSigs
1444+
slotsigs |> List.map (ReparentSlotSigToUseMethodTypars g overrideBy.Range overrideBy)
1445+
else
14441446
[ for ((reqdTy,m),(SlotImplSet(_dispatchSlots,dispatchSlotsKeyed,_,_))) in allImpls do
14451447
let overrideByInfo = GetTypeMemberOverrideInfo g reqdTy overrideBy
14461448
let overridenForThisSlotImplSet =
@@ -1466,7 +1468,7 @@ module DispatchSlotChecking =
14661468
// assert nonNil overridenForThisSlotImplSet
14671469
yield! overridenForThisSlotImplSet ]
14681470

1469-
overrideBy.MemberInfo.Value.ImplementedSlotSigs <- overriden)
1471+
overrideBy.MemberInfo.Value.ImplementedSlotSigs <- overriden)
14701472

14711473

14721474
//-------------------------------------------------------------------------
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
namespace Neg94Pre
22

3+
open System
4+
35
type Class1() =
46
static member inline ($) (r:'R, _) = fun (x:'T) -> ((^R) : (static member method2: ^T -> ^R) x)
5-
static member inline method1 x = Unchecked.defaultof<'r> $ Class1()
7+
static member inline method1 x = Unchecked.defaultof<'r> $ Class1()
8+
9+
type IComm =
10+
[<CLIEvent>]
11+
abstract CanExecuteChanged : IEvent<EventHandler,EventArgs>
12+
13+
type Interface2<'T> =
14+
inherit IComm
15+
16+
type Class<'T>() =
17+
interface Interface2<'T> with
18+
[<CLIEvent>]
19+
member __.CanExecuteChanged : IEvent<EventHandler,EventArgs> = Event<EventHandler,EventArgs>().Publish

tests/fsharp/typecheck/sigs/neg94.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ module Repro1 =
66
let v2 = undefined
77
// We're expecting the compile of this file to fail, but the point is that the
88
// reference of neg94-pre.dll shouldn't give extra warnings about bad definitions.
9-
// See https://github.com/Microsoft/visualfsharp/issues/631
9+
// See
10+
// https://github.com/Microsoft/visualfsharp/issues/631
11+
// https://github.com/Microsoft/visualfsharp/issues/592
1012

0 commit comments

Comments
 (0)