mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-19 16:57:40 +03:00
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:
parent
97e3a1a557
commit
e52469c1dc
20
compiler/damlc/tests/daml-test-files/MkMethodTypeError.daml
Normal file
20
compiler/damlc/tests/daml-test-files/MkMethodTypeError.daml
Normal 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
|
Loading…
Reference in New Issue
Block a user