mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 00:35:25 +03:00
Better errors related to Interface Views (#14648)
* Point to new GHC with errors for missing views * Add placeholder view to ImplementsNonInterface * Fix doc comment in InterfaceViewNotSpecified * Add test for error when method named `view` is declared * Add placeholder unit viewtype to doc tests * Update err message in ImplementsNonInterface - error now detected in LF * empty changelog commit CHANGELOG_BEGIN CHANGELOG_END
This commit is contained in:
parent
4105cb30bd
commit
b73e852604
@ -9,7 +9,7 @@ GHC_LIB_PATCHES = [
|
||||
]
|
||||
|
||||
GHC_REPO_URL = "https://github.com/digital-asset/ghc"
|
||||
GHC_REV = "0bb070fac5370b2a68d5e132b4c74a36cbaf4d29"
|
||||
GHC_REV = "3af876d60209705afc0acac5e196a44f570e6e72"
|
||||
GHC_PATCHES = [
|
||||
]
|
||||
|
||||
|
@ -187,13 +187,16 @@ unitTests =
|
||||
Nothing
|
||||
"Interface implementations"
|
||||
[ testModHdr
|
||||
, "data EmptyInterfaceView = EmptyInterfaceView"
|
||||
, "interface Bar where"
|
||||
, " viewtype EmptyInterfaceView"
|
||||
, " method : Update ()"
|
||||
, "template Foo with"
|
||||
, " field1 : Party"
|
||||
, " where"
|
||||
, " signatory field1"
|
||||
, " implements Bar where"
|
||||
, " view = EmptyInterfaceView"
|
||||
, " method = pure ()"
|
||||
]
|
||||
(\md -> assertBool
|
||||
|
@ -6,7 +6,7 @@
|
||||
-- is caught prior due to missing Eq and Show instances.
|
||||
|
||||
-- @SINCE-LF-FEATURE DAML_INTERFACE
|
||||
-- @ERROR range=18:5-18:20; Invalid 'interface instance Bool for T': 'Bool' is not an interface
|
||||
-- @ERROR range=19:7-19:16; No instance for (HasInterfaceTypeRep Bool)
|
||||
|
||||
module ImplementsNonInterface where
|
||||
|
||||
@ -15,4 +15,5 @@ template T
|
||||
p : Party
|
||||
where
|
||||
signatory p
|
||||
implements Bool
|
||||
implements Bool where
|
||||
view = ()
|
||||
|
@ -0,0 +1,13 @@
|
||||
-- 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
|
||||
-- @ERROR range=13:3-13:7; Interface methods with name `view` are disallowed.
|
||||
|
||||
-- | Check that error is thrown if method with name `view` is declared
|
||||
module InterfaceMethodNamedView where
|
||||
|
||||
data UnitPlaceholderView = UnitPlaceholderView
|
||||
|
||||
interface I where
|
||||
view : UnitPlaceholderView
|
@ -4,7 +4,7 @@
|
||||
-- @SINCE-LF-FEATURE DAML_INTERFACE
|
||||
-- @ERROR range=10:11-10:12; No view found for interface I
|
||||
|
||||
-- | Check that no error is thrown if interface view exists and is serializable
|
||||
-- | Check that error is thrown if no view is specified
|
||||
module InterfaceViewNotSpecified where
|
||||
|
||||
interface I where
|
||||
|
Loading…
Reference in New Issue
Block a user