diff --git a/tests/fsharp/Compiler/ErrorMessages/UnitGenericAbstactType.fs b/tests/fsharp/Compiler/ErrorMessages/UnitGenericAbstactType.fs new file mode 100644 index 00000000000..e9165a4cf6a --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/UnitGenericAbstactType.fs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module ``Unit generic abstract Type`` = + + [] + let ``Unit can not be used as return type of abstract method paramete on return type``() = + CompilerAssert.TypeCheckSingleError + """ +type EDF<'S> = + abstract member Apply : int -> 'S +type SomeEDF () = + interface EDF with + member this.Apply d = + // [ERROR] The member 'Apply' does not have the correct type to override the corresponding abstract method. + () + """ + FSharpErrorSeverity.Error + 17 + (6, 21, 6, 26) + "The member 'Apply : int -> unit' is specialized with 'unit' but 'unit' can't be used as return type of an abstract method parameterized on return type." + diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index 50e3e4f2d47..0c9578f2192 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -36,6 +36,7 @@ + diff --git a/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/E_UnitGenericAbstractType1.fs b/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/E_UnitGenericAbstractType1.fs deleted file mode 100644 index 0b7f1d98a6d..00000000000 --- a/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/E_UnitGenericAbstractType1.fs +++ /dev/null @@ -1,9 +0,0 @@ -// #ErrorMessages #UnitGenericAbstractType -//The member 'Apply : int -> unit' is specialized with 'unit' but 'unit' can't be used as return type of an abstract method parameterized on return type\. -type EDF<'S> = - abstract member Apply : int -> 'S -type SomeEDF () = - interface EDF with - member this.Apply d = - // [ERROR] The member 'Apply' does not have the correct type to override the corresponding abstract method. - () \ No newline at end of file diff --git a/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/env.lst b/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/env.lst deleted file mode 100644 index 26ae602bd6a..00000000000 --- a/tests/fsharpqa/Source/ErrorMessages/UnitGenericAbstractType/env.lst +++ /dev/null @@ -1 +0,0 @@ - SOURCE=E_UnitGenericAbstractType1.fs # E_UnitGenericAbstractType1 \ No newline at end of file