-
Notifications
You must be signed in to change notification settings - Fork 859
Add EmittedIL tests proving [<CompiledName>] works by design on extension overloads (#19604) #19737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
T-Gro
wants to merge
1
commit into
main
Choose a base branch
from
fix/19604-compiledname
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute06.fs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // #NoMono #NoMT #CodeGen #EmittedIL #Attributes | ||
| // Regression test for https://github.com/dotnet/fsharp/issues/19604 | ||
| // EXPECTED: [<CompiledName>] applied to one overload renames only that overload in IL. | ||
| // The unannotated overload keeps its original logical name. | ||
| module Program | ||
|
|
||
| open System | ||
| open System.Runtime.CompilerServices | ||
| open System.Runtime.InteropServices | ||
|
|
||
| type Builder() = | ||
| member _.X = 1 | ||
|
|
||
| [<AutoOpen; Extension>] | ||
| module Ext = | ||
| type Builder with | ||
| [<Extension; CompiledName "UseCosmosDb">] | ||
| member builder.UseCosmosDb ([<Optional; DefaultParameterValue false>] storeScopesAndAppsInMemory : bool) = () | ||
|
|
||
| [<Extension>] | ||
| member builder.UseCosmosDb (configuration : Action<int>) = () |
Empty file.
114 changes: 114 additions & 0 deletions
114
...Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute06.fs.il.bsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| .assembly extern runtime { } | ||
| .assembly extern FSharp.Core { } | ||
| .assembly assembly | ||
| { | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, | ||
| int32, | ||
| int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) | ||
|
|
||
|
|
||
|
|
||
|
|
||
| .hash algorithm 0x00008004 | ||
| .ver 0:0:0:0 | ||
| } | ||
| .module assembly.exe | ||
|
|
||
| .imagebase {value} | ||
| .file alignment 0x00000200 | ||
| .stackreserve 0x00100000 | ||
| .subsystem 0x0003 | ||
| .corflags 0x00000001 | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| .class public abstract auto ansi sealed Program | ||
| extends [runtime]System.Object | ||
| { | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) | ||
| .class auto ansi serializable nested public Builder | ||
| extends [runtime]System.Object | ||
| { | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) | ||
| .method public specialname rtspecialname instance void .ctor() cil managed | ||
| { | ||
|
|
||
| .maxstack 8 | ||
| IL_0000: ldarg.0 | ||
| IL_0001: callvirt instance void [runtime]System.Object::.ctor() | ||
| IL_0006: ldarg.0 | ||
| IL_0007: pop | ||
| IL_0008: ret | ||
| } | ||
|
|
||
| .method public hidebysig specialname instance int32 get_X() cil managed | ||
| { | ||
|
|
||
| .maxstack 8 | ||
| IL_0000: ldc.i4.1 | ||
| IL_0001: ret | ||
| } | ||
|
|
||
| .property instance int32 X() | ||
| { | ||
| .get instance int32 Program/Builder::get_X() | ||
| } | ||
| } | ||
|
|
||
| .class abstract auto ansi sealed nested public Ext | ||
| extends [runtime]System.Object | ||
| { | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.AutoOpenAttribute::.ctor() = ( 01 00 00 00 ) | ||
| .custom instance void [runtime]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) | ||
| .method public static void UseCosmosDb(class Program/Builder builder, | ||
| [opt] bool storeScopesAndAppsInMemory) cil managed | ||
| { | ||
| .custom instance void [runtime]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 0B 55 73 65 43 6F 73 6D 6F 73 44 62 00 00 ) | ||
| .param [2] = bool(false) | ||
|
|
||
| .maxstack 8 | ||
| IL_0000: ret | ||
| } | ||
|
|
||
| .method public static void Builder.UseCosmosDb(class Program/Builder builder, | ||
|
T-Gro marked this conversation as resolved.
|
||
| class [runtime]System.Action`1<int32> configuration) cil managed | ||
| { | ||
| .custom instance void [runtime]System.Runtime.CompilerServices.ExtensionAttribute::.ctor() = ( 01 00 00 00 ) | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) | ||
|
|
||
| .maxstack 8 | ||
| IL_0000: ret | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } | ||
|
|
||
| .class private abstract auto ansi sealed '<StartupCode$assembly>'.$Program | ||
| extends [runtime]System.Object | ||
| { | ||
| .method public static void main@() cil managed | ||
| { | ||
| .entrypoint | ||
|
|
||
| .maxstack 8 | ||
| IL_0000: ret | ||
| } | ||
|
|
||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
14 changes: 14 additions & 0 deletions
14
...FSharp.Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute07.fs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // #NoMono #NoMT #CodeGen #EmittedIL #Attributes | ||
| // Regression test for https://github.com/dotnet/fsharp/issues/19604 | ||
| // EXPECTED: [<CompiledName>] with a different value on one overload renames only that overload. | ||
| module Program | ||
|
|
||
| type Builder() = | ||
| member _.X = 1 | ||
|
|
||
| module Ext = | ||
| type Builder with | ||
| [<CompiledName "Renamed">] | ||
| member builder.UseDb (i: int) = i | ||
|
|
||
| member builder.UseDb (s: string) = s |
Empty file.
111 changes: 111 additions & 0 deletions
111
...Compiler.ComponentTests/EmittedIL/CompiledNameAttribute/CompiledNameAttribute07.fs.il.bsl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| .assembly extern runtime { } | ||
| .assembly extern FSharp.Core { } | ||
| .assembly assembly | ||
| { | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, | ||
| int32, | ||
| int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) | ||
|
|
||
|
|
||
|
|
||
|
|
||
| .hash algorithm 0x00008004 | ||
| .ver 0:0:0:0 | ||
| } | ||
| .module assembly.exe | ||
|
|
||
| .imagebase {value} | ||
| .file alignment 0x00000200 | ||
| .stackreserve 0x00100000 | ||
| .subsystem 0x0003 | ||
| .corflags 0x00000001 | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| .class public abstract auto ansi sealed Program | ||
| extends [runtime]System.Object | ||
| { | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) | ||
| .class auto ansi serializable nested public Builder | ||
| extends [runtime]System.Object | ||
| { | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) | ||
| .method public specialname rtspecialname instance void .ctor() cil managed | ||
| { | ||
|
|
||
| .maxstack 8 | ||
| IL_0000: ldarg.0 | ||
| IL_0001: callvirt instance void [runtime]System.Object::.ctor() | ||
| IL_0006: ldarg.0 | ||
| IL_0007: pop | ||
| IL_0008: ret | ||
| } | ||
|
|
||
| .method public hidebysig specialname instance int32 get_X() cil managed | ||
| { | ||
|
|
||
| .maxstack 8 | ||
| IL_0000: ldc.i4.1 | ||
| IL_0001: ret | ||
| } | ||
|
|
||
| .property instance int32 X() | ||
| { | ||
| .get instance int32 Program/Builder::get_X() | ||
| } | ||
| } | ||
|
|
||
| .class abstract auto ansi sealed nested public Ext | ||
| extends [runtime]System.Object | ||
| { | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) | ||
| .method public static int32 Renamed(class Program/Builder builder, | ||
| int32 i) cil managed | ||
| { | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationSourceNameAttribute::.ctor(string) = ( 01 00 05 55 73 65 44 62 00 00 ) | ||
|
|
||
| .maxstack 8 | ||
| IL_0000: ldarg.1 | ||
| IL_0001: ret | ||
| } | ||
|
|
||
| .method public static string Builder.UseDb(class Program/Builder builder, | ||
| string s) cil managed | ||
| { | ||
| .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 02 00 00 00 01 00 00 00 01 00 00 00 00 00 ) | ||
|
|
||
| .maxstack 8 | ||
| IL_0000: ldarg.1 | ||
| IL_0001: ret | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } | ||
|
|
||
| .class private abstract auto ansi sealed '<StartupCode$assembly>'.$Program | ||
| extends [runtime]System.Object | ||
| { | ||
| .method public static void main@() cil managed | ||
| { | ||
| .entrypoint | ||
|
|
||
| .maxstack 8 | ||
| IL_0000: ret | ||
| } | ||
|
|
||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.