Qualify interface name in _requires_ markers (#14054)

* Add failing test
* update ghc patch
* Update *.EXPECTED.desugared-daml daml-test-files
This commit is contained in:
Moisés Ackerman 2022-06-07 12:00:36 +02:00 committed by GitHub
parent 4bb1cc9a06
commit 3255dccfc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 159 additions and 11 deletions

View File

@ -9,7 +9,7 @@ GHC_LIB_PATCHES = [
]
GHC_REPO_URL = "https://github.com/digital-asset/ghc"
GHC_REV = "45d5588a3341f8a6d43686fc0c9d0addc238a99a"
GHC_REV = "28bf6bba34330b517d2b51ab080f89d9f0653496"
GHC_PATCHES = [
]

View File

@ -66,35 +66,35 @@ _choice_TArchive
= (\ this _ -> DA.Internal.Desugar.signatory this,
\ _ _ _ -> pure (), DA.Internal.Desugar.Consuming,
DA.Internal.Desugar.None)
_implements_T_InterfaceChoiceCollision1_Interface :
_implements_T_InterfaceChoiceCollision1:Interface :
DA.Internal.Desugar.ImplementsT T InterfaceChoiceCollision1.Interface
_implements_T_InterfaceChoiceCollision1_Interface
_implements_T_InterfaceChoiceCollision1:Interface
= DA.Internal.Desugar.ImplementsT
instance DA.Internal.Desugar.HasToInterface T InterfaceChoiceCollision1.Interface where
_toInterface = GHC.Types.primitive @"EToInterface"
instance DA.Internal.Desugar.HasFromInterface T InterfaceChoiceCollision1.Interface where
fromInterface = GHC.Types.primitive @"EFromInterface"
unsafeFromInterface = GHC.Types.primitive @"EUnsafeFromInterface"
_method_T_InterfaceChoiceCollision1_Interface_getOwner :
_method_T_InterfaceChoiceCollision1:Interface_getOwner :
DA.Internal.Desugar.Method T InterfaceChoiceCollision1.Interface "getOwner"
_method_T_InterfaceChoiceCollision1_Interface_getOwner
_method_T_InterfaceChoiceCollision1:Interface_getOwner
= DA.Internal.Desugar.mkMethod
@T
@InterfaceChoiceCollision1.Interface
@"getOwner"
(\ this@T {..} -> let _ = this in let getOwner = owner in getOwner)
_implements_T_InterfaceChoiceCollision2_Interface :
_implements_T_InterfaceChoiceCollision2:Interface :
DA.Internal.Desugar.ImplementsT T InterfaceChoiceCollision2.Interface
_implements_T_InterfaceChoiceCollision2_Interface
_implements_T_InterfaceChoiceCollision2:Interface
= DA.Internal.Desugar.ImplementsT
instance DA.Internal.Desugar.HasToInterface T InterfaceChoiceCollision2.Interface where
_toInterface = GHC.Types.primitive @"EToInterface"
instance DA.Internal.Desugar.HasFromInterface T InterfaceChoiceCollision2.Interface where
fromInterface = GHC.Types.primitive @"EFromInterface"
unsafeFromInterface = GHC.Types.primitive @"EUnsafeFromInterface"
_method_T_InterfaceChoiceCollision2_Interface_getOwner :
_method_T_InterfaceChoiceCollision2:Interface_getOwner :
DA.Internal.Desugar.Method T InterfaceChoiceCollision2.Interface "getOwner"
_method_T_InterfaceChoiceCollision2_Interface_getOwner
_method_T_InterfaceChoiceCollision2:Interface_getOwner
= DA.Internal.Desugar.mkMethod
@T
@InterfaceChoiceCollision2.Interface

View File

@ -16,9 +16,10 @@ instance DA.Internal.Desugar.HasToInterface Interface Interface where
instance DA.Internal.Desugar.HasFromInterface Interface Interface where
fromInterface this = DA.Internal.Desugar.Some this
unsafeFromInterface _ this = this
_requires_Interface_Interface :
_requires_Interface_InterfaceChoiceCollision1:Interface :
DA.Internal.Desugar.RequiresT Interface InterfaceChoiceCollision1.Interface
_requires_Interface_Interface = DA.Internal.Desugar.RequiresT
_requires_Interface_InterfaceChoiceCollision1:Interface
= DA.Internal.Desugar.RequiresT
instance DA.Internal.Desugar.HasToInterface Interface InterfaceChoiceCollision1.Interface where
_toInterface = GHC.Types.primitive @"EToRequiredInterface"
instance DA.Internal.Desugar.HasFromInterface Interface InterfaceChoiceCollision1.Interface where

View File

@ -0,0 +1,52 @@
module InterfaceRequiresClash where
import (implicit) qualified DA.Internal.Record
import (implicit) qualified GHC.Types
import (implicit) qualified DA.Internal.Desugar
import (implicit) DA.Internal.RebindableSyntax
import qualified InterfaceRequiresClashA as A
import qualified InterfaceRequiresClashB as B
data GHC.Types.DamlInterface => C = C GHC.Types.Opaque
instance DA.Internal.Desugar.HasInterfaceTypeRep C where
_interfaceTypeRep
= GHC.Types.primitive @"EInterfaceTemplateTypeRep"
instance DA.Internal.Desugar.HasFetch C where
fetch = GHC.Types.primitive @"UFetchInterface"
instance DA.Internal.Desugar.HasToInterface C C where
_toInterface this = this
instance DA.Internal.Desugar.HasFromInterface C C where
fromInterface this = DA.Internal.Desugar.Some this
unsafeFromInterface _ this = this
_requires_C_A:I : DA.Internal.Desugar.RequiresT C A.I
_requires_C_A:I = DA.Internal.Desugar.RequiresT
_requires_C_B:I : DA.Internal.Desugar.RequiresT C B.I
_requires_C_B:I = DA.Internal.Desugar.RequiresT
instance DA.Internal.Desugar.HasToInterface C A.I where
_toInterface = GHC.Types.primitive @"EToRequiredInterface"
instance DA.Internal.Desugar.HasFromInterface C A.I where
fromInterface = GHC.Types.primitive @"EFromRequiredInterface"
unsafeFromInterface
= GHC.Types.primitive @"EUnsafeFromRequiredInterface"
instance DA.Internal.Desugar.HasToInterface C B.I where
_toInterface = GHC.Types.primitive @"EToRequiredInterface"
instance DA.Internal.Desugar.HasFromInterface C B.I where
fromInterface = GHC.Types.primitive @"EFromRequiredInterface"
unsafeFromInterface
= GHC.Types.primitive @"EUnsafeFromRequiredInterface"
instance DA.Internal.Desugar.HasToAnyTemplate C where
_toAnyTemplate = GHC.Types.primitive @"EToAnyTemplate"
instance DA.Internal.Desugar.HasFromAnyTemplate C where
_fromAnyTemplate = GHC.Types.primitive @"EFromAnyTemplate"
instance DA.Internal.Desugar.HasTemplateTypeRep C where
_templateTypeRep = GHC.Types.primitive @"ETemplateTypeRep"
instance DA.Internal.Desugar.HasSignatory C where
signatory = GHC.Types.primitive @"ESignatoryInterface"
instance DA.Internal.Desugar.HasObserver C where
observer = GHC.Types.primitive @"EObserverInterface"
instance DA.Internal.Desugar.HasCreate C where
create = GHC.Types.primitive @"UCreateInterface"
instance DA.Internal.Desugar.HasEnsure C where
ensure this = DA.Internal.Desugar.True
instance DA.Internal.Desugar.HasIsInterfaceType C where
_isInterfaceType _ = DA.Internal.Desugar.True
instance DA.Internal.Desugar.Eq C where
(==) = GHC.Types.primitive @"BEEqual"

View File

@ -0,0 +1,11 @@
-- Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
-- @SINCE-LF-FEATURE DAML_INTERFACE
module InterfaceRequiresClash where
import InterfaceRequiresClashA qualified as A
import InterfaceRequiresClashB qualified as B
interface C requires A.I, B.I

View File

@ -0,0 +1,34 @@
module InterfaceRequiresClashA where
import (implicit) qualified DA.Internal.Record
import (implicit) qualified GHC.Types
import (implicit) qualified DA.Internal.Desugar
import (implicit) DA.Internal.RebindableSyntax
data GHC.Types.DamlInterface => I = I GHC.Types.Opaque
instance DA.Internal.Desugar.HasInterfaceTypeRep I where
_interfaceTypeRep
= GHC.Types.primitive @"EInterfaceTemplateTypeRep"
instance DA.Internal.Desugar.HasFetch I where
fetch = GHC.Types.primitive @"UFetchInterface"
instance DA.Internal.Desugar.HasToInterface I I where
_toInterface this = this
instance DA.Internal.Desugar.HasFromInterface I I where
fromInterface this = DA.Internal.Desugar.Some this
unsafeFromInterface _ this = this
instance DA.Internal.Desugar.HasToAnyTemplate I where
_toAnyTemplate = GHC.Types.primitive @"EToAnyTemplate"
instance DA.Internal.Desugar.HasFromAnyTemplate I where
_fromAnyTemplate = GHC.Types.primitive @"EFromAnyTemplate"
instance DA.Internal.Desugar.HasTemplateTypeRep I where
_templateTypeRep = GHC.Types.primitive @"ETemplateTypeRep"
instance DA.Internal.Desugar.HasSignatory I where
signatory = GHC.Types.primitive @"ESignatoryInterface"
instance DA.Internal.Desugar.HasObserver I where
observer = GHC.Types.primitive @"EObserverInterface"
instance DA.Internal.Desugar.HasCreate I where
create = GHC.Types.primitive @"UCreateInterface"
instance DA.Internal.Desugar.HasEnsure I where
ensure this = DA.Internal.Desugar.True
instance DA.Internal.Desugar.HasIsInterfaceType I where
_isInterfaceType _ = DA.Internal.Desugar.True
instance DA.Internal.Desugar.Eq I where
(==) = GHC.Types.primitive @"BEEqual"

View File

@ -0,0 +1,8 @@
-- Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
-- @SINCE-LF-FEATURE DAML_INTERFACE
module InterfaceRequiresClashA where
interface I

View File

@ -0,0 +1,34 @@
module InterfaceRequiresClashB where
import (implicit) qualified DA.Internal.Record
import (implicit) qualified GHC.Types
import (implicit) qualified DA.Internal.Desugar
import (implicit) DA.Internal.RebindableSyntax
data GHC.Types.DamlInterface => I = I GHC.Types.Opaque
instance DA.Internal.Desugar.HasInterfaceTypeRep I where
_interfaceTypeRep
= GHC.Types.primitive @"EInterfaceTemplateTypeRep"
instance DA.Internal.Desugar.HasFetch I where
fetch = GHC.Types.primitive @"UFetchInterface"
instance DA.Internal.Desugar.HasToInterface I I where
_toInterface this = this
instance DA.Internal.Desugar.HasFromInterface I I where
fromInterface this = DA.Internal.Desugar.Some this
unsafeFromInterface _ this = this
instance DA.Internal.Desugar.HasToAnyTemplate I where
_toAnyTemplate = GHC.Types.primitive @"EToAnyTemplate"
instance DA.Internal.Desugar.HasFromAnyTemplate I where
_fromAnyTemplate = GHC.Types.primitive @"EFromAnyTemplate"
instance DA.Internal.Desugar.HasTemplateTypeRep I where
_templateTypeRep = GHC.Types.primitive @"ETemplateTypeRep"
instance DA.Internal.Desugar.HasSignatory I where
signatory = GHC.Types.primitive @"ESignatoryInterface"
instance DA.Internal.Desugar.HasObserver I where
observer = GHC.Types.primitive @"EObserverInterface"
instance DA.Internal.Desugar.HasCreate I where
create = GHC.Types.primitive @"UCreateInterface"
instance DA.Internal.Desugar.HasEnsure I where
ensure this = DA.Internal.Desugar.True
instance DA.Internal.Desugar.HasIsInterfaceType I where
_isInterfaceType _ = DA.Internal.Desugar.True
instance DA.Internal.Desugar.Eq I where
(==) = GHC.Types.primitive @"BEEqual"

View File

@ -0,0 +1,8 @@
-- Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
-- @SINCE-LF-FEATURE DAML_INTERFACE
module InterfaceRequiresClashB where
interface I