diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index e9272db3bc0a79f892c667dcf4610d18420a53ee..1b85fada4c62e69e10c5b0fbe7a18f1f1e76ded2 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -3161,7 +3161,10 @@ module EstablishTypeDefinitionCores = | None -> () | Some spats -> let ctorArgNames, _ = TcSimplePatsOfUnknownType cenv true CheckCxs envinner tpenv spats - if not ctorArgNames.IsEmpty then errorR (Error(FSComp.SR.parsOnlyClassCanTakeValueArguments(), m)) + if not ctorArgNames.IsEmpty then + match spats with + | SynSimplePats.SimplePats(_, m) -> errorR (Error(FSComp.SR.parsOnlyClassCanTakeValueArguments(), m)) + | SynSimplePats.Typed(_, _, m) -> errorR (Error(FSComp.SR.parsOnlyClassCanTakeValueArguments(), m)) let envinner = AddDeclaredTypars CheckForDuplicateTypars (tycon.Typars m) envinner let envinner = MakeInnerEnvForTyconRef envinner thisTyconRef false diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/DelegateTypes/DelegateDefinition.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/DelegateTypes/DelegateDefinition.fs index df0857b3f28b8f045251e889741a4d1f9c7658f5..3e01c1723fd7c765b4e2fcd01751e7543b62cc72 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/DelegateTypes/DelegateDefinition.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/DelegateTypes/DelegateDefinition.fs @@ -17,8 +17,9 @@ namespace FSharpTest """ |> compile |> shouldFail - |> withErrorCode 552 - |> withErrorMessage "Only class types may take value arguments" + |> withDiagnostics [ + (Error 552, Line 3, Col 11, Line 3, Col 19, "Only class types may take value arguments") + ] [] let ``Delegate definition with primary constructor no argument.`` () = @@ -30,8 +31,10 @@ namespace FSharpTest """ |> compile |> shouldFail - |> withErrorCode 552 - |> withErrorMessage "Only class types may take value arguments" + |> shouldFail + |> withDiagnostics [ + (Error 552, Line 3, Col 11, Line 3, Col 13, "Only class types may take value arguments") + ] [] let ``Delegate definition`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/DelegateTypes/invalid_delegate_definition.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/DelegateTypes/invalid_delegate_definition.fs deleted file mode 100644 index dd55759ff61cafdd19f86088f541a192187bfe9f..0000000000000000000000000000000000000000 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/DelegateTypes/invalid_delegate_definition.fs +++ /dev/null @@ -1,5 +0,0 @@ -type T(x: int) = - delegate of int -> int - -type T() = - delegate of int -> int \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/DelegateTypes/invalid_delegate_definition.fs.err.bsl b/tests/FSharp.Compiler.ComponentTests/Conformance/DelegateTypes/invalid_delegate_definition.fs.err.bsl deleted file mode 100644 index c804d43021197b9a259313d0e69098ff1542d876..0000000000000000000000000000000000000000 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/DelegateTypes/invalid_delegate_definition.fs.err.bsl +++ /dev/null @@ -1,3 +0,0 @@ -invalid_delegate_definition.fs (1,6)-(1,15) Only class types may take value arguments -invalid_delegate_definition.fs (4,6)-(1,9) Only class types may take value arguments -