zzarchive-VisualFSharpPowerTools
zzarchive-VisualFSharpPowerTools copied to clipboard
Renaming virtual methods doesn't work
This is an edge case, just stumbled upon it and wanted to let you know. Sorry if this is a know issue already.
If I rename the virtual TestMethod, its name in the overloaded method doesn't change. I am using version 1.9.0.
type Test() =
abstract TestMethod: unit -> unit // rename this
default this.TestMethod() = // or this with F2
Console.WriteLine("No args")
member this.TestMethod(txt:string) =
Console.WriteLine(txt)
this.TestMethod() // this is unchanged
The result of renaming is:
type Test() =
abstract TestMethod2: unit -> unit
default this.TestMethod2() =
Console.WriteLine("No args")
member this.TestMethod(txt:string) =
Console.WriteLine(txt)
this.TestMethod() // error
For non-virtual methods it works as expected.
Before:
type Test() =
member this.TestMethod() =
Console.WriteLine("No args")
member this.TestMethod(txt:string) =
Console.WriteLine(txt)
this.TestMethod()
After:
type Test() =
member this.TestMethod2() =
Console.WriteLine("No args")
member this.TestMethod(txt:string) =
Console.WriteLine(txt)
this.TestMethod2()
It also works for abstract methods: Before:
[<AbstractClassAttribute>]
type Test() =
abstract TestMethod: unit -> unit
member this.TestMethod(txt:string) =
Console.WriteLine(txt)
this.TestMethod()
After:
[<AbstractClassAttribute>]
type Test() =
abstract TestMethod2: unit -> unit
member this.TestMethod(txt:string) =
Console.WriteLine(txt)
this.TestMethod2()
Hm. I've never used virtual methods in F# :)
This is also evident from the highlighting:
If you remove the default
keyword, it's highlighted (and renamed) just fine:
Makes me think symbol usage is not returning correct results...
@hmemcpy Yes, FCS gives us wrong data. It's not a new issue actually. See a related one at https://github.com/fsharp/FSharp.Compiler.Service/issues/189