From 49f472296a3c805427ad8d1253dfb4d9c04c4342 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Wed, 17 Apr 2024 18:07:39 +0100 Subject: [PATCH 01/12] Improve error reporting for abstract members when used in classes --- src/Compiler/Checking/CheckDeclarations.fs | 15 +++++++++++---- src/Compiler/Checking/CheckDeclarations.fsi | 2 ++ src/Compiler/Checking/MethodOverrides.fs | 9 ++------- src/Compiler/Checking/MethodOverrides.fsi | 2 -- .../Basic/Basic.fs | 3 --- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 30f773f7478..4d79c2c8afb 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -54,6 +54,8 @@ type cenv = TcFileState type MutRecDataForOpen = MutRecDataForOpen of SynOpenDeclTarget * range * appliedScope: range * OpenDeclaration list ref type MutRecDataForModuleAbbrev = MutRecDataForModuleAbbrev of Ident * LongIdent * range +exception TypeIsImplicitlyAbstract of range + /// Represents the shape of a mutually recursive group of declarations including nested modules [] type MutRecShape<'TypeData, 'LetsData, 'ModuleData> = @@ -3629,8 +3631,10 @@ module EstablishTypeDefinitionCores = noSealedAttributeCheck FSComp.SR.tcTypesAreAlwaysSealedStruct noAbstractClassAttributeCheck() noAllowNullLiteralAttributeCheck() - if not (isNil slotsigs) then - errorR (Error(FSComp.SR.tcStructTypesCannotContainAbstractMembers(), m)) + + for slot in abstractSlots do + errorR (Error(FSComp.SR.tcStructTypesCannotContainAbstractMembers(), slot.Range)) + structLayoutAttributeCheck true TFSharpStruct @@ -3647,8 +3651,11 @@ module EstablishTypeDefinitionCores = structLayoutAttributeCheck(not isIncrClass) allowNullLiteralAttributeCheck() for slot in abstractSlots do - if not slot.IsInstanceMember then - errorR(Error(FSComp.SR.chkStaticAbstractMembersOnClasses(), slot.Range)) + if not slot.IsInstanceMember then + errorR(Error(FSComp.SR.chkStaticAbstractMembersOnClasses(), slot.Range)) + elif not hasAbstractAttr then + errorR(TypeIsImplicitlyAbstract(slot.Range)) + TFSharpClass | SynTypeDefnKind.Delegate (ty, arity) -> noCLIMutableAttributeCheck() diff --git a/src/Compiler/Checking/CheckDeclarations.fsi b/src/Compiler/Checking/CheckDeclarations.fsi index fb4679f2438..11dd28f3771 100644 --- a/src/Compiler/Checking/CheckDeclarations.fsi +++ b/src/Compiler/Checking/CheckDeclarations.fsi @@ -79,3 +79,5 @@ val CheckOneSigFile: exception NotUpperCaseConstructor of range: range exception NotUpperCaseConstructorWithoutRQA of range: range + +exception TypeIsImplicitlyAbstract of range \ No newline at end of file diff --git a/src/Compiler/Checking/MethodOverrides.fs b/src/Compiler/Checking/MethodOverrides.fs index b166d7fc07a..703b5c256d3 100644 --- a/src/Compiler/Checking/MethodOverrides.fs +++ b/src/Compiler/Checking/MethodOverrides.fs @@ -103,7 +103,6 @@ type SlotImplSet = availablePriorOverrides: OverrideInfo list * requiredProperties: PropInfo list -exception TypeIsImplicitlyAbstract of range exception OverrideDoesntOverride of DisplayEnv * OverrideInfo * MethInfo option * TcGlobals * Import.ImportMap * range module DispatchSlotChecking = @@ -828,11 +827,7 @@ module DispatchSlotChecking = if isImplementation && not (isInterfaceTy g overallTy) then let overrides = allImmediateMembersThatMightImplementDispatchSlots |> List.map snd - let allCorrect = CheckDispatchSlotsAreImplemented (denv, infoReader, m, nenv, sink, tcaug.tcaug_abstract, false, reqdTy, dispatchSlots, availPriorOverrides, overrides) - - // Tell the user to mark the thing abstract if it was missing implementations - if not allCorrect && not tcaug.tcaug_abstract && not (isInterfaceTy g reqdTy) then - errorR(TypeIsImplicitlyAbstract(m)) + let _ = CheckDispatchSlotsAreImplemented (denv, infoReader, m, nenv, sink, tcaug.tcaug_abstract, false, reqdTy, dispatchSlots, availPriorOverrides, overrides) let overridesToCheck = allImmediateMembersThatMightImplementDispatchSlots @@ -882,7 +877,7 @@ module DispatchSlotChecking = overrideBy.MemberInfo.Value.ImplementedSlotSigs <- overriden) /// "Type Completion" inference and a few other checks at the end of the inference scope -let FinalTypeDefinitionChecksAtEndOfInferenceScope (infoReader: InfoReader, nenv, sink, isImplementation, denv, tycon: Tycon) = +let FinalTypeDefinitionChecksAtEndOfInferenceScope (infoReader: InfoReader, nenv: NameResolutionEnv, sink: TcResultsSink, isImplementation, denv: DisplayEnv, tycon: Tycon) = let g = infoReader.g let amap = infoReader.amap diff --git a/src/Compiler/Checking/MethodOverrides.fsi b/src/Compiler/Checking/MethodOverrides.fsi index b06fb16e499..f2976c5dc71 100644 --- a/src/Compiler/Checking/MethodOverrides.fsi +++ b/src/Compiler/Checking/MethodOverrides.fsi @@ -77,8 +77,6 @@ type SlotImplSet = availablePriorOverrides: OverrideInfo list * requiredProperties: PropInfo list -exception TypeIsImplicitlyAbstract of range - exception OverrideDoesntOverride of DisplayEnv * OverrideInfo * MethInfo option * TcGlobals * ImportMap * range module DispatchSlotChecking = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs index 76203d10cda..c3a239e07f0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs @@ -62,15 +62,12 @@ module Basic = (Error 344, Line 13, Col 6, Line 13, Col 7, "The struct, record or union type 'R' has an explicit implementation of 'Object.GetHashCode' or 'Object.Equals'. You must apply the 'CustomEquality' attribute to the type") (Warning 345, Line 13, Col 6, Line 13, Col 7, "The struct, record or union type 'R' has an explicit implementation of 'Object.GetHashCode'. Consider implementing a matching override for 'Object.Equals(obj)'") (Error 359, Line 13, Col 6, Line 13, Col 7, "More than one override implements 'GetHashCode: unit -> int'") - (Error 54, Line 13, Col 6, Line 13, Col 7, "This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[]' attribute to your type.") (Error 344, Line 17, Col 6, Line 17, Col 7, "The struct, record or union type 'U' has an explicit implementation of 'Object.GetHashCode' or 'Object.Equals'. You must apply the 'CustomEquality' attribute to the type") (Warning 345, Line 17, Col 6, Line 17, Col 7, "The struct, record or union type 'U' has an explicit implementation of 'Object.GetHashCode'. Consider implementing a matching override for 'Object.Equals(obj)'") (Error 359, Line 17, Col 6, Line 17, Col 7, "More than one override implements 'GetHashCode: unit -> int'") - (Error 54, Line 17, Col 6, Line 17, Col 7, "This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[]' attribute to your type.") (Error 344, Line 21, Col 6, Line 21, Col 7, "The struct, record or union type 'S' has an explicit implementation of 'Object.GetHashCode' or 'Object.Equals'. You must apply the 'CustomEquality' attribute to the type") (Warning 345, Line 21, Col 6, Line 21, Col 7, "The struct, record or union type 'S' has an explicit implementation of 'Object.GetHashCode'. Consider implementing a matching override for 'Object.Equals(obj)'") (Error 359, Line 21, Col 6, Line 21, Col 7, "More than one override implements 'GetHashCode: unit -> int'") - (Error 54, Line 21, Col 6, Line 21, Col 7, "This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[]' attribute to your type.") ] // SOURCE=E_ExceptionsNoComparison.fs SCFLAGS="--test:ErrorRanges" # E_ExceptionsNoComparison.fs From c99466566f63930cf1bf3175a513bc57ba2b76df Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Thu, 18 Apr 2024 13:47:02 +0100 Subject: [PATCH 02/12] Revert "Improve error reporting for abstract members when used in classes" This reverts commit 49f472296a3c805427ad8d1253dfb4d9c04c4342. --- src/Compiler/Checking/CheckDeclarations.fs | 15 ++++----------- src/Compiler/Checking/CheckDeclarations.fsi | 2 -- src/Compiler/Checking/MethodOverrides.fs | 9 +++++++-- src/Compiler/Checking/MethodOverrides.fsi | 2 ++ .../Basic/Basic.fs | 3 +++ 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs index 4d79c2c8afb..30f773f7478 100644 --- a/src/Compiler/Checking/CheckDeclarations.fs +++ b/src/Compiler/Checking/CheckDeclarations.fs @@ -54,8 +54,6 @@ type cenv = TcFileState type MutRecDataForOpen = MutRecDataForOpen of SynOpenDeclTarget * range * appliedScope: range * OpenDeclaration list ref type MutRecDataForModuleAbbrev = MutRecDataForModuleAbbrev of Ident * LongIdent * range -exception TypeIsImplicitlyAbstract of range - /// Represents the shape of a mutually recursive group of declarations including nested modules [] type MutRecShape<'TypeData, 'LetsData, 'ModuleData> = @@ -3631,10 +3629,8 @@ module EstablishTypeDefinitionCores = noSealedAttributeCheck FSComp.SR.tcTypesAreAlwaysSealedStruct noAbstractClassAttributeCheck() noAllowNullLiteralAttributeCheck() - - for slot in abstractSlots do - errorR (Error(FSComp.SR.tcStructTypesCannotContainAbstractMembers(), slot.Range)) - + if not (isNil slotsigs) then + errorR (Error(FSComp.SR.tcStructTypesCannotContainAbstractMembers(), m)) structLayoutAttributeCheck true TFSharpStruct @@ -3651,11 +3647,8 @@ module EstablishTypeDefinitionCores = structLayoutAttributeCheck(not isIncrClass) allowNullLiteralAttributeCheck() for slot in abstractSlots do - if not slot.IsInstanceMember then - errorR(Error(FSComp.SR.chkStaticAbstractMembersOnClasses(), slot.Range)) - elif not hasAbstractAttr then - errorR(TypeIsImplicitlyAbstract(slot.Range)) - + if not slot.IsInstanceMember then + errorR(Error(FSComp.SR.chkStaticAbstractMembersOnClasses(), slot.Range)) TFSharpClass | SynTypeDefnKind.Delegate (ty, arity) -> noCLIMutableAttributeCheck() diff --git a/src/Compiler/Checking/CheckDeclarations.fsi b/src/Compiler/Checking/CheckDeclarations.fsi index 11dd28f3771..fb4679f2438 100644 --- a/src/Compiler/Checking/CheckDeclarations.fsi +++ b/src/Compiler/Checking/CheckDeclarations.fsi @@ -79,5 +79,3 @@ val CheckOneSigFile: exception NotUpperCaseConstructor of range: range exception NotUpperCaseConstructorWithoutRQA of range: range - -exception TypeIsImplicitlyAbstract of range \ No newline at end of file diff --git a/src/Compiler/Checking/MethodOverrides.fs b/src/Compiler/Checking/MethodOverrides.fs index 703b5c256d3..b166d7fc07a 100644 --- a/src/Compiler/Checking/MethodOverrides.fs +++ b/src/Compiler/Checking/MethodOverrides.fs @@ -103,6 +103,7 @@ type SlotImplSet = availablePriorOverrides: OverrideInfo list * requiredProperties: PropInfo list +exception TypeIsImplicitlyAbstract of range exception OverrideDoesntOverride of DisplayEnv * OverrideInfo * MethInfo option * TcGlobals * Import.ImportMap * range module DispatchSlotChecking = @@ -827,7 +828,11 @@ module DispatchSlotChecking = if isImplementation && not (isInterfaceTy g overallTy) then let overrides = allImmediateMembersThatMightImplementDispatchSlots |> List.map snd - let _ = CheckDispatchSlotsAreImplemented (denv, infoReader, m, nenv, sink, tcaug.tcaug_abstract, false, reqdTy, dispatchSlots, availPriorOverrides, overrides) + let allCorrect = CheckDispatchSlotsAreImplemented (denv, infoReader, m, nenv, sink, tcaug.tcaug_abstract, false, reqdTy, dispatchSlots, availPriorOverrides, overrides) + + // Tell the user to mark the thing abstract if it was missing implementations + if not allCorrect && not tcaug.tcaug_abstract && not (isInterfaceTy g reqdTy) then + errorR(TypeIsImplicitlyAbstract(m)) let overridesToCheck = allImmediateMembersThatMightImplementDispatchSlots @@ -877,7 +882,7 @@ module DispatchSlotChecking = overrideBy.MemberInfo.Value.ImplementedSlotSigs <- overriden) /// "Type Completion" inference and a few other checks at the end of the inference scope -let FinalTypeDefinitionChecksAtEndOfInferenceScope (infoReader: InfoReader, nenv: NameResolutionEnv, sink: TcResultsSink, isImplementation, denv: DisplayEnv, tycon: Tycon) = +let FinalTypeDefinitionChecksAtEndOfInferenceScope (infoReader: InfoReader, nenv, sink, isImplementation, denv, tycon: Tycon) = let g = infoReader.g let amap = infoReader.amap diff --git a/src/Compiler/Checking/MethodOverrides.fsi b/src/Compiler/Checking/MethodOverrides.fsi index f2976c5dc71..b06fb16e499 100644 --- a/src/Compiler/Checking/MethodOverrides.fsi +++ b/src/Compiler/Checking/MethodOverrides.fsi @@ -77,6 +77,8 @@ type SlotImplSet = availablePriorOverrides: OverrideInfo list * requiredProperties: PropInfo list +exception TypeIsImplicitlyAbstract of range + exception OverrideDoesntOverride of DisplayEnv * OverrideInfo * MethInfo option * TcGlobals * ImportMap * range module DispatchSlotChecking = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs index c3a239e07f0..76203d10cda 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs @@ -62,12 +62,15 @@ module Basic = (Error 344, Line 13, Col 6, Line 13, Col 7, "The struct, record or union type 'R' has an explicit implementation of 'Object.GetHashCode' or 'Object.Equals'. You must apply the 'CustomEquality' attribute to the type") (Warning 345, Line 13, Col 6, Line 13, Col 7, "The struct, record or union type 'R' has an explicit implementation of 'Object.GetHashCode'. Consider implementing a matching override for 'Object.Equals(obj)'") (Error 359, Line 13, Col 6, Line 13, Col 7, "More than one override implements 'GetHashCode: unit -> int'") + (Error 54, Line 13, Col 6, Line 13, Col 7, "This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[]' attribute to your type.") (Error 344, Line 17, Col 6, Line 17, Col 7, "The struct, record or union type 'U' has an explicit implementation of 'Object.GetHashCode' or 'Object.Equals'. You must apply the 'CustomEquality' attribute to the type") (Warning 345, Line 17, Col 6, Line 17, Col 7, "The struct, record or union type 'U' has an explicit implementation of 'Object.GetHashCode'. Consider implementing a matching override for 'Object.Equals(obj)'") (Error 359, Line 17, Col 6, Line 17, Col 7, "More than one override implements 'GetHashCode: unit -> int'") + (Error 54, Line 17, Col 6, Line 17, Col 7, "This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[]' attribute to your type.") (Error 344, Line 21, Col 6, Line 21, Col 7, "The struct, record or union type 'S' has an explicit implementation of 'Object.GetHashCode' or 'Object.Equals'. You must apply the 'CustomEquality' attribute to the type") (Warning 345, Line 21, Col 6, Line 21, Col 7, "The struct, record or union type 'S' has an explicit implementation of 'Object.GetHashCode'. Consider implementing a matching override for 'Object.Equals(obj)'") (Error 359, Line 21, Col 6, Line 21, Col 7, "More than one override implements 'GetHashCode: unit -> int'") + (Error 54, Line 21, Col 6, Line 21, Col 7, "This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[]' attribute to your type.") ] // SOURCE=E_ExceptionsNoComparison.fs SCFLAGS="--test:ErrorRanges" # E_ExceptionsNoComparison.fs From e4eb2c97013f34c3acd2d180723b54548554dc89 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Thu, 18 Apr 2024 15:16:26 +0100 Subject: [PATCH 03/12] Improve error reporting for abstract members when used in classes --- src/Compiler/Checking/MethodOverrides.fs | 6 ++-- src/Compiler/FSStrings.resx | 2 +- src/Compiler/xlf/FSStrings.cs.xlf | 4 +-- src/Compiler/xlf/FSStrings.de.xlf | 4 +-- src/Compiler/xlf/FSStrings.es.xlf | 4 +-- src/Compiler/xlf/FSStrings.fr.xlf | 4 +-- src/Compiler/xlf/FSStrings.it.xlf | 4 +-- src/Compiler/xlf/FSStrings.ja.xlf | 4 +-- src/Compiler/xlf/FSStrings.ko.xlf | 4 +-- src/Compiler/xlf/FSStrings.pl.xlf | 4 +-- src/Compiler/xlf/FSStrings.pt-BR.xlf | 4 +-- src/Compiler/xlf/FSStrings.ru.xlf | 4 +-- src/Compiler/xlf/FSStrings.tr.xlf | 4 +-- src/Compiler/xlf/FSStrings.zh-Hans.xlf | 4 +-- src/Compiler/xlf/FSStrings.zh-Hant.xlf | 4 +-- .../Basic/Basic.fs | 3 -- .../ErrorMessages/ClassesTests.fs | 36 ++++++++++++++++++- 17 files changed, 66 insertions(+), 33 deletions(-) diff --git a/src/Compiler/Checking/MethodOverrides.fs b/src/Compiler/Checking/MethodOverrides.fs index b166d7fc07a..0b966d26b2f 100644 --- a/src/Compiler/Checking/MethodOverrides.fs +++ b/src/Compiler/Checking/MethodOverrides.fs @@ -831,8 +831,10 @@ module DispatchSlotChecking = let allCorrect = CheckDispatchSlotsAreImplemented (denv, infoReader, m, nenv, sink, tcaug.tcaug_abstract, false, reqdTy, dispatchSlots, availPriorOverrides, overrides) // Tell the user to mark the thing abstract if it was missing implementations - if not allCorrect && not tcaug.tcaug_abstract && not (isInterfaceTy g reqdTy) then - errorR(TypeIsImplicitlyAbstract(m)) + if not allCorrect && not tcaug.tcaug_abstract && (isClassTy g reqdTy) then + let abstractMembers = dispatchSlots |> List.filter (fun x -> x.MethodInfo.IsAbstract) + for slot in abstractMembers do + errorR(TypeIsImplicitlyAbstract(slot.MethodInfo.ArbitraryValRef.Value.Range)) let overridesToCheck = allImmediateMembersThatMightImplementDispatchSlots diff --git a/src/Compiler/FSStrings.resx b/src/Compiler/FSStrings.resx index d5e19724c80..caeb1678882 100644 --- a/src/Compiler/FSStrings.resx +++ b/src/Compiler/FSStrings.resx @@ -220,7 +220,7 @@ A coercion from the value type \n {0} \nto the type \n {1} \nwill involve boxing. Consider using 'box' instead - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. This construct causes code to be less generic than indicated by its type annotations. The type variable implied by the use of a '#', '_' or other type annotation at or near '{0}' has been constrained to be type '{1}'. diff --git a/src/Compiler/xlf/FSStrings.cs.xlf b/src/Compiler/xlf/FSStrings.cs.xlf index 51770445099..8c2301d198a 100644 --- a/src/Compiler/xlf/FSStrings.cs.xlf +++ b/src/Compiler/xlf/FSStrings.cs.xlf @@ -248,8 +248,8 @@ - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. - Tento typ je abstract, protože se neimplementovali někteří abstraktní členové. Pokud je to záměr, pak k typu přidejte atribut [<AbstractClass>]. + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Tento typ je abstract, protože se neimplementovali někteří abstraktní členové. Pokud je to záměr, pak k typu přidejte atribut [<AbstractClass>]. diff --git a/src/Compiler/xlf/FSStrings.de.xlf b/src/Compiler/xlf/FSStrings.de.xlf index 816fe236526..831d539cfb9 100644 --- a/src/Compiler/xlf/FSStrings.de.xlf +++ b/src/Compiler/xlf/FSStrings.de.xlf @@ -248,8 +248,8 @@ - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. - Der Typ entspricht „abstract“, da einige abstrakte Member nicht mit einer Implementierung versehen wurden. Wenn dies Ihre Absicht ist, fügen Sie das [<AbstractClass>]-Attribut zu Ihrem Typ hinzu. + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Der Typ entspricht „abstract“, da einige abstrakte Member nicht mit einer Implementierung versehen wurden. Wenn dies Ihre Absicht ist, fügen Sie das [<AbstractClass>]-Attribut zu Ihrem Typ hinzu. diff --git a/src/Compiler/xlf/FSStrings.es.xlf b/src/Compiler/xlf/FSStrings.es.xlf index 5230e06b774..d6d11278bb3 100644 --- a/src/Compiler/xlf/FSStrings.es.xlf +++ b/src/Compiler/xlf/FSStrings.es.xlf @@ -248,8 +248,8 @@ - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. - Este tipo es "abstract" ya que a algunos miembros abstractos no se les ha dado una implementación. Si esto es intencional, agregue el atributo "[<AbstractClass>]" + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Este tipo es "abstract" ya que a algunos miembros abstractos no se les ha dado una implementación. Si esto es intencional, agregue el atributo "[<AbstractClass>]" diff --git a/src/Compiler/xlf/FSStrings.fr.xlf b/src/Compiler/xlf/FSStrings.fr.xlf index 059408c760b..60b2635a62e 100644 --- a/src/Compiler/xlf/FSStrings.fr.xlf +++ b/src/Compiler/xlf/FSStrings.fr.xlf @@ -248,8 +248,8 @@ - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. - Ce type est 'abstract', car des membres abstraits n'ont pas reçu d'implémentation. Si cela est intentionnel, ajoutez l'attribut '[<AbstractClass>]' à votre type. + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Ce type est 'abstract', car des membres abstraits n'ont pas reçu d'implémentation. Si cela est intentionnel, ajoutez l'attribut '[<AbstractClass>]' à votre type. diff --git a/src/Compiler/xlf/FSStrings.it.xlf b/src/Compiler/xlf/FSStrings.it.xlf index 3e79188ed4b..1403c9615b0 100644 --- a/src/Compiler/xlf/FSStrings.it.xlf +++ b/src/Compiler/xlf/FSStrings.it.xlf @@ -248,8 +248,8 @@ - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. - Questo tipo è 'abstract' perché non è stata specificata un'implementazione per alcuni membri astratti. Se questa scelta è intenzionale, aggiungere l'attributo '[<AbstractClass>]' al tipo. + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Questo tipo è 'abstract' perché non è stata specificata un'implementazione per alcuni membri astratti. Se questa scelta è intenzionale, aggiungere l'attributo '[<AbstractClass>]' al tipo. diff --git a/src/Compiler/xlf/FSStrings.ja.xlf b/src/Compiler/xlf/FSStrings.ja.xlf index 7aea227ec19..885eda91fd9 100644 --- a/src/Compiler/xlf/FSStrings.ja.xlf +++ b/src/Compiler/xlf/FSStrings.ja.xlf @@ -248,8 +248,8 @@ - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. - これは 'abstract' 型です。一部の抽象メンバーに実装がありません。意図的な場合には、型に '[<AbstractClass>]' 属性を追加してください。 + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + これは 'abstract' 型です。一部の抽象メンバーに実装がありません。意図的な場合には、型に '[<AbstractClass>]' 属性を追加してください。 diff --git a/src/Compiler/xlf/FSStrings.ko.xlf b/src/Compiler/xlf/FSStrings.ko.xlf index 825f5d99b9f..6d9760f5138 100644 --- a/src/Compiler/xlf/FSStrings.ko.xlf +++ b/src/Compiler/xlf/FSStrings.ko.xlf @@ -248,8 +248,8 @@ - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. - 일부 추상 멤버에 구현이 지정되지 않았으므로 이 형식은 'abstract'입니다. 의도적으로 구현을 지정하지 않은 경우에는 형식에 '[<AbstractClass>]' 특성을 추가하세요. + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + 일부 추상 멤버에 구현이 지정되지 않았으므로 이 형식은 'abstract'입니다. 의도적으로 구현을 지정하지 않은 경우에는 형식에 '[<AbstractClass>]' 특성을 추가하세요. diff --git a/src/Compiler/xlf/FSStrings.pl.xlf b/src/Compiler/xlf/FSStrings.pl.xlf index 0de699e9f96..f9aed07a801 100644 --- a/src/Compiler/xlf/FSStrings.pl.xlf +++ b/src/Compiler/xlf/FSStrings.pl.xlf @@ -248,8 +248,8 @@ - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. - Ten typ ma wartość „abstract”, ponieważ niektóre abstrakcyjne składowe nie mają określonej implementacji. Jeśli jest to zamierzone działanie, dodaj atrybut „[<AbstractClass>]” do typu. + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Ten typ ma wartość „abstract”, ponieważ niektóre abstrakcyjne składowe nie mają określonej implementacji. Jeśli jest to zamierzone działanie, dodaj atrybut „[<AbstractClass>]” do typu. diff --git a/src/Compiler/xlf/FSStrings.pt-BR.xlf b/src/Compiler/xlf/FSStrings.pt-BR.xlf index 9f1aaba8b97..19d5510ad9d 100644 --- a/src/Compiler/xlf/FSStrings.pt-BR.xlf +++ b/src/Compiler/xlf/FSStrings.pt-BR.xlf @@ -248,8 +248,8 @@ - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. - Esse tipo é 'abstrato', pois alguns membros abstratos não receberam uma implementação. Se isso for intencional, adicione o atributo '[<AbstractClass>]' ao seu tipo. + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Esse tipo é 'abstrato', pois alguns membros abstratos não receberam uma implementação. Se isso for intencional, adicione o atributo '[<AbstractClass>]' ao seu tipo. diff --git a/src/Compiler/xlf/FSStrings.ru.xlf b/src/Compiler/xlf/FSStrings.ru.xlf index 0da994d81bb..d2c82a49f7e 100644 --- a/src/Compiler/xlf/FSStrings.ru.xlf +++ b/src/Compiler/xlf/FSStrings.ru.xlf @@ -248,8 +248,8 @@ - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. - Этот тип является абстрактным ('abstract'), так как для нескольких абстрактных членов не указана реализация. Если это сделано намеренно, добавьте атрибут '[<AbstractClass>]' к своему типу. + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Этот тип является абстрактным ('abstract'), так как для нескольких абстрактных членов не указана реализация. Если это сделано намеренно, добавьте атрибут '[<AbstractClass>]' к своему типу. diff --git a/src/Compiler/xlf/FSStrings.tr.xlf b/src/Compiler/xlf/FSStrings.tr.xlf index d7095e4c6f3..a45e764278c 100644 --- a/src/Compiler/xlf/FSStrings.tr.xlf +++ b/src/Compiler/xlf/FSStrings.tr.xlf @@ -248,8 +248,8 @@ - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. - Bazı soyut üyelere bir uygulama verilmediğinden bu bir 'abstract' türdür. Bu bilerek yapıldıysa türünüze '[<AbstractClass>]' özniteliğini ekleyin. + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Bazı soyut üyelere bir uygulama verilmediğinden bu bir 'abstract' türdür. Bu bilerek yapıldıysa türünüze '[<AbstractClass>]' özniteliğini ekleyin. diff --git a/src/Compiler/xlf/FSStrings.zh-Hans.xlf b/src/Compiler/xlf/FSStrings.zh-Hans.xlf index 2371bf01202..3d61d87b3b0 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hans.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hans.xlf @@ -248,8 +248,8 @@ - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. - 由于未向一些抽象成员提供实现,因此该类型为 "abstract"。如果是故意如此,请向你的类型添加 "[<AbstractClass>]" 属性。 + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + 由于未向一些抽象成员提供实现,因此该类型为 "abstract"。如果是故意如此,请向你的类型添加 "[<AbstractClass>]" 属性。 diff --git a/src/Compiler/xlf/FSStrings.zh-Hant.xlf b/src/Compiler/xlf/FSStrings.zh-Hant.xlf index 1cb1d903cf7..4640952ad46 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hant.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hant.xlf @@ -248,8 +248,8 @@ - This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[<AbstractClass>]' attribute to your type. - 因為未提供實作給某些抽象成員,所以此類型為 'abstract'。如果這是預期的情況,則請將 '[<AbstractClass>]' 屬性新增到您的類型。 + Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + 因為未提供實作給某些抽象成員,所以此類型為 'abstract'。如果這是預期的情況,則請將 '[<AbstractClass>]' 屬性新增到您的類型。 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs index 76203d10cda..c3a239e07f0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/GeneratedEqualityHashingComparison/Basic/Basic.fs @@ -62,15 +62,12 @@ module Basic = (Error 344, Line 13, Col 6, Line 13, Col 7, "The struct, record or union type 'R' has an explicit implementation of 'Object.GetHashCode' or 'Object.Equals'. You must apply the 'CustomEquality' attribute to the type") (Warning 345, Line 13, Col 6, Line 13, Col 7, "The struct, record or union type 'R' has an explicit implementation of 'Object.GetHashCode'. Consider implementing a matching override for 'Object.Equals(obj)'") (Error 359, Line 13, Col 6, Line 13, Col 7, "More than one override implements 'GetHashCode: unit -> int'") - (Error 54, Line 13, Col 6, Line 13, Col 7, "This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[]' attribute to your type.") (Error 344, Line 17, Col 6, Line 17, Col 7, "The struct, record or union type 'U' has an explicit implementation of 'Object.GetHashCode' or 'Object.Equals'. You must apply the 'CustomEquality' attribute to the type") (Warning 345, Line 17, Col 6, Line 17, Col 7, "The struct, record or union type 'U' has an explicit implementation of 'Object.GetHashCode'. Consider implementing a matching override for 'Object.Equals(obj)'") (Error 359, Line 17, Col 6, Line 17, Col 7, "More than one override implements 'GetHashCode: unit -> int'") - (Error 54, Line 17, Col 6, Line 17, Col 7, "This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[]' attribute to your type.") (Error 344, Line 21, Col 6, Line 21, Col 7, "The struct, record or union type 'S' has an explicit implementation of 'Object.GetHashCode' or 'Object.Equals'. You must apply the 'CustomEquality' attribute to the type") (Warning 345, Line 21, Col 6, Line 21, Col 7, "The struct, record or union type 'S' has an explicit implementation of 'Object.GetHashCode'. Consider implementing a matching override for 'Object.Equals(obj)'") (Error 359, Line 21, Col 6, Line 21, Col 7, "More than one override implements 'GetHashCode: unit -> int'") - (Error 54, Line 21, Col 6, Line 21, Col 7, "This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[]' attribute to your type.") ] // SOURCE=E_ExceptionsNoComparison.fs SCFLAGS="--test:ErrorRanges" # E_ExceptionsNoComparison.fs diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs index 5d8273748b9..3b493f87e8f 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs @@ -782,4 +782,38 @@ type FooImpl = static member val X = "" with get, set """ |> typecheck - |> shouldSucceed \ No newline at end of file + |> shouldSucceed + + + [] + let ``Error when declaring abstract members on a class, No [] or default implementation`` () = + Fsx """ +type A() = + abstract member M: unit -> unit + """ + |> typecheck + |> shouldFail + |> withDiagnostics [ + (Error 365, Line 2, Col 6, Line 2, Col 7, "No implementation was given for 'abstract A.M: unit -> unit'") + (Error 54, Line 3, Col 21, Line 3, Col 22, "Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[]' attribute to your type.") + ] + + [] + let ``Not error when declaring abstract members on a class with [] attribute.`` () = + Fsx """ +[] +type A() = + abstract member M: unit -> unit + """ + |> typecheck + |> shouldSucceed + + [] + let ``Not error when declaring abstract members on a class with a default implementation.`` () = + Fsx """ +type A() = + abstract member M: unit -> unit + default this.M() = () + """ + |> typecheck + |> shouldSucceed \ No newline at end of file From 8ef444353a188a00763fa5bcf9245cf8de6b7d1e Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Thu, 18 Apr 2024 18:57:34 +0100 Subject: [PATCH 04/12] Update tests --- src/Compiler/Checking/MethodOverrides.fs | 4 +--- .../ErrorMessages/ClassesTests.fs | 3 +-- .../E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs | 2 +- .../AbstractMembers/E_CallToAbstractMember03.fs | 2 +- .../MemberDeclarations/E_Sealed_Member_Override02.fsx | 2 +- .../ClassTypes/Misc/E_AbstractClass01.fs | 2 +- .../TypeKindInference/infer_interface003e.fs | 2 +- 7 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Compiler/Checking/MethodOverrides.fs b/src/Compiler/Checking/MethodOverrides.fs index 0b966d26b2f..7d41026582a 100644 --- a/src/Compiler/Checking/MethodOverrides.fs +++ b/src/Compiler/Checking/MethodOverrides.fs @@ -832,9 +832,7 @@ module DispatchSlotChecking = // Tell the user to mark the thing abstract if it was missing implementations if not allCorrect && not tcaug.tcaug_abstract && (isClassTy g reqdTy) then - let abstractMembers = dispatchSlots |> List.filter (fun x -> x.MethodInfo.IsAbstract) - for slot in abstractMembers do - errorR(TypeIsImplicitlyAbstract(slot.MethodInfo.ArbitraryValRef.Value.Range)) + errorR(TypeIsImplicitlyAbstract(m)) let overridesToCheck = allImmediateMembersThatMightImplementDispatchSlots diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs index 3b493f87e8f..6d4a7c9e1f4 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs @@ -783,7 +783,6 @@ type FooImpl = """ |> typecheck |> shouldSucceed - [] let ``Error when declaring abstract members on a class, No [] or default implementation`` () = @@ -795,7 +794,7 @@ type A() = |> shouldFail |> withDiagnostics [ (Error 365, Line 2, Col 6, Line 2, Col 7, "No implementation was given for 'abstract A.M: unit -> unit'") - (Error 54, Line 3, Col 21, Line 3, Col 22, "Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[]' attribute to your type.") + (Error 54, Line 2, Col 6, Line 2, Col 7, "Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[]' attribute to your type.") ] [] diff --git a/tests/fsharpqa/Source/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs b/tests/fsharpqa/Source/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs index fc8085da099..02ab8a392dc 100644 --- a/tests/fsharpqa/Source/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs +++ b/tests/fsharpqa/Source/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypeInference // Regression test for FSHARP1.0:6123 //No implementation was given for 'Derived\.get_Foo\(\) : int'$ -//This type is 'abstract' since some abstract members have not been given an implementation\. If this is intentional then add the '\[\]' attribute to your type\.$ +//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ type FSDerived() = inherit Derived() diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs index 277ed73ab9d..8ab3d13239d 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs @@ -2,7 +2,7 @@ // Regression test for TFS bug Dev10:834160 // This test would fail if we don't set the IsImplemented bit for the abstract slot //No implementation was given for 'abstract B\.M: int -> float'$ -//This type is 'abstract' since some abstract members have not been given an implementation\. If this is intentional then add the '\[\]' attribute to your type\.$ +//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ [] type B() = abstract M : int -> float diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx index 08eb1ecdafd..0edb3e8d358 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx @@ -28,5 +28,5 @@ type T4() = //No implementation was given for those members: // 'CSLib5\.B0\.M\(c: char, a: int\) : int' // 'CSLib5\.B0\.N\(c: char, a: int\) : int' -//This type is 'abstract' since some abstract members have not been given an implementation\. If this is intentional then add the '\[\]' attribute to your type\.$ +//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ //Cannot override inherited member 'CSLib5.B1::M' because it is sealed$ \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs index ce38600f850..7f1efc9575f 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs @@ -5,7 +5,7 @@ //This type is 'abstract' since some abstract members have not been given an implementation\. If this is intentional then add the '\[\]' attribute to your type //No implementation was given for 'abstract Foo\.f: int -> int' -//This type is 'abstract' since some abstract members have not been given an implementation\. If this is intentional then add the '\[\]' attribute to your type +//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ //No implementation was given for 'abstract Foo\.f: int -> int' diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs index 7240d11d5fa..9c426371208 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs @@ -5,7 +5,7 @@ //No implementation was given for 'abstract TK_I_005\.M: unit -> unit'$ //This type is 'abstract' since some abstract members have not been given an implementation\. If this is intentional then add the '\[\]' attribute to your type\.$ //No implementation was given for 'abstract TK_C_000\.M: int -> int'$ -//This type is 'abstract' since some abstract members have not been given an implementation\. If this is intentional then add the '\[\]' attribute to your type\.$ +//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ [] type TK_C_000 = From 642b2be8404561770dccdb1a28aca9bc774fad88 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Thu, 18 Apr 2024 20:44:15 +0100 Subject: [PATCH 05/12] more tests --- tests/fsharp/typecheck/sigs/neg44.bsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fsharp/typecheck/sigs/neg44.bsl b/tests/fsharp/typecheck/sigs/neg44.bsl index a8aa1d6ecea..a7792bdb82e 100644 --- a/tests/fsharp/typecheck/sigs/neg44.bsl +++ b/tests/fsharp/typecheck/sigs/neg44.bsl @@ -1,4 +1,4 @@ neg44.fs(6,6,6,12): typecheck error FS0365: No implementation was given for 'Type.get_Module() : Module' -neg44.fs(6,6,6,12): typecheck error FS0054: This type is 'abstract' since some abstract members have not been given an implementation. If this is intentional then add the '[]' attribute to your type. +neg44.fs(6,6,6,12): typecheck error FS0054: Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[]' attribute to your type. From 7cafa3e995b6ad96dfa65c0870fb3e45a972dd9e Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Thu, 18 Apr 2024 22:15:46 +0100 Subject: [PATCH 06/12] update tests --- .../ClassTypes/Misc/E_AbstractClass01.fs | 4 ++-- .../TypeKindInference/infer_interface003e.fs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs index 7f1efc9575f..a2757f2a785 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs @@ -3,9 +3,9 @@ // FSB 1272, New-ing a sub class with unimplemented abstract members should not be allowed. -//This type is 'abstract' since some abstract members have not been given an implementation\. If this is intentional then add the '\[\]' attribute to your type +//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type //No implementation was given for 'abstract Foo\.f: int -> int' -//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ +//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type //No implementation was given for 'abstract Foo\.f: int -> int' diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs index 9c426371208..17eb25a0e70 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs @@ -3,7 +3,7 @@ // attribute must match inferred type //No implementation was given for 'abstract TK_I_005\.M: unit -> unit'$ -//This type is 'abstract' since some abstract members have not been given an implementation\. If this is intentional then add the '\[\]' attribute to your type\.$ +//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ //No implementation was given for 'abstract TK_C_000\.M: int -> int'$ //Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ From cd78561d85a4dd8c057c13de32a155fd3974d3c7 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Fri, 19 Apr 2024 09:12:52 +0100 Subject: [PATCH 07/12] release notes --- docs/release-notes/.FSharp.Compiler.Service/8.0.400.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md b/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md index b24a17b85fb..dce2420cb64 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md +++ b/docs/release-notes/.FSharp.Compiler.Service/8.0.400.md @@ -1,5 +1,6 @@ ### Fixed +* Improve error reporting for abstract members when used in classes. ([PR #17063](https://github.com/dotnet/fsharp/pull/17063)) * Static abstract method on classes no longer yields internal error. ([Issue #17044](https://github.com/dotnet/fsharp/issues/17044), [PR #17055](https://github.com/dotnet/fsharp/pull/17055)) * Disallow calling abstract methods directly on interfaces. ([Issue #14012](https://github.com/dotnet/fsharp/issues/14012), [Issue #16299](https://github.com/dotnet/fsharp/issues/16299), [PR #17021](https://github.com/dotnet/fsharp/pull/17021)) * Various parenthesization API fixes. ([PR #16977](https://github.com/dotnet/fsharp/pull/16977)) From 43989966e906bf187cdae49b7f565f35e1204bdf Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Fri, 19 Apr 2024 13:02:08 +0100 Subject: [PATCH 08/12] more tests --- .../Types/UnionTypes/UnionStructTypes.fs | 12 ++++++++++++ .../Conformance/Types/UnionTypes/UnionTypes.fs | 12 ++++++++++++ .../Diagnostics/Records.fs | 13 ++++++++++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs index 630d2c2a838..574f1695d62 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionStructTypes.fs @@ -752,6 +752,18 @@ type GenericStructDu<'T> = EmptyFirst | SingleVal of f:'T | DoubleVal of f2:'T * """ |> compile |> shouldSucceed + + [] + let ``Error when declaring an abstract member in union struct type`` () = + Fsx """ +[] +type U = + | A | B + abstract M : unit -> unit + """ + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 912, Line 5, Col 3, Line 5, Col 28, "This declaration element is not permitted in an augmentation") [] let ``Regression 16282 DefaultAugment false on a struct union with fields`` () = diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs index 948ae405822..75ee664d938 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/UnionTypes/UnionTypes.fs @@ -709,3 +709,15 @@ if (sprintf "%%A" ABC.ab) <> "[A; B]" then failwith (sprintf "Failed: printing ' |> asExe |> compileAndRun |> shouldSucceed + + [] + let ``Error when declaring an abstract member in union type`` () = + Fsx """ +type U = + | A | B + abstract M : unit -> unit + """ + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 912, Line 4, Col 3, Line 4, Col 28, "This declaration element is not permitted in an augmentation") + diff --git a/tests/FSharp.Compiler.ComponentTests/Diagnostics/Records.fs b/tests/FSharp.Compiler.ComponentTests/Diagnostics/Records.fs index d617daaee7c..7b6bd70d729 100644 --- a/tests/FSharp.Compiler.ComponentTests/Diagnostics/Records.fs +++ b/tests/FSharp.Compiler.ComponentTests/Diagnostics/Records.fs @@ -111,4 +111,15 @@ type FooImpl = |> asExe |> compile |> shouldFail - |> withSingleDiagnostic (Error 912, Line 9, Col 5, Line 9, Col 36, "This declaration element is not permitted in an augmentation") \ No newline at end of file + |> withSingleDiagnostic (Error 912, Line 9, Col 5, Line 9, Col 36, "This declaration element is not permitted in an augmentation") + +[] +let ``Error when declaring an abstract member in record type`` () = + Fsx """ +type R = + { a : int; b : string } + abstract M : unit -> unit + """ + |> typecheck + |> shouldFail + |> withSingleDiagnostic (Error 912, Line 4, Col 3, Line 4, Col 28, "This declaration element is not permitted in an augmentation") From 38d66f4f2ba7e8dd00d2056f2fb4132bde216730 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Fri, 19 Apr 2024 13:05:49 +0100 Subject: [PATCH 09/12] Update src/Compiler/FSStrings.resx Co-authored-by: Tomas Grosup --- src/Compiler/FSStrings.resx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/FSStrings.resx b/src/Compiler/FSStrings.resx index caeb1678882..85b0beab7a1 100644 --- a/src/Compiler/FSStrings.resx +++ b/src/Compiler/FSStrings.resx @@ -220,7 +220,7 @@ A coercion from the value type \n {0} \nto the type \n {1} \nwill involve boxing. Consider using 'box' instead - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. This construct causes code to be less generic than indicated by its type annotations. The type variable implied by the use of a '#', '_' or other type annotation at or near '{0}' has been constrained to be type '{1}'. From cae2368e99858e1d25c8e16f8803bae0ac254b85 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Fri, 19 Apr 2024 13:18:56 +0100 Subject: [PATCH 10/12] Update error messages --- src/Compiler/xlf/FSStrings.cs.xlf | 2 +- src/Compiler/xlf/FSStrings.de.xlf | 2 +- src/Compiler/xlf/FSStrings.es.xlf | 2 +- src/Compiler/xlf/FSStrings.fr.xlf | 2 +- src/Compiler/xlf/FSStrings.it.xlf | 2 +- src/Compiler/xlf/FSStrings.ja.xlf | 2 +- src/Compiler/xlf/FSStrings.ko.xlf | 2 +- src/Compiler/xlf/FSStrings.pl.xlf | 2 +- src/Compiler/xlf/FSStrings.pt-BR.xlf | 2 +- src/Compiler/xlf/FSStrings.ru.xlf | 2 +- src/Compiler/xlf/FSStrings.tr.xlf | 2 +- src/Compiler/xlf/FSStrings.zh-Hans.xlf | 2 +- src/Compiler/xlf/FSStrings.zh-Hant.xlf | 2 +- .../ErrorMessages/ClassesTests.fs | 2 +- tests/fsharp/typecheck/sigs/neg44.bsl | 2 +- .../E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs | 2 +- .../AbstractMembers/E_CallToAbstractMember03.fs | 2 +- .../MemberDeclarations/E_Sealed_Member_Override02.fsx | 2 +- .../ClassTypes/Misc/E_AbstractClass01.fs | 4 ++-- .../TypeKindInference/infer_interface003e.fs | 4 ++-- 20 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Compiler/xlf/FSStrings.cs.xlf b/src/Compiler/xlf/FSStrings.cs.xlf index 8c2301d198a..04b6cd5a8c0 100644 --- a/src/Compiler/xlf/FSStrings.cs.xlf +++ b/src/Compiler/xlf/FSStrings.cs.xlf @@ -248,7 +248,7 @@ - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Tento typ je abstract, protože se neimplementovali někteří abstraktní členové. Pokud je to záměr, pak k typu přidejte atribut [<AbstractClass>]. diff --git a/src/Compiler/xlf/FSStrings.de.xlf b/src/Compiler/xlf/FSStrings.de.xlf index 831d539cfb9..6ffadc1e7fd 100644 --- a/src/Compiler/xlf/FSStrings.de.xlf +++ b/src/Compiler/xlf/FSStrings.de.xlf @@ -248,7 +248,7 @@ - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Der Typ entspricht „abstract“, da einige abstrakte Member nicht mit einer Implementierung versehen wurden. Wenn dies Ihre Absicht ist, fügen Sie das [<AbstractClass>]-Attribut zu Ihrem Typ hinzu. diff --git a/src/Compiler/xlf/FSStrings.es.xlf b/src/Compiler/xlf/FSStrings.es.xlf index d6d11278bb3..b67781488f6 100644 --- a/src/Compiler/xlf/FSStrings.es.xlf +++ b/src/Compiler/xlf/FSStrings.es.xlf @@ -248,7 +248,7 @@ - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Este tipo es "abstract" ya que a algunos miembros abstractos no se les ha dado una implementación. Si esto es intencional, agregue el atributo "[<AbstractClass>]" diff --git a/src/Compiler/xlf/FSStrings.fr.xlf b/src/Compiler/xlf/FSStrings.fr.xlf index 60b2635a62e..e13c363b0a8 100644 --- a/src/Compiler/xlf/FSStrings.fr.xlf +++ b/src/Compiler/xlf/FSStrings.fr.xlf @@ -248,7 +248,7 @@ - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Ce type est 'abstract', car des membres abstraits n'ont pas reçu d'implémentation. Si cela est intentionnel, ajoutez l'attribut '[<AbstractClass>]' à votre type. diff --git a/src/Compiler/xlf/FSStrings.it.xlf b/src/Compiler/xlf/FSStrings.it.xlf index 1403c9615b0..9ee9f935cc4 100644 --- a/src/Compiler/xlf/FSStrings.it.xlf +++ b/src/Compiler/xlf/FSStrings.it.xlf @@ -248,7 +248,7 @@ - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Questo tipo è 'abstract' perché non è stata specificata un'implementazione per alcuni membri astratti. Se questa scelta è intenzionale, aggiungere l'attributo '[<AbstractClass>]' al tipo. diff --git a/src/Compiler/xlf/FSStrings.ja.xlf b/src/Compiler/xlf/FSStrings.ja.xlf index 885eda91fd9..836bd2871ae 100644 --- a/src/Compiler/xlf/FSStrings.ja.xlf +++ b/src/Compiler/xlf/FSStrings.ja.xlf @@ -248,7 +248,7 @@ - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. これは 'abstract' 型です。一部の抽象メンバーに実装がありません。意図的な場合には、型に '[<AbstractClass>]' 属性を追加してください。 diff --git a/src/Compiler/xlf/FSStrings.ko.xlf b/src/Compiler/xlf/FSStrings.ko.xlf index 6d9760f5138..ca33a5cd0b8 100644 --- a/src/Compiler/xlf/FSStrings.ko.xlf +++ b/src/Compiler/xlf/FSStrings.ko.xlf @@ -248,7 +248,7 @@ - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. 일부 추상 멤버에 구현이 지정되지 않았으므로 이 형식은 'abstract'입니다. 의도적으로 구현을 지정하지 않은 경우에는 형식에 '[<AbstractClass>]' 특성을 추가하세요. diff --git a/src/Compiler/xlf/FSStrings.pl.xlf b/src/Compiler/xlf/FSStrings.pl.xlf index f9aed07a801..2827475f462 100644 --- a/src/Compiler/xlf/FSStrings.pl.xlf +++ b/src/Compiler/xlf/FSStrings.pl.xlf @@ -248,7 +248,7 @@ - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Ten typ ma wartość „abstract”, ponieważ niektóre abstrakcyjne składowe nie mają określonej implementacji. Jeśli jest to zamierzone działanie, dodaj atrybut „[<AbstractClass>]” do typu. diff --git a/src/Compiler/xlf/FSStrings.pt-BR.xlf b/src/Compiler/xlf/FSStrings.pt-BR.xlf index 19d5510ad9d..a4a0cf09493 100644 --- a/src/Compiler/xlf/FSStrings.pt-BR.xlf +++ b/src/Compiler/xlf/FSStrings.pt-BR.xlf @@ -248,7 +248,7 @@ - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Esse tipo é 'abstrato', pois alguns membros abstratos não receberam uma implementação. Se isso for intencional, adicione o atributo '[<AbstractClass>]' ao seu tipo. diff --git a/src/Compiler/xlf/FSStrings.ru.xlf b/src/Compiler/xlf/FSStrings.ru.xlf index d2c82a49f7e..3ea252d5d2a 100644 --- a/src/Compiler/xlf/FSStrings.ru.xlf +++ b/src/Compiler/xlf/FSStrings.ru.xlf @@ -248,7 +248,7 @@ - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Этот тип является абстрактным ('abstract'), так как для нескольких абстрактных членов не указана реализация. Если это сделано намеренно, добавьте атрибут '[<AbstractClass>]' к своему типу. diff --git a/src/Compiler/xlf/FSStrings.tr.xlf b/src/Compiler/xlf/FSStrings.tr.xlf index a45e764278c..3b0d48a9ca0 100644 --- a/src/Compiler/xlf/FSStrings.tr.xlf +++ b/src/Compiler/xlf/FSStrings.tr.xlf @@ -248,7 +248,7 @@ - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Bazı soyut üyelere bir uygulama verilmediğinden bu bir 'abstract' türdür. Bu bilerek yapıldıysa türünüze '[<AbstractClass>]' özniteliğini ekleyin. diff --git a/src/Compiler/xlf/FSStrings.zh-Hans.xlf b/src/Compiler/xlf/FSStrings.zh-Hans.xlf index 3d61d87b3b0..f04028d28c3 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hans.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hans.xlf @@ -248,7 +248,7 @@ - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. 由于未向一些抽象成员提供实现,因此该类型为 "abstract"。如果是故意如此,请向你的类型添加 "[<AbstractClass>]" 属性。 diff --git a/src/Compiler/xlf/FSStrings.zh-Hant.xlf b/src/Compiler/xlf/FSStrings.zh-Hant.xlf index 4640952ad46..2df3d3d8247 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hant.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hant.xlf @@ -248,7 +248,7 @@ - Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. 因為未提供實作給某些抽象成員,所以此類型為 'abstract'。如果這是預期的情況,則請將 '[<AbstractClass>]' 屬性新增到您的類型。 diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs index 6d4a7c9e1f4..82600367d98 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs @@ -794,7 +794,7 @@ type A() = |> shouldFail |> withDiagnostics [ (Error 365, Line 2, Col 6, Line 2, Col 7, "No implementation was given for 'abstract A.M: unit -> unit'") - (Error 54, Line 2, Col 6, Line 2, Col 7, "Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[]' attribute to your type.") + (Error 54, Line 2, Col 6, Line 2, Col 7, "Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[]' attribute to your type.") ] [] diff --git a/tests/fsharp/typecheck/sigs/neg44.bsl b/tests/fsharp/typecheck/sigs/neg44.bsl index a7792bdb82e..a323a64b7cf 100644 --- a/tests/fsharp/typecheck/sigs/neg44.bsl +++ b/tests/fsharp/typecheck/sigs/neg44.bsl @@ -1,4 +1,4 @@ neg44.fs(6,6,6,12): typecheck error FS0365: No implementation was given for 'Type.get_Module() : Module' -neg44.fs(6,6,6,12): typecheck error FS0054: Classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[]' attribute to your type. +neg44.fs(6,6,6,12): typecheck error FS0054: Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[]' attribute to your type. diff --git a/tests/fsharpqa/Source/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs b/tests/fsharpqa/Source/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs index 02ab8a392dc..1d4ba7fea2c 100644 --- a/tests/fsharpqa/Source/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs +++ b/tests/fsharpqa/Source/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypeInference // Regression test for FSHARP1.0:6123 //No implementation was given for 'Derived\.get_Foo\(\) : int'$ -//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ +//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ type FSDerived() = inherit Derived() diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs index 8ab3d13239d..c91065ef950 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs @@ -2,7 +2,7 @@ // Regression test for TFS bug Dev10:834160 // This test would fail if we don't set the IsImplemented bit for the abstract slot //No implementation was given for 'abstract B\.M: int -> float'$ -//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ +//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ [] type B() = abstract M : int -> float diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx index 0edb3e8d358..13c2fa474de 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx @@ -28,5 +28,5 @@ type T4() = //No implementation was given for those members: // 'CSLib5\.B0\.M\(c: char, a: int\) : int' // 'CSLib5\.B0\.N\(c: char, a: int\) : int' -//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ +//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ //Cannot override inherited member 'CSLib5.B1::M' because it is sealed$ \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs index a2757f2a785..c675e3bbbd4 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs @@ -3,9 +3,9 @@ // FSB 1272, New-ing a sub class with unimplemented abstract members should not be allowed. -//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type +//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type //No implementation was given for 'abstract Foo\.f: int -> int' -//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type +//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type //No implementation was given for 'abstract Foo\.f: int -> int' diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs index 17eb25a0e70..63828f97262 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs @@ -3,9 +3,9 @@ // attribute must match inferred type //No implementation was given for 'abstract TK_I_005\.M: unit -> unit'$ -//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ +//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ //No implementation was given for 'abstract TK_C_000\.M: int -> int'$ -//Classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ +//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ [] type TK_C_000 = From 371c484064fcb08294d109d1fc2a88547ae245e5 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Fri, 19 Apr 2024 14:22:57 +0100 Subject: [PATCH 11/12] Update src/Compiler/FSStrings.resx Co-authored-by: Petr --- src/Compiler/FSStrings.resx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/FSStrings.resx b/src/Compiler/FSStrings.resx index 85b0beab7a1..73ae2901566 100644 --- a/src/Compiler/FSStrings.resx +++ b/src/Compiler/FSStrings.resx @@ -220,7 +220,7 @@ A coercion from the value type \n {0} \nto the type \n {1} \nwill involve boxing. Consider using 'box' instead - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. This construct causes code to be less generic than indicated by its type annotations. The type variable implied by the use of a '#', '_' or other type annotation at or near '{0}' has been constrained to be type '{1}'. From 48650b15b1917ced47aa104d23e3dc8bf50961d6 Mon Sep 17 00:00:00 2001 From: Edgar Gonzalez Date: Fri, 19 Apr 2024 14:29:30 +0100 Subject: [PATCH 12/12] Another one --- src/Compiler/xlf/FSStrings.cs.xlf | 2 +- src/Compiler/xlf/FSStrings.de.xlf | 2 +- src/Compiler/xlf/FSStrings.es.xlf | 2 +- src/Compiler/xlf/FSStrings.fr.xlf | 2 +- src/Compiler/xlf/FSStrings.it.xlf | 2 +- src/Compiler/xlf/FSStrings.ja.xlf | 2 +- src/Compiler/xlf/FSStrings.ko.xlf | 2 +- src/Compiler/xlf/FSStrings.pl.xlf | 2 +- src/Compiler/xlf/FSStrings.pt-BR.xlf | 2 +- src/Compiler/xlf/FSStrings.ru.xlf | 2 +- src/Compiler/xlf/FSStrings.tr.xlf | 2 +- src/Compiler/xlf/FSStrings.zh-Hans.xlf | 2 +- src/Compiler/xlf/FSStrings.zh-Hant.xlf | 2 +- .../ErrorMessages/ClassesTests.fs | 2 +- tests/fsharp/typecheck/sigs/neg44.bsl | 2 +- .../E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs | 2 +- .../AbstractMembers/E_CallToAbstractMember03.fs | 2 +- .../MemberDeclarations/E_Sealed_Member_Override02.fsx | 2 +- .../ClassTypes/Misc/E_AbstractClass01.fs | 4 ++-- .../TypeKindInference/infer_interface003e.fs | 4 ++-- 20 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Compiler/xlf/FSStrings.cs.xlf b/src/Compiler/xlf/FSStrings.cs.xlf index 04b6cd5a8c0..8fa85e6c640 100644 --- a/src/Compiler/xlf/FSStrings.cs.xlf +++ b/src/Compiler/xlf/FSStrings.cs.xlf @@ -248,7 +248,7 @@ - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Tento typ je abstract, protože se neimplementovali někteří abstraktní členové. Pokud je to záměr, pak k typu přidejte atribut [<AbstractClass>]. diff --git a/src/Compiler/xlf/FSStrings.de.xlf b/src/Compiler/xlf/FSStrings.de.xlf index 6ffadc1e7fd..46c2c4eb4f1 100644 --- a/src/Compiler/xlf/FSStrings.de.xlf +++ b/src/Compiler/xlf/FSStrings.de.xlf @@ -248,7 +248,7 @@ - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Der Typ entspricht „abstract“, da einige abstrakte Member nicht mit einer Implementierung versehen wurden. Wenn dies Ihre Absicht ist, fügen Sie das [<AbstractClass>]-Attribut zu Ihrem Typ hinzu. diff --git a/src/Compiler/xlf/FSStrings.es.xlf b/src/Compiler/xlf/FSStrings.es.xlf index b67781488f6..0009c7dd034 100644 --- a/src/Compiler/xlf/FSStrings.es.xlf +++ b/src/Compiler/xlf/FSStrings.es.xlf @@ -248,7 +248,7 @@ - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Este tipo es "abstract" ya que a algunos miembros abstractos no se les ha dado una implementación. Si esto es intencional, agregue el atributo "[<AbstractClass>]" diff --git a/src/Compiler/xlf/FSStrings.fr.xlf b/src/Compiler/xlf/FSStrings.fr.xlf index e13c363b0a8..788fbf8d78d 100644 --- a/src/Compiler/xlf/FSStrings.fr.xlf +++ b/src/Compiler/xlf/FSStrings.fr.xlf @@ -248,7 +248,7 @@ - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Ce type est 'abstract', car des membres abstraits n'ont pas reçu d'implémentation. Si cela est intentionnel, ajoutez l'attribut '[<AbstractClass>]' à votre type. diff --git a/src/Compiler/xlf/FSStrings.it.xlf b/src/Compiler/xlf/FSStrings.it.xlf index 9ee9f935cc4..98994f92f88 100644 --- a/src/Compiler/xlf/FSStrings.it.xlf +++ b/src/Compiler/xlf/FSStrings.it.xlf @@ -248,7 +248,7 @@ - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Questo tipo è 'abstract' perché non è stata specificata un'implementazione per alcuni membri astratti. Se questa scelta è intenzionale, aggiungere l'attributo '[<AbstractClass>]' al tipo. diff --git a/src/Compiler/xlf/FSStrings.ja.xlf b/src/Compiler/xlf/FSStrings.ja.xlf index 836bd2871ae..e48f47c0f6f 100644 --- a/src/Compiler/xlf/FSStrings.ja.xlf +++ b/src/Compiler/xlf/FSStrings.ja.xlf @@ -248,7 +248,7 @@ - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. これは 'abstract' 型です。一部の抽象メンバーに実装がありません。意図的な場合には、型に '[<AbstractClass>]' 属性を追加してください。 diff --git a/src/Compiler/xlf/FSStrings.ko.xlf b/src/Compiler/xlf/FSStrings.ko.xlf index ca33a5cd0b8..31481aa4566 100644 --- a/src/Compiler/xlf/FSStrings.ko.xlf +++ b/src/Compiler/xlf/FSStrings.ko.xlf @@ -248,7 +248,7 @@ - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. 일부 추상 멤버에 구현이 지정되지 않았으므로 이 형식은 'abstract'입니다. 의도적으로 구현을 지정하지 않은 경우에는 형식에 '[<AbstractClass>]' 특성을 추가하세요. diff --git a/src/Compiler/xlf/FSStrings.pl.xlf b/src/Compiler/xlf/FSStrings.pl.xlf index 2827475f462..8dde95ed7e9 100644 --- a/src/Compiler/xlf/FSStrings.pl.xlf +++ b/src/Compiler/xlf/FSStrings.pl.xlf @@ -248,7 +248,7 @@ - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Ten typ ma wartość „abstract”, ponieważ niektóre abstrakcyjne składowe nie mają określonej implementacji. Jeśli jest to zamierzone działanie, dodaj atrybut „[<AbstractClass>]” do typu. diff --git a/src/Compiler/xlf/FSStrings.pt-BR.xlf b/src/Compiler/xlf/FSStrings.pt-BR.xlf index a4a0cf09493..5c17c16072b 100644 --- a/src/Compiler/xlf/FSStrings.pt-BR.xlf +++ b/src/Compiler/xlf/FSStrings.pt-BR.xlf @@ -248,7 +248,7 @@ - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Esse tipo é 'abstrato', pois alguns membros abstratos não receberam uma implementação. Se isso for intencional, adicione o atributo '[<AbstractClass>]' ao seu tipo. diff --git a/src/Compiler/xlf/FSStrings.ru.xlf b/src/Compiler/xlf/FSStrings.ru.xlf index 3ea252d5d2a..07467917126 100644 --- a/src/Compiler/xlf/FSStrings.ru.xlf +++ b/src/Compiler/xlf/FSStrings.ru.xlf @@ -248,7 +248,7 @@ - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Этот тип является абстрактным ('abstract'), так как для нескольких абстрактных членов не указана реализация. Если это сделано намеренно, добавьте атрибут '[<AbstractClass>]' к своему типу. diff --git a/src/Compiler/xlf/FSStrings.tr.xlf b/src/Compiler/xlf/FSStrings.tr.xlf index 3b0d48a9ca0..c4123c8a985 100644 --- a/src/Compiler/xlf/FSStrings.tr.xlf +++ b/src/Compiler/xlf/FSStrings.tr.xlf @@ -248,7 +248,7 @@ - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. Bazı soyut üyelere bir uygulama verilmediğinden bu bir 'abstract' türdür. Bu bilerek yapıldıysa türünüze '[<AbstractClass>]' özniteliğini ekleyin. diff --git a/src/Compiler/xlf/FSStrings.zh-Hans.xlf b/src/Compiler/xlf/FSStrings.zh-Hans.xlf index f04028d28c3..4af6f427ebd 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hans.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hans.xlf @@ -248,7 +248,7 @@ - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. 由于未向一些抽象成员提供实现,因此该类型为 "abstract"。如果是故意如此,请向你的类型添加 "[<AbstractClass>]" 属性。 diff --git a/src/Compiler/xlf/FSStrings.zh-Hant.xlf b/src/Compiler/xlf/FSStrings.zh-Hant.xlf index 2df3d3d8247..d945cbe3d33 100644 --- a/src/Compiler/xlf/FSStrings.zh-Hant.xlf +++ b/src/Compiler/xlf/FSStrings.zh-Hant.xlf @@ -248,7 +248,7 @@ - Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. + Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[<AbstractClass>]' attribute to your type. 因為未提供實作給某些抽象成員,所以此類型為 'abstract'。如果這是預期的情況,則請將 '[<AbstractClass>]' 屬性新增到您的類型。 diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs index 82600367d98..55f4d1cbf1b 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/ClassesTests.fs @@ -794,7 +794,7 @@ type A() = |> shouldFail |> withDiagnostics [ (Error 365, Line 2, Col 6, Line 2, Col 7, "No implementation was given for 'abstract A.M: unit -> unit'") - (Error 54, Line 2, Col 6, Line 2, Col 7, "Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[]' attribute to your type.") + (Error 54, Line 2, Col 6, Line 2, Col 7, "Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[]' attribute to your type.") ] [] diff --git a/tests/fsharp/typecheck/sigs/neg44.bsl b/tests/fsharp/typecheck/sigs/neg44.bsl index a323a64b7cf..1f69c7d9ff0 100644 --- a/tests/fsharp/typecheck/sigs/neg44.bsl +++ b/tests/fsharp/typecheck/sigs/neg44.bsl @@ -1,4 +1,4 @@ neg44.fs(6,6,6,12): typecheck error FS0365: No implementation was given for 'Type.get_Module() : Module' -neg44.fs(6,6,6,12): typecheck error FS0054: Non-abstract classes cannot contain abstract members. If this is intentional then provide a default member implementation or add the '[]' attribute to your type. +neg44.fs(6,6,6,12): typecheck error FS0054: Non-abstract classes cannot contain abstract members. Either provide a default member implementation or add the '[]' attribute to your type. diff --git a/tests/fsharpqa/Source/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs b/tests/fsharpqa/Source/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs index 1d4ba7fea2c..f844bbfda6f 100644 --- a/tests/fsharpqa/Source/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs +++ b/tests/fsharpqa/Source/Conformance/InferenceProcedures/WellFormednessChecking/E_NonAbstractClassNotImplAllInheritedAbstractSlots01.fs @@ -1,7 +1,7 @@ // #Regression #Conformance #TypeInference // Regression test for FSHARP1.0:6123 //No implementation was given for 'Derived\.get_Foo\(\) : int'$ -//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ +//Non-abstract classes cannot contain abstract members\. Either provide a default member implementation or add the '\[\]' attribute to your type\.$ type FSDerived() = inherit Derived() diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs index c91065ef950..18fc7c46d55 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/AbstractMembers/E_CallToAbstractMember03.fs @@ -2,7 +2,7 @@ // Regression test for TFS bug Dev10:834160 // This test would fail if we don't set the IsImplemented bit for the abstract slot //No implementation was given for 'abstract B\.M: int -> float'$ -//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ +//Non-abstract classes cannot contain abstract members\. Either provide a default member implementation or add the '\[\]' attribute to your type\.$ [] type B() = abstract M : int -> float diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx index 13c2fa474de..529a497ee4b 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/MemberDeclarations/E_Sealed_Member_Override02.fsx @@ -28,5 +28,5 @@ type T4() = //No implementation was given for those members: // 'CSLib5\.B0\.M\(c: char, a: int\) : int' // 'CSLib5\.B0\.N\(c: char, a: int\) : int' -//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ +//Non-abstract classes cannot contain abstract members\. Either provide a default member implementation or add the '\[\]' attribute to your type\.$ //Cannot override inherited member 'CSLib5.B1::M' because it is sealed$ \ No newline at end of file diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs index c675e3bbbd4..d4d614ca1c9 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/ClassTypes/Misc/E_AbstractClass01.fs @@ -3,9 +3,9 @@ // FSB 1272, New-ing a sub class with unimplemented abstract members should not be allowed. -//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type +//Non-abstract classes cannot contain abstract members\. Either provide a default member implementation or add the '\[\]' attribute to your type //No implementation was given for 'abstract Foo\.f: int -> int' -//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type +//Non-abstract classes cannot contain abstract members\. Either provide a default member implementation or add the '\[\]' attribute to your type //No implementation was given for 'abstract Foo\.f: int -> int' diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs index 63828f97262..e56e6266453 100644 --- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs +++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeKindInference/infer_interface003e.fs @@ -3,9 +3,9 @@ // attribute must match inferred type //No implementation was given for 'abstract TK_I_005\.M: unit -> unit'$ -//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ +//Non-abstract classes cannot contain abstract members\. Either provide a default member implementation or add the '\[\]' attribute to your type\.$ //No implementation was given for 'abstract TK_C_000\.M: int -> int'$ -//Non-abstract classes cannot contain abstract members\. If this is intentional then provide a default member implementation or add the '\[\]' attribute to your type\.$ +//Non-abstract classes cannot contain abstract members\. Either provide a default member implementation or add the '\[\]' attribute to your type\.$ [] type TK_C_000 =