Add a test that mkMethod call causes a type error. (#12175)

Relevant discussion: https://github.com/digital-asset/daml/pull/12171#discussion_r770553009

changelog_begin
changelog_end
This commit is contained in:
Sofia Faro 2021-12-16 15:52:44 +00:00 committed by GitHub
parent 97e3a1a557
commit e52469c1dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,20 @@
-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
-- @SINCE-LF-FEATURE DAML_INTERFACE
-- @ERROR error type checking value MkMethodTypeError.main: unknown data type
-- | Verify that calling mkMethod outside of desugared interface method definitions is an LF type error.
module MkMethodTypeError where
data T = T
instance HasInterfaceTypeRep T where interfaceTypeRep = undefined
instance HasToInterface T T where _toInterface x = x
instance HasFromInterface T T where fromInterface = Some
instance DA.Internal.Desugar.HasMethod T "foo" T where
main : Int
main =
let _ = DA.Internal.Desugar.mkMethod @T @T @"foo" identity
in 10