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
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/11.0.100.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* Fix signature generation: `private` keyword placement for prefix-style type abbreviations. ([Issue #15560](https://github.com/dotnet/fsharp/issues/15560), [PR #19586](https://github.com/dotnet/fsharp/pull/19586))
* Fix signature generation: missing `[<Class>]` attribute for types without visible constructors. ([Issue #16531](https://github.com/dotnet/fsharp/issues/16531), [PR #19586](https://github.com/dotnet/fsharp/pull/19586))
* Fix methods being tagged as `Member` instead of `Method` in tooltips. ([Issue #10540](https://github.com/dotnet/fsharp/issues/10540), [PR #19507](https://github.com/dotnet/fsharp/pull/19507))
* IlxGen: fix missing CompilationMapping attribute for generic values ([PR #19643](https://github.com/dotnet/fsharp/pull/19643))

### Added

Expand Down
8 changes: 7 additions & 1 deletion src/Compiler/CodeGen/IlxGen.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9863,8 +9863,14 @@ and GenMethodForBinding
| _ -> ilAttrsThatGoOnPrimaryItem
| _ -> ilAttrsThatGoOnPrimaryItem

let compilationMappingAttrs =
[
if v.MemberInfo.IsNone && curriedArgInfos.IsEmpty then
mkCompilationMappingAttr g (int SourceConstructFlags.Value)
]

let ilCustomAttrs =
mkILCustomAttrs (ilAttrs @ sourceNameAttribs @ ilAttrsCompilerGenerated)
mkILCustomAttrs (ilAttrs @ compilationMappingAttrs @ sourceNameAttribs @ ilAttrsCompilerGenerated)

let mdef = mdef.With(customAttrs = ilCustomAttrs)
mdef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,28 @@ type MyClass() =
|> shouldSucceed
|> verifyAssemblyReference "System.Xml"
|> ignore


// https://github.com/dotnet/fsharp/issues/19428
[<Fact>]
let ``Issue_19428_CompilationMappingOnGenericValue`` () =
FSharp """
module GenericValueTest

let l = []
let empty<'T> = Seq.empty<'T>
"""
|> compile
|> shouldSucceed
|> verifyIL [
"""
.method public static class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1<!!a> l<a>() cil managed
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 )
"""
"""
.method public static class [runtime]System.Collections.Generic.IEnumerable`1<!!T> empty<T>() cil managed
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 )
"""
]
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
.method public static !!a Null<class a>() cil managed
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.LiteralAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 )

.maxstack 3
.locals init (!!a V_0)
Expand Down Expand Up @@ -99,4 +100,3 @@




Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
.method public static !!a Null<class a>() cil managed
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.LiteralAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 )

.maxstack 3
.locals init (!!a V_0)
Expand Down Expand Up @@ -107,4 +108,3 @@




Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
.method public static !!a Null<class a>() cil managed
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.LiteralAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 )

.maxstack 3
.locals init (!!a V_0)
Expand Down Expand Up @@ -116,4 +117,3 @@




Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
.method public static !!a Null<class a>() cil managed
{
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.LiteralAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 )

.maxstack 3
.locals init (!!a V_0)
Expand Down Expand Up @@ -126,4 +127,3 @@




Loading