Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,15 @@ module CompiledNameAttribute =
|> compile
|> shouldSucceed
|> ignore

[<Theory; FileInlineData("CompiledNameAttribute06.fs")>]
let ``CompiledNameAttribute06_fs`` compilation =
compilation
|> getCompilation
|> verifyCompilation

[<Theory; FileInlineData("CompiledNameAttribute07.fs")>]
let ``CompiledNameAttribute07_fs`` compilation =
compilation
|> getCompilation
|> verifyCompilation
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>) = ()
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,
Comment thread
T-Gro marked this conversation as resolved.
[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,
Comment thread
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
}

}






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
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
}

}






Loading