-
Notifications
You must be signed in to change notification settings - Fork 823
Closed
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone
Description
This was noted while updating Benchmark.Net library. DisassemblyDiagnoser attribute got a new "params string[]" parameter at the end. This actually broke compilation for my F# benchmarks.
As a workaround it's enough to specify only 1 parameter value. Otherwise compiler is unable to construct an object.
Tested in Rider 2022.2.4 (fcs before F# 7) amd in Visual Studio Community Version 17.4.0 Preview 3.0 (I guess with F#7 but I can be wrong)
Repro:
type DefaultAndParams([<Optional; DefaultParameterValue(1)>]x: int, [<ParamArray>] value: string[]) =
inherit Attribute()
type ParamsOnly([<ParamArray>] value: string[]) =
inherit Attribute()
type DefaultOnly([<Optional; DefaultParameterValue(1)>]x: int) =
inherit Attribute()
// The object constructor 'DefaultAndParams' takes 2 argument(s) but is here given 0. The required signature is 'new: x: int * [<ParamArray>] value: string[] -> DefaultAndParams'.
[<DefaultAndParams>]
type Q1 = struct end
[<DefaultAndParams(x = 1)>] // ok
type Q11 = struct end
[<DefaultAndParams(value = [||])>] // ok
type Q12 = struct end
[<ParamsOnly>]
type Q2 = struct end
[<DefaultOnly>]
type Q3 = struct end
Metadata
Metadata
Assignees
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Type
Projects
Status
Done