From 367fc5f9d01180559fa08485d76bcfd7e73ca192 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Sun, 6 Oct 2024 19:19:37 +0100 Subject: [PATCH] Regression test for #14304 --- .../AttributeUsage/AttributeUsage.fs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs index f6d8a0cc530..9b7cdc5a053 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/CustomAttributes/AttributeUsage/AttributeUsage.fs @@ -933,3 +933,36 @@ and [] |> verifyCompile |> shouldSucceed #endif + + [] // 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([]x: int, [] value: string[]) = + inherit Attribute() + +type ParamsOnly([] value: string[]) = + inherit Attribute() + +type DefaultOnly([]x: int) = + inherit Attribute() + +[] +type Q1 = struct end + +[] // ok +type Q11 = struct end + +[] // ok +type Q12 = struct end + +[] +type Q2 = struct end + +[] +type Q3 = struct end + """ + |> typecheck + |> shouldSucceed \ No newline at end of file