Skip to content
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

Regression test for #14304 #17839

Merged
merged 4 commits into from
Oct 8, 2024
Merged
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 @@ -933,3 +933,36 @@ and [<ApplicationTenantJsonDerivedType>]
|> verifyCompile
|> shouldSucceed
#endif

[<Fact>] // Regression for https://github.com/dotnet/fsharp/issues/14304
let ``Construct an object with default and params parameters using parameterless constructor`` () =
Fsx """
open System
open System.Runtime.InteropServices

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()

[<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
"""
|> typecheck
|> shouldSucceed
Loading