зеркало из https://github.com/dotnet/fsharp.git
Co-authored-by: Florian Verdonck <florian.verdonck@outlook.com> Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>
This commit is contained in:
Родитель
30bbce677c
Коммит
77d05bb16c
|
@ -15,7 +15,7 @@
|
|||
<!-- F# Version components -->
|
||||
<FSMajorVersion>7</FSMajorVersion>
|
||||
<FSMinorVersion>0</FSMinorVersion>
|
||||
<FSBuildVersion>400</FSBuildVersion>
|
||||
<FSBuildVersion>401</FSBuildVersion>
|
||||
<FSRevisionVersion>0</FSRevisionVersion>
|
||||
<!-- -->
|
||||
<!-- F# Language version -->
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"xcopy-msbuild": "17.6.0-2"
|
||||
},
|
||||
"native-tools": {
|
||||
"perl": "5.32.1.1"
|
||||
"perl": "5.38.0.1"
|
||||
},
|
||||
"msbuild-sdks": {
|
||||
"Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.23320.3",
|
||||
|
|
|
@ -3958,8 +3958,10 @@ module TcDeclarations =
|
|||
if tcref.TyparsNoRange.Length = synTypars.Length then
|
||||
(tcref.TyparsNoRange, synTypars)
|
||||
||> List.zip
|
||||
|> List.iter (fun (typar, SynTyparDecl.SynTyparDecl(_, SynTypar(ident = untypedIdent))) ->
|
||||
typar.SetIdent(untypedIdent)
|
||||
|> List.iter (fun (typar, SynTyparDecl.SynTyparDecl (_, tp)) ->
|
||||
let (SynTypar(ident = untypedIdent; staticReq = sr)) = tp
|
||||
if typar.StaticReq = sr then
|
||||
typar.SetIdent(untypedIdent)
|
||||
)
|
||||
|
||||
res
|
||||
|
|
|
@ -46,3 +46,31 @@ else ()
|
|||
|> run
|
||||
|> shouldSucceed
|
||||
|> withExitCode 0
|
||||
|
||||
[<Fact>]
|
||||
let ``Respect nowarn 957 for extension method`` () =
|
||||
FSharp """
|
||||
module Foo
|
||||
|
||||
type DataItem<'data> =
|
||||
{ Identifier: string
|
||||
Label: string
|
||||
Data: 'data }
|
||||
|
||||
static member Create<'data>(identifier: string, label: string, data: 'data) =
|
||||
{ DataItem.Identifier = identifier
|
||||
DataItem.Label = label
|
||||
DataItem.Data = data }
|
||||
|
||||
#nowarn "957"
|
||||
|
||||
type DataItem< ^input> with
|
||||
|
||||
static member inline Create(item: ^input) =
|
||||
let stringValue: string = (^input: (member get_StringValue: unit -> string) (item))
|
||||
let friendlyStringValue: string = (^input: (member get_FriendlyStringValue: unit -> string) (item))
|
||||
|
||||
DataItem.Create< ^input>(stringValue, friendlyStringValue, item)
|
||||
"""
|
||||
|> compile
|
||||
|> shouldSucceed
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
module Extensions
|
||||
|
||||
type DataItem<'data> =
|
||||
{ Identifier: string
|
||||
Label: string
|
||||
Data: 'data }
|
||||
|
||||
static member Create<'data>(identifier: string, label: string, data: 'data) =
|
||||
{ DataItem.Identifier = identifier
|
||||
DataItem.Label = label
|
||||
DataItem.Data = data }
|
||||
|
||||
#nowarn "957"
|
||||
|
||||
type DataItem< ^input> with
|
||||
|
||||
static member inline Create(item: ^input) =
|
||||
let stringValue: string = (^input: (member get_StringValue: unit -> string) (item))
|
||||
|
||||
let friendlyStringValue: string =
|
||||
(^input: (member get_FriendlyStringValue: unit -> string) (item))
|
||||
|
||||
DataItem.Create< ^input>(stringValue, friendlyStringValue, item)
|
|
@ -133,6 +133,49 @@ type System.Collections.Concurrent.ConcurrentDictionary<'key,'value> with
|
|||
|
||||
member TryFind: key: 'key -> 'value option"""
|
||||
|
||||
[<Fact>]
|
||||
let ``Don't update typar name in type extension when TyparStaticReq doesn't match`` () =
|
||||
FSharp """
|
||||
module Extensions
|
||||
|
||||
type DataItem<'data> =
|
||||
{ Identifier: string
|
||||
Label: string
|
||||
Data: 'data }
|
||||
|
||||
static member Create<'data>(identifier: string, label: string, data: 'data) =
|
||||
{ DataItem.Identifier = identifier
|
||||
DataItem.Label = label
|
||||
DataItem.Data = data }
|
||||
|
||||
#nowarn "957"
|
||||
|
||||
type DataItem< ^input> with
|
||||
|
||||
static member inline Create(item: ^input) =
|
||||
let stringValue: string = (^input: (member get_StringValue: unit -> string) (item))
|
||||
|
||||
let friendlyStringValue: string =
|
||||
(^input: (member get_FriendlyStringValue: unit -> string) (item))
|
||||
|
||||
DataItem.Create< ^input>(stringValue, friendlyStringValue, item)
|
||||
"""
|
||||
|> printSignatures
|
||||
|> should equal
|
||||
"""
|
||||
module Extensions
|
||||
|
||||
type DataItem<'data> =
|
||||
{
|
||||
Identifier: string
|
||||
Label: string
|
||||
Data: 'data
|
||||
}
|
||||
|
||||
static member inline Create: item: ^input -> DataItem<^input> when ^input: (member get_StringValue: unit -> string) and ^input: (member get_FriendlyStringValue: unit -> string)
|
||||
|
||||
static member Create<'data> : identifier: string * label: string * data: 'data -> DataItem<'data>"""
|
||||
|
||||
[<Fact>]
|
||||
let ``ValText for C# abstract member override`` () =
|
||||
let csharp = CSharp """
|
||||
|
|
Загрузка…
Ссылка в новой задаче