Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
37e462d
Remove interface check
gusty Mar 2, 2021
80321ba
Remove expectation
gusty Mar 3, 2021
4d41a8f
Restore check
gusty Mar 3, 2021
8b3de86
Try again
gusty Mar 3, 2021
32326da
Merge branch 'main' into patch-4
vzarytovskii Mar 8, 2021
19ac6d2
Update baseline with new errors
gusty Mar 10, 2021
42a3084
Switch expected error
gusty Mar 10, 2021
e1d15a8
Same here
gusty Mar 10, 2021
4e42399
... and here
gusty Mar 10, 2021
b7b7b34
Merge branch 'main' into pr/11170
T-Gro Oct 4, 2022
1baf8be
Merge branch 'main' into patch-4
T-Gro Oct 4, 2022
d806c85
Adding tests for combinations of rec and non-rec modules/namespaces/n…
T-Gro Oct 4, 2022
b79ab18
Merge branch 'main' into patch-4
T-Gro Oct 4, 2022
96868ce
Covering test cases also for augmented exception types
T-Gro Oct 5, 2022
194423e
Different approach taken based on method call origin
T-Gro Oct 5, 2022
967cbc6
More tests added
T-Gro Oct 5, 2022
36d3ac6
Merge branch 'main' into patch-4
T-Gro Oct 5, 2022
2da6637
Deleting fsharpqa tests which are covered by componenttests now
T-Gro Oct 5, 2022
9d7d8f4
Removing test definitions
T-Gro Oct 5, 2022
5b05efe
Adopting legacy tests
T-Gro Oct 6, 2022
f3175d2
Merge branch 'main' into patch-4
T-Gro Oct 6, 2022
88b6a0f
PR Feedback reflected
T-Gro Oct 7, 2022
a74dfc5
Merge branch 'main' into patch-4
T-Gro Oct 7, 2022
e8defc8
Merge branch 'main' into patch-4
T-Gro Oct 12, 2022
607bd46
Update tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceIm…
T-Gro Oct 12, 2022
e6d631a
Update tests/FSharp.Compiler.ComponentTests/ErrorMessages/InterfaceIm…
T-Gro Oct 12, 2022
1af02ee
Merge branch 'main' into patch-4
T-Gro Oct 12, 2022
15b74d8
Merge branch 'main' into patch-4
T-Gro Oct 12, 2022
b1566e5
Merge branch 'main' into patch-4
T-Gro Oct 13, 2022
962cea1
Merge branch 'main' into patch-4
dsyme Oct 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions src/Compiler/Checking/CheckDeclarations.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,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) isMutRec =
let g = cenv.g
let interfacesFromTypeDefn envForTycon tyconMembersData =
let (MutRecDefnsPhase2DataForTycon(_, _, declKind, tcref, _, _, declaredTyconTypars, members, _, _, _)) = tyconMembersData
Expand Down Expand Up @@ -1665,11 +1665,13 @@ 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 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))

match defnOpt with
| Some defn -> [ (intfTyR, defn, m) ]
| _-> []
Expand Down Expand Up @@ -2270,7 +2272,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
Expand Down Expand Up @@ -4162,7 +4164,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) isMutRec =

let g = cenv.g

Expand Down Expand Up @@ -4216,7 +4218,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 isMutRec

// Generate the hash/compare/equality bindings for all tycons.
//
Expand Down Expand Up @@ -4674,7 +4676,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 () =
Expand Down Expand Up @@ -4725,7 +4727,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
Expand Down Expand Up @@ -4927,7 +4929,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
Expand Down
2 changes: 1 addition & 1 deletion src/Compiler/FSStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@
<value>Override implementations should be given as part of the initial declaration of a type.</value>
</data>
<data name="IntfImplInIntrinsicAugmentation" xml:space="preserve">
<value>Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.</value>
<value>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.</value>
</data>
<data name="IntfImplInExtrinsicAugmentation" xml:space="preserve">
<value>Interface implementations should be given on the initial declaration of a type.</value>
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSStrings.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,8 @@
<note />
</trans-unit>
<trans-unit id="IntfImplInIntrinsicAugmentation">
<source>Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.</source>
<target state="translated">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.</target>
<source>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.</source>
<target state="needs-review-translation">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.</target>
<note />
</trans-unit>
<trans-unit id="IntfImplInExtrinsicAugmentation">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSStrings.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,8 @@
<note />
</trans-unit>
<trans-unit id="IntfImplInIntrinsicAugmentation">
<source>Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.</source>
<target state="translated">Schnittstellenimplementierungen in Augmentationen sind jetzt veraltet. Schnittstellenimplementierungen sollten in der ersten Deklaration eines Typs angegeben werden.</target>
<source>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.</source>
<target state="needs-review-translation">Schnittstellenimplementierungen in Augmentationen sind jetzt veraltet. Schnittstellenimplementierungen sollten in der ersten Deklaration eines Typs angegeben werden.</target>
<note />
</trans-unit>
<trans-unit id="IntfImplInExtrinsicAugmentation">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSStrings.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,8 @@
<note />
</trans-unit>
<trans-unit id="IntfImplInIntrinsicAugmentation">
<source>Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.</source>
<target state="translated">Las implementaciones de interfaz en aumentos están en desuso. Las implementaciones de interfaz deben proporcionarse en la declaración inicial de un tipo.</target>
<source>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.</source>
<target state="needs-review-translation">Las implementaciones de interfaz en aumentos están en desuso. Las implementaciones de interfaz deben proporcionarse en la declaración inicial de un tipo.</target>
<note />
</trans-unit>
<trans-unit id="IntfImplInExtrinsicAugmentation">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSStrings.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,8 @@
<note />
</trans-unit>
<trans-unit id="IntfImplInIntrinsicAugmentation">
<source>Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.</source>
<target state="translated">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.</target>
<source>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.</source>
<target state="needs-review-translation">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.</target>
<note />
</trans-unit>
<trans-unit id="IntfImplInExtrinsicAugmentation">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSStrings.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,8 @@
<note />
</trans-unit>
<trans-unit id="IntfImplInIntrinsicAugmentation">
<source>Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.</source>
<target state="translated">Le implementazioni di interfaccia negli aumenti sono ora deprecate. Le implementazioni di interfaccia devono essere specificate nella dichiarazione iniziale di un tipo.</target>
<source>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.</source>
<target state="needs-review-translation">Le implementazioni di interfaccia negli aumenti sono ora deprecate. Le implementazioni di interfaccia devono essere specificate nella dichiarazione iniziale di un tipo.</target>
<note />
</trans-unit>
<trans-unit id="IntfImplInExtrinsicAugmentation">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSStrings.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,8 @@
<note />
</trans-unit>
<trans-unit id="IntfImplInIntrinsicAugmentation">
<source>Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.</source>
<target state="translated">拡張内のインターフェイスの実装は使用されなくなりました。インターフェイスの実装は、型の最初の宣言で指定してください。</target>
<source>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.</source>
<target state="needs-review-translation">拡張内のインターフェイスの実装は使用されなくなりました。インターフェイスの実装は、型の最初の宣言で指定してください。</target>
<note />
</trans-unit>
<trans-unit id="IntfImplInExtrinsicAugmentation">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSStrings.ko.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,8 @@
<note />
</trans-unit>
<trans-unit id="IntfImplInIntrinsicAugmentation">
<source>Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.</source>
<target state="translated">확대의 인터페이스 구현은 이제 사용되지 않습니다. 인터페이스 구현은 초기 형식 선언 시 지정해야 합니다.</target>
<source>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.</source>
<target state="needs-review-translation">확대의 인터페이스 구현은 이제 사용되지 않습니다. 인터페이스 구현은 초기 형식 선언 시 지정해야 합니다.</target>
<note />
</trans-unit>
<trans-unit id="IntfImplInExtrinsicAugmentation">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSStrings.pl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,8 @@
<note />
</trans-unit>
<trans-unit id="IntfImplInIntrinsicAugmentation">
<source>Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.</source>
<target state="translated">Implementacje interfejsów w powiększeniach są teraz przestarzałe. Implementacje interfejsów powinny występować w początkowej deklaracji typu.</target>
<source>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.</source>
<target state="needs-review-translation">Implementacje interfejsów w powiększeniach są teraz przestarzałe. Implementacje interfejsów powinny występować w początkowej deklaracji typu.</target>
<note />
</trans-unit>
<trans-unit id="IntfImplInExtrinsicAugmentation">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSStrings.pt-BR.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,8 @@
<note />
</trans-unit>
<trans-unit id="IntfImplInIntrinsicAugmentation">
<source>Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.</source>
<target state="translated">Implementações de interface em aumentos agora são preteridas. Implementações de interface devem ser dadas nas declarações de tipo iniciais.</target>
<source>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.</source>
<target state="needs-review-translation">Implementações de interface em aumentos agora são preteridas. Implementações de interface devem ser dadas nas declarações de tipo iniciais.</target>
<note />
</trans-unit>
<trans-unit id="IntfImplInExtrinsicAugmentation">
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/xlf/FSStrings.ru.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,8 @@
<note />
</trans-unit>
<trans-unit id="IntfImplInIntrinsicAugmentation">
<source>Interface implementations in augmentations are now deprecated. Interface implementations should be given on the initial declaration of a type.</source>
<target state="translated">Реализации интерфейсов в приращениях теперь являются не рекомендуемыми к использованию. Реализации интерфейсов должны быть даны при первичном объявлении типа.</target>
<source>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.</source>
<target state="needs-review-translation">Реализации интерфейсов в приращениях теперь являются не рекомендуемыми к использованию. Реализации интерфейсов должны быть даны при первичном объявлении типа.</target>
<note />
</trans-unit>
<trans-unit id="IntfImplInExtrinsicAugmentation">
Expand Down
Loading