From 37e462df38c3fca4ee6d2f6d53e5ca4612a90103 Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Tue, 2 Mar 2021 23:16:24 +0100
Subject: [PATCH 01/18] Remove interface check
---
src/fsharp/CheckDeclarations.fs | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/fsharp/CheckDeclarations.fs b/src/fsharp/CheckDeclarations.fs
index bb7813857c4..91de0c9838a 100644
--- a/src/fsharp/CheckDeclarations.fs
+++ b/src/fsharp/CheckDeclarations.fs
@@ -2366,9 +2366,6 @@ let TcMutRecDefns_Phase2 (cenv: cenv) envInitial bindsm scopem mutRecNSInfo (env
let envinner = AddDeclaredTypars CheckForDuplicateTypars declaredTyconTypars envForTycon
TcTypeAndRecover cenv NoNewTypars CheckCxs ItemOccurence.UseInType envinner emptyUnscopedTyparEnv ity |> fst
if not (isInterfaceTy g ity') then errorR(Error(FSComp.SR.tcTypeIsNotInterfaceType0(), ity.Range))
-
- if not (tcref.HasInterface g ity') then
- error(Error(FSComp.SR.tcAllImplementedInterfacesShouldBeDeclared(), ity.Range))
let generatedCompareToValues = tcref.GeneratedCompareToValues.IsSome
let generatedHashAndEqualsWithComparerValues = tcref.GeneratedHashAndEqualsWithComparerValues.IsSome
From 80321badbf78c4b9d192f9051993dea6fa927d58 Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Wed, 3 Mar 2021 08:05:16 +0100
Subject: [PATCH 02/18] Remove expectation
---
tests/fsharp/typecheck/sigs/neg46.bsl | 4 ----
1 file changed, 4 deletions(-)
diff --git a/tests/fsharp/typecheck/sigs/neg46.bsl b/tests/fsharp/typecheck/sigs/neg46.bsl
index 1bdf9fbc95b..f3e44555733 100644
--- a/tests/fsharp/typecheck/sigs/neg46.bsl
+++ b/tests/fsharp/typecheck/sigs/neg46.bsl
@@ -34,7 +34,3 @@ neg46.fs(56,17,56,20): typecheck error FS0696: This is not a valid object constr
neg46.fs(60,8,60,19): typecheck error FS0912: This declaration element is not permitted in an augmentation
neg46.fs(64,8,64,26): typecheck error FS0912: This declaration element is not permitted in an augmentation
-
-neg46.fs(68,18,68,36): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type
-
-neg46.fs(73,18,73,36): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type
From 4d41a8f0948e50c5a2f60c17146cad4d1062b102 Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Wed, 3 Mar 2021 11:01:54 +0100
Subject: [PATCH 03/18] Restore check
---
tests/fsharp/typecheck/sigs/neg46.bsl | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/fsharp/typecheck/sigs/neg46.bsl b/tests/fsharp/typecheck/sigs/neg46.bsl
index f3e44555733..3e9e94dc00f 100644
--- a/tests/fsharp/typecheck/sigs/neg46.bsl
+++ b/tests/fsharp/typecheck/sigs/neg46.bsl
@@ -34,3 +34,7 @@ neg46.fs(56,17,56,20): typecheck error FS0696: This is not a valid object constr
neg46.fs(60,8,60,19): typecheck error FS0912: This declaration element is not permitted in an augmentation
neg46.fs(64,8,64,26): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(68,18,68,36): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type
+
+neg46.fs(73,18,73,36): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type
From 8b3de86f26e60ae63d65b943489bfd2d6c38b1b4 Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Wed, 3 Mar 2021 20:48:40 +0100
Subject: [PATCH 04/18] Try again
---
tests/fsharp/typecheck/sigs/neg46.bsl | 4 ----
1 file changed, 4 deletions(-)
diff --git a/tests/fsharp/typecheck/sigs/neg46.bsl b/tests/fsharp/typecheck/sigs/neg46.bsl
index 3e9e94dc00f..f3e44555733 100644
--- a/tests/fsharp/typecheck/sigs/neg46.bsl
+++ b/tests/fsharp/typecheck/sigs/neg46.bsl
@@ -34,7 +34,3 @@ neg46.fs(56,17,56,20): typecheck error FS0696: This is not a valid object constr
neg46.fs(60,8,60,19): typecheck error FS0912: This declaration element is not permitted in an augmentation
neg46.fs(64,8,64,26): typecheck error FS0912: This declaration element is not permitted in an augmentation
-
-neg46.fs(68,18,68,36): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type
-
-neg46.fs(73,18,73,36): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type
From 19ac6d2d660a58222715be0d7f051a7640e0a783 Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Wed, 10 Mar 2021 11:08:46 +0100
Subject: [PATCH 05/18] Update baseline with new errors
---
tests/fsharp/typecheck/sigs/neg46.bsl | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/fsharp/typecheck/sigs/neg46.bsl b/tests/fsharp/typecheck/sigs/neg46.bsl
index f3e44555733..577ea4b8cd7 100644
--- a/tests/fsharp/typecheck/sigs/neg46.bsl
+++ b/tests/fsharp/typecheck/sigs/neg46.bsl
@@ -34,3 +34,9 @@ neg46.fs(56,17,56,20): typecheck error FS0696: This is not a valid object constr
neg46.fs(60,8,60,19): typecheck error FS0912: This declaration element is not permitted in an augmentation
neg46.fs(64,8,64,26): typecheck error FS0912: This declaration element is not permitted in an augmentation
+
+neg46.fs(68,18,68,36): typecheck error FS0090: Interface implementations should be given on the initial declaration of a type.
+
+neg46.fs(69,18,69,21): typecheck error FS0854: Method overrides and interface implementations are not permitted here
+
+neg46.fs(73,18,73,36): typecheck error FS0090: Interface implementations should be given on the initial declaration of a type.
From 42a30843207901040a29b4c3945f99c39f3b02ba Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Wed, 10 Mar 2021 18:23:08 +0100
Subject: [PATCH 06/18] Switch expected error
---
.../TypeExtensions/optional/E_TypeExtensionWithInterface01.fs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/E_TypeExtensionWithInterface01.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/E_TypeExtensionWithInterface01.fs
index c33ef60b389..6beb9786c50 100644
--- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/E_TypeExtensionWithInterface01.fs
+++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/E_TypeExtensionWithInterface01.fs
@@ -1,6 +1,6 @@
// #Conformance #ObjectOrientedTypes #TypeExtensions #Regression
// Regression for 909525, previously there was no error here
-// All implemented interfaces should be declared on the initial declaration of the type
+// Interface implementations should be given on the initial declaration of a type.
type System.Random with
interface System.IComparable
static member Factory() = 1
From e1d15a85f08059e1793cedddebae9c516f51898e Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Wed, 10 Mar 2021 19:24:11 +0100
Subject: [PATCH 07/18] Same here
---
.../TypeExtensions/optional/typeext_opt006.fs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/typeext_opt006.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/typeext_opt006.fs
index 4335bc703a7..51bc03add71 100644
--- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/typeext_opt006.fs
+++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/typeext_opt006.fs
@@ -1,5 +1,5 @@
// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions
-//All implemented interfaces should be declared on the initial declaration of the type
+//Interface implementations should be given on the initial declaration of a type.
namespace NS
module M =
From 4e423991387cec3fc0618774d7291bcf23b2cacd Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Wed, 10 Mar 2021 19:46:28 +0100
Subject: [PATCH 08/18] ... and here
---
.../TypeExtensions/intrinsic/lib006.fs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib006.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib006.fs
index 52ea4d77c14..a412543a324 100644
--- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib006.fs
+++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib006.fs
@@ -1,5 +1,5 @@
// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions
-//All implemented interfaces should be declared on the initial declaration of the type
+//Interface implementations should be given on the initial declaration of a type.
namespace NS
type IM =
From d806c85b5fc433c316f1094a914dcb5befeb9b70 Mon Sep 17 00:00:00 2001
From: Tomas Grosup
Date: Tue, 4 Oct 2022 17:17:55 +0200
Subject: [PATCH 09/18] Adding tests for combinations of rec and non-rec
modules/namespaces/nested namespaces
---
src/Compiler/Checking/CheckDeclarations.fs | 13 ++--
.../InterfaceImplInAugmentationsTests.fs | 69 ++++++++++++++++++-
2 files changed, 73 insertions(+), 9 deletions(-)
diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs
index ac0080ca829..a005f091f4b 100644
--- a/src/Compiler/Checking/CheckDeclarations.fs
+++ b/src/Compiler/Checking/CheckDeclarations.fs
@@ -1621,7 +1621,7 @@ module MutRecBindingChecking =
defnsEs, envMutRec
/// Check and generalize the interface implementations, members, 'let' definitions in a mutually recursive group of definitions.
-let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (envMutRec: TcEnv) (mutRecDefns: MutRecDefnsPhase2Data) =
+let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (envMutRec: TcEnv) (mutRecDefns: MutRecDefnsPhase2Data) =
let g = cenv.g
let interfacesFromTypeDefn envForTycon tyconMembersData =
let (MutRecDefnsPhase2DataForTycon(_, _, declKind, tcref, _, _, declaredTyconTypars, members, _, _, _)) = tyconMembersData
@@ -1650,11 +1650,12 @@ let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (env
(generatedHashAndEqualsWithComparerValues && typeEquiv g intfTyR (mkAppTy g.system_GenericIEquatable_tcref [ty])) ||
(generatedHashAndEqualsWithComparerValues && typeEquiv g intfTyR g.mk_IStructuralEquatable_ty) then
errorR(Error(FSComp.SR.tcDefaultImplementationForInterfaceHasAlreadyBeenAdded(), intfTy.Range))
-
- if overridesOK = WarnOnOverrides then
- warning(IntfImplInIntrinsicAugmentation(intfTy.Range))
- if overridesOK = ErrorOnOverrides then
- errorR(IntfImplInExtrinsicAugmentation(intfTy.Range))
+
+ match mutRecNSInfo, overridesOK with
+ | _, OverridesOK | Some(_,_), WarnOnOverrides -> ()
+ | None, WarnOnOverrides -> warning(IntfImplInIntrinsicAugmentation(intfTy.Range))
+ | _, ErrorOnOverrides -> errorR(IntfImplInExtrinsicAugmentation(intfTy.Range))
+
match defnOpt with
| Some defn -> [ (intfTyR, defn, m) ]
| _-> []
diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
index c7c2b042bcf..5c6f6d4de25 100644
--- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
+++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
@@ -8,7 +8,7 @@ open FSharp.Test.Compiler
module InterfaceImplAugmentation =
[]
- let ``Public Module Abbreviation``() =
+ let ``Type in non-recursive namespace show give a warning when augmented externally``() =
FSharp """
namespace AugmentationsTest
type MyCustomType<'T> =
@@ -19,8 +19,71 @@ type MyCustomType<'T> with
interface System.IDisposable with
member x.Dispose() = printfn "Finish" """
|> typecheck
- |> shouldSucceed
- |> withSingleDiagnostic (Warning 69, Line 6, Col 20, Line 6, Col 30,
+ |> shouldFail
+ |> withSingleDiagnostic (Warning 69, Line 8, Col 15, Line 8, Col 33,
"""Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
+
+ []
+ let ``Type in a recursive namespace can be augmented without warning``() =
+ FSharp """
+namespace rec AugmentationsTest
+type MyCustomType<'T> =
+ | Data of string
+ interface System.IDisposable
+
+type MyCustomType<'T> with
+ interface System.IDisposable with
+ member x.Dispose() = printfn "Finish" """
+ |> typecheck
+ |> shouldSucceed
+ |> withWarnings []
+
+ []
+ let ``Type in a recursive module and in a non-recursive namespace can be augmented without warning``() =
+ FSharp """
+namespace MyNonRecursiveNs
+module rec RecursiveModule =
+ type MyCustomType<'T> =
+ | Data of string
+ interface System.IDisposable
+
+ type MyCustomType<'T> with
+ interface System.IDisposable with
+ member x.Dispose() = printfn "Finish" """
+ |> typecheck
+ |> shouldSucceed
+ |> withWarnings []
+
+ []
+ let ``Type in a nonrecursive module but in a recursive namespace can be augmented without warning``() =
+ FSharp """
+namespace rec AugmentationsTest
+module InnerNonRecursiveModule =
+ type MyCustomType<'T> =
+ | Data of string
+ interface System.IDisposable
+
+ type MyCustomType<'T> with
+ interface System.IDisposable with
+ member x.Dispose() = printfn "Finish" """
+ |> typecheck
+ |> shouldSucceed
+ |> withWarnings []
+
+ []
+ let ``Type in non-recursive namespace nested in a bigger recursive namespace can be augmented``() =
+ FSharp """
+namespace rec OuuterRec
+namespace OuuterRec.InnerNonRec
+ type MyCustomType<'T> =
+ | Data of string
+ interface System.IDisposable
+
+ type MyCustomType<'T> with
+ interface System.IDisposable with
+ member x.Dispose() = printfn "Finish" """
+ |> typecheck
+ |> shouldSucceed
+ |> withWarnings []
\ No newline at end of file
From 96868cea5084415cf13e5de6b8dfd10a60f35a40 Mon Sep 17 00:00:00 2001
From: Tomas Grosup
Date: Wed, 5 Oct 2022 12:40:01 +0200
Subject: [PATCH 10/18] Covering test cases also for augmented exception types
---
.../InterfaceImplInAugmentationsTests.fs | 33 ++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
index 5c6f6d4de25..6ecb66f61f8 100644
--- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
+++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
@@ -23,7 +23,23 @@ type MyCustomType<'T> with
|> withSingleDiagnostic (Warning 69, Line 8, Col 15, Line 8, Col 33,
"""Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
-
+ []
+ let ``Exception type in non-recursive namespace show give a warning when augmented externally``() =
+ FSharp """
+namespace AugmentationsTest
+type MyCustomExcType<'T>() =
+ inherit System.Exception()
+ interface System.IDisposable
+
+type MyCustomExcType<'T> with
+ interface System.IDisposable with
+ member x.Dispose() = printfn "Finish" """
+ |> typecheck
+ |> shouldFail
+ |> withSingleDiagnostic (Warning 69, Line 8, Col 15, Line 8, Col 33,
+ """Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
+
+
[]
let ``Type in a recursive namespace can be augmented without warning``() =
FSharp """
@@ -39,6 +55,21 @@ type MyCustomType<'T> with
|> shouldSucceed
|> withWarnings []
+ []
+ let ``Exception in a recursive namespace can be augmented without warning``() =
+ FSharp """
+namespace rec AugmentationsTest
+type MyCustomExcType<'T>() =
+ inherit System.Exception()
+ interface System.IDisposable
+
+type MyCustomExcType<'T> with
+ interface System.IDisposable with
+ member x.Dispose() = printfn "Finish" """
+ |> typecheck
+ |> shouldSucceed
+ |> withWarnings []
+
[]
let ``Type in a recursive module and in a non-recursive namespace can be augmented without warning``() =
FSharp """
From 194423e7598a5e921a085719378b1352b9371bf9 Mon Sep 17 00:00:00 2001
From: Tomas Grosup
Date: Wed, 5 Oct 2022 14:35:14 +0200
Subject: [PATCH 11/18] Different approach taken based on method call origin
---
src/Compiler/Checking/CheckDeclarations.fs | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs
index a005f091f4b..53add7988b2 100644
--- a/src/Compiler/Checking/CheckDeclarations.fs
+++ b/src/Compiler/Checking/CheckDeclarations.fs
@@ -1621,7 +1621,7 @@ module MutRecBindingChecking =
defnsEs, envMutRec
/// Check and generalize the interface implementations, members, 'let' definitions in a mutually recursive group of definitions.
-let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (envMutRec: TcEnv) (mutRecDefns: MutRecDefnsPhase2Data) =
+let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (envMutRec: TcEnv) (mutRecDefns: MutRecDefnsPhase2Data) skipExternalAugmWarning =
let g = cenv.g
let interfacesFromTypeDefn envForTycon tyconMembersData =
let (MutRecDefnsPhase2DataForTycon(_, _, declKind, tcref, _, _, declaredTyconTypars, members, _, _, _)) = tyconMembersData
@@ -1651,9 +1651,9 @@ let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (env
(generatedHashAndEqualsWithComparerValues && typeEquiv g intfTyR g.mk_IStructuralEquatable_ty) then
errorR(Error(FSComp.SR.tcDefaultImplementationForInterfaceHasAlreadyBeenAdded(), intfTy.Range))
- match mutRecNSInfo, overridesOK with
- | _, OverridesOK | Some(_,_), WarnOnOverrides -> ()
- | None, WarnOnOverrides -> warning(IntfImplInIntrinsicAugmentation(intfTy.Range))
+ match skipExternalAugmWarning, overridesOK with
+ | _, OverridesOK | true, WarnOnOverrides -> ()
+ | false, WarnOnOverrides -> warning(IntfImplInIntrinsicAugmentation(intfTy.Range))
| _, ErrorOnOverrides -> errorR(IntfImplInExtrinsicAugmentation(intfTy.Range))
match defnOpt with
@@ -2256,7 +2256,7 @@ module TcExceptionDeclarations =
let envMutRec = AddLocalExnDefnAndReport cenv.tcSink scopem (AddLocalTycons g cenv.amap scopem [exnc] envInitial) exnc
let defns = [MutRecShape.Tycon(MutRecDefnsPhase2DataForTycon(Some exnc, parent, ModuleOrMemberBinding, mkLocalEntityRef exnc, None, NoSafeInitInfo, [], aug, m, NoNewSlots, (fun () -> ())))]
- let binds2, envFinal = TcMutRecDefns_Phase2 cenv envInitial m scopem None envMutRec defns
+ let binds2, envFinal = TcMutRecDefns_Phase2 cenv envInitial m scopem None envMutRec defns true
let binds2flat = binds2 |> MutRecShapes.collectTycons |> List.collect snd
// Augment types with references to values that implement the pre-baked semantics of the type
let binds3 = AddAugmentationDeclarations.AddGenericEqualityBindings cenv envFinal exnc
@@ -4140,7 +4140,7 @@ module TcDeclarations =
//-------------------------------------------------------------------------
/// Bind a collection of mutually recursive definitions in an implementation file
- let TcMutRecDefinitions (cenv: cenv) envInitial parent typeNames tpenv m scopem mutRecNSInfo (mutRecDefns: MutRecDefnsInitialData) =
+ let TcMutRecDefinitions (cenv: cenv) envInitial parent typeNames tpenv m scopem mutRecNSInfo (mutRecDefns: MutRecDefnsInitialData) skipExternalAugmWarning =
let g = cenv.g
@@ -4194,7 +4194,7 @@ module TcDeclarations =
cenv true scopem m
// Check the members and decide on representations for types with implicit constructors.
- let withBindings, envFinal = TcMutRecDefns_Phase2 cenv envInitial m scopem mutRecNSInfo envMutRecPrelimWithReprs withEnvs
+ let withBindings, envFinal = TcMutRecDefns_Phase2 cenv envInitial m scopem mutRecNSInfo envMutRecPrelimWithReprs withEnvs skipExternalAugmWarning
// Generate the hash/compare/equality bindings for all tycons.
//
@@ -4650,7 +4650,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem
| SynModuleDecl.Types (typeDefs, m) ->
let scopem = unionRanges m scopem
let mutRecDefns = typeDefs |> List.map MutRecShape.Tycon
- let mutRecDefnsChecked, envAfter = TcDeclarations.TcMutRecDefinitions cenv env parent typeNames tpenv m scopem None mutRecDefns
+ let mutRecDefnsChecked, envAfter = TcDeclarations.TcMutRecDefinitions cenv env parent typeNames tpenv m scopem None mutRecDefns false
// Check the non-escaping condition as we build the expression on the way back up
let defn = TcMutRecDefsFinish cenv mutRecDefnsChecked m
let escapeCheck () =
@@ -4701,7 +4701,7 @@ let rec TcModuleOrNamespaceElementNonMutRec (cenv: cenv) parent typeNames scopem
// Treat 'module rec M = ...' as a single mutually recursive definition group 'module M = ...'
if isRec then
assert (not isContinuingModule)
- let modDecl = SynModuleDecl.NestedModule(compInfo, false, moduleDefs, isContinuingModule, m, trivia)
+ let modDecl = SynModuleDecl.NestedModule(compInfo, false, moduleDefs, isContinuingModule, m, trivia)
return! TcModuleOrNamespaceElementsMutRec cenv parent typeNames m env None [modDecl]
else
let (SynComponentInfo(Attributes attribs, _, _, longPath, xml, _, vis, im)) = compInfo
@@ -4903,7 +4903,7 @@ and TcModuleOrNamespaceElementsMutRec (cenv: cenv) parent typeNames m envInitial
loop (match parent with ParentNone -> true | Parent _ -> false) m [] defs
let tpenv = emptyUnscopedTyparEnv
- let mutRecDefnsChecked, envAfter = TcDeclarations.TcMutRecDefinitions cenv envInitial parent typeNames tpenv m scopem mutRecNSInfo mutRecDefns
+ let mutRecDefnsChecked, envAfter = TcDeclarations.TcMutRecDefinitions cenv envInitial parent typeNames tpenv m scopem mutRecNSInfo mutRecDefns true
// Check the assembly attributes
let attrs, _ = TcAttributesWithPossibleTargets false cenv envAfter AttributeTargets.Top synAttrs
From 967cbc6f55ea5a238de4bc0cfc2233547dc9db5b Mon Sep 17 00:00:00 2001
From: Tomas Grosup
Date: Wed, 5 Oct 2022 15:16:36 +0200
Subject: [PATCH 12/18] More tests added
---
.../InterfaceImplInAugmentationsTests.fs | 31 ++++++++++++++++---
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
index 6ecb66f61f8..59beefa5f79 100644
--- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
+++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
@@ -103,7 +103,7 @@ module InnerNonRecursiveModule =
|> withWarnings []
[]
- let ``Type in non-recursive namespace nested in a bigger recursive namespace can be augmented``() =
+ let ``Type in non-recursive namespace nested in a bigger recursive namespace shows warning``() =
FSharp """
namespace rec OuuterRec
namespace OuuterRec.InnerNonRec
@@ -115,6 +115,29 @@ namespace OuuterRec.InnerNonRec
interface System.IDisposable with
member x.Dispose() = printfn "Finish" """
|> typecheck
- |> shouldSucceed
- |> withWarnings []
-
\ No newline at end of file
+ |> shouldFail
+ |> withSingleDiagnostic (Warning 69, Line 9, Col 19, Line 9, Col 37,
+ """Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
+
+
+
+ []
+ let ``Type in non-rec ns show give a warning when augmented externally even when the same file has a recursive (but different) ns``() =
+ FSharp """
+namespace rec OuuterRec
+ module Stuff =
+ let x = 5
+namespace TotallyDifferentNs.InnerNonRec
+ type MyCustomType<'T> =
+ | Data of string
+ interface System.IDisposable
+
+ type MyCustomType<'T> with
+ interface System.IDisposable with
+ member x.Dispose() = printfn "Finish" """
+ |> typecheck
+ |> shouldFail
+ |> withSingleDiagnostic (Warning 69, Line 11, Col 19, Line 11, Col 37,
+ """Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
+
+
\ No newline at end of file
From 2da6637993028a699c252f79cdf1b4853346541e Mon Sep 17 00:00:00 2001
From: Tomas Grosup
Date: Wed, 5 Oct 2022 17:55:51 +0200
Subject: [PATCH 13/18] Deleting fsharpqa tests which are covered by
componenttests now
---
.../InterfaceImplInAugmentationsTests.fs | 11 +++++++
.../TypeExtensions/intrinsic/env.lst | 3 +-
.../TypeExtensions/intrinsic/lib006.fs | 14 ---------
.../intrinsic/typeext_int006.fs | 14 ---------
.../E_TypeExtensionWithInterface01.fs | 8 -----
.../TypeExtensions/optional/env.lst | 3 --
.../TypeExtensions/optional/lib006.fs | 13 --------
.../TypeExtensions/optional/typeext_opt006.fs | 13 --------
...nterfaceImplementationInAugmentation01a.fs | 22 -------------
...nterfaceImplementationInAugmentation01b.fs | 31 -------------------
...nterfaceImplementationInAugmentation02a.fs | 30 ------------------
...OverrideImplementationInAugmentation01b.fs | 14 ---------
...OverrideImplementationInAugmentation02a.fs | 14 ---------
.../Source/Diagnostics/General/env.lst | 3 --
14 files changed, 12 insertions(+), 181 deletions(-)
delete mode 100644 tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib006.fs
delete mode 100644 tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int006.fs
delete mode 100644 tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/E_TypeExtensionWithInterface01.fs
delete mode 100644 tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/lib006.fs
delete mode 100644 tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/typeext_opt006.fs
delete mode 100644 tests/fsharpqa/Source/Diagnostics/General/W_InterfaceImplementationInAugmentation01a.fs
delete mode 100644 tests/fsharpqa/Source/Diagnostics/General/W_InterfaceImplementationInAugmentation01b.fs
delete mode 100644 tests/fsharpqa/Source/Diagnostics/General/W_InterfaceImplementationInAugmentation02a.fs
delete mode 100644 tests/fsharpqa/Source/Diagnostics/General/W_OverrideImplementationInAugmentation01b.fs
delete mode 100644 tests/fsharpqa/Source/Diagnostics/General/W_OverrideImplementationInAugmentation02a.fs
diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
index 59beefa5f79..47fd4ae1517 100644
--- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
+++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
@@ -140,4 +140,15 @@ namespace TotallyDifferentNs.InnerNonRec
|> withSingleDiagnostic (Warning 69, Line 11, Col 19, Line 11, Col 37,
"""Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
+ []
+ let ``Adding an interface to a previously defined type should still be just an 909 error and nothing else``() =
+ FSharp """
+type System.Random with
+ interface System.IComparable
+ static member Factory() = 1 """
+ |> typecheck
+ |> shouldFail
+ |> withSingleDiagnostic (Error 909, Line 3, Col 15, Line 3, Col 33,
+ """All implemented interfaces should be declared on the initial declaration of the type""")
+
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/env.lst b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/env.lst
index cb4bf2101d8..1f10ac869db 100644
--- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/env.lst
+++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/env.lst
@@ -2,5 +2,4 @@
SOURCE="lib002.fs E_typeext_int002.fs" SCFLAGS="--test:ErrorRanges" # E_typeext_int002.fs
SOURCE="lib003.fs typeext_int003.fs" # typeext_int003.fs
SOURCE="lib004.fs typeext_int004.fs" # typeext_int004fs
- SOURCE="lib005.fs typeext_int005.fs" # typeext_int005fs
- SOURCE="lib006.fs typeext_int006.fs" SCFLAGS="--test:ErrorRanges" # typeext_int006.fs
+ SOURCE="lib005.fs typeext_int005.fs" # typeext_int005fs
\ No newline at end of file
diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib006.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib006.fs
deleted file mode 100644
index a412543a324..00000000000
--- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/lib006.fs
+++ /dev/null
@@ -1,14 +0,0 @@
-// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions
-//Interface implementations should be given on the initial declaration of a type.
-
-namespace NS
- type IM =
- interface
- abstract M : int -> int
- end
-
- type Lib() =
- class
- member x.Prop = 1
- end
-
diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int006.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int006.fs
deleted file mode 100644
index c5bfd677714..00000000000
--- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/intrinsic/typeext_int006.fs
+++ /dev/null
@@ -1,14 +0,0 @@
-// #Conformance #ObjectOrientedTypes #TypeExtensions
-// verify that implementing an interface is not allowed
-
-namespace NS
- module M =
- type Lib with
- interface IM
- with member x.M i = i
-
-
- module F = exit 0
-
-
-
diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/E_TypeExtensionWithInterface01.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/E_TypeExtensionWithInterface01.fs
deleted file mode 100644
index 6beb9786c50..00000000000
--- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/E_TypeExtensionWithInterface01.fs
+++ /dev/null
@@ -1,8 +0,0 @@
-// #Conformance #ObjectOrientedTypes #TypeExtensions #Regression
-// Regression for 909525, previously there was no error here
-// Interface implementations should be given on the initial declaration of a type.
-type System.Random with
- interface System.IComparable
- static member Factory() = 1
-
-exit 1
diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/env.lst b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/env.lst
index bef08d26615..6cf885da545 100644
--- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/env.lst
+++ b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/env.lst
@@ -3,7 +3,6 @@
SOURCE="lib003.fs" SCFLAGS="-a" # lib003.fs
SOURCE="lib004.fs" SCFLAGS="-a" # lib004.fs
SOURCE="lib005.fs" SCFLAGS="-a" # lib005.fs
- SOURCE="lib006.fs" SCFLAGS="-a" # lib006.fs
SOURCE="E_NotInModule.fs" SCFLAGS="-r:lib000.dll --test:ErrorRanges" # E_NotInModule.fs
SOURCE="ShortNamesAllowed.fs" SCFLAGS="-r:lib000.dll" # ShortNamesAllowed.fs
SOURCE="E_ModuleNotOpen.fs" SCFLAGS="-r:lib000.dll --test:ErrorRanges" # E_ModuleNotOpen.fs
@@ -13,8 +12,6 @@
SOURCE="typeext_opt004.fs" SCFLAGS="-r:lib004.dll" # typeext_opt004.fs
SOURCE="typeext_opt005.fs" SCFLAGS="-r:lib005.dll" # typeext_opt005.fs
SOURCE="E_typeext_opt005.fs" SCFLAGS="-r:lib005.dll --test:ErrorRanges" # E_typeext_opt005.fs
- SOURCE="typeext_opt006.fs" SCFLAGS="-r:lib006.dll --test:ErrorRanges" # typeext_opt006.fs
SOURCE="typeext_opt007.fs" SCFLAGS="-r:lib001.dll" # typeext_opt007.fs
SOURCE="typeext_opt008.fs" SCFLAGS="-r:lib001.dll --test:ErrorRanges" # typeext_opt008.fs
- SOURCE=E_TypeExtensionWithInterface01.fs SCFLAGS="--test:ErrorRanges" # E_TypeExtensionWithInterface01.fs
SOURCE=E_CrossModule01.fs SCFLAGS="--test:ErrorRanges" # E_CrossModule01.fs
diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/lib006.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/lib006.fs
deleted file mode 100644
index b36e866272e..00000000000
--- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/lib006.fs
+++ /dev/null
@@ -1,13 +0,0 @@
-// #Conformance #ObjectOrientedTypes #TypeExtensions
-#light
-namespace NS
- type IM =
- interface
- abstract M : int -> int
- end
-
- type Lib() =
- class
- member x.Prop = 1
- end
-
diff --git a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/typeext_opt006.fs b/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/typeext_opt006.fs
deleted file mode 100644
index 51bc03add71..00000000000
--- a/tests/fsharpqa/Source/Conformance/ObjectOrientedTypeDefinitions/TypeExtensions/optional/typeext_opt006.fs
+++ /dev/null
@@ -1,13 +0,0 @@
-// #Regression #Conformance #ObjectOrientedTypes #TypeExtensions
-//Interface implementations should be given on the initial declaration of a type.
-
-namespace NS
- module M =
- type Lib with
- interface IM
- with member x.M i = i
-
- module F = exit 0
-
-
-
diff --git a/tests/fsharpqa/Source/Diagnostics/General/W_InterfaceImplementationInAugmentation01a.fs b/tests/fsharpqa/Source/Diagnostics/General/W_InterfaceImplementationInAugmentation01a.fs
deleted file mode 100644
index 0e1afb421cd..00000000000
--- a/tests/fsharpqa/Source/Diagnostics/General/W_InterfaceImplementationInAugmentation01a.fs
+++ /dev/null
@@ -1,22 +0,0 @@
-// #Regression #Diagnostics
-// Regression test for FSHARP1.0:1273
-// Give warning on use of interface and/or override implementations in augmentations
-//
-//
-
-
-
-type I = interface
- abstract M : int
- end
-
-type T2b2 = class
- interface I
- end
-
-type T2b2 with
- interface I with
- member a.M = 3
- end
- end
-
diff --git a/tests/fsharpqa/Source/Diagnostics/General/W_InterfaceImplementationInAugmentation01b.fs b/tests/fsharpqa/Source/Diagnostics/General/W_InterfaceImplementationInAugmentation01b.fs
deleted file mode 100644
index 2002b516ab4..00000000000
--- a/tests/fsharpqa/Source/Diagnostics/General/W_InterfaceImplementationInAugmentation01b.fs
+++ /dev/null
@@ -1,31 +0,0 @@
-// #Regression #Diagnostics
-// Regression test for FSHARP1.0:1273
-// Give warning on use of interface and/or override implementations in augmentations
-//Interface implementations in augmentations are now deprecated\. Interface implementations should be given on the initial declaration of a type\.$
-
-type I = interface
- abstract M : int
- end
-
-type I2 = interface
- inherit I
- end
-
-type I3 = interface
- inherit I2
- end
-type I4 = interface
- inherit I3
- end
-
-type T2b2 = class
- interface I4
- end
-
-type T2b2 with
- interface I4 with
- member a.M = 3
- end
- end
-
-
diff --git a/tests/fsharpqa/Source/Diagnostics/General/W_InterfaceImplementationInAugmentation02a.fs b/tests/fsharpqa/Source/Diagnostics/General/W_InterfaceImplementationInAugmentation02a.fs
deleted file mode 100644
index a9bce5df4a8..00000000000
--- a/tests/fsharpqa/Source/Diagnostics/General/W_InterfaceImplementationInAugmentation02a.fs
+++ /dev/null
@@ -1,30 +0,0 @@
-// #Regression #Diagnostics
-// Regression test for FSHARP1.0:1273
-// Give warning on use of interface and/or override implementations in augmentations
-//Interface implementations in augmentations are now deprecated\. Interface implementations should be given on the initial declaration of a type\.$
-
-type I = interface
- end
-
-type I2 = interface
- inherit I
- end
-
-type I3 = interface
- inherit I2
- end
-
-type I4 = interface
- inherit I3
- abstract M : int
- end
-
-type T2b2 = class
- interface I4
- end
-
-type T2b2 with
- interface I4 with
- member a.M = 3
- end
- end
diff --git a/tests/fsharpqa/Source/Diagnostics/General/W_OverrideImplementationInAugmentation01b.fs b/tests/fsharpqa/Source/Diagnostics/General/W_OverrideImplementationInAugmentation01b.fs
deleted file mode 100644
index 32742489d9d..00000000000
--- a/tests/fsharpqa/Source/Diagnostics/General/W_OverrideImplementationInAugmentation01b.fs
+++ /dev/null
@@ -1,14 +0,0 @@
-// #Regression #Diagnostics
-// Regression test for FSHARP1.0:1273
-// Give warning on use of interface and/or override implementations in augmentations
-//
-//
-module M
-
-type T2b = class
- abstract M : int
- //default a.M = 3
- end
-type T2b with
- default x.M = 0 // warning FS0060: Override implementations should be given as part of the initial declaration of a type. While the current language specification allows overrides implementations in augmentations, this is likely to be deprecated in a future revision of the language
- end
diff --git a/tests/fsharpqa/Source/Diagnostics/General/W_OverrideImplementationInAugmentation02a.fs b/tests/fsharpqa/Source/Diagnostics/General/W_OverrideImplementationInAugmentation02a.fs
deleted file mode 100644
index 70c842c270a..00000000000
--- a/tests/fsharpqa/Source/Diagnostics/General/W_OverrideImplementationInAugmentation02a.fs
+++ /dev/null
@@ -1,14 +0,0 @@
-// #Regression #Diagnostics
-// Regression test for FSHARP1.0:1273
-// Give warning on use of interface and/or override implementations in augmentations
-//
-//
-//
-
-type T2 = class
- abstract M : int
- //default a.M = 3
- end
-type T2 with
- override x.M = 0.0 // warning + error
- end
diff --git a/tests/fsharpqa/Source/Diagnostics/General/env.lst b/tests/fsharpqa/Source/Diagnostics/General/env.lst
index d77d0099a55..79442b163d1 100644
--- a/tests/fsharpqa/Source/Diagnostics/General/env.lst
+++ b/tests/fsharpqa/Source/Diagnostics/General/env.lst
@@ -93,9 +93,6 @@ NoMT SOURCE=E_MissingSourceFile04.fs SCFLAGS="--exec doesnotexist.fs" FSIMODE=PI
SOURCE=E_StructMustHaveAtLeastOneField.fs SCFLAGS="--test:ErrorRanges" # E_StructMustHaveAtLeastOneField.fs
SOURCE=E_UnexpectedSymbol01.fs SCFLAGS="--test:ErrorRanges" # E_UnexpectedSymbol01.fs
- SOURCE=W_InterfaceImplementationInAugmentation01a.fs SCFLAGS="--test:ErrorRanges" # W_InterfaceImplementationInAugmentation01a.fs
- SOURCE=W_InterfaceImplementationInAugmentation01b.fs SCFLAGS="--test:ErrorRanges" # W_InterfaceImplementationInAugmentation01b.fs
- SOURCE=W_InterfaceImplementationInAugmentation02a.fs SCFLAGS="--test:ErrorRanges" # W_InterfaceImplementationInAugmentation02a.fs
SOURCE=W_OverrideImplementationInAugmentation01a.fs SCFLAGS="--test:ErrorRanges -a" # W_OverrideImplementationInAugmentation01a.fs
SOURCE=W_OverrideImplementationInAugmentation01b.fs SCFLAGS="--test:ErrorRanges -a" # W_OverrideImplementationInAugmentation01b.fs
SOURCE=W_OverrideImplementationInAugmentation02a.fs SCFLAGS="--test:ErrorRanges" # W_OverrideImplementationInAugmentation02a.fs
From 9d7d8f42473cc94b24082e6b068a53f4062b65f4 Mon Sep 17 00:00:00 2001
From: Tomas Grosup
Date: Wed, 5 Oct 2022 18:18:40 +0200
Subject: [PATCH 14/18] Removing test definitions
---
tests/fsharpqa/Source/Diagnostics/General/env.lst | 2 --
1 file changed, 2 deletions(-)
diff --git a/tests/fsharpqa/Source/Diagnostics/General/env.lst b/tests/fsharpqa/Source/Diagnostics/General/env.lst
index 79442b163d1..99a0383442b 100644
--- a/tests/fsharpqa/Source/Diagnostics/General/env.lst
+++ b/tests/fsharpqa/Source/Diagnostics/General/env.lst
@@ -94,8 +94,6 @@ NoMT SOURCE=E_MissingSourceFile04.fs SCFLAGS="--exec doesnotexist.fs" FSIMODE=PI
SOURCE=E_UnexpectedSymbol01.fs SCFLAGS="--test:ErrorRanges" # E_UnexpectedSymbol01.fs
SOURCE=W_OverrideImplementationInAugmentation01a.fs SCFLAGS="--test:ErrorRanges -a" # W_OverrideImplementationInAugmentation01a.fs
- SOURCE=W_OverrideImplementationInAugmentation01b.fs SCFLAGS="--test:ErrorRanges -a" # W_OverrideImplementationInAugmentation01b.fs
- SOURCE=W_OverrideImplementationInAugmentation02a.fs SCFLAGS="--test:ErrorRanges" # W_OverrideImplementationInAugmentation02a.fs
SOURCE=W_OverrideImplementationInAugmentation02b.fs SCFLAGS="--test:ErrorRanges" # W_OverrideImplementationInAugmentation02b.fs
SOURCE=W_OverrideImplementationInAugmentation03a.fs SCFLAGS="--test:ErrorRanges -a" # W_OverrideImplementationInAugmentation03a.fs
SOURCE=W_OverrideImplementationInAugmentation03b.fs SCFLAGS="--test:ErrorRanges -a" # W_OverrideImplementationInAugmentation03b.fs
From 5b05efe9858c12e5c98ec7c10d3f4c73d1e57862 Mon Sep 17 00:00:00 2001
From: Tomas Grosup
Date: Thu, 6 Oct 2022 11:48:29 +0200
Subject: [PATCH 15/18] Adopting legacy tests
---
tests/fsharp/typecheck/sigs/neg10.bsl | 2 +-
tests/fsharp/typecheck/sigs/neg46.bsl | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/tests/fsharp/typecheck/sigs/neg10.bsl b/tests/fsharp/typecheck/sigs/neg10.bsl
index ca47dbf94d0..849a688e3a1 100644
--- a/tests/fsharp/typecheck/sigs/neg10.bsl
+++ b/tests/fsharp/typecheck/sigs/neg10.bsl
@@ -29,7 +29,7 @@ neg10.fs(25,16,25,53): typecheck error FS0001: This type parameter cannot be ins
neg10.fs(54,17,54,20): typecheck error FS0060: Override implementations in augmentations are now deprecated. Override implementations should be given as part of the initial declaration of a type.
-neg10.fs(66,19,66,21): typecheck error FS0069: Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.
+neg10.fs(66,19,66,21): typecheck error FS0069: Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
neg10.fs(77,13,77,34): typecheck error FS0896: Enumerations cannot have members
diff --git a/tests/fsharp/typecheck/sigs/neg46.bsl b/tests/fsharp/typecheck/sigs/neg46.bsl
index 577ea4b8cd7..bb3cafeccb3 100644
--- a/tests/fsharp/typecheck/sigs/neg46.bsl
+++ b/tests/fsharp/typecheck/sigs/neg46.bsl
@@ -35,8 +35,6 @@ neg46.fs(60,8,60,19): typecheck error FS0912: This declaration element is not pe
neg46.fs(64,8,64,26): typecheck error FS0912: This declaration element is not permitted in an augmentation
-neg46.fs(68,18,68,36): typecheck error FS0090: Interface implementations should be given on the initial declaration of a type.
+neg46.fs(68,18,68,36): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type
-neg46.fs(69,18,69,21): typecheck error FS0854: Method overrides and interface implementations are not permitted here
-
-neg46.fs(73,18,73,36): typecheck error FS0090: Interface implementations should be given on the initial declaration of a type.
+neg46.fs(73,18,73,36): typecheck error FS0909: All implemented interfaces should be declared on the initial declaration of the type
\ No newline at end of file
From 88b6a0f4492e1a35c84e3acaac6b2e90fe181e3a Mon Sep 17 00:00:00 2001
From: Tomas Grosup
Date: Fri, 7 Oct 2022 20:48:58 +0200
Subject: [PATCH 16/18] PR Feedback reflected
---
src/Compiler/Checking/CheckDeclarations.fs | 11 ++++++-----
src/Compiler/FSStrings.resx | 2 +-
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 +-
src/FSharp.Core/prim-types.fs | 2 +-
.../InterfaceImplInAugmentationsTests.fs | 8 ++++----
tests/fsharp/typecheck/sigs/neg10.bsl | 2 +-
18 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/src/Compiler/Checking/CheckDeclarations.fs b/src/Compiler/Checking/CheckDeclarations.fs
index 53add7988b2..32daf163c4f 100644
--- a/src/Compiler/Checking/CheckDeclarations.fs
+++ b/src/Compiler/Checking/CheckDeclarations.fs
@@ -1621,7 +1621,7 @@ module MutRecBindingChecking =
defnsEs, envMutRec
/// Check and generalize the interface implementations, members, 'let' definitions in a mutually recursive group of definitions.
-let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (envMutRec: TcEnv) (mutRecDefns: MutRecDefnsPhase2Data) skipExternalAugmWarning =
+let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (envMutRec: TcEnv) (mutRecDefns: MutRecDefnsPhase2Data) isMutRec =
let g = cenv.g
let interfacesFromTypeDefn envForTycon tyconMembersData =
let (MutRecDefnsPhase2DataForTycon(_, _, declKind, tcref, _, _, declaredTyconTypars, members, _, _, _)) = tyconMembersData
@@ -1651,8 +1651,9 @@ let TcMutRecDefns_Phase2 (cenv: cenv) envInitial mBinds scopem mutRecNSInfo (env
(generatedHashAndEqualsWithComparerValues && typeEquiv g intfTyR g.mk_IStructuralEquatable_ty) then
errorR(Error(FSComp.SR.tcDefaultImplementationForInterfaceHasAlreadyBeenAdded(), intfTy.Range))
- match skipExternalAugmWarning, overridesOK with
- | _, OverridesOK | true, WarnOnOverrides -> ()
+ match isMutRec, overridesOK with
+ | _, OverridesOK -> () // No warning/error if overrides are allowed
+ | true, WarnOnOverrides -> () // If we are in a recursive module/namespace, overrides of interface implementations are allowed and not considered a warning
| false, WarnOnOverrides -> warning(IntfImplInIntrinsicAugmentation(intfTy.Range))
| _, ErrorOnOverrides -> errorR(IntfImplInExtrinsicAugmentation(intfTy.Range))
@@ -4140,7 +4141,7 @@ module TcDeclarations =
//-------------------------------------------------------------------------
/// Bind a collection of mutually recursive definitions in an implementation file
- let TcMutRecDefinitions (cenv: cenv) envInitial parent typeNames tpenv m scopem mutRecNSInfo (mutRecDefns: MutRecDefnsInitialData) skipExternalAugmWarning =
+ let TcMutRecDefinitions (cenv: cenv) envInitial parent typeNames tpenv m scopem mutRecNSInfo (mutRecDefns: MutRecDefnsInitialData) isMutRec =
let g = cenv.g
@@ -4194,7 +4195,7 @@ module TcDeclarations =
cenv true scopem m
// Check the members and decide on representations for types with implicit constructors.
- let withBindings, envFinal = TcMutRecDefns_Phase2 cenv envInitial m scopem mutRecNSInfo envMutRecPrelimWithReprs withEnvs skipExternalAugmWarning
+ let withBindings, envFinal = TcMutRecDefns_Phase2 cenv envInitial m scopem mutRecNSInfo envMutRecPrelimWithReprs withEnvs isMutRec
// Generate the hash/compare/equality bindings for all tycons.
//
diff --git a/src/Compiler/FSStrings.resx b/src/Compiler/FSStrings.resx
index f3e0e70a849..a6953680006 100644
--- a/src/Compiler/FSStrings.resx
+++ b/src/Compiler/FSStrings.resx
@@ -1054,7 +1054,7 @@
Override implementations should be given as part of the initial declaration of a type.
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.Interface implementations should be given on the initial declaration of a type.
diff --git a/src/Compiler/xlf/FSStrings.cs.xlf b/src/Compiler/xlf/FSStrings.cs.xlf
index db9f4914e45..828b90669df 100644
--- a/src/Compiler/xlf/FSStrings.cs.xlf
+++ b/src/Compiler/xlf/FSStrings.cs.xlf
@@ -1558,7 +1558,7 @@
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.Implementace rozhraní v rozšířeních jsou už zastaralé. Implementace rozhraní by se měly provádět při počáteční deklaraci typu.
diff --git a/src/Compiler/xlf/FSStrings.de.xlf b/src/Compiler/xlf/FSStrings.de.xlf
index 5e76ad973f8..9c6e11f305c 100644
--- a/src/Compiler/xlf/FSStrings.de.xlf
+++ b/src/Compiler/xlf/FSStrings.de.xlf
@@ -1558,7 +1558,7 @@
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.Schnittstellenimplementierungen in Augmentationen sind jetzt veraltet. Schnittstellenimplementierungen sollten in der ersten Deklaration eines Typs angegeben werden.
diff --git a/src/Compiler/xlf/FSStrings.es.xlf b/src/Compiler/xlf/FSStrings.es.xlf
index 093233f22d6..74d41dad785 100644
--- a/src/Compiler/xlf/FSStrings.es.xlf
+++ b/src/Compiler/xlf/FSStrings.es.xlf
@@ -1558,7 +1558,7 @@
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.Las implementaciones de interfaz en aumentos están en desuso. Las implementaciones de interfaz deben proporcionarse en la declaración inicial de un tipo.
diff --git a/src/Compiler/xlf/FSStrings.fr.xlf b/src/Compiler/xlf/FSStrings.fr.xlf
index da6a24fd39f..6039490dc6d 100644
--- a/src/Compiler/xlf/FSStrings.fr.xlf
+++ b/src/Compiler/xlf/FSStrings.fr.xlf
@@ -1558,7 +1558,7 @@
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.Les implémentations d'interfaces dans les augmentations sont désormais déconseillées. Les implémentations d'interfaces doivent être fournies dans la déclaration initiale d'un type.
diff --git a/src/Compiler/xlf/FSStrings.it.xlf b/src/Compiler/xlf/FSStrings.it.xlf
index e0f837b8773..eda88c84995 100644
--- a/src/Compiler/xlf/FSStrings.it.xlf
+++ b/src/Compiler/xlf/FSStrings.it.xlf
@@ -1558,7 +1558,7 @@
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.Le implementazioni di interfaccia negli aumenti sono ora deprecate. Le implementazioni di interfaccia devono essere specificate nella dichiarazione iniziale di un tipo.
diff --git a/src/Compiler/xlf/FSStrings.ja.xlf b/src/Compiler/xlf/FSStrings.ja.xlf
index 7cce99dc9b3..d62c37b5fe7 100644
--- a/src/Compiler/xlf/FSStrings.ja.xlf
+++ b/src/Compiler/xlf/FSStrings.ja.xlf
@@ -1558,7 +1558,7 @@
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.拡張内のインターフェイスの実装は使用されなくなりました。インターフェイスの実装は、型の最初の宣言で指定してください。
diff --git a/src/Compiler/xlf/FSStrings.ko.xlf b/src/Compiler/xlf/FSStrings.ko.xlf
index b6a5c3bdba3..6332a9dcbb2 100644
--- a/src/Compiler/xlf/FSStrings.ko.xlf
+++ b/src/Compiler/xlf/FSStrings.ko.xlf
@@ -1558,7 +1558,7 @@
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.확대의 인터페이스 구현은 이제 사용되지 않습니다. 인터페이스 구현은 초기 형식 선언 시 지정해야 합니다.
diff --git a/src/Compiler/xlf/FSStrings.pl.xlf b/src/Compiler/xlf/FSStrings.pl.xlf
index ba890c84a27..a09fa340ac5 100644
--- a/src/Compiler/xlf/FSStrings.pl.xlf
+++ b/src/Compiler/xlf/FSStrings.pl.xlf
@@ -1558,7 +1558,7 @@
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.Implementacje interfejsów w powiększeniach są teraz przestarzałe. Implementacje interfejsów powinny występować w początkowej deklaracji typu.
diff --git a/src/Compiler/xlf/FSStrings.pt-BR.xlf b/src/Compiler/xlf/FSStrings.pt-BR.xlf
index 2b93a7c8e22..c98c991ca2f 100644
--- a/src/Compiler/xlf/FSStrings.pt-BR.xlf
+++ b/src/Compiler/xlf/FSStrings.pt-BR.xlf
@@ -1558,7 +1558,7 @@
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.Implementações de interface em aumentos agora são preteridas. Implementações de interface devem ser dadas nas declarações de tipo iniciais.
diff --git a/src/Compiler/xlf/FSStrings.ru.xlf b/src/Compiler/xlf/FSStrings.ru.xlf
index 4e50510761a..53c522f0096 100644
--- a/src/Compiler/xlf/FSStrings.ru.xlf
+++ b/src/Compiler/xlf/FSStrings.ru.xlf
@@ -1558,7 +1558,7 @@
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.Реализации интерфейсов в приращениях теперь являются не рекомендуемыми к использованию. Реализации интерфейсов должны быть даны при первичном объявлении типа.
diff --git a/src/Compiler/xlf/FSStrings.tr.xlf b/src/Compiler/xlf/FSStrings.tr.xlf
index 6e936985dc6..cd29eea14d1 100644
--- a/src/Compiler/xlf/FSStrings.tr.xlf
+++ b/src/Compiler/xlf/FSStrings.tr.xlf
@@ -1558,7 +1558,7 @@
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.Genişletmelerdeki arabirim uygulamaları artık kullanım dışı bırakıldı. Arabirim uygulamaları bir türün ilk bildiriminde verilmelidir.
diff --git a/src/Compiler/xlf/FSStrings.zh-Hans.xlf b/src/Compiler/xlf/FSStrings.zh-Hans.xlf
index b666bbc99c7..21b470ea885 100644
--- a/src/Compiler/xlf/FSStrings.zh-Hans.xlf
+++ b/src/Compiler/xlf/FSStrings.zh-Hans.xlf
@@ -1558,7 +1558,7 @@
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.扩大中的接口实现现已弃用。应在类型的初始声明中提供接口实现。
diff --git a/src/Compiler/xlf/FSStrings.zh-Hant.xlf b/src/Compiler/xlf/FSStrings.zh-Hant.xlf
index 4dfd23638ce..eb2c82827bc 100644
--- a/src/Compiler/xlf/FSStrings.zh-Hant.xlf
+++ b/src/Compiler/xlf/FSStrings.zh-Hant.xlf
@@ -1558,7 +1558,7 @@
- Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+ Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.增強指定中的介面實作現在已被取代。應該在類型的初始宣告上指定介面實作。
diff --git a/src/FSharp.Core/prim-types.fs b/src/FSharp.Core/prim-types.fs
index 3719303ddf8..bb35924a75d 100644
--- a/src/FSharp.Core/prim-types.fs
+++ b/src/FSharp.Core/prim-types.fs
@@ -6,7 +6,7 @@
#nowarn "52" // The value has been copied to ensure the original is not mutated by this operation
#nowarn "60" // Override implementations in augmentations are now deprecated. Override implementations should be given as part of the initial declaration of a type.
#nowarn "61" // The containing type can use 'null' as a representation value for its nullary union case. This member will be compiled as a static member.
-#nowarn "69" // Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+#nowarn "69" // Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
#nowarn "77" // Member constraints with the name 'Exp' are given special status by the F# compiler...
#nowarn "3218" // mismatch of parameter name for 'fst' and 'snd'
diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
index 47fd4ae1517..5b70fe84062 100644
--- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
+++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
@@ -21,7 +21,7 @@ type MyCustomType<'T> with
|> typecheck
|> shouldFail
|> withSingleDiagnostic (Warning 69, Line 8, Col 15, Line 8, Col 33,
- """Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
+ """Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
[]
let ``Exception type in non-recursive namespace show give a warning when augmented externally``() =
@@ -37,7 +37,7 @@ type MyCustomExcType<'T> with
|> typecheck
|> shouldFail
|> withSingleDiagnostic (Warning 69, Line 8, Col 15, Line 8, Col 33,
- """Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
+ """Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
[]
@@ -117,7 +117,7 @@ namespace OuuterRec.InnerNonRec
|> typecheck
|> shouldFail
|> withSingleDiagnostic (Warning 69, Line 9, Col 19, Line 9, Col 37,
- """Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
+ """Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
@@ -138,7 +138,7 @@ namespace TotallyDifferentNs.InnerNonRec
|> typecheck
|> shouldFail
|> withSingleDiagnostic (Warning 69, Line 11, Col 19, Line 11, Col 37,
- """Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
+ """Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
[]
let ``Adding an interface to a previously defined type should still be just an 909 error and nothing else``() =
diff --git a/tests/fsharp/typecheck/sigs/neg10.bsl b/tests/fsharp/typecheck/sigs/neg10.bsl
index 849a688e3a1..50dadab0ddd 100644
--- a/tests/fsharp/typecheck/sigs/neg10.bsl
+++ b/tests/fsharp/typecheck/sigs/neg10.bsl
@@ -29,7 +29,7 @@ neg10.fs(25,16,25,53): typecheck error FS0001: This type parameter cannot be ins
neg10.fs(54,17,54,20): typecheck error FS0060: Override implementations in augmentations are now deprecated. Override implementations should be given as part of the initial declaration of a type.
-neg10.fs(66,19,66,21): typecheck error FS0069: Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
+neg10.fs(66,19,66,21): typecheck error FS0069: Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.
neg10.fs(77,13,77,34): typecheck error FS0896: Enumerations cannot have members
From 607bd464fd6ea321cd4966d21dd2270570ae71a4 Mon Sep 17 00:00:00 2001
From: Tomas Grosup
Date: Wed, 12 Oct 2022 15:08:13 +0200
Subject: [PATCH 17/18] Update
tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
Co-authored-by: Petr Pokorny
---
.../ErrorMessages/InterfaceImplInAugmentationsTests.fs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
index 5b70fe84062..b7795c947b3 100644
--- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
+++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
@@ -8,7 +8,7 @@ open FSharp.Test.Compiler
module InterfaceImplAugmentation =
[]
- let ``Type in non-recursive namespace show give a warning when augmented externally``() =
+ let ``Type in non-recursive namespace gives a warning when augmented externally``() =
FSharp """
namespace AugmentationsTest
type MyCustomType<'T> =
From e6d631aca75b5389c6025ca41c90288ce344f144 Mon Sep 17 00:00:00 2001
From: Tomas Grosup
Date: Wed, 12 Oct 2022 15:08:20 +0200
Subject: [PATCH 18/18] Update
tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
Co-authored-by: Petr Pokorny
---
.../ErrorMessages/InterfaceImplInAugmentationsTests.fs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
index b7795c947b3..828775a958f 100644
--- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
+++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceImplInAugmentationsTests.fs
@@ -24,7 +24,7 @@ type MyCustomType<'T> with
"""Interface implementations should normally be given on the initial declaration of a type. Interface implementations in augmentations may lead to accessing static bindings before they are initialized, though only if the interface implementation is invoked during initialization of the static data, and in turn access the static data. You may remove this warning using #nowarn "69" if you have checked this is not the case.""")
[]
- let ``Exception type in non-recursive namespace show give a warning when augmented externally``() =
+ let ``Exception type in non-recursive namespace gives a warning when augmented externally``() =
FSharp """
namespace AugmentationsTest
type MyCustomExcType<'T>() =