Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/10.0.200.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Fix `--preferreduilang` switch leaking into `fsi.CommandLineArgs` when positioned after script file ([PR #19151](https://github.com/dotnet/fsharp/pull/19151))
* Fixed runtime crash when using interfaces with unimplemented static abstract members as constrained type arguments. ([Issue #19184](https://github.com/dotnet/fsharp/issues/19184))
* Fix delegates with `[<OptionalArgument>]` and caller info attributes failing to compile. ([Issue #18868](https://github.com/dotnet/fsharp/issues/18868), [PR #19069](https://github.com/dotnet/fsharp/pull/19069))
* Type checker: mark generated event tree nodes as synthetic ([PR #19213](https://github.com/dotnet/fsharp/pull/19213))

### Added

Expand Down
2 changes: 2 additions & 0 deletions src/Compiler/Checking/Expressions/CheckExpressions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2651,6 +2651,7 @@ module EventDeclarationNormalization =
let MakeOne (prefix, target) =
let declPattern = RenameBindingPattern (fun s -> prefix + s) declPattern
let argName = "handler"
let mBinding = mBinding.MakeSynthetic()

// modify the rhs and argument data
let bindingRhs, valSynData =
Expand All @@ -2662,6 +2663,7 @@ module EventDeclarationNormalization =
match rhsExpr with
// Detect 'fun () -> e' which results from the compilation of a property getter
| SynExpr.Lambda (args=SynSimplePats.SimplePats(pats = []); body=trueRhsExpr; range=m) ->
let m = m.MakeSynthetic()
let rhsExpr = mkSynApp1 (SynExpr.DotGet (SynExpr.Paren (trueRhsExpr, range0, None, m), range0, SynLongIdent([ident(target, m)], [], [None]), m)) (SynExpr.Ident (ident(argName, m))) m

// reconstitute rhsExpr
Expand Down
12 changes: 12 additions & 0 deletions tests/FSharp.Compiler.Service.Tests/Symbols.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,18 @@ type T() =

Assert.False hasPropertySymbols

[<Fact>]
let ``CLIEvent 01 - Synthetic range`` () =
let _, checkResults = getParseAndCheckResults """
type T() =
[<CLIEvent>]
member this.Event = Event<int>().Publish
"""
checkResults.GetAllUsesOfAllSymbolsInFile()
|> Seq.exists (fun symbolUse -> symbolUse.Symbol.DisplayNameCore = "handler")
|> shouldEqual false


module Delegates =
[<Fact>]
let ``IL metadata`` () =
Expand Down
Loading